[exodus] 02/48: Update to 4.98
Alastair McKinstry
mckinstry at moszumanska.debian.org
Wed Jul 15 11:35:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository exodus.
commit 4a53ec123a5ab5107b044c9d3961d166c3a2cdbe
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Wed Apr 27 16:56:51 2011 +0100
Update to 4.98
---
CMakeLists.txt | 1 +
CVS/Entries | 12 +-
CVS/Entries.Log | 3 +
Doxyfile | 1297 +++++++++++++++
Imakefile | 21 +-
Makefile.standalone | 20 +-
README | 101 +-
cbind/CMakeLists.txt | 111 +-
cbind/CVS/Entries | 6 +-
cbind/CVS/Entries.Log | 3 +
cbind/include/CVS/Entries | 11 +-
cbind/include/Imakefile | 1 -
cbind/include/doxygen.h | 133 ++
cbind/include/exodusII.h | 1385 +++++++++-------
cbind/include/exodusII_cfg.h.in | 1 -
cbind/include/exodusII_ext.h | 208 +--
cbind/include/exodusII_int.h | 237 +--
cbind/src/CVS/Entries | 329 ++--
cbind/src/Imakefile | 71 +-
cbind/src/Makefile.standalone | 56 +-
cbind/src/ex_conv.c | 472 +-----
cbind/src/ex_utils.c | 713 ++++----
cbind/src/exclos.c | 82 +-
cbind/src/excn2s.c | 202 +--
cbind/src/excopy.c | 581 +++----
cbind/src/excre.c | 298 ++--
cbind/src/exerr.c | 50 +-
cbind/src/exgatm.c | 77 +-
cbind/src/exgatn.c | 168 +-
cbind/src/exgatt.c | 187 +--
cbind/src/exgattp.c | 146 ++
cbind/src/exgblk.c | 502 +++---
cbind/src/exgcns.c | 12 +-
cbind/src/exgcon.c | 166 +-
cbind/src/exgconn.c | 284 +---
cbind/src/exgcor.c | 228 ++-
cbind/src/exgcset.c | 360 ++--
cbind/src/exgcss.c | 54 +-
cbind/src/{exgssc.c => exgcssc.c} | 377 ++---
cbind/src/exgean.c | 7 +-
cbind/src/exgeat.c | 15 +-
cbind/src/exgebi.c | 12 +-
cbind/src/exgecpp.c | 121 ++
cbind/src/exgelb.c | 8 +-
cbind/src/exgelc.c | 13 +-
cbind/src/exgem.c | 13 +-
cbind/src/exgenm.c | 93 +-
cbind/src/exgev.c | 12 +-
cbind/src/exgevid.c | 6 +-
cbind/src/exgevt.c | 11 +-
cbind/src/exgfrm.c | 107 +-
cbind/src/exggv.c | 40 +-
cbind/src/exggvt.c | 58 +-
cbind/src/{exgnvid.c => exgidm.c} | 129 +-
cbind/src/exgids.c | 121 +-
cbind/src/exginf.c | 153 +-
cbind/src/exgini.c | 22 +-
cbind/src/exginix.c | 183 +-
cbind/src/exgmap.c | 77 +-
cbind/src/exgmp.c | 75 +-
cbind/src/exgnam.c | 100 +-
cbind/src/exgnams.c | 220 ++-
cbind/src/exgnconn.c | 293 ++++
cbind/src/exgncor.c | 255 +++
cbind/src/exgnm.c | 9 +-
cbind/src/exgnmap.c | 111 +-
cbind/src/exgnnm.c | 90 +-
cbind/src/{exgnv.c => exgnnv.c} | 74 +-
cbind/src/exgnoatt.c | 227 +++
cbind/src/exgnp.c | 12 +-
cbind/src/exgns.c | 12 +-
cbind/src/exgnsd.c | 12 +-
cbind/src/exgnsi.c | 12 +-
cbind/src/exgnstt.c | 6 +-
cbind/src/exgnsv.c | 78 +-
cbind/src/exgnsvid.c | 6 +-
cbind/src/exgnv.c | 35 +-
cbind/src/exgnvar.c | 161 ++
cbind/src/exgnvid.c | 28 +-
cbind/src/exgnvt.c | 81 +-
cbind/src/exgnvv.c | 28 +-
cbind/src/exgoatt.c | 183 +-
cbind/src/exgoea.c | 5 +-
cbind/src/exgotv.c | 278 ++--
cbind/src/exgp.c | 117 +-
cbind/src/exgpa.c | 146 +-
cbind/src/exgpem.c | 160 +-
cbind/src/exgpn.c | 135 +-
cbind/src/exgqa.c | 174 +-
cbind/src/exgset.c | 332 ++--
cbind/src/exgsetd.c | 261 +--
cbind/src/exgsetp.c | 306 ++--
cbind/src/exgsnl.c | 172 +-
cbind/src/exgsp.c | 52 +-
cbind/src/exgss.c | 10 +-
cbind/src/exgssc.c | 53 +-
cbind/src/exgssd.c | 8 +-
cbind/src/exgssi.c | 13 +-
cbind/src/exgssn.c | 200 +--
cbind/src/exgsstt.c | 5 +-
cbind/src/exgssv.c | 68 +-
cbind/src/exgssvid.c | 4 +-
cbind/src/exgtim.c | 44 +-
cbind/src/exgtt.c | 187 +--
cbind/src/exgvan.c | 114 +-
cbind/src/exgvar.c | 163 +-
cbind/src/exgvarnam.c | 156 ++
cbind/src/{exgvan.c => exgvarnams.c} | 84 +-
cbind/src/{exgnvid.c => exgvarparam.c} | 134 +-
cbind/src/exgvart.c | 258 ++-
cbind/src/exgvartab.c | 200 +++
cbind/src/exgvid.c | 77 +-
cbind/src/exgvnm.c | 141 +-
cbind/src/exgvp.c | 102 +-
cbind/src/exgvtt.c | 6 +-
cbind/src/exgvv.c | 24 +-
cbind/src/exinq.c | 1740 ++++++++------------
cbind/src/exopen.c | 75 +-
cbind/src/exopts.c | 22 +-
cbind/src/expatn.c | 164 +-
cbind/src/expatt.c | 205 +--
cbind/src/expattp.c | 249 +++
cbind/src/expblk.c | 894 +++++-----
cbind/src/expcab.c | 647 ++++----
cbind/src/expclb.c | 248 +--
cbind/src/expcns.c | 10 +-
cbind/src/expcon.c | 107 +-
cbind/src/expconn.c | 250 +--
cbind/src/expcor.c | 285 ++--
cbind/src/expcset.c | 603 +++----
cbind/src/expcss.c | 11 +-
cbind/src/expean.c | 5 +-
cbind/src/expeat.c | 5 +-
cbind/src/expecpp.c | 122 ++
cbind/src/expelb.c | 11 +-
cbind/src/expelc.c | 123 +-
cbind/src/expem.c | 9 +-
cbind/src/expenm.c | 130 +-
cbind/src/expev.c | 246 +--
cbind/src/expfrm.c | 112 +-
cbind/src/expgv.c | 14 +-
cbind/src/expidm.c | 182 ++
cbind/src/expinf.c | 226 ++-
cbind/src/expini.c | 12 +-
cbind/src/expinix.c | 487 +++---
cbind/src/expmap.c | 211 +--
cbind/src/expmp.c | 139 +-
cbind/src/expnam.c | 171 +-
cbind/src/expnams.c | 274 ++-
cbind/src/expncor.c | 255 +++
cbind/src/expnm.c | 9 +-
cbind/src/expnmap.c | 213 +--
cbind/src/expnnm.c | 131 +-
cbind/src/{expnv.c => expnnv.c} | 71 +-
cbind/src/expnoatt.c | 221 +++
cbind/src/expnp.c | 17 +-
cbind/src/expns.c | 13 +-
cbind/src/expnsd.c | 13 +-
cbind/src/expnstt.c | 8 +-
cbind/src/expnsv.c | 246 +--
cbind/src/expnv.c | 40 +-
cbind/src/expnvar.c | 330 ++++
cbind/src/expnvv.c | 34 +-
cbind/src/expoatt.c | 217 +--
cbind/src/expoea.c | 7 +-
cbind/src/expp.c | 554 ++++---
cbind/src/exppa.c | 450 +++--
cbind/src/exppem.c | 189 +--
cbind/src/exppn.c | 292 ++--
cbind/src/exppsetd.c | 171 ++
cbind/src/expqa.c | 250 ++-
cbind/src/expset.c | 364 ++--
cbind/src/expsetd.c | 288 ++--
cbind/src/expsetp.c | 745 ++++-----
cbind/src/expsp.c | 14 +-
cbind/src/expss.c | 14 +-
cbind/src/expssd.c | 11 +-
cbind/src/expsstt.c | 8 +-
cbind/src/expssv.c | 252 +--
cbind/src/exptim.c | 67 +-
cbind/src/exptt.c | 309 +---
cbind/src/expvan.c | 133 +-
cbind/src/expvar.c | 434 +++--
cbind/src/expvarnam.c | 153 ++
cbind/src/expvarnams.c | 169 ++
cbind/src/expvarparam.c | 330 ++++
cbind/src/{exptt.c => expvartab.c} | 272 +--
cbind/src/expvnm.c | 118 +-
cbind/src/expvp.c | 325 +---
cbind/src/expvpa.c | 12 +-
cbind/src/expvpax.c | 452 +++--
cbind/src/expvpc.c | 14 +-
cbind/src/expvtt.c | 8 +-
cbind/src/expvv.c | 15 +-
cbind/src/exupda.c | 36 +-
cbind/test/CMakeLists.txt | 12 +-
cbind/test/CVS/Entries | 121 +-
cbind/test/CreateEdgeFace.c | 418 +++--
cbind/test/Imakefile | 22 +-
cbind/test/Makefile.standalone | 18 +-
cbind/test/ReadEdgeFace.c | 7 +-
cbind/test/create_mesh.c | 447 +++--
cbind/test/rd_wt_mesh.c | 345 ++--
cbind/test/test.dmp | 149 +-
cbind/test/test1.dmp | 92 +-
cbind/test/test2-1.dmp | 82 +-
cbind/test/test2-2.dmp | 82 +-
cbind/test/test2.dmp | 33 +-
cbind/test/test_clb.dmp | 178 +-
cbind/test/testall | 108 +-
cbind/test/testall.in | 87 +-
cbind/test/testcp.c | 2 +-
cbind/test/testcp_dd.dmp | 33 +-
cbind/test/testcp_ds.dmp | 33 +-
cbind/test/testcp_ln.c | 2 +-
cbind/test/{testcp_ss.dmp => testcp_ln.dmp} | 69 +-
cbind/test/testcp_nl.c | 4 +-
cbind/test/testcp_nl.dmp | 71 +-
cbind/test/testcp_sd.dmp | 88 +-
cbind/test/testcp_ss.dmp | 88 +-
cbind/test/testcpd.c | 2 +-
cbind/test/testd.dmp | 82 +-
cbind/test/testrd-nfaced.c | 354 ++++
cbind/test/testrd-nfaced.dmp | 109 ++
cbind/test/{testrd.c => testrd-nsided.c} | 686 ++++----
cbind/test/{testrdd.dmp => testrd-nsided.dmp} | 530 +++---
cbind/test/{testrd.c => testrd-partial.c} | 174 +-
cbind/test/testrd.c | 174 +-
cbind/test/testrd.dmp | 88 +-
cbind/test/testrd1.c | 5 +-
cbind/test/testrd1.dmp | 2 -
cbind/test/testrd_nc.c | 5 +-
cbind/test/testrd_nc.dmp | 2 -
cbind/test/testrd_ss.c | 4 +-
cbind/test/testrd_ss.dmp | 2 -
cbind/test/testrd_zeroe.dmp | 5 +-
cbind/test/testrd_zeron.dmp | 72 +-
cbind/test/testrdd.c | 5 +-
cbind/test/testrdd.dmp | 1 -
cbind/test/testrdv.c | 5 +-
cbind/test/testrdv.dmp | 2 -
cbind/test/testrdwt.c | 4 +-
cbind/test/testwt-nfaced.c | 429 +++++
cbind/test/testwt-nfaced.dmp | 101 ++
cbind/test/{testwt_nc.c => testwt-nsided.c} | 407 ++---
cbind/test/{test.dmp => testwt-nsided.dmp} | 593 ++-----
cbind/test/testwt-one-attrib.c | 32 +
cbind/test/{testwt.c => testwt-partial.c} | 180 +-
cbind/test/testwt-zeroe.c | 1 -
cbind/test/testwt-zeroe.dmp | 94 +-
cbind/test/testwt-zeron.c | 14 -
cbind/test/testwt-zeron.dmp | 24 +-
cbind/test/testwt.c | 63 +-
cbind/test/testwt1.c | 1 -
cbind/test/testwt2.c | 1 -
cbind/test/testwt_clb.c | 1 -
cbind/test/testwt_nc.c | 67 +-
cbind/test/testwt_nossnsdf.c | 1 -
cbind/test/testwt_ss.dmp | 33 +-
cbind/test/testwtbig.c | 1 -
cbind/test/testwtd.c | 190 +--
cbind/test/testwtm.c | 1 -
doc/CVS/Entries | 2 +
doc/CVS/Repository | 1 +
doc/CVS/Root | 1 +
doc/doc.poly.txt | 216 +++
forbind/CVS/Entries | 4 +-
forbind/CVS/Entries.Log | 3 +
forbind/include/CVS/Entries | 6 +-
forbind/include/Imakefile | 1 -
forbind/include/exodusII.inc | 7 -
forbind/include/exodusII_int.inc | 10 -
forbind/src/CVS/Entries | 20 +-
forbind/src/Imakefile | 1 -
forbind/src/addrwrap.F | 198 ++-
forbind/src/exgenm_jack.src | 1 -
forbind/src/exgnnm_jack.src | 1 -
forbind/src/exgvnm_jack.src | 1 -
forbind/src/exo_jack.src | 228 ++-
forbind/src/expenm_jack.src | 1 -
forbind/src/expnnm_jack.src | 1 -
forbind/src/expvnm_jack.src | 1 -
forbind/src/fortc | 2 +-
forbind/test/CVS/Entries | 41 +-
forbind/test/Imakefile | 19 +-
forbind/test/Makefile.standalone | 4 +-
forbind/test/test-nsided.dmp | 81 +
forbind/test/test.dmp | 83 +-
forbind/test/test.exo_f | Bin 3844 -> 31 bytes
forbind/test/test1.dmp | 93 +-
forbind/test/test2-1.dmp | 83 +-
forbind/test/test2-2.dmp | 83 +-
forbind/test/testall | 34 +-
forbind/test/testcp_dd.dmp | 2 -
forbind/test/testcp_ds.dmp | 2 -
forbind/test/testcp_sd.dmp | 2 -
forbind/test/testcp_ss.dmp | 33 +-
.../testcp_ds.dmp => forbind/test/testcpln.dmp | 97 +-
forbind/test/testcpln.f | 2 +-
forbind/test/testcpnl.dmp | 16 +-
forbind/test/testd.dmp | 47 +-
forbind/test/testrd.dmp | 4 +-
forbind/test/testrd1.dmp | 2 -
forbind/test/testrd_nsid.dmp | 154 ++
forbind/test/testrd_nsid.f | 181 ++
forbind/test/testrdd.dmp | 2 -
forbind/test/testwt_nsid.f | 375 +++++
307 files changed, 22180 insertions(+), 19831 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98d78c6..34d91e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 2.6)
PROJECT(ExodusII)
SET(EXODUSII_VERSION_MAJOR "2")
diff --git a/CVS/Entries b/CVS/Entries
index 49106cb..58bb019 100644
--- a/CVS/Entries
+++ b/CVS/Entries
@@ -1,9 +1,9 @@
-/CMakeLists.txt/1.1/Sun Nov 26 05:37:17 2006//
+/CMakeLists.txt/1.2/Mon Feb 16 16:20:57 2009//
/COPYRIGHT/1.1.1.1/Tue Sep 6 15:59:03 2005//
/DartConfig.cmake/1.1/Sun Nov 26 05:37:17 2006//
-/Imakefile/1.4/Tue Nov 28 14:01:59 2006//
-/Makefile.standalone/1.3/Sun Nov 26 05:37:17 2006//
-/README/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/Doxyfile/1.3/Tue Jul 20 21:36:58 2010//
+/Imakefile/1.11/Tue Jul 20 21:36:58 2010//
+/Makefile.standalone/1.6/Tue Jul 20 21:36:58 2010//
+/README/1.5/Tue Jul 20 21:36:58 2010//
/exodusii.dsp/1.1.1.1/Tue Sep 6 15:59:03 2005//
-D/cbind////
-D/forbind////
+D
diff --git a/CVS/Entries.Log b/CVS/Entries.Log
new file mode 100644
index 0000000..3dcfcf9
--- /dev/null
+++ b/CVS/Entries.Log
@@ -0,0 +1,3 @@
+A D/cbind////
+A D/doc////
+A D/forbind////
diff --git a/Doxyfile b/Doxyfile
new file mode 100644
index 0000000..e19a521
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,1297 @@
+# Doxyfile 1.5.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file that
+# follow. The default is UTF-8 which is also the encoding used for all text before
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
+# possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = ExodusII
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 4.96
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be extracted
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}',
+# where file will be replaced with the base name of the file that contains the anonymous
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from the
+# version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text "
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = cbind/include \
+ cbind/src \
+ forbind/src
+
+# This tag can be used to specify the character encoding of the source files that
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS = *.c \
+ *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the output.
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH
+# then you must also enable this option. If you don't then doxygen will produce
+# a warning and turn it on anyway
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX = ex_
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED = EXODUS_EXPORT
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
+# be found in the default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = gif
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the number
+# of direct children of the root node in a graph is already larger than
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/Imakefile b/Imakefile
index 6c93f97..0de7b87 100644
--- a/Imakefile
+++ b/Imakefile
@@ -31,7 +31,6 @@ XCOMM (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
XCOMM OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
XCOMM
-XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
XCOMM Imakefile for ExodusII libraries
XCOMM Building ExodusII libraries for installation
/* Building ExodusII libraries for installation
@@ -58,8 +57,11 @@ XCOMM Building ExodusII libraries for installation
#define IHaveSubdirs
-#define PassDebugFlags "CDEBUGFLAGS=$(CDEBUGFLAGS)"
-#define PassCDebugFlags "CDEBUGFLAGS=$(CDEBUGFLAGS)"
+#define PassDebugFlags "DEBUG=$(DEBUG)" \
+ "CDEBUGFLAGS=$(CDEBUGFLAGS)" \
+ "CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)" \
+ "F90DEBUGFLAGS=$(F90DEBUGFLAGS)" \
+ "F77DEBUGFLAGS=$(F77DEBUGFLAGS)"
#define ExtraOptions "CCOPTIONS=$(CCOPTIONS)"
@@ -75,9 +77,9 @@ INCLIST2 = exodusII_int.inc exodusII.inc
SUBDIRS = cbind/include cbind/src forbind/include forbind/src cbind/test forbind/test
#if Build64BitAccess == YES
-AllTarget(libexoIIv2c.a libexoIIv2for.a libexoIIv2for32.a)
+AllTarget(libexodus.a libexoIIv2for.a libexoIIv2for32.a)
#else
-AllTarget(libexoIIv2c.a libexoIIv2for.a)
+AllTarget(libexodus.a libexoIIv2for.a)
#endif
InstallSubdirIncludeList(makeincludes,cbind/include,$(INCLIST1),$(INCDIR))
@@ -85,7 +87,7 @@ InstallSubdirIncludeList(makeincludes,cbind/include,$(INCLIST1),$(INCDIR))
InstallSubdirIncludeList(makeincludes,forbind/include,$(INCLIST2),$(INCDIR))
/* Directory for exodusII c library */
-NamedTargetSubdirs(libexoIIv2c.a,cbind/src,"making exoIIv2c ",PassDebugFlags ExtraOptions,libexoIIv2c.a)
+NamedTargetSubdirs(libexodus.a,cbind/src,"making exodus ",PassDebugFlags ExtraOptions,libexodus.a)
/* Directory for exodusII fortran wrappers */
NamedTargetSubdirs(libexoIIv2for.a,forbind/src,"making exoIIv2for ",PassDebugFlags ExtraOptions,libexoIIv2for.a)
@@ -94,15 +96,16 @@ NamedTargetSubdirs(libexoIIv2for.a,forbind/src,"making exoIIv2for ",PassDebugFla
NamedTargetSubdirs(libexoIIv2for32.a,forbind/src,"making exoIIv2for32 ",PassDebugFlags ExtraOptions,libexoIIv2for32.a)
#endif
-InstallLibrary(exoIIv2c,$(LIBDIR))
+InstallLibrary(exodus,$(LIBDIR))
InstallLibrary(exoIIv2for,$(LIBDIR))
+InstallLibraryAlias(exodus,exoIIv2c,$(LIBDIR))
#if Build64BitAccess == YES
InstallLibrary(exoIIv2for32,$(LIBDIR))
#endif
#if Parallel
-InstallParallelLibrary(exoIIv2c,$(PLIBDIR))
+InstallParallelLibrary(exodus,$(PLIBDIR))
InstallParallelLibrary(exoIIv2for,$(PLIBDIR))
#if Build64BitAccess == YES
@@ -111,7 +114,7 @@ InstallParallelLibrary(exoIIv2for32,$(PLIBDIR))
#endif
check: test
-test:: libexoIIv2c.a libexoIIv2for.a
+test:: libexodus.a libexoIIv2for.a
NamedMakeSubdirs(test,cbind/test)
NamedMakeSubdirs(test,forbind/test)
diff --git a/Makefile.standalone b/Makefile.standalone
index 51aa4cd..8b42b40 100644
--- a/Makefile.standalone
+++ b/Makefile.standalone
@@ -76,7 +76,7 @@ endif
ifeq ($(COMPILER),GNU)
CC = gcc
FC = g77
-CCOPTIONS = -O2 -Wall -Wno-deprecated
+CCOPTIONS = -O2 -Wall
F77OPTIONS = -O2
endif
@@ -197,21 +197,21 @@ FFLAGS = $(OPTIMIZE_FLAG) $(F77OPTIONS) $(LOC_EXOII_INC) $(F77PREC)
# Use include files locates in exodusii/cbind/include
LOC_EXOII_INC = -I../../cbind/include -I../../forbind/include
-NETCDF_INC = -I$(ACCESS)/inc
+NETCDF_INC = -I/usr/local/eng_sci/struct/x86_64/current64-gcc/inc
-NETCDF_LIB_DIR = $(ACCESS)/lib
+NETCDF_LIB_DIR = /usr/local/eng_sci/struct/x86_64/current64-gcc/lib
NETCDF_LIB = -L$(NETCDF_LIB_DIR) -lnetcdf
SUBDIRS = cbind/src forbind/src cbind/test forbind/test
-all:: libexoIIv2c.a libexoIIv2for.a
+all:: libexodus.a libexoIIv2for.a
-libexoIIv2c.a::
- echo "making exoIIv2c in cbind/src"
- (cd cbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "RANLIB=$(RANLIB)" libexoIIv2c.a)
- cp cbind/src/libexoIIv2c.a .
- $(RANLIB) libexoIIv2c.a
+libexodus.a::
+ echo "making exodus in cbind/src"
+ (cd cbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "RANLIB=$(RANLIB)" libexodus.a)
+ cp cbind/src/libexodus.a .
+ $(RANLIB) libexodus.a
libexoIIv2for.a::
echo "making exoIIv2for in forbind/src"
@@ -220,7 +220,7 @@ libexoIIv2for.a::
$(RANLIB) libexoIIv2for.a
check: test
-test:: libexoIIv2c.a libexoIIv2for.a
+test:: libexodus.a libexoIIv2for.a
test::
echo "making test in cbind/test"
diff --git a/README b/README
index 238eb6f..aac63cb 100644
--- a/README
+++ b/README
@@ -1,3 +1,12 @@
+========================================================================
+CONTACT:
+
+Greg Sjaardema,
+Sandia National Laboratories,
+gdsjaar at sandia.gov
+
+========================================================================
+LICENSE:
The ExodusII library is licensed under the terms of the BSD License.
Legal stuff (copyright, licensing restrictions, etc.) can be found in
@@ -7,9 +16,46 @@ the file COPYRIGHT which contains:
2. The BSD License.
We appreciate feedback from users of this package. Please send
-comments, suggestions, and bug reports to Greg Sjaardema <gdsjaar at sandia.gov>.
+comments, suggestions, and bug reports to Greg Sjaardema
+<gdsjaar at sandia.gov>.
+
Please identify the version of the package.
+========================================================================
+BUILDING
+
+There are 4 methods for building exodusII.
+
+1. SEAMS/SEACAS Build system which is based on imake. If you have a
+SEAMS or SEACAS installation, you can use its build system. In the
+top-level exodusii directory, do 'accmkmf' followed by 'make
+Makefiles' and then 'make'
+
+2. CMAKE: type 'cmake .' or 'cmake -i' to generate the Makefiles
+followed by 'make'. Cmake will search for the netcdf include file in
+the directories:
+ ${ACCESS}/inc,
+ ${NETCDF_DIR}/inc,
+ ${NETCDF_DIR}/libsrc
+
+and the netcdf library in the directories:
+ ${ACCESS}/lib,
+ ${NETCDF_DIR}/lib,
+ ${NETCDF_DIR}/libsrc/.libs
+
+You should one of the environment variables ACCESS or NETCDF_DIR to
+point to the location of your netcdf installation.
+
+3. Makefile.standalone. Edit the top-level Makefile.standalone file
+and specify the compiler and other options as detailed in the
+file. Then, do "make -f Makefile.standalone".
+
+4. Building in the Trilinos system as part of the Trios package.
+See the Trilinos documentation for more details.
+
+Once you have built the library, you can test it by typing "make
+check"
+
========================================================================
NETCDF
@@ -18,57 +64,26 @@ The exodusII library uses the netcdf library for low-level data
storage.
ExodusII requires NetCDF version 3.6.0 or later with the "large-model
-modifications".
+modifications". NetCDF version 4.1 or later is highly recommended.
The netcdf library must be modified slightly in order to handle the
exodusII datamodel. The specific changes are:
-1. src/libsrc/netcdf.h -- Modify the following defines:
+1. libsrc/netcdf.h -- Modify the following defines:
+ libsrc4/netcdf_base.h (netcdf-4.X only)
+ libsrc4/netcdf.h (netcdf-4.X only if it exists)
#define NC_MAX_DIMS 65536 /* max dimensions per file */
#define NC_MAX_VARS 524288 /* max variables per file */
#define NC_MAX_VAR_DIMS 8 /* max per variable dimensions */
-2. src/ncdump/ncdump.c -- Due to the increased sizes above, the 'dims'
-and 'vdims' arrays are malloc'd instead of static arrays which fail
-with the increased sizes.
-
-
-347a348,351
-> #if 0
-> /* The following code was blowing out the stack on some systems.
-> * Changed code to get the memory off the heap using malloc instead
-> */
-349a354,357
-> #else
-> struct ncdim *dims; /* dimensions */
-> size_t *vdims; /* dimension sizes for a single variable */
-> #endif
-359a368,370
-> dims = NULL;
-> vdims = NULL;
->
-388c399
-< if (ndims > 0)
----
-> if (ndims > 0) {
-389a401,403
-> dims = malloc(ndims * sizeof(struct ncdim));
-> vdims = malloc(ndims * sizeof(size_t));
-> }
-508a523,526
-> if (dims)
-> free(dims);
-> if (vdims)
-> free(vdims);
-519a538,541
-> if (dims)
-> free(dims);
-> if (vdims)
-> free(vdims);
-
-3. When running the netcdf tests, you may have to do "unlimit
-stacksize" to avoid some failures due to the increased define sizes
+If these changes are not made, the exodus library will still function
+for "normal" size models, but it will fail for "large" models. The
+error message from exodus/netcdf should be somewhat clear when this
+happens...
+
+2. When running the netcdf tests, you may have to do "unlimit
+stacksize" (csh/tcsh) to avoid some failures due to the increased define sizes
above.
========================================================================
diff --git a/cbind/CMakeLists.txt b/cbind/CMakeLists.txt
index 8a57c72..2fdbcdc 100644
--- a/cbind/CMakeLists.txt
+++ b/cbind/CMakeLists.txt
@@ -1,3 +1,22 @@
+
+find_path( NETCDF_INCLUDE_DIR netcdf.h
+ $ENV{ACCESS}/inc
+ $ENV{NETCDF_DIR}/inc
+ $ENV{NETCDF_DIR}/libsrc
+)
+
+find_path( NETCDF_LIBRARY libnetcdf.a
+ $ENV{ACCESS}/lib
+ $ENV{NETCDF_DIR}/lib
+ $ENV{NETCDF_DIR}/libsrc/.libs
+)
+
+find_program (NETCDF_NCDUMP ncdump
+ $ENV{ACCESS}/bin
+ $ENV{NETCDF_DIR}/bin
+ $ENV{NETCDF_DIR}/ncdump
+)
+
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE( malloc.h EX_HAVE_MALLOC_H )
@@ -9,42 +28,44 @@ CONFIGURE_FILE(
INCLUDE_DIRECTORIES(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
- "${CMAKE_CURRENT_SOURCE_DIR}/../../netcdf/netcdf-3.6.1/src/libsrc"
- "${CMAKE_CURRENT_BINARY_DIR}/../../netcdf/netcdf-3.6.1/src/libsrc"
+ "${NETCDF_INCLUDE_DIR}"
)
SET(cbind_SRCS
+ src/ex_conv.c
+ src/ex_utils.c
src/exclos.c
src/excn2s.c
- src/ex_conv.c
src/excopy.c
src/excre.c
src/exerr.c
src/exgatm.c
+ src/exgatn.c
+ src/exgatt.c
+ src/exgattp.c
+ src/exgblk.c
src/exgcns.c
src/exgcon.c
+ src/exgconn.c
src/exgcor.c
src/exgcset.c
src/exgcss.c
+ src/exgcssc.c
src/exgean.c
- src/exgatn.c
src/exgeat.c
- src/exgatt.c
src/exgebi.c
+ src/exgecpp.c
src/exgelb.c
- src/exgblk.c
src/exgelc.c
- src/exgconn.c
src/exgem.c
src/exgenm.c
src/exgev.c
- src/exgvar.c
src/exgevid.c
src/exgevt.c
- src/exgvart.c
src/exgfrm.c
src/exggv.c
src/exggvt.c
+ src/exgidm.c
src/exgids.c
src/exginf.c
src/exgini.c
@@ -53,8 +74,13 @@ SET(cbind_SRCS
src/exgmp.c
src/exgnam.c
src/exgnams.c
+ src/exgnconn.c
+ src/exgncor.c
src/exgnm.c
+ src/exgnmap.c
src/exgnnm.c
+ src/exgnnv.c
+ src/exgnoatt.c
src/exgnp.c
src/exgns.c
src/exgnsd.c
@@ -63,24 +89,25 @@ SET(cbind_SRCS
src/exgnsv.c
src/exgnsvid.c
src/exgnv.c
+ src/exgnvar.c
src/exgnvid.c
src/exgnvt.c
src/exgnvv.c
- src/exgoea.c
src/exgoatt.c
+ src/exgoea.c
src/exgotv.c
- src/exgpa.c
src/exgp.c
+ src/exgpa.c
src/exgpem.c
src/exgpn.c
src/exgqa.c
- src/exgsnl.c
+ src/exgset.c
+ src/exgsetd.c
src/exgsetp.c
+ src/exgsnl.c
src/exgsp.c
- src/exgset.c
src/exgss.c
src/exgssc.c
- src/exgsetd.c
src/exgssd.c
src/exgssi.c
src/exgssn.c
@@ -90,6 +117,12 @@ SET(cbind_SRCS
src/exgtim.c
src/exgtt.c
src/exgvan.c
+ src/exgvar.c
+ src/exgvarnam.c
+ src/exgvarnams.c
+ src/exgvarparam.c
+ src/exgvart.c
+ src/exgvartab.c
src/exgvid.c
src/exgvnm.c
src/exgvp.c
@@ -100,6 +133,8 @@ SET(cbind_SRCS
src/exopts.c
src/expatn.c
src/expatt.c
+ src/expattp.c
+ src/expblk.c
src/expcab.c
src/expclb.c
src/expcns.c
@@ -110,14 +145,15 @@ SET(cbind_SRCS
src/expcss.c
src/expean.c
src/expeat.c
+ src/expecpp.c
src/expelb.c
- src/expblk.c
src/expelc.c
src/expem.c
src/expenm.c
src/expev.c
src/expfrm.c
src/expgv.c
+ src/expidm.c
src/expinf.c
src/expini.c
src/expinix.c
@@ -125,27 +161,31 @@ SET(cbind_SRCS
src/expmp.c
src/expnam.c
src/expnams.c
+ src/expncor.c
src/expnm.c
src/expnmap.c
- src/exgnmap.c
src/expnnm.c
+ src/expnnv.c
+ src/expnoatt.c
src/expnp.c
src/expns.c
src/expnsd.c
src/expnstt.c
src/expnsv.c
src/expnv.c
+ src/expnvar.c
src/expnvv.c
- src/expoea.c
src/expoatt.c
- src/exppa.c
+ src/expoea.c
src/expp.c
+ src/exppa.c
src/exppem.c
src/exppn.c
+ src/exppsetd.c
src/expqa.c
- src/expsetp.c
src/expset.c
src/expsetd.c
+ src/expsetp.c
src/expsp.c
src/expss.c
src/expssd.c
@@ -155,15 +195,24 @@ SET(cbind_SRCS
src/exptt.c
src/expvan.c
src/expvar.c
+ src/expvarnam.c
+ src/expvarnams.c
+ src/expvarparam.c
+ src/expvartab.c
src/expvnm.c
+ src/expvp.c
src/expvpa.c
src/expvpax.c
- src/expvp.c
src/expvpc.c
src/expvtt.c
src/expvv.c
src/exupda.c
- src/ex_utils.c
+)
+
+SET(cbind_HEADERS
+ include/exodusII.h
+ include/exodusII_ext.h
+ include/exodusII_int.h
)
IF(APPLE)
@@ -173,21 +222,25 @@ IF(APPLE)
COMPILE_FLAGS -fno-common)
ENDIF(APPLE)
-ADD_LIBRARY(exoIIc ${cbind_SRCS})
-TARGET_LINK_LIBRARIES(exoIIc NetCDF)
+ADD_LIBRARY(exoIIv2c ${cbind_SRCS})
+
+TARGET_LINK_LIBRARIES(exoIIv2c ${NETCDF_LIBRARY}/libnetcdf.a)
IF(VTK_LIBRARY_PROPERTIES)
- SET_TARGET_PROPERTIES(exoIIc PROPERTIES ${VTK_LIBRARY_PROPERTIES})
+ SET_TARGET_PROPERTIES(exoIIv2c PROPERTIES ${VTK_LIBRARY_PROPERTIES})
ENDIF(VTK_LIBRARY_PROPERTIES)
IF(NOT VTK_INSTALL_NO_LIBRARIES)
+MESSAGE("cbind_HEADERS=${cbind_HEADERS}")
IF(VTK_INSTALL_HAS_CMAKE_24)
- INSTALL(TARGETS exoIIc
- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT Runtime
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT Runtime
- ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT Development)
+ INSTALL(TARGETS exoIIv2c
+ RUNTIME DESTINATION /lib COMPONENT Runtime
+ LIBRARY DESTINATION /lib COMPONENT Runtime
+ ARCHIVE DESTINATION /lib COMPONENT Development)
+ INSTALL(FILES ${cbind_HEADERS} DESTINATION /include)
ELSE(VTK_INSTALL_HAS_CMAKE_24)
- INSTALL_TARGETS(${CMAKE_INSTALL_PREFIX}/lib exoIIc)
+ INSTALL_TARGETS(/lib exoIIv2c)
+ INSTALL_FILES(/include .h ${cbind_HEADERS})
ENDIF(VTK_INSTALL_HAS_CMAKE_24)
ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
diff --git a/cbind/CVS/Entries b/cbind/CVS/Entries
index ac99b55..67cebb0 100644
--- a/cbind/CVS/Entries
+++ b/cbind/CVS/Entries
@@ -1,4 +1,2 @@
-/CMakeLists.txt/1.1/Sun Nov 26 05:37:18 2006//
-D/include////
-D/src////
-D/test////
+/CMakeLists.txt/1.11/Mon Oct 4 14:12:11 2010//
+D
diff --git a/cbind/CVS/Entries.Log b/cbind/CVS/Entries.Log
new file mode 100644
index 0000000..0d7c7bb
--- /dev/null
+++ b/cbind/CVS/Entries.Log
@@ -0,0 +1,3 @@
+A D/include////
+A D/src////
+A D/test////
diff --git a/cbind/include/CVS/Entries b/cbind/include/CVS/Entries
index 85b4d96..6831257 100644
--- a/cbind/include/CVS/Entries
+++ b/cbind/include/CVS/Entries
@@ -1,7 +1,8 @@
-/Imakefile/1.4/Tue Nov 28 14:01:59 2006//
-/exodusII.h/1.4/Tue Nov 28 14:01:59 2006//
-/exodusII_cfg.h.in/1.1/Sun Nov 26 05:37:18 2006//
-/exodusII_ext.h/1.1/Sun Nov 26 05:37:18 2006//
-/exodusII_int.h/1.4/Tue Nov 28 14:01:59 2006//
+/Imakefile/1.9/Wed Jul 15 19:17:37 2009//
+/doxygen.h/1.1/Wed Feb 20 19:49:12 2008//
+/exodusII.h/1.16/Mon Oct 4 13:58:10 2010//
+/exodusII_cfg.h.in/1.2/Wed Feb 20 19:49:12 2008//
+/exodusII_ext.h/1.5/Wed Feb 24 13:48:30 2010//
+/exodusII_int.h/1.13/Wed Feb 24 13:48:30 2010//
/exodusII_test.h/1.1/Tue Nov 28 14:01:59 2006//
D
diff --git a/cbind/include/Imakefile b/cbind/include/Imakefile
index 4465fe0..01b49eb 100644
--- a/cbind/include/Imakefile
+++ b/cbind/include/Imakefile
@@ -1,4 +1,3 @@
-XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
INCLIST=exodusII.h exodusII_int.h exodusII_ext.h
diff --git a/cbind/include/doxygen.h b/cbind/include/doxygen.h
new file mode 100644
index 0000000..a845ce9
--- /dev/null
+++ b/cbind/include/doxygen.h
@@ -0,0 +1,133 @@
+/*! \mainpage ExodusII API Documentation
+
+\section intro Introduction
+
+EXODUS II is the successor of the widely used finite element (FE) data file format EXODUS
+(henceforth referred to as EXODUS I) developed by Mills-Curran and Flanagan. It
+continues the concept of a common database for multiple application codes (mesh generators,
+analysis codes, visualization software, etc.) rather than code-specific utilities, affording
+flexibility and robustness for both the application code developer and application code user.
+By using the EXODUS II data model, a user inherits the flexibility of using a large array of
+application codes (including vendor-supplied codes) which access this common data file
+directly or via translators.
+
+The uses of the EXODUS II data model include the following:
+ - Problem definition -- mesh generation, specification of locations of boundary conditions and load application, specification of material types.
+ - Simulation -- model input and results output.
+ - Visualization -- model verification, results postprocessing, data interrogation, and analysis tracking.
+
+\section avail License and Availability
+The EXODUS II library is licensed under the BSD open source license.
+
+Copyright (c) 2005 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000
+with Sandia Corporation, 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 Sandia Corporation 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.
+
+The ExodusII library source code is available on Sourceforge at
+http://sourceforge.net/projects/exodusii
+
+For bug reports, documentation errors, and enhancement suggestions, contact:
+- Gregory D. Sjaardema
+- PHONE: (505) 844-2701
+- EMAIL: gdsjaar at sandia.gov
+
+\section devel Development of EXODUS II
+
+The evolution of the EXODUS data model has been steered by FE application code developers
+who desire the advantages of a common data format. The EXODUS II model has been
+designed to overcome deficiencies in the EXODUS I file format and meet the following
+functional requirements as specified by these developers:
+ - Random read/write access.
+ - Application programming interface (API) -- provide routines callable from FORTRAN, C, and C++ application codes.
+ - Extensible -- allow new data objects to be added without modifying the application programs that use the file format.
+ - Machine independent -- data should be independent of the machine which generated it.
+ - Real-time access during analysis -- allow access to the data in a file while the file is
+being created.
+
+To address these requirements, the open source database library
+etCDF (http://www.unidata.ucar.edu/software/netcdf/) was selected to handle the low-level data storage. The EXODUS
+II library functions provide the mapping between FE data objects and
+netCDF dimensions, attributes, and variables. Thus, the code developer
+interacts with the data model using the vocabulary of an FE analyst
+(element connectivity, nodal coordinates, etc.) and is relieved of the
+details of the data access mechanism.
+
+Because an EXODUS II file is a netCDF file, an application program can
+access data via the EXODUS II API or the netCDF API directly. Although
+accessing the data directly via the netCDF API requires more in-depth
+understanding of netCDF, this capability is a powerful feature that
+allows the development of auxiliary libraries of special purpose
+functions not offered in the standard EXODUS II library. For example,
+if an application required access to the coordinates of a single node
+(the standard library function returns the coordinates for all of the
+nodes in the model), a simple function could be written that calls
+netCDF routines directly to read the data of interest.
+
+\section descrip Description of Data Objects
+
+The data in EXODUS II files can be divided into three primary
+categories: initialization data, model, and results.
+
+Initialization data includes sizing parameters (number of nodes,
+number of elements, etc.), optional quality assurance information
+(names of codes that have operated on the data), and optional
+informational text.
+
+The model is described by data which are static (do not change through
+time). These data include nodal coordinates, element connectivity
+(node lists for each element), element attributes, and node sets and
+side sets (used to aid in applying loading conditions and boundary
+constraints).
+
+The results are optional and include five types of variables -- nodal,
+element, nodeset, sideset, and global -- each of which is stored
+through time. Nodal results are output (at each time step) for all the
+nodes in the model. An example of a nodal variable is displacement in
+the X direction. Element, nodeset, and sideset results are output (at
+each time step) for all entities (elements, nodes, sides) in one or
+more entity block. For example, stress may be an element
+variable. Another use of element variables is to record element status
+(a binary flag indicating whether each element is "alive" or "dead")
+through time. Global results are output (at each time step) for a
+single element or node, or for a single property. Linear momentum of a
+structure and the acceleration at a particular point are both examples
+of global variables. Although these examples correspond to typical FE
+applications, the data format is flexible enough to accommodate a
+spectrum of uses.
+
+A few conventions and limitations must be cited:
+
+ - There are no restrictions on the frequency of results output except
+ that the time value associated with each successive time step must
+ increase monotonically.
+ - To output results at different frequencies (i.e., variable A at
+ every simulation time step, variable B at every other time step)
+ multiple EXODUS II files must be used.
+ - There are no limits to the number of each type of results, but once
+ declared, the number cannot change.
+ - If the mesh geometry or topology changes in time (i.e., number of
+ nodes increases, connectivity changes), then the new geometrymust be
+ output to a new EXODUS II file.
+
+*/
diff --git a/cbind/include/exodusII.h b/cbind/include/exodusII.h
index a5fa239..119198e 100644
--- a/cbind/include/exodusII.h
+++ b/cbind/include/exodusII.h
@@ -4,8 +4,8 @@
* 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:
+ * 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.
@@ -21,666 +21,809 @@
*
* 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.
+ * 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.
*
*/
/*****************************************************************************
*
- * exodusII.h - Exodus II include file, for general use
+ * exodusII.h - Exodus II API include file
*
- * author - Sandia National Laboratories
- *
- * environment - UNIX
- *
- * exit conditions -
- *
- * revision history -
- *
- * $Id: exodusII.h,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
*****************************************************************************/
+#ifndef EXODUS_II_HDR
+#define EXODUS_II_HDR
+
#include "netcdf.h"
#include "stddef.h"
-#ifndef TRUE
-#define TRUE -1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
+/* EXODUS II version number */
+#define EX_API_VERS 4.98
+#define EX_API_VERS_NODOT 498
+#define EX_VERS EX_API_VERS
-#ifndef EXODUS_II_HDR
-#define EXODUS_II_HDR
/*
- * need following extern if this include file is used in a C++ program, to
- * keep the C++ compiler from mangling the function names.
+ * need following extern if this include file is used in a C++
+ * program, to keep the C++ compiler from mangling the function names.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
- * The following are miscellaneous constants used in the EXODUS II API.
+ * The following are miscellaneous constants used in the EXODUS II
+ * API. They should already be defined, but are left over from the
+ * old days...
*/
+#ifndef TRUE
+#define TRUE -1
+#endif
-#define EX_NOCLOBBER 0 /* Don't overwrite existing database, default */
-#define EX_CLOBBER 1
-#define EX_NORMAL_MODEL 2 /* disable mods that permit storage of larger models */
-#define EX_LARGE_MODEL 4 /* enable mods that permit storage of larger models */
-#define EX_NETCDF4 8 /* use the hdf5-based netcdf4 output */
-#define EX_NOSHARE 16 /* Do not open netcdf file in "share" mode */
-#define EX_SHARE 32 /* Do open netcdf file in "share" mode */
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+ /**
+ * \defgroup FileVars Variables controlling the file creation mode.
+ *@{
+ */
+#define EX_NOCLOBBER 0 /**< Don't overwrite existing database, default */
+#define EX_CLOBBER 1 /**< Overwrite existing database if it exists */
+#define EX_NORMAL_MODEL 2 /**< disable mods that permit storage of larger models */
+#define EX_LARGE_MODEL 4 /**< enable mods that permit storage of larger models */
+#define EX_NETCDF4 8 /**< use the hdf5-based netcdf4 output */
+#define EX_NOSHARE 16 /**< Do not open netcdf file in "share" mode */
+#define EX_SHARE 32 /**< Do open netcdf file in "share" mode */
#define EX_READ 0
#define EX_WRITE 1
-
-#define EX_INQ_FILE_TYPE 1 /* inquire EXODUS II file type*/
-#define EX_INQ_API_VERS 2 /* inquire API version number */
-#define EX_INQ_DB_VERS 3 /* inquire database version */
- /* number */
-#define EX_INQ_TITLE 4 /* inquire database title */
-#define EX_INQ_DIM 5 /* inquire number of */
- /* dimensions */
-#define EX_INQ_NODES 6 /* inquire number of nodes */
-#define EX_INQ_ELEM 7 /* inquire number of elements */
-#define EX_INQ_ELEM_BLK 8 /* inquire number of element */
- /* blocks */
-#define EX_INQ_NODE_SETS 9 /* inquire number of node sets*/
-#define EX_INQ_NS_NODE_LEN 10 /* inquire length of node set */
- /* node list */
-#define EX_INQ_SIDE_SETS 11 /* inquire number of side sets*/
-#define EX_INQ_SS_NODE_LEN 12 /* inquire length of side set */
- /* node list */
-#define EX_INQ_SS_ELEM_LEN 13 /* inquire length of side set */
- /* element list */
-#define EX_INQ_QA 14 /* inquire number of QA */
- /* records */
-#define EX_INQ_INFO 15 /* inquire number of info */
- /* records */
-#define EX_INQ_TIME 16 /* inquire number of time */
- /* steps in the database */
-#define EX_INQ_EB_PROP 17 /* inquire number of element */
- /* block properties */
-#define EX_INQ_NS_PROP 18 /* inquire number of node set */
- /* properties */
-#define EX_INQ_SS_PROP 19 /* inquire number of side set */
-#define EX_INQ_NS_DF_LEN 20 /* inquire length of node set */
- /* distribution factor list*/
-#define EX_INQ_SS_DF_LEN 21 /* inquire length of node set */
- /* distribution factor list*/
-#define EX_INQ_LIB_VERS 22 /* inquire API Lib vers number*/
-#define EX_INQ_EM_PROP 23 /* inquire number of element */
- /* map properties */
-#define EX_INQ_NM_PROP 24 /* inquire number of node */
- /* map properties */
-#define EX_INQ_ELEM_MAP 25 /* inquire number of element */
- /* maps */
-#define EX_INQ_NODE_MAP 26 /* inquire number of node */
- /* maps */
-
+ /*@}*/
+
+ /*! \sa ex_inquire() */
+ enum ex_inquiry {
+ EX_INQ_FILE_TYPE = 1, /**< inquire EXODUS II file type*/
+ EX_INQ_API_VERS = 2, /**< inquire API version number */
+ EX_INQ_DB_VERS = 3, /**< inquire database version number */
+ EX_INQ_TITLE = 4, /**< inquire database title */
+ EX_INQ_DIM = 5, /**< inquire number of dimensions */
+ EX_INQ_NODES = 6, /**< inquire number of nodes */
+ EX_INQ_ELEM = 7, /**< inquire number of elements */
+ EX_INQ_ELEM_BLK = 8, /**< inquire number of element blocks */
+ EX_INQ_NODE_SETS = 9, /**< inquire number of node sets*/
+ EX_INQ_NS_NODE_LEN = 10, /**< inquire length of node set node list */
+ EX_INQ_SIDE_SETS = 11, /**< inquire number of side sets*/
+ EX_INQ_SS_NODE_LEN = 12, /**< inquire length of side set node list */
+ EX_INQ_SS_ELEM_LEN = 13, /**< inquire length of side set element list */
+ EX_INQ_QA = 14, /**< inquire number of QA records */
+ EX_INQ_INFO = 15, /**< inquire number of info records */
+ EX_INQ_TIME = 16, /**< inquire number of time steps in the database */
+ EX_INQ_EB_PROP = 17, /**< inquire number of element block properties */
+ EX_INQ_NS_PROP = 18, /**< inquire number of node set properties */
+ EX_INQ_SS_PROP = 19, /**< inquire number of side set properties */
+ EX_INQ_NS_DF_LEN = 20, /**< inquire length of node set distribution factor list*/
+ EX_INQ_SS_DF_LEN = 21, /**< inquire length of side set distribution factor list*/
+ EX_INQ_LIB_VERS = 22, /**< inquire API Lib vers number*/
+ EX_INQ_EM_PROP = 23, /**< inquire number of element map properties */
+ EX_INQ_NM_PROP = 24, /**< inquire number of node map properties */
+ EX_INQ_ELEM_MAP = 25, /**< inquire number of element maps */
+ EX_INQ_NODE_MAP = 26, /**< inquire number of node maps*/
+ EX_INQ_EDGE = 27, /**< inquire number of edges */
+ EX_INQ_EDGE_BLK = 28, /**< inquire number of edge blocks */
+ EX_INQ_EDGE_SETS = 29, /**< inquire number of edge sets */
+ EX_INQ_ES_LEN = 30, /**< inquire length of concat edge set edge list */
+ EX_INQ_ES_DF_LEN = 31, /**< inquire length of concat edge set dist factor list*/
+ EX_INQ_EDGE_PROP = 32, /**< inquire number of properties stored per edge block */
+ EX_INQ_ES_PROP = 33, /**< inquire number of properties stored per edge set */
+ EX_INQ_FACE = 34, /**< inquire number of faces */
+ EX_INQ_FACE_BLK = 35, /**< inquire number of face blocks */
+ EX_INQ_FACE_SETS = 36, /**< inquire number of face sets */
+ EX_INQ_FS_LEN = 37, /**< inquire length of concat face set face list */
+ EX_INQ_FS_DF_LEN = 38, /**< inquire length of concat face set dist factor list*/
+ EX_INQ_FACE_PROP = 39, /**< inquire number of properties stored per face block */
+ EX_INQ_FS_PROP = 40, /**< inquire number of properties stored per face set */
+ EX_INQ_ELEM_SETS = 41, /**< inquire number of element sets */
+ EX_INQ_ELS_LEN = 42, /**< inquire length of concat element set element list */
+ EX_INQ_ELS_DF_LEN = 43, /**< inquire length of concat element set dist factor list*/
+ EX_INQ_ELS_PROP = 44, /**< inquire number of properties stored per elem set */
+ EX_INQ_EDGE_MAP = 45, /**< inquire number of edge maps */
+ EX_INQ_FACE_MAP = 46, /**< inquire number of face maps */
+ EX_INQ_COORD_FRAMES = 47, /**< inquire number of coordinate frames */
+ EX_INQ_INVALID = -1};
+
+ typedef enum ex_inquiry ex_inquiry;
+
/* properties */
-#define EX_ELEM_BLOCK 1 /* element block property code*/
-#define EX_NODE_SET 2 /* node set property code */
-#define EX_SIDE_SET 3 /* side set property code */
-#define EX_ELEM_MAP 4 /* element map property code */
-#define EX_NODE_MAP 5 /* node map property code */
-
- /* max string lengths; constants that are used as netcdf dimensions must be
- of type long */
-#define MAX_STR_LENGTH 32L
-#define MAX_VAR_NAME_LENGTH 20
+ enum ex_entity_type {
+ EX_NODAL = 14, /**< nodal "block" for variables*/
+ EX_NODE_BLOCK = 14, /**< alias for EX_NODAL */
+ EX_NODE_SET = 2, /**< node set property code */
+ EX_EDGE_BLOCK = 6, /**< edge block property code */
+ EX_EDGE_SET = 7, /**< edge set property code */
+ EX_FACE_BLOCK = 8, /**< face block property code */
+ EX_FACE_SET = 9, /**< face set property code */
+ EX_ELEM_BLOCK = 1, /**< element block property code*/
+ EX_ELEM_SET = 10, /**< face set property code */
+
+ EX_SIDE_SET = 3, /**< side set property code */
+
+ EX_ELEM_MAP = 4, /**< element map property code */
+ EX_NODE_MAP = 5, /**< node map property code */
+ EX_EDGE_MAP = 11, /**< edge map property code */
+ EX_FACE_MAP = 12, /**< face map property code */
+
+ EX_GLOBAL = 13, /**< global "block" for variables*/
+ EX_INVALID = -1};
+ typedef enum ex_entity_type ex_entity_type;
+
+ /**
+ * ex_opts() function codes - codes are OR'ed into exopts
+ */
+ enum ex_options {
+ EX_DEFAULT = 0,
+ EX_VERBOSE = 1, /**< verbose mode message flag */
+ EX_DEBUG = 2, /**< debug mode def */
+ EX_ABORT = 4 /**< abort mode flag def */
+ };
+ typedef enum ex_options ex_options;
+
+ /**
+ * \defgroup StringLengths maximum string lengths;
+ * constants that are used as netcdf dimensions must be of type long
+ * @{
+ */
+ /** Maximum length of an entity name, attribute name, variable name,
+ QA record, element type name */
+#define MAX_STR_LENGTH 32L
+ /** Maximum length of the database title or an information record */
#define MAX_LINE_LENGTH 80L
+ /** Maximum length of an error message passed to ex_err() function. Typically, internal use only */
#define MAX_ERR_LENGTH 256
+ /* @} */
- /* for netCDF 3.4, we estimate the size of the header;
- if estimate is larger than this max, set the estimate to this max;
- I've never measured a header larger than 20K */
-#define MAX_HEADER_SIZE 30000
+#ifndef EXODUS_EXPORT
+#define EXODUS_EXPORT extern
+#endif /* EXODUS_EXPORT */
/* routines for file initialization i/o */
- extern int ex_close (int exoid);
- extern int ex_cvt_nodes_to_sides(int exoid, int *num_elem_per_set,
- int *num_nodes_per_set, int *side_sets_elem_index,
- int *side_sets_node_index, int *side_sets_elem_list,
- int *side_sets_node_list, int *side_sets_side_list);
- extern int ex_copy (int in_exoid, int out_exoid);
- extern int ex_create (const char *path, int cmode, int *comp_ws, int *io_ws);
- extern int ex_get_all_times (int exoid, void *time_values);
- extern int ex_get_concat_node_sets (int exoid,
- int *node_set_ids,
- int *num_nodes_per_set,
- int *num_df_per_set,
- int *node_sets_node_index,
- int *node_sets_df_index,
- int *node_sets_node_list,
- void *node_sets_dist_fact);
- extern int ex_get_coord_names (int exoid,
- char **coord_names);
- extern int ex_get_coord (int exoid,
- void *x_coor,
- void *y_coor,
- void *z_coor);
- extern int ex_get_concat_side_sets (int exoid,
- int *side_set_ids,
- int *num_elem_per_set,
- int *num_dist_per_set,
- int *side_sets_elem_index,
- int *side_sets_dist_index,
- int *side_sets_elem_list,
- int *side_sets_side_list,
- void *side_sets_dist_fact);
- extern int ex_get_elem_attr_names (int exoid,
- int elem_blk_id,
- char **names);
- extern int ex_get_elem_attr (int exoid,
- int elem_blk_id,
- void *attrib);
- extern int ex_get_ids (int exoid, int obj_type, int *ids);
- extern int ex_get_elem_blk_ids (int exoid, int *ids);
- extern int ex_get_elem_block (int exoid,
- int elem_blk_id,
- char *elem_type,
- int *num_elem_this_blk,
- int *num_nodes_per_elem,
- int *num_attr);
-
- extern int ex_get_elem_conn (int exoid,
- int elem_blk_id,
- int *connect);
-
- extern int ex_get_elem_map (int exoid,
- int map_id,
- int *elem_map);
- extern int ex_get_elem_num_map (int exoid,
- int *elem_map);
- extern int ex_get_elem_var (int exoid,
- int time_step,
- int elem_var_index,
- int elem_blk_id,
- int num_elem_this_blk,
- void *elem_var_vals);
- extern int ex_get_elem_varid (int exoid,
- int *varid);
- extern int ex_get_elem_var_time (int exoid,
- int elem_var_index,
- int elem_number,
- int beg_time_step,
- int end_time_step,
- void *elem_var_vals);
- extern int ex_get_coordinate_frames(int exoid, int *nframes, int *cf_ids,
- void* pt_coordinates, char* tags);
-
- extern int ex_get_glob_vars (int exoid,
- int time_step,
- int num_glob_vars,
- void *glob_var_vals);
-
- extern int ex_get_glob_var_time (int exoid,
- int glob_var_index,
- int beg_time_step,
- int end_time_step,
- void *glob_var_vals);
-
- extern int ex_get_info (int exoid, char **info);
-
- extern int ex_get_init (int exoid,
- char *title,
- int *num_dim,
- int *num_nodes,
- int *num_elem,
- int *num_elem_blk,
- int *num_node_sets,
- int *num_side_sets);
-
- extern int ex_get_map (int exoid, int *elem_map);
-
- extern int ex_get_map_param (int exoid,
- int *num_node_maps,
- int *num_elem_maps);
-
- extern int ex_get_name (int exoid,
- int obj_type,
- int entity_id,
- char *name);
-
- extern int ex_get_names (int exoid,
- int obj_type,
- char **names);
-
- extern int ex_get_node_map (int exoid,
- int map_id,
- int *node_map);
-
- extern int ex_get_node_num_map (int exoid,
- int *node_map);
-
- extern int ex_get_node_set_param (int exoid,
- int node_set_id,
- int *num_nodes_in_set,
- int *num_df_in_set);
-
- extern int ex_get_node_set (int exoid,
- int node_set_id,
- int *node_set_node_list);
-
- extern int ex_get_node_set_dist_fact (int exoid,
- int node_set_id,
- void *node_set_dist_fact);
-
- extern int ex_get_node_set_ids (int exoid,
- int *ids);
-
- extern int ex_get_nset_var_tab (int exoid,
- int num_nodesets,
- int num_nset_var,
- int *nset_var_tab);
-
- extern int ex_get_nset_var (int exoid,
- int time_step,
- int nset_var_index,
- int nset_id,
- int num_node_this_nset,
- void *nset_var_vals);
-
- extern int ex_get_nset_varid (int exoid,
- int *varid);
-
- extern int ex_get_nodal_var (int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- void *nodal_var_vals);
-
- extern int ex_get_nodal_varid(int exoid, int *varid);
-
- extern int ex_get_nodal_var_time (int exoid,
- int nodal_var_index,
- int node_number,
- int beg_time_step,
- int end_time_step,
- void *nodal_var_vals);
-
- extern int ex_get_nodal_varid_var(int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- int varid,
- void *nodal_var_vals);
-
- extern int ex_get_one_elem_attr (int exoid,
- int elem_blk_id,
- int attrib_index,
- void *attrib);
-
- extern int ex_get_prop_array (int exoid,
- int obj_type,
- const char *prop_name,
- int *values);
-
- extern int ex_get_prop (int exoid,
- int obj_type,
- int obj_id,
- const char *prop_name,
- int *value);
-
- extern int ex_get_partial_elem_map (int exoid,
- int map_id,
- int ent_start,
- int ent_count,
- int *elem_map);
-
- extern int ex_get_prop_names (int exoid,
- int obj_type,
- char **prop_names);
-
- extern int ex_get_qa (int exoid,
- char *qa_record[][4]);
- extern int ex_get_side_set_node_list_len(int exoid,
- int side_set_id,
- int *side_set_node_list_len);
- extern int ex_get_side_set_param (int exoid,
- int side_set_id,
- int *num_side_in_set,
- int *num_dist_fact_in_set);
- extern int ex_get_side_set (int exoid,
- int side_set_id,
- int *side_set_elem_list,
- int *side_set_side_list);
- extern int ex_get_side_set_node_count(int exoid,
- int side_set_id,
- int *side_set_node_cnt_list);
- extern int ex_get_side_set_dist_fact (int exoid,
- int side_set_id,
- void *side_set_dist_fact);
- extern int ex_get_side_set_ids (int exoid,
- int *ids);
- extern int ex_get_side_set_node_list(int exoid,
- int side_set_id,
- int *side_set_node_cnt_list,
- int *side_set_node_list);
- extern int ex_get_sset_var (int exoid,
- int time_step,
- int sset_var_index,
- int sset_id,
- int num_side_this_sset,
- void *sset_var_vals);
-
- extern int ex_get_sset_var_tab (int exoid,
- int num_sidesets,
- int num_sset_var,
- int *sset_var_tab);
- extern int ex_get_sset_varid (int exoid,
- int *varid);
- extern int ex_get_time (int exoid,
- int time_step,
- void *time_value);
- extern int ex_get_var_names (int exoid,
- const char *var_type,
- int num_vars,
- char *var_names[]);
- extern int ex_get_varid (int exoid, const char *var_type,
- int *varid_arr);
- extern int ex_get_var_name (int exoid,
- const char *var_type,
- int var_num,
- char *var_name);
- extern int ex_get_var_param (int exoid,
- const char *var_type,
- int *num_vars);
-
- extern int ex_get_object_truth_vector (int exoid,
- const char *var_type,
- int object_id,
- int num_var,
- int *var_vector);
+ EXODUS_EXPORT int ex_close (int exoid);
+ EXODUS_EXPORT int ex_cvt_nodes_to_sides(int exoid, int *num_elem_per_set,
+ int *num_nodes_per_set, int *side_sets_elem_index,
+ int *side_sets_node_index, int *side_sets_elem_list,
+ int *side_sets_node_list, int *side_sets_side_list);
+ EXODUS_EXPORT int ex_copy (int in_exoid, int out_exoid);
+#define ex_create(path, mode, comp_ws, io_ws) ex_create_int(path, mode, comp_ws, io_ws, EX_API_VERS_NODOT)
+ EXODUS_EXPORT int ex_create_int (const char *path, int cmode, int *comp_ws, int *io_ws, int my_version);
+ EXODUS_EXPORT int ex_get_all_times (int exoid, void *time_values);
+ EXODUS_EXPORT int ex_get_concat_node_sets (int exoid,
+ int *node_set_ids,
+ int *num_nodes_per_set,
+ int *num_df_per_set,
+ int *node_sets_node_index,
+ int *node_sets_df_index,
+ int *node_sets_node_list,
+ void *node_sets_dist_fact);
+ EXODUS_EXPORT int ex_get_coord_names (int exoid,
+ char **coord_names);
+ EXODUS_EXPORT int ex_get_coord (int exoid,
+ void *x_coor,
+ void *y_coor,
+ void *z_coor);
+ EXODUS_EXPORT int ex_get_n_coord (int exoid,
+ int start_node_num,
+ int num_nodes,
+ void *x_coor,
+ void *y_coor,
+ void *z_coor);
+ EXODUS_EXPORT int ex_get_concat_side_sets (int exoid,
+ int *side_set_ids,
+ int *num_elem_per_set,
+ int *num_dist_per_set,
+ int *side_sets_elem_index,
+ int *side_sets_dist_index,
+ int *side_sets_elem_list,
+ int *side_sets_side_list,
+ void *side_sets_dist_fact);
+ EXODUS_EXPORT int ex_get_elem_attr_names (int exoid,
+ int elem_blk_id,
+ char **names);
+ EXODUS_EXPORT int ex_get_elem_attr (int exoid,
+ int elem_blk_id,
+ void *attrib);
+ EXODUS_EXPORT int ex_get_ids (int exoid, ex_entity_type obj_type, int *ids);
+ EXODUS_EXPORT int ex_get_elem_blk_ids (int exoid, int *ids);
+ EXODUS_EXPORT int ex_get_elem_block (int exoid,
+ int elem_blk_id,
+ char *elem_type,
+ int *num_elem_this_blk,
+ int *num_nodes_per_elem,
+ int *num_attr);
+
+ EXODUS_EXPORT int ex_get_elem_conn (int exoid,
+ int elem_blk_id,
+ int *connect);
+
+ EXODUS_EXPORT int ex_get_elem_map (int exoid,
+ int map_id,
+ int *elem_map);
+ EXODUS_EXPORT int ex_get_elem_num_map (int exoid,
+ int *elem_map);
+ EXODUS_EXPORT int ex_get_elem_var (int exoid,
+ int time_step,
+ int elem_var_index,
+ int elem_blk_id,
+ int num_elem_this_blk,
+ void *elem_var_vals);
+ EXODUS_EXPORT int ex_get_elem_varid (int exoid,
+ int *varid);
+ EXODUS_EXPORT int ex_get_elem_var_time (int exoid,
+ int elem_var_index,
+ int elem_number,
+ int beg_time_step,
+ int end_time_step,
+ void *elem_var_vals);
+ EXODUS_EXPORT int ex_get_coordinate_frames(int exoid, int *nframes, int *cf_ids,
+ void* pt_coordinates, char* tags);
+
+ EXODUS_EXPORT int ex_get_glob_vars (int exoid,
+ int time_step,
+ int num_glob_vars,
+ void *glob_var_vals);
+
+ EXODUS_EXPORT int ex_get_glob_var_time (int exoid,
+ int glob_var_index,
+ int beg_time_step,
+ int end_time_step,
+ void *glob_var_vals);
+
+ EXODUS_EXPORT int ex_get_info (int exoid, char **info);
+
+ EXODUS_EXPORT int ex_get_init (int exoid,
+ char *title,
+ int *num_dim,
+ int *num_nodes,
+ int *num_elem,
+ int *num_elem_blk,
+ int *num_node_sets,
+ int *num_side_sets);
+
+ EXODUS_EXPORT int ex_get_map (int exoid, int *elem_map);
+
+ EXODUS_EXPORT int ex_get_map_param (int exoid,
+ int *num_node_maps,
+ int *num_elem_maps);
+
+ EXODUS_EXPORT int ex_get_name (int exoid,
+ ex_entity_type obj_type,
+ int entity_id,
+ char *name);
+
+ EXODUS_EXPORT int ex_get_names (int exoid,
+ ex_entity_type obj_type,
+ char **names);
+
+ EXODUS_EXPORT int ex_get_node_map (int exoid,
+ int map_id,
+ int *node_map);
+
+ EXODUS_EXPORT int ex_get_node_num_map (int exoid,
+ int *node_map);
+
+ EXODUS_EXPORT int ex_get_node_set_param (int exoid,
+ int node_set_id,
+ int *num_nodes_in_set,
+ int *num_df_in_set);
+
+ EXODUS_EXPORT int ex_get_node_set (int exoid,
+ int node_set_id,
+ int *node_set_node_list);
+
+ EXODUS_EXPORT int ex_get_node_set_dist_fact (int exoid,
+ int node_set_id,
+ void *node_set_dist_fact);
+
+ EXODUS_EXPORT int ex_get_node_set_ids (int exoid,
+ int *ids);
+
+ EXODUS_EXPORT int ex_get_nset_var_tab (int exoid,
+ int num_nodesets,
+ int num_nset_var,
+ int *nset_var_tab);
+
+ EXODUS_EXPORT int ex_get_nset_var (int exoid,
+ int time_step,
+ int nset_var_index,
+ int nset_id,
+ int num_node_this_nset,
+ void *nset_var_vals);
+
+ EXODUS_EXPORT int ex_get_nset_varid (int exoid,
+ int *varid);
+
+ EXODUS_EXPORT int ex_get_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_get_n_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int start_node,
+ int num_nodes,
+ void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_get_nodal_varid(int exoid, int *varid);
+
+ EXODUS_EXPORT int ex_get_nodal_var_time (int exoid,
+ int nodal_var_index,
+ int node_number,
+ int beg_time_step,
+ int end_time_step,
+ void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_get_nodal_varid_var(int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ int varid,
+ void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_get_one_elem_attr (int exoid,
+ int elem_blk_id,
+ int attrib_index,
+ void *attrib);
+
+ EXODUS_EXPORT int ex_get_prop_array (int exoid,
+ ex_entity_type obj_type,
+ const char *prop_name,
+ int *values);
+
+ EXODUS_EXPORT int ex_get_prop (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ const char *prop_name,
+ int *value);
+
+ EXODUS_EXPORT int ex_get_partial_elem_map (int exoid,
+ int map_id,
+ int ent_start,
+ int ent_count,
+ int *elem_map);
+
+ EXODUS_EXPORT int ex_get_prop_names (int exoid,
+ ex_entity_type obj_type,
+ char **prop_names);
+
+ EXODUS_EXPORT int ex_get_qa (int exoid,
+ char *qa_record[][4]);
+ EXODUS_EXPORT int ex_get_side_set_node_list_len(int exoid,
+ int side_set_id,
+ int *side_set_node_list_len);
+ EXODUS_EXPORT int ex_get_side_set_param (int exoid,
+ int side_set_id,
+ int *num_side_in_set,
+ int *num_dist_fact_in_set);
+ EXODUS_EXPORT int ex_get_side_set (int exoid,
+ int side_set_id,
+ int *side_set_elem_list,
+ int *side_set_side_list);
+ EXODUS_EXPORT int ex_get_side_set_node_count(int exoid,
+ int side_set_id,
+ int *side_set_node_cnt_list);
+ EXODUS_EXPORT int ex_get_concat_side_set_node_count(int exoid,
+ int *side_set_node_cnt_list);
+ EXODUS_EXPORT int ex_get_side_set_dist_fact (int exoid,
+ int side_set_id,
+ void *side_set_dist_fact);
+ EXODUS_EXPORT int ex_get_side_set_ids (int exoid,
+ int *ids);
+ EXODUS_EXPORT int ex_get_side_set_node_list(int exoid,
+ int side_set_id,
+ int *side_set_node_cnt_list,
+ int *side_set_node_list);
+ EXODUS_EXPORT int ex_get_sset_var (int exoid,
+ int time_step,
+ int sset_var_index,
+ int sset_id,
+ int num_side_this_sset,
+ void *sset_var_vals);
+
+ EXODUS_EXPORT int ex_get_sset_var_tab (int exoid,
+ int num_sidesets,
+ int num_sset_var,
+ int *sset_var_tab);
+ EXODUS_EXPORT int ex_get_sset_varid (int exoid,
+ int *varid);
+ EXODUS_EXPORT int ex_get_time (int exoid,
+ int time_step,
+ void *time_value);
+ EXODUS_EXPORT int ex_get_variable_names (int exoid,
+ ex_entity_type obj_type,
+ int num_vars,
+ char *var_names[]);
+ EXODUS_EXPORT int ex_get_var_names (int exoid,
+ const char *var_type,
+ int num_vars,
+ char *var_names[]);
+ EXODUS_EXPORT int ex_get_varid (int exoid, ex_entity_type obj_type,
+ int *varid_arr);
+ EXODUS_EXPORT int ex_get_variable_name (int exoid,
+ ex_entity_type obj_type,
+ int var_num,
+ char *var_name);
+ EXODUS_EXPORT int ex_get_var_name (int exoid,
+ const char *var_type,
+ int var_num,
+ char *var_name);
+ EXODUS_EXPORT int ex_get_var_param (int exoid,
+ const char *var_type,
+ int *num_vars);
+ EXODUS_EXPORT int ex_get_variable_param (int exoid,
+ ex_entity_type obj_type,
+ int *num_vars);
+
+ EXODUS_EXPORT int ex_get_object_truth_vector (int exoid,
+ ex_entity_type var_type,
+ int object_id,
+ int num_var,
+ int *var_vector);
+ EXODUS_EXPORT int ex_get_truth_table (int exoid,
+ ex_entity_type obj_type,
+ int num_blk,
+ int num_var,
+ int *var_tab);
+ EXODUS_EXPORT int ex_get_var_tab (int exoid,
+ const char *var_type,
+ int num_blk,
+ int num_var,
+ int *var_tab);
- extern int ex_get_var_tab (int exoid,
- const char *var_type,
- int num_blk,
- int num_var,
- int *var_tab);
+ EXODUS_EXPORT int ex_get_elem_var_tab (int exoid,
+ int num_elem_blk,
+ int num_elem_var,
+ int *elem_var_tab);
+
+#define ex_open(path, mode, comp_ws, io_ws, version) ex_open_int(path, mode, comp_ws, io_ws, version, EX_API_VERS_NODOT)
+ EXODUS_EXPORT int ex_open_int (const char *path,
+ int mode,
+ int *comp_ws,
+ int *io_ws,
+ float *version, int my_version);
- extern int ex_get_elem_var_tab (int exoid,
- int num_elem_blk,
- int num_elem_var,
- int *elem_var_tab);
- extern int ex_open (const char *path,
- int mode,
- int *comp_ws,
- int *io_ws,
- float *version);
-
- extern int ex_put_all_var_param (int exoid,
- int num_g, int num_n,
- int num_e, int *elem_var_tab,
- int num_m, int *nset_var_tab,
- int num_s, int *sset_var_tab);
-
- extern int ex_put_concat_elem_block (int exoid,
- const int* elem_blk_id,
- char *elem_type[],
- const int* num_elem_this_blk,
- const int* num_nodes_per_elem,
- const int* num_attr,
- int define_maps);
-
- extern int ex_put_concat_node_sets (int exoid,
- int *node_set_ids,
- int *num_nodes_per_set,
- int *num_dist_per_set,
- int *node_sets_node_index,
- int *node_sets_df_index,
- int *node_sets_node_list,
- void *node_sets_dist_fact);
-
- extern int ex_put_concat_side_sets (int exoid,
- int *side_set_ids,
- int *num_elem_per_set,
- int *num_dist_per_set,
- int *side_sets_elem_index,
- int *side_sets_dist_index,
- int *side_sets_elem_list,
- int *side_sets_side_list,
- void *side_sets_dist_fact);
-
- extern int ex_put_concat_var_param (int exoid, int num_g, int num_n,
- int num_e, int num_elem_blk, int *elem_var_tab);
+ EXODUS_EXPORT int ex_put_attr_param (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int num_attrs);
+
+ EXODUS_EXPORT int ex_get_attr_param (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int *num_attrs);
+
+ EXODUS_EXPORT int ex_put_all_var_param (int exoid,
+ int num_g, int num_n,
+ int num_e, int *elem_var_tab,
+ int num_m, int *nset_var_tab,
+ int num_s, int *sset_var_tab);
+
+ EXODUS_EXPORT int ex_put_concat_elem_block (int exoid,
+ const int* elem_blk_id,
+ char *elem_type[],
+ const int* num_elem_this_blk,
+ const int* num_nodes_per_elem,
+ const int* num_attr,
+ int define_maps);
+
+ EXODUS_EXPORT int ex_put_concat_node_sets (int exoid,
+ int *node_set_ids,
+ int *num_nodes_per_set,
+ int *num_dist_per_set,
+ int *node_sets_node_index,
+ int *node_sets_df_index,
+ int *node_sets_node_list,
+ void *node_sets_dist_fact);
+
+ EXODUS_EXPORT int ex_put_concat_side_sets (int exoid,
+ int *side_set_ids,
+ int *num_elem_per_set,
+ int *num_dist_per_set,
+ int *side_sets_elem_index,
+ int *side_sets_dist_index,
+ int *side_sets_elem_list,
+ int *side_sets_side_list,
+ void *side_sets_dist_fact);
+
+ EXODUS_EXPORT int ex_put_concat_var_param (int exoid, int num_g, int num_n,
+ int num_e, int num_elem_blk, int *elem_var_tab);
- extern int ex_put_coord_names (int exoid,
- char *coord_names[]);
- extern int ex_put_coord (int exoid,
- const void *x_coor,
- const void *y_coor,
- const void *z_coor);
- extern int ex_put_elem_attr_names(int exoid,
- int elem_blk_id,
- char *names[]);
- extern int ex_put_elem_attr (int exoid,
- int elem_blk_id,
- const void *attrib);
- extern int ex_put_elem_block (int exoid,
- int elem_blk_id,
- const char *elem_type,
- int num_elem_this_blk,
- int num_nodes_per_elem,
- int num_attr);
-
- extern int ex_put_elem_conn (int exoid,
- int elem_blk_id,
- const int *connect);
- extern int ex_put_elem_map (int exoid,
- int map_id,
- const int *elem_map);
- extern int ex_put_elem_num_map (int exoid,
- const int *elem_map);
- extern int ex_put_elem_var (int exoid,
- int time_step,
- int elem_var_index,
- int elem_blk_id,
- int num_elem_this_blk,
- const void *elem_var_vals);
-
- extern int ex_put_coordinate_frames(int exoid, int nframes, const int cf_ids[],
- void* pt_coordinates, const char* tags);
- extern int ex_put_glob_vars (int exoid,
- int time_step,
- int num_glob_vars,
- const void *glob_var_vals);
- extern int ex_put_info (int exoid,
- int num_info,
- char *info[]);
- extern int ex_put_init (int exoid,
- const char *title,
- int num_dim,
- int num_nodes,
- int num_elem,
- int num_elem_blk,
- int num_node_sets,
- int num_side_sets);
-
- extern int ex_put_map (int exoid,
- const int *elem_map);
- extern int ex_put_map_param (int exoid,
- int num_node_maps,
- int num_elem_maps);
- extern int ex_put_name (int exoid,
- int obj_type,
- int entity_id,
- const char *name);
- extern int ex_put_names (int exoid,
- int obj_type,
- char *names[]);
- extern int ex_put_nodal_var (int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- const void *nodal_var_vals);
-
- extern int ex_put_nodal_varid_var(int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- int varid,
- const void *nodal_var_vals);
-
- extern int ex_put_node_map (int exoid,
- int map_id,
- const int *node_map);
- extern int ex_put_node_num_map (int exoid,
- const int *node_map);
- extern int ex_put_node_set_param (int exoid,
- int node_set_id,
- int num_nodes_in_set,
- int num_dist_in_set);
- extern int ex_put_node_set (int exoid,
- int node_set_id,
- const int *node_set_node_list);
- extern int ex_put_node_set_dist_fact (int exoid,
- int node_set_id,
- const void *node_set_dist_fact);
- extern int ex_put_nset_var (int exoid,
- int time_step,
- int nset_var_index,
- int nset_id,
- int num_nodes_this_nset,
- const void *nset_var_vals);
-
- extern int ex_put_nset_var_tab (int exoid,
- int num_nset,
- int num_nset_var,
- int *nset_var_tab);
- extern int ex_put_one_elem_attr (int exoid,
- int elem_blk_id,
- int attrib_index,
- const void *attrib);
- extern int ex_put_partial_elem_map (int exoid,
- int map_id,
- int ent_start,
- int ent_count,
- const int *elem_map);
-
- extern int ex_put_prop (int exoid,
- int obj_type,
- int obj_id,
- const char *prop_name,
- int value);
-
- extern int ex_put_prop_array (int exoid,
- int obj_type,
- const char *prop_name,
- const int *values);
- extern int ex_put_prop_names (int exoid,
- int obj_type,
- int num_props,
- char **prop_names);
- extern int ex_put_qa (int exoid,
- int num_qa_records,
- char* qa_record[][4]);
- extern int ex_put_side_set_param (int exoid,
- int side_set_id,
- int num_side_in_set,
- int num_dist_fact_in_set);
- extern int ex_put_side_set (int exoid,
- int side_set_id,
- const int *side_set_elem_list,
- const int *side_set_side_list);
- extern int ex_put_side_set_dist_fact (int exoid,
- int side_set_id,
- const void *side_set_dist_fact);
- extern int ex_put_sset_var (int exoid,
- int time_step,
- int sset_var_index,
- int sset_id,
- int num_faces_this_sset,
- const void *sset_var_vals);
-
- extern int ex_put_sset_var_tab (int exoid,
- int num_sset,
- int num_sset_var,
- int *sset_var_tab);
- extern int ex_put_time (int exoid,
- int time_step,
- const void *time_value);
- extern int ex_put_varid_var(int exoid,
- int time_step,
- int varid,
- int num_entity,
- const void *var_vals);
-
- extern int ex_put_var_names (int exoid,
- const char *var_type,
- int num_vars,
- char *var_names[]);
- extern int ex_put_var_name (int exoid,
- const char *var_type,
- int var_num,
- const char *var_name);
- extern int ex_put_var_param (int exoid,
- const char *var_type,
- int num_vars);
- extern int ex_put_var_tab (int exoid,
- const char *var_type,
- int num_blk,
- int num_var,
- int *var_tab);
+ EXODUS_EXPORT int ex_put_coord_names (int exoid,
+ char *coord_names[]);
+ EXODUS_EXPORT int ex_put_coord (int exoid,
+ const void *x_coor,
+ const void *y_coor,
+ const void *z_coor);
+ EXODUS_EXPORT int ex_put_n_coord (int exoid,
+ int start_node_num,
+ int num_nodes,
+ const void *x_coor,
+ const void *y_coor,
+ const void *z_coor);
+ EXODUS_EXPORT int ex_put_elem_attr_names(int exoid,
+ int elem_blk_id,
+ char *names[]);
+ EXODUS_EXPORT int ex_put_elem_attr (int exoid,
+ int elem_blk_id,
+ const void *attrib);
+ EXODUS_EXPORT int ex_put_elem_block (int exoid,
+ int elem_blk_id,
+ const char *elem_type,
+ int num_elem_this_blk,
+ int num_nodes_per_elem,
+ int num_attr);
+
+ EXODUS_EXPORT int ex_put_elem_conn (int exoid,
+ int elem_blk_id,
+ const int *connect);
+ EXODUS_EXPORT int ex_put_elem_map (int exoid,
+ int map_id,
+ const int *elem_map);
+ EXODUS_EXPORT int ex_put_id_map(int exoid,
+ ex_entity_type obj_type,
+ const int *map);
- extern int ex_put_elem_var_tab (int exoid,
- int num_elem_blk,
- int num_elem_var,
- int *elem_var_tab);
- extern int ex_update (int exoid);
- extern int ex_get_num_props (int exoid, int obj_type);
- extern int ex_large_model(int exoid);
- extern size_t ex_header_size(int exoid);
-
- extern int *itol (const int*, int);
- extern int ltoi (const int*, int*, int);
-
- extern void ex_err(const char*, const char*, int);
- extern void ex_opts(int);
- extern int ex_inquire(int, int, int*, void*, char*);
-
- extern int ex_get_varid_var(int exoid,
- int time_step,
- int varid,
- int num_entity,
- void *var_vals);
+ EXODUS_EXPORT int ex_get_id_map(int exoid,
+ ex_entity_type obj_type,
+ int *map);
+
+ EXODUS_EXPORT int ex_put_elem_num_map (int exoid,
+ const int *elem_map);
+ EXODUS_EXPORT int ex_put_elem_var (int exoid,
+ int time_step,
+ int elem_var_index,
+ int elem_blk_id,
+ int num_elem_this_blk,
+ const void *elem_var_vals);
+
+ EXODUS_EXPORT int ex_put_coordinate_frames(int exoid, int nframes, const int cf_ids[],
+ void* pt_coordinates, const char* tags);
+ EXODUS_EXPORT int ex_put_glob_vars (int exoid,
+ int time_step,
+ int num_glob_vars,
+ const void *glob_var_vals);
+ EXODUS_EXPORT int ex_put_info (int exoid,
+ int num_info,
+ char *info[]);
+ EXODUS_EXPORT int ex_put_init (int exoid,
+ const char *title,
+ int num_dim,
+ int num_nodes,
+ int num_elem,
+ int num_elem_blk,
+ int num_node_sets,
+ int num_side_sets);
+
+ EXODUS_EXPORT int ex_put_map (int exoid,
+ const int *elem_map);
+ EXODUS_EXPORT int ex_put_map_param (int exoid,
+ int num_node_maps,
+ int num_elem_maps);
+ EXODUS_EXPORT int ex_put_name (int exoid,
+ ex_entity_type obj_type,
+ int entity_id,
+ const char *name);
+ EXODUS_EXPORT int ex_put_names (int exoid,
+ ex_entity_type obj_type,
+ char *names[]);
+ EXODUS_EXPORT int ex_put_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ const void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_put_n_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int start_node,
+ int num_nodes,
+ const void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_put_nodal_varid_var(int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ int varid,
+ const void *nodal_var_vals);
+
+ EXODUS_EXPORT int ex_put_node_map (int exoid,
+ int map_id,
+ const int *node_map);
+ EXODUS_EXPORT int ex_put_node_num_map (int exoid,
+ const int *node_map);
+ EXODUS_EXPORT int ex_put_node_set_param (int exoid,
+ int node_set_id,
+ int num_nodes_in_set,
+ int num_dist_in_set);
+ EXODUS_EXPORT int ex_put_node_set (int exoid,
+ int node_set_id,
+ const int *node_set_node_list);
+ EXODUS_EXPORT int ex_put_node_set_dist_fact (int exoid,
+ int node_set_id,
+ const void *node_set_dist_fact);
+ EXODUS_EXPORT int ex_put_nset_var (int exoid,
+ int time_step,
+ int nset_var_index,
+ int nset_id,
+ int num_nodes_this_nset,
+ const void *nset_var_vals);
+
+ EXODUS_EXPORT int ex_put_nset_var_tab (int exoid,
+ int num_nset,
+ int num_nset_var,
+ int *nset_var_tab);
+ EXODUS_EXPORT int ex_put_one_elem_attr (int exoid,
+ int elem_blk_id,
+ int attrib_index,
+ const void *attrib);
+
+ EXODUS_EXPORT int ex_put_n_one_attr( int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int start_num,
+ int num_ent,
+ int attrib_index,
+ const void *attrib );
+
+ EXODUS_EXPORT int ex_put_partial_elem_map (int exoid,
+ int map_id,
+ int ent_start,
+ int ent_count,
+ const int *elem_map);
+
+ EXODUS_EXPORT int ex_put_partial_set_dist_fact (int exoid,
+ ex_entity_type set_type,
+ int set_id,
+ int offset,
+ int num_to_put,
+ const void *set_dist_fact);
+
+ EXODUS_EXPORT int ex_put_prop (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ const char *prop_name,
+ int value);
+
+ EXODUS_EXPORT int ex_put_prop_array (int exoid,
+ ex_entity_type obj_type,
+ const char *prop_name,
+ const int *values);
+ EXODUS_EXPORT int ex_put_prop_names (int exoid,
+ ex_entity_type obj_type,
+ int num_props,
+ char **prop_names);
+ EXODUS_EXPORT int ex_put_qa (int exoid,
+ int num_qa_records,
+ char* qa_record[][4]);
+ EXODUS_EXPORT int ex_put_side_set_param (int exoid,
+ int side_set_id,
+ int num_side_in_set,
+ int num_dist_fact_in_set);
+ EXODUS_EXPORT int ex_put_side_set (int exoid,
+ int side_set_id,
+ const int *side_set_elem_list,
+ const int *side_set_side_list);
+ EXODUS_EXPORT int ex_put_side_set_dist_fact (int exoid,
+ int side_set_id,
+ const void *side_set_dist_fact);
+ EXODUS_EXPORT int ex_put_sset_var (int exoid,
+ int time_step,
+ int sset_var_index,
+ int sset_id,
+ int num_faces_this_sset,
+ const void *sset_var_vals);
+
+ EXODUS_EXPORT int ex_put_sset_var_tab (int exoid,
+ int num_sset,
+ int num_sset_var,
+ int *sset_var_tab);
+ EXODUS_EXPORT int ex_put_time (int exoid,
+ int time_step,
+ const void *time_value);
+ EXODUS_EXPORT int ex_put_varid_var(int exoid,
+ int time_step,
+ int varid,
+ int num_entity,
+ const void *var_vals);
+
+ EXODUS_EXPORT int ex_put_var_names (int exoid,
+ const char *var_type,
+ int num_vars,
+ char *var_names[]);
+ EXODUS_EXPORT int ex_put_var_name (int exoid,
+ const char *var_type,
+ int var_num,
+ const char *var_name);
+ EXODUS_EXPORT int ex_put_var_param (int exoid,
+ const char *var_type,
+ int num_vars);
+ EXODUS_EXPORT int ex_put_variable_names (int exoid,
+ ex_entity_type obj_type,
+ int num_vars,
+ char* var_names[]);
+ EXODUS_EXPORT int ex_put_variable_name (int exoid,
+ ex_entity_type obj_type,
+ int var_num,
+ const char *var_name);
+ EXODUS_EXPORT int ex_put_variable_param (int exoid,
+ ex_entity_type obj_type,
+ int num_vars);
+ EXODUS_EXPORT int ex_put_truth_table (int exoid,
+ ex_entity_type obj_type,
+ int num_blk,
+ int num_var,
+ int *var_tab);
+ EXODUS_EXPORT int ex_put_var_tab (int exoid,
+ const char *var_type,
+ int num_blk,
+ int num_var,
+ int *var_tab);
+
+ EXODUS_EXPORT int ex_put_elem_var_tab (int exoid,
+ int num_elem_blk,
+ int num_elem_var,
+ int *elem_var_tab);
+ EXODUS_EXPORT int ex_update (int exoid);
+ EXODUS_EXPORT int ex_get_num_props (int exoid, ex_entity_type obj_type);
+ EXODUS_EXPORT int ex_large_model(int exoid);
+ EXODUS_EXPORT size_t ex_header_size(int exoid);
+
+ EXODUS_EXPORT void ex_err(const char*, const char*, int);
+ EXODUS_EXPORT void ex_get_err(const char** msg, const char** func, int* errcode);
+ EXODUS_EXPORT void ex_opts(int options);
+ EXODUS_EXPORT int ex_inquire(int exoid, int inquiry, int*, void*, char*);
+ EXODUS_EXPORT int ex_inquire_int(int exoid, int inquiry);
+
+ EXODUS_EXPORT int ex_get_varid_var(int exoid,
+ int time_step,
+ int varid,
+ int num_entity,
+ void *var_vals);
/* ERROR CODE DEFINITIONS AND STORAGE */
- extern int exerrval; /* shared error return value */
- extern int exoptval; /* error reporting flag (default is quiet) */
+ extern int exerrval; /**< shared error return value */
+ extern int exoptval; /**< error reporting flag (default is quiet) */
+ char* ex_name_of_object(ex_entity_type obj_type);
+ ex_entity_type ex_var_type_to_ex_entity_type(char var_type);
+
#ifdef __cplusplus
} /* close brackets on extern "C" declaration */
#endif
-#endif
-
-/* ex_opts function codes - codes are OR'ed into exopts */
-#define EX_VERBOSE 1 /* verbose mode message flag */
-#define EX_DEBUG 2 /* debug mode def */
-#define EX_ABORT 4 /* abort mode flag def */
-
-/* Exodus error return codes - exerrval return values: */
-#define EX_MEMFAIL 1000 /* memory allocation failure flag def */
-#define EX_BADFILEMODE 1001 /* bad file mode def */
-#define EX_BADFILEID 1002 /* bad file id def */
-#define EX_WRONGFILETYPE 1003 /* wrong file type for function */
-#define EX_LOOKUPFAIL 1004 /* id table lookup failed */
-#define EX_BADPARAM 1005 /* bad parameter passed */
-#define EX_NULLENTITY -1006 /* null entity found */
-#define EX_MSG -1000 /* message print code - no error implied */
-#define EX_PRTLASTMSG -1001 /* print last error message msg code */
+/**
+ * \defgroup ErrorReturnCodes Exodus error return codes - exerrval return values
+ * @{
+ */
+#define EX_MEMFAIL 1000 /**< memory allocation failure flag def */
+#define EX_BADFILEMODE 1001 /**< bad file mode def */
+#define EX_BADFILEID 1002 /**< bad file id def */
+#define EX_WRONGFILETYPE 1003 /**< wrong file type for function */
+#define EX_LOOKUPFAIL 1004 /**< id table lookup failed */
+#define EX_BADPARAM 1005 /**< bad parameter passed */
+#define EX_MSG -1000 /**< message print code - no error implied */
+#define EX_PRTLASTMSG -1001 /**< print last error message msg code */
+#define EX_NULLENTITY -1006 /**< null entity found */
+/* @} */
#include "exodusII_ext.h"
+#endif
+
diff --git a/cbind/include/exodusII_cfg.h.in b/cbind/include/exodusII_cfg.h.in
index f43f4a6..8b9d0f4 100755
--- a/cbind/include/exodusII_cfg.h.in
+++ b/cbind/include/exodusII_cfg.h.in
@@ -10,7 +10,6 @@
# define WIN32
#endif
-#cmakedefine EXODUSII_HAVE_MALLOC_H
#cmakedefine EXODUSII_BUILD_SHARED_LIBS
#if defined(WIN32) && defined(EXODUSII_BUILD_SHARED_LIBS)
# if defined(exoIIc_EXPORTS)
diff --git a/cbind/include/exodusII_ext.h b/cbind/include/exodusII_ext.h
index 3ddee0b..dd55eb5 100644
--- a/cbind/include/exodusII_ext.h
+++ b/cbind/include/exodusII_ext.h
@@ -1,61 +1,48 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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 __exodus_ext_h
#define __exodus_ext_h
-#define EX_INQ_EDGE 27 /* inquire number of edges */
-#define EX_INQ_EDGE_BLK 28 /* inquire number of edge */
- /* blocks */
-#define EX_INQ_EDGE_SETS 29 /* inquire number of edge */
- /* sets */
-#define EX_INQ_ES_LEN 30 /* inquire length of concat */
- /* edge set edge list */
-#define EX_INQ_ES_DF_LEN 31 /* inquire length of concat */
- /* edge set dist factor list*/
-#define EX_INQ_EDGE_PROP 32 /* inquire number of props */
- /* stored per edge block */
-#define EX_INQ_ES_PROP 33 /* inquire number of props */
- /* stored per edge set */
-#define EX_INQ_FACE 34 /* inquire number of faces */
-#define EX_INQ_FACE_BLK 35 /* inquire number of face */
- /* blocks */
-#define EX_INQ_FACE_SETS 36 /* inquire number of face */
- /* sets */
-#define EX_INQ_FS_LEN 37 /* inquire length of concat */
- /* face set face list */
-#define EX_INQ_FS_DF_LEN 38 /* inquire length of concat */
- /* face set dist factor list*/
-#define EX_INQ_FACE_PROP 39 /* inquire number of props */
- /* stored per face block */
-#define EX_INQ_FS_PROP 40 /* inquire number of props */
- /* stored per face set */
-#define EX_INQ_ELEM_SETS 41 /* inquire number of face */
- /* sets */
-#define EX_INQ_ELS_LEN 42 /* inquire length of concat */
- /* face set face list */
-#define EX_INQ_ELS_DF_LEN 43 /* inquire length of concat */
- /* face set dist factor list*/
-#define EX_INQ_ELS_PROP 44 /* inquire number of props */
- /* stored per elem set */
-#define EX_INQ_EDGE_MAP 45 /* inquire number of edge */
- /* maps */
-#define EX_INQ_FACE_MAP 46 /* inquire number of face */
- /* maps */
-
- /* properties */
-#define EX_EDGE_BLOCK 6 /* edge block property code */
-#define EX_EDGE_SET 7 /* edge set property code */
-#define EX_FACE_BLOCK 8 /* face block property code */
-#define EX_FACE_SET 9 /* face set property code */
-#define EX_ELEM_SET 10 /* face set property code */
-#define EX_EDGE_MAP 11 /* edge map property code */
-#define EX_FACE_MAP 12 /* face map property code */
-#define EX_GLOBAL 13 /* global "block" for variables*/
-#define EX_NODAL 14 /* nodal "block" for variables*/
-
#ifdef __cplusplus
extern "C" {
#endif
-/* structures used by external API functions.
+ /**
+ * \defgroup APIStructs Structures used by external API functions.
+ * @{
*/
typedef struct ex_init_params {
char title[MAX_LINE_LENGTH + 1];
@@ -79,24 +66,24 @@ typedef struct ex_init_params {
} ex_init_params;
typedef struct ex_block_params {
- int* edge_blk_id;
+ int* edge_blk_id;
char** edge_type;
- int* num_edge_this_blk;
- int* num_nodes_per_edge;
- int* num_attr_edge;
- int* face_blk_id;
+ int* num_edge_this_blk;
+ int* num_nodes_per_edge;
+ int* num_attr_edge;
+ int* face_blk_id;
char** face_type;
- int* num_face_this_blk;
- int* num_nodes_per_face;
- int* num_attr_face;
- int* elem_blk_id;
+ int* num_face_this_blk;
+ int* num_nodes_per_face;
+ int* num_attr_face;
+ int* elem_blk_id;
char** elem_type;
- int* num_elem_this_blk;
- int* num_nodes_per_elem;
- int* num_edges_per_elem;
- int* num_faces_per_elem;
- int* num_attr_elem;
- int define_maps;
+ int* num_elem_this_blk;
+ int* num_nodes_per_elem;
+ int* num_edges_per_elem;
+ int* num_faces_per_elem;
+ int* num_attr_elem;
+ int define_maps;
} ex_block_params;
typedef struct ex_set_specs {
@@ -111,25 +98,26 @@ typedef struct ex_set_specs {
} ex_set_specs;
typedef struct ex_var_params {
- int num_glob;
- int num_node;
- int num_edge;
+ int num_glob;
+ int num_node;
+ int num_edge;
int* edge_var_tab;
- int num_face;
+ int num_face;
int* face_var_tab;
- int num_elem;
+ int num_elem;
int* elem_var_tab;
- int num_nset;
+ int num_nset;
int* nset_var_tab;
- int num_eset;
+ int num_eset;
int* eset_var_tab;
- int num_fset;
+ int num_fset;
int* fset_var_tab;
- int num_sset;
+ int num_sset;
int* sset_var_tab;
- int num_elset;
+ int num_elset;
int* elset_var_tab;
} ex_var_params;
+ /* @} */
#ifndef EXODUS_EXPORT
#define EXODUS_EXPORT extern
@@ -142,83 +130,105 @@ EXODUS_EXPORT int ex_put_init_ext (int, const ex_init_params*);
EXODUS_EXPORT int ex_get_init_ext (int, ex_init_params*);
/* Write Node Edge Face or Element Number Map */
-EXODUS_EXPORT int ex_put_num_map (int, int, int, const int*);
+EXODUS_EXPORT int ex_put_num_map (int, ex_entity_type, int, const int*);
/* Read Number Map */
-EXODUS_EXPORT int ex_get_num_map (int, int, int, int*);
+EXODUS_EXPORT int ex_get_num_map (int, ex_entity_type, int, int*);
/* Write Edge Face or Element Block Parameters */
-EXODUS_EXPORT int ex_put_block (int, int, int, const char*, int, int,
+EXODUS_EXPORT int ex_put_block (int, ex_entity_type, int, const char*, int, int,
int, int, int);
/* Read Edge Face or Element Block Parameters */
-EXODUS_EXPORT int ex_get_block (int, int, int, char*, int*, int*, int*,
+EXODUS_EXPORT int ex_get_block (int, ex_entity_type, int, char*, int*, int*, int*,
int*, int*);
/* Write All Edge Face and Element Block Parameters */
EXODUS_EXPORT int ex_put_concat_all_blocks(int, const ex_block_params*);
+EXODUS_EXPORT int ex_put_entity_count_per_polyhedra (int, ex_entity_type, int, const int*);
+
+EXODUS_EXPORT int ex_get_entity_count_per_polyhedra (int, ex_entity_type, int, int*);
+
/* Write Edge Face or Element Block Connectivity */
-EXODUS_EXPORT int ex_put_conn (int, int, int, const int*, const int*,
+EXODUS_EXPORT int ex_put_conn (int, ex_entity_type, int, const int*, const int*,
const int*);
/* Read Edge Face or Element Block Connectivity */
-EXODUS_EXPORT int ex_get_conn (int, int, int, int*, int*, int*);
+EXODUS_EXPORT int ex_get_conn (int, ex_entity_type, int, int*, int*, int*);
+
+/* Read Partial Edge Face or Element Block Connectivity */
+EXODUS_EXPORT int ex_get_n_conn (int, ex_entity_type, int, int, int, int*, int*, int*);
/* Write Edge Face or Element Block Attributes */
-EXODUS_EXPORT int ex_put_attr (int, int, int, const void*);
+EXODUS_EXPORT int ex_put_attr (int, ex_entity_type, int, const void*);
/* Read Edge Face or Element Block Attributes */
-EXODUS_EXPORT int ex_get_attr (int, int, int, void*);
+EXODUS_EXPORT int ex_get_attr (int, ex_entity_type, int, void*);
/* Write One Edge Face or Element Block Attribute */
-EXODUS_EXPORT int ex_put_one_attr (int, int, int, int, const void*);
+EXODUS_EXPORT int ex_put_one_attr (int, ex_entity_type, int, int, const void*);
+
+/* Read One Edge Face or Element Block Attribute */
+EXODUS_EXPORT int ex_get_one_attr (int, ex_entity_type, int, int, void*);
/* Read One Edge Face or Element Block Attribute */
-EXODUS_EXPORT int ex_get_one_attr (int, int, int, int, void*);
+EXODUS_EXPORT int ex_get_n_one_attr (int exoid, ex_entity_type obj_type, int obj_id,
+ int start_num, int num_ent, int attrib_index,
+ void* attrib );
/* Write Edge Face or Element Block Attribute Names */
-EXODUS_EXPORT int ex_put_attr_names (int, int, int, char**);
+EXODUS_EXPORT int ex_put_attr_names (int, ex_entity_type, int, char**);
/* Read Edge Face or Element Block Attribute Names */
-EXODUS_EXPORT int ex_get_attr_names (int, int, int, char**);
+EXODUS_EXPORT int ex_get_attr_names (int, ex_entity_type, int, char**);
/* Write Node Edge Face or Side Set Parameters */
-EXODUS_EXPORT int ex_put_set_param (int, int, int, int, int);
+EXODUS_EXPORT int ex_put_set_param (int, ex_entity_type, int, int, int);
/* Read Node Edge Face or Side Set Parameters */
-EXODUS_EXPORT int ex_get_set_param (int, int, int, int*, int*);
+EXODUS_EXPORT int ex_get_set_param (int, ex_entity_type, int, int*, int*);
/* Write a Node Edge Face or Side Set */
-EXODUS_EXPORT int ex_put_set (int, int, int, const int*, const int*);
+EXODUS_EXPORT int ex_put_set (int, ex_entity_type, int, const int*, const int*);
/* Read a Node Edge Face or Side Set */
-EXODUS_EXPORT int ex_get_set (int, int, int, int*, int*);
+EXODUS_EXPORT int ex_get_set (int, ex_entity_type, int, int*, int*);
/* Write Node Edge Face or Side Set Distribution Factors */
-EXODUS_EXPORT int ex_put_set_dist_fact (int, int, int, const void*);
+EXODUS_EXPORT int ex_put_set_dist_fact (int, ex_entity_type, int, const void*);
/* Read Node Edge Face or Side Set Distribution Factors */
-EXODUS_EXPORT int ex_get_set_dist_fact (int, int, int, void*);
+EXODUS_EXPORT int ex_get_set_dist_fact (int, ex_entity_type, int, void*);
/* Write Concatenated Node Edge Face or Side Sets */
-EXODUS_EXPORT int ex_put_concat_sets (int, int, const ex_set_specs*);
+EXODUS_EXPORT int ex_put_concat_sets (int, ex_entity_type, const ex_set_specs*);
/* Read Concatenated Node Edge Face or Side Sets */
-EXODUS_EXPORT int ex_get_concat_sets(int, int, ex_set_specs*);
+EXODUS_EXPORT int ex_get_concat_sets(int, ex_entity_type, ex_set_specs*);
/* (MODIFIED) Write All Results Variables Parameters */
EXODUS_EXPORT int ex_put_all_var_param_ext(int, const ex_var_params*);
/* Write Edge Face or Element Variable Values on Blocks or Sets at a Time Step */
-EXODUS_EXPORT int ex_put_var (int, int, int, int, int, int,
+EXODUS_EXPORT int ex_put_var (int, int, ex_entity_type, int, int, int,
const void*);
+/* Write Partial Edge Face or Element Variable Values on Blocks or Sets at a Time Step */
+EXODUS_EXPORT int ex_put_n_var (int exoid, int time_step , ex_entity_type var_type,
+ int var_index, int obj_id, int start_index, int num_entities,
+ const void* var_vals);
+
/* Read Edge Face or Element Variable Values Defined On Blocks or Sets at a Time Step */
-EXODUS_EXPORT int ex_get_var (int, int, int, int, int, int, void*);
+EXODUS_EXPORT int ex_get_var (int, int, ex_entity_type, int, int, int, void*);
+
+/* Read Partial Edge Face or Element Variable Values on Blocks or Sets at a Time Step */
+EXODUS_EXPORT int ex_get_n_var (int exoid, int time_step , ex_entity_type var_type,
+ int var_index, int obj_id, int start_index, int num_entities,
+ void* var_vals);
/* Read Edge Face or Element Variable Values Defined On Blocks or Sets Through Time */
-EXODUS_EXPORT int ex_get_var_time (int, int, int, int, int, int,
+EXODUS_EXPORT int ex_get_var_time (int, ex_entity_type, int, int, int, int,
void*);
#ifdef __cplusplus
diff --git a/cbind/include/exodusII_int.h b/cbind/include/exodusII_int.h
index 9ca77c5..f19cc0b 100644
--- a/cbind/include/exodusII_int.h
+++ b/cbind/include/exodusII_int.h
@@ -36,17 +36,6 @@
*
* exodusII_int.h - ExodusII header file for internal Exodus call use only
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
-* revision history -
-*
-* $Id: exodusII_int.h,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
-*
-****************************************************************************
*/
#ifndef EXODUS_II_INT_HDR
@@ -73,29 +62,18 @@
#include <stdio.h>
-/* these should be defined in ANSI C and C++, but just in case ... */
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
+#define MAX_VAR_NAME_LENGTH 20 /**< Internal use only */
+
+/* this should be defined in ANSI C and C++, but just in case ... */
#ifndef NULL
#define NULL 0
#endif
-/* EXODUS II version number */
-
-/* ExodusII file version */
-#define EX_VERS 3.05
-/* ExodusII access library version */
-#define EX_API_VERS 4.46
-
/* Default "filesize" for newly created files.
* Set to 0 for normal filesize setting.
* Set to 1 for EXODUS_LARGE_MODEL setting to be the default
*/
-#define EXODUS_DEFAULT_SIZE 0
+#define EXODUS_DEFAULT_SIZE 1
/* Exodus error return codes - function return values: */
#define EX_FATAL -1 /* fatal error flag def */
@@ -165,8 +143,8 @@
#define VAR_STAT_ED_BLK "ed_status" /* edge block status */
#define VAR_STAT_FA_BLK "fa_status" /* face block status */
#define VAR_ID_EL_BLK "eb_prop1" /* element block ids props */
-#define VAR_ID_ED_BLK "ed_prop1" /* element block ids props */
-#define VAR_ID_FA_BLK "fa_prop1" /* element block ids props */
+#define VAR_ID_ED_BLK "ed_prop1" /* edge block ids props */
+#define VAR_ID_FA_BLK "fa_prop1" /* face block ids props */
#define ATT_NAME_ELB "elem_type" /* element type names for */
/* each element block */
#define DIM_NUM_EL_IN_BLK(num) ex_catstr("num_el_in_blk",num)
@@ -190,7 +168,7 @@
#define DIM_NUM_ATT_IN_EBLK(num) ex_catstr("num_att_in_eblk",num)
/* # of attributes in edge */
/* block num */
-#define DIM_NUM_FA_IN_FBLK(num) ex_catstr("num_fa_in_fblk",num)
+#define DIM_NUM_FA_IN_FBLK(num) ex_catstr("num_fa_in_blk",num)
/* # of faces in face */
/* block num */
#define DIM_NUM_NOD_PER_FA(num) ex_catstr("num_nod_per_fa",num)
@@ -202,9 +180,14 @@
#define DIM_NUM_ATT_IN_FBLK(num) ex_catstr("num_att_in_fblk",num)
/* # of attributes in face */
/* block num */
+#define DIM_NUM_ATT_IN_NBLK "num_att_in_nblk"
+
#define VAR_CONN(num) ex_catstr("connect",num)
/* element connectivity for */
/* element block num */
+#define VAR_EBEPEC(num) ex_catstr("ebepecnt",num)
+ /* array containing number of entity per */
+ /* entity for n-sided face/element blocks */
#define VAR_ATTRIB(num) ex_catstr("attrib",num)
/* list of attributes for */
/* element block num */
@@ -226,7 +209,31 @@
#define VAR_NAME_EATTRIB(num) ex_catstr("eattrib_name",num)
/* list of attribute names */
/* for edge block num */
-#define VAR_ED_PROP(num) ex_catstr("edgprop",num)
+#define VAR_NATTRIB "nattrb"
+#define VAR_NAME_NATTRIB "nattrib_name"
+#define DIM_NUM_ATT_IN_NBLK "num_att_in_nblk"
+
+#define VAR_NSATTRIB(num) ex_catstr("nsattrb",num)
+#define VAR_NAME_NSATTRIB(num) ex_catstr("nsattrib_name",num)
+#define DIM_NUM_ATT_IN_NS(num) ex_catstr("num_att_in_ns",num)
+
+#define VAR_SSATTRIB(num) ex_catstr("ssattrb",num)
+#define VAR_NAME_SSATTRIB(num) ex_catstr("ssattrib_name",num)
+#define DIM_NUM_ATT_IN_SS(num) ex_catstr("num_att_in_ss",num)
+
+#define VAR_ESATTRIB(num) ex_catstr("esattrb",num)
+#define VAR_NAME_ESATTRIB(num) ex_catstr("esattrib_name",num)
+#define DIM_NUM_ATT_IN_ES(num) ex_catstr("num_att_in_es",num)
+
+#define VAR_FSATTRIB(num) ex_catstr("fsattrb",num)
+#define VAR_NAME_FSATTRIB(num) ex_catstr("fsattrib_name",num)
+#define DIM_NUM_ATT_IN_FS(num) ex_catstr("num_att_in_fs",num)
+
+#define VAR_ELSATTRIB(num) ex_catstr("elsattrb",num)
+#define VAR_NAME_ELSATTRIB(num) ex_catstr("elsattrib_name",num)
+#define DIM_NUM_ATT_IN_ELS(num) ex_catstr("num_att_in_els",num)
+
+#define VAR_ED_PROP(num) ex_catstr("ed_prop",num)
/* list of the numth property*/
/* for all edge blocks */
#define VAR_FCONN(num) ex_catstr("facconn",num)
@@ -235,13 +242,16 @@
#define VAR_FBCONN(num) ex_catstr("fbconn",num)
/* face connectivity for */
/* face block num */
+#define VAR_FBEPEC(num) ex_catstr("fbepecnt",num)
+ /* array containing number of entity per */
+ /* entity for n-sided face/element blocks */
#define VAR_FATTRIB(num) ex_catstr("fattrb",num)
/* list of attributes for */
/* face block num */
#define VAR_NAME_FATTRIB(num) ex_catstr("fattrib_name",num)
/* list of attribute names */
/* for face block num */
-#define VAR_FA_PROP(num) ex_catstr("facprop",num)
+#define VAR_FA_PROP(num) ex_catstr("fa_prop",num)
/* list of the numth property*/
/* for all face blocks */
#define ATT_PROP_NAME "name" /* name attached to element */
@@ -443,6 +453,12 @@
#define VAR_ELEM_NUM_MAP "elem_num_map" /* element numbering map */
/* obsolete, replaced by */
/* VAR_ELEM_MAP(num) */
+#define VAR_FACE_NUM_MAP "face_num_map" /* face numbering map */
+ /* obsolete, replaced by */
+ /* VAR_FACE_MAP(num) */
+#define VAR_EDGE_NUM_MAP "edge_num_map" /* edge numbering map */
+ /* obsolete, replaced by */
+ /* VAR_EDGE_MAP(num) */
#define VAR_NODE_NUM_MAP "node_num_map" /* node numbering map */
/* obsolete, replaced by */
/* VAR_NODE_MAP(num) */
@@ -471,28 +487,46 @@
/* list of the numth property*/
/* for all node maps */
-#define NUM_CFRAMES "num_cframes"
-#define NUM_CFRAME9 "num_cframes_9"
-#define FRAME_COORDS "frame_coordinates"
-#define FRAME_IDS "frame_ids"
-#define FRAME_TAGS "frame_tags"
-
-
-#define UNK -1 /* unknown entity */
-#define TRIANGLE 1 /* Triangle entity */
-#define QUAD 2 /* Quad entity */
-#define HEX 3 /* Hex entity */
-#define WEDGE 4 /* Wedge entity */
-#define TETRA 5 /* Tetra entity */
-#define TRUSS 6 /* Truss entity */
-#define BEAM 7 /* Beam entity */
-#define SHELL 8 /* Shell entity */
-#define SPHERE 9 /* Sphere entity */
-#define CIRCLE 10 /* Circle entity */
-#define TRISHELL 11 /* Triangular Shell entity */
-#define PYRAMID 12 /* Pyramid entity */
+#define DIM_NUM_CFRAMES "num_cframes"
+#define DIM_NUM_CFRAME9 "num_cframes_9"
+#define VAR_FRAME_COORDS "frame_coordinates"
+#define VAR_FRAME_IDS "frame_ids"
+#define VAR_FRAME_TAGS "frame_tags"
+
+
+enum ex_element_type {
+ EX_EL_UNK = -1, /**< unknown entity */
+ EX_EL_NULL_ELEMENT= 0,
+ EX_EL_TRIANGLE = 1, /**< Triangle entity */
+ EX_EL_QUAD = 2, /**< Quad entity */
+ EX_EL_HEX = 3, /**< Hex entity */
+ EX_EL_WEDGE = 4, /**< Wedge entity */
+ EX_EL_TETRA = 5, /**< Tetra entity */
+ EX_EL_TRUSS = 6, /**< Truss entity */
+ EX_EL_BEAM = 7, /**< Beam entity */
+ EX_EL_SHELL = 8, /**< Shell entity */
+ EX_EL_SPHERE = 9, /**< Sphere entity */
+ EX_EL_CIRCLE = 10, /**< Circle entity */
+ EX_EL_TRISHELL = 11, /**< Triangular Shell entity */
+ EX_EL_PYRAMID = 12 /**< Pyramid entity */
+};
+typedef enum ex_element_type ex_element_type;
+
/* Internal structure declarations */
+struct elem_blk_parm
+{
+ char elem_type[33];
+ int elem_blk_id;
+ int num_elem_in_blk;
+ int num_nodes_per_elem;
+ int num_sides;
+ int num_nodes_per_side[6];
+ int num_attr;
+ int elem_ctr;
+ ex_element_type elem_type_val;
+};
+
struct list_item { /* for use with ex_get_file_item */
int exo_id;
@@ -510,74 +544,43 @@ struct obj_stats {
struct obj_stats *next;
};
-
-void ex_iqsort (int v[], int iv[], int count );
-char *ex_catstr (const char*, int);
-char *ex_catstr2 (const char*, int, const char*, int);
-char* ex_dim_num_entries_in_object( int, int );
-char* ex_name_var_of_object( int, int, int );
-char* ex_name_of_map( int, int );
-
-
-enum convert_task { RTN_ADDRESS,
- READ_CONVERT,
- WRITE_CONVERT,
- WRITE_CONVERT_DOWN,
- WRITE_CONVERT_UP };
-
-int ex_conv_ini ( int, int*, int*, int);
-void ex_conv_exit (int);
-nc_type nc_flt_code (int);
-int ex_comp_ws (int);
-void* ex_conv_array (int, int, const void*, int);
+void ex_iqsort(int v[], int iv[], int count );
+char* ex_catstr(const char*, int);
+char* ex_catstr2(const char*, int, const char*, int);
+char* ex_dim_num_entries_in_object(ex_entity_type, int);
+char* ex_dim_num_objects(ex_entity_type obj_type);
+char* ex_name_var_of_object( ex_entity_type, int, int );
+char* ex_name_of_map( ex_entity_type, int );
+
+int ex_conv_ini (int exoid, int* comp_wordsize, int* io_wordsize, int file_wordsize);
+void ex_conv_exit (int exoid);
+nc_type nc_flt_code (int exoid);
+int ex_comp_ws (int exoid);
int ex_get_cpu_ws(void);
-void ex_rm_file_item_eb (int);
-void ex_rm_file_item_ns (int);
-void ex_rm_file_item_ss (int);
-
-extern struct list_item* eb_ctr_list;
-extern struct list_item* ed_ctr_list;
-extern struct list_item* fa_ctr_list;
-extern struct list_item* ns_ctr_list;
-extern struct list_item* es_ctr_list;
-extern struct list_item* fs_ctr_list;
-extern struct list_item* ss_ctr_list;
-extern struct list_item* els_ctr_list;
-extern struct list_item* em_ctr_list;
-extern struct list_item* edm_ctr_list;
-extern struct list_item* fam_ctr_list;
-extern struct list_item* nm_ctr_list;
-
-int ex_get_file_item ( int, struct list_item**);
-int ex_inc_file_item ( int, struct list_item**);
+struct list_item** ex_get_counter_list(ex_entity_type obj_type);
+int ex_get_file_item (int, struct list_item**);
+int ex_inc_file_item (int, struct list_item**);
void ex_rm_file_item (int, struct list_item**);
-extern struct obj_stats* eb;
-extern struct obj_stats* ed;
-extern struct obj_stats* fa;
-extern struct obj_stats* ns;
-extern struct obj_stats* es;
-extern struct obj_stats* fs;
-extern struct obj_stats* ss;
-extern struct obj_stats* els;
-extern struct obj_stats* em;
-extern struct obj_stats* edm;
-extern struct obj_stats* fam;
-extern struct obj_stats* nm;
-
-extern int cpy_att (int, int, int, int);
-extern int cpy_var_def(int, int, int, char*);
-extern int cpy_var_val(int, int, char*);
-extern int cpy_coord_def(int in_id,int out_id,int rec_dim_id,
- char *var_nm, int in_large, int out_large);
-extern int cpy_coord_val(int in_id,int out_id,char *var_nm,
- int in_large, int out_large);
-
-int ex_get_side_set_node_list_len (int, int, int*);
-struct obj_stats *get_stat_ptr ( int, struct obj_stats**);
-void rm_stat_ptr (int, struct obj_stats**);
-
-int ex_id_lkup ( int exoid, const char *id_type, int num);
-int ex_get_dimension(int exoid, const char *dimtype, const char *label, long *count, const char *routine);
+extern struct obj_stats* exoII_eb;
+extern struct obj_stats* exoII_ed;
+extern struct obj_stats* exoII_fa;
+extern struct obj_stats* exoII_ns;
+extern struct obj_stats* exoII_es;
+extern struct obj_stats* exoII_fs;
+extern struct obj_stats* exoII_ss;
+extern struct obj_stats* exoII_els;
+extern struct obj_stats* exoII_em;
+extern struct obj_stats* exoII_edm;
+extern struct obj_stats* exoII_fam;
+extern struct obj_stats* exoII_nm;
+
+
+struct obj_stats *ex_get_stat_ptr ( int exoid, struct obj_stats** obj_ptr);
+void ex_rm_stat_ptr (int exoid, struct obj_stats** obj_ptr);
+
+int ex_id_lkup (int exoid, ex_entity_type id_type, int num);
+int ex_get_dimension(int exoid, const char *dimtype, const char *label,
+ size_t *count, int *dimid, const char *routine);
#endif
diff --git a/cbind/src/CVS/Entries b/cbind/src/CVS/Entries
index e7814db..151862e 100644
--- a/cbind/src/CVS/Entries
+++ b/cbind/src/CVS/Entries
@@ -1,153 +1,178 @@
-/Imakefile/1.4/Tue Nov 28 14:01:59 2006//
-/Makefile.standalone/1.3/Sun Nov 26 05:37:18 2006//
-/ex_conv.c/1.4/Tue Nov 28 14:01:59 2006//
-/ex_utils.c/1.4/Tue Nov 28 14:02:00 2006//
-/exclos.c/1.4/Tue Nov 28 14:02:00 2006//
-/excn2s.c/1.4/Tue Nov 28 14:02:00 2006//
-/excopy.c/1.3/Sun Nov 26 05:37:18 2006//
-/excre.c/1.4/Tue Nov 28 14:02:00 2006//
-/exerr.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgatm.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgatn.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgatt.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgblk.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgcns.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgcon.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgconn.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgcor.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgcset.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgcss.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgean.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgeat.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgebi.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgelb.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgelc.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgem.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgenm.c/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/exgev.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgevid.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgevt.c/1.2/Sun Nov 26 05:37:19 2006//
-/exgfrm.c/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/exggv.c/1.4/Tue Nov 28 14:02:00 2006//
-/exggvt.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgids.c/1.3/Tue Nov 28 14:02:00 2006//
-/exginf.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgini.c/1.4/Tue Nov 28 14:02:00 2006//
-/exginix.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgmap.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgmp.c/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/exgnam.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgnams.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgnm.c/1.2/Sun Nov 26 05:37:20 2006//
-/exgnmap.c/1.1/Sun Nov 26 05:37:20 2006//
-/exgnnm.c/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/exgnp.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgns.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnsd.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnsi.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnstt.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgnsv.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgnsvid.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgnv.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnvid.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnvt.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgnvv.c/1.4/Tue Nov 28 14:02:00 2006//
-/exgoatt.c/1.2/Tue Nov 28 14:02:00 2006//
-/exgoea.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgotv.c/1.3/Tue Nov 28 14:02:00 2006//
-/exgp.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgpa.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgpem.c/1.1/Wed Apr 12 17:43:14 2006//
-/exgpn.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgqa.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgset.c/1.2/Tue Nov 28 14:02:01 2006//
-/exgsetd.c/1.2/Tue Nov 28 14:02:01 2006//
-/exgsetp.c/1.2/Tue Nov 28 14:02:01 2006//
-/exgsnl.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgsp.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgss.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgssc.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgssd.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgssi.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgssn.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgsstt.c/1.3/Tue Nov 28 14:02:01 2006//
-/exgssv.c/1.3/Tue Nov 28 14:02:01 2006//
-/exgssvid.c/1.3/Tue Nov 28 14:02:01 2006//
-/exgtim.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgtt.c/1.3/Tue Nov 28 14:02:01 2006//
-/exgvan.c/1.4/Tue Nov 28 14:02:01 2006//
-/exgvar.c/1.2/Tue Nov 28 14:02:01 2006//
-/exgvart.c/1.2/Tue Nov 28 14:02:01 2006//
-/exgvid.c/1.3/Tue Nov 28 14:02:01 2006//
-/exgvnm.c/1.4/Tue Nov 28 14:02:02 2006//
-/exgvp.c/1.4/Tue Nov 28 14:02:02 2006//
-/exgvtt.c/1.4/Tue Nov 28 14:02:02 2006//
-/exgvv.c/1.4/Tue Nov 28 14:02:02 2006//
-/exinq.c/1.4/Tue Nov 28 14:02:02 2006//
-/exopen.c/1.4/Tue Nov 28 14:02:02 2006//
-/exopts.c/1.4/Tue Nov 28 14:02:02 2006//
-/expatn.c/1.2/Tue Nov 28 14:02:02 2006//
-/expatt.c/1.2/Tue Nov 28 14:02:02 2006//
-/expblk.c/1.2/Tue Nov 28 14:02:02 2006//
-/expcab.c/1.1/Sun Nov 26 05:37:21 2006//
-/expclb.c/1.3/Sun Nov 26 05:37:21 2006//
-/expcns.c/1.4/Tue Nov 28 14:02:02 2006//
-/expcon.c/1.4/Tue Nov 28 14:02:02 2006//
-/expconn.c/1.2/Tue Nov 28 14:02:02 2006//
-/expcor.c/1.4/Tue Nov 28 14:02:02 2006//
-/expcset.c/1.2/Tue Nov 28 14:02:02 2006//
-/expcss.c/1.4/Tue Nov 28 14:02:02 2006//
-/expean.c/1.3/Tue Nov 28 14:02:02 2006//
-/expeat.c/1.4/Tue Nov 28 14:02:02 2006//
-/expelb.c/1.4/Tue Nov 28 14:02:02 2006//
-/expelc.c/1.4/Tue Nov 28 14:02:02 2006//
-/expem.c/1.3/Sun Nov 26 05:37:21 2006//
-/expenm.c/1.3/Sun Nov 26 05:37:21 2006//
-/expev.c/1.4/Tue Nov 28 14:02:02 2006//
-/expfrm.c/1.2/Wed Apr 12 17:43:15 2006//
-/expgv.c/1.4/Tue Nov 28 14:02:02 2006//
-/expinf.c/1.4/Tue Nov 28 14:02:02 2006//
-/expini.c/1.4/Tue Nov 28 14:02:02 2006//
-/expinix.c/1.2/Tue Nov 28 14:02:02 2006//
-/expmap.c/1.4/Tue Nov 28 14:02:02 2006//
-/expmp.c/1.2/Wed Apr 12 17:43:15 2006//
-/expnam.c/1.3/Tue Nov 28 14:02:02 2006//
-/expnams.c/1.3/Tue Nov 28 14:02:02 2006//
-/expnm.c/1.3/Sun Nov 26 05:37:21 2006//
-/expnmap.c/1.1/Sun Nov 26 05:37:21 2006//
-/expnnm.c/1.3/Sun Nov 26 05:37:21 2006//
-/expnp.c/1.4/Tue Nov 28 14:02:02 2006//
-/expns.c/1.4/Tue Nov 28 14:02:02 2006//
-/expnsd.c/1.4/Tue Nov 28 14:02:05 2006//
-/expnstt.c/1.3/Tue Nov 28 14:02:05 2006//
-/expnsv.c/1.3/Tue Nov 28 14:02:05 2006//
-/expnv.c/1.4/Tue Nov 28 14:02:05 2006//
-/expnvv.c/1.4/Tue Nov 28 14:02:06 2006//
-/expoatt.c/1.2/Tue Nov 28 14:02:06 2006//
-/expoea.c/1.3/Tue Nov 28 14:02:06 2006//
-/expp.c/1.4/Tue Nov 28 14:02:06 2006//
-/exppa.c/1.4/Tue Nov 28 14:02:06 2006//
-/exppem.c/1.2/Sun Nov 26 05:37:21 2006//
-/exppn.c/1.4/Tue Nov 28 14:02:06 2006//
-/expqa.c/1.4/Tue Nov 28 14:02:06 2006//
-/expset.c/1.2/Tue Nov 28 14:02:06 2006//
-/expsetd.c/1.2/Tue Nov 28 14:02:06 2006//
-/expsetp.c/1.2/Tue Nov 28 14:02:06 2006//
-/expsp.c/1.4/Tue Nov 28 14:02:06 2006//
-/expss.c/1.4/Tue Nov 28 14:02:06 2006//
-/expssd.c/1.4/Tue Nov 28 14:02:06 2006//
-/expsstt.c/1.3/Tue Nov 28 14:02:06 2006//
-/expssv.c/1.3/Tue Nov 28 14:02:06 2006//
-/exptim.c/1.4/Tue Nov 28 14:02:06 2006//
-/exptt.c/1.3/Tue Nov 28 14:02:06 2006//
-/expvan.c/1.4/Tue Nov 28 14:02:06 2006//
-/expvar.c/1.2/Tue Nov 28 14:02:06 2006//
-/expvnm.c/1.4/Tue Nov 28 14:02:06 2006//
-/expvp.c/1.4/Tue Nov 28 14:02:06 2006//
-/expvpa.c/1.3/Tue Nov 28 14:02:06 2006//
-/expvpax.c/1.2/Tue Nov 28 14:02:06 2006//
-/expvpc.c/1.4/Tue Nov 28 14:02:06 2006//
-/expvtt.c/1.4/Tue Nov 28 14:02:06 2006//
-/expvv.c/1.4/Tue Nov 28 14:02:06 2006//
-/exupda.c/1.4/Tue Nov 28 14:02:06 2006//
+/Imakefile/1.13/Tue Jul 20 21:36:59 2010//
+/Makefile.standalone/1.8/Mon Oct 4 13:58:10 2010//
+/ex_conv.c/1.10/Wed Jul 15 19:17:37 2009//
+/ex_utils.c/1.11/Thu Aug 13 13:34:51 2009//
+/exclos.c/1.11/Sat Jan 23 01:15:16 2010//
+/excn2s.c/1.12/Tue Jul 20 21:36:59 2010//
+/excopy.c/1.6/Thu Aug 13 13:34:51 2009//
+/excre.c/1.12/Sat Oct 10 22:24:41 2009//
+/exerr.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgatm.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgatn.c/1.9/Thu Aug 13 13:34:51 2009//
+/exgatt.c/1.9/Thu Aug 13 13:34:51 2009//
+/exgattp.c/1.2/Wed Feb 20 19:49:25 2008//
+/exgblk.c/1.10/Tue Jul 20 21:36:59 2010//
+/exgcns.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgcon.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgconn.c/1.11/Tue Jul 20 21:36:59 2010//
+/exgcor.c/1.13/Tue Jul 20 21:36:59 2010//
+/exgcset.c/1.9/Sat Jan 23 01:15:16 2010//
+/exgcss.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgcssc.c/1.2/Wed Feb 24 13:48:30 2010//
+/exgean.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgeat.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgebi.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgecpp.c/1.1/Sat Jan 23 01:16:43 2010//
+/exgelb.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgelc.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgem.c/1.4/Wed Feb 20 19:49:25 2008//
+/exgenm.c/1.3/Wed Feb 20 19:49:25 2008//
+/exgev.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgevid.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgevt.c/1.4/Wed Feb 20 19:49:25 2008//
+/exgfrm.c/1.4/Wed Feb 24 13:48:30 2010//
+/exggv.c/1.10/Wed Jul 15 19:17:37 2009//
+/exggvt.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgidm.c/1.2/Thu Aug 13 13:34:51 2009//
+/exgids.c/1.9/Wed Jul 15 19:17:37 2009//
+/exginf.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgini.c/1.10/Wed Jul 15 19:17:37 2009//
+/exginix.c/1.9/Mon Oct 4 13:58:10 2010//
+/exgmap.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgmp.c/1.3/Wed Feb 20 19:49:25 2008//
+/exgnam.c/1.10/Sat Jan 23 01:15:16 2010//
+/exgnams.c/1.10/Thu Aug 13 13:34:51 2009//
+/exgnconn.c/1.1/Wed Feb 24 13:48:30 2010//
+/exgncor.c/1.5/Tue Jul 20 21:36:59 2010//
+/exgnm.c/1.4/Wed Feb 20 19:49:26 2008//
+/exgnmap.c/1.3/Wed Feb 20 19:49:26 2008//
+/exgnnm.c/1.3/Wed Feb 20 19:49:26 2008//
+/exgnnv.c/1.3/Wed Jul 15 19:17:37 2009//
+/exgnoatt.c/1.4/Thu Aug 13 13:34:51 2009//
+/exgnp.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgns.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgnsd.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgnsi.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgnstt.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgnsv.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgnsvid.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgnv.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgnvar.c/1.3/Wed Jul 15 19:17:37 2009//
+/exgnvid.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgnvt.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgnvv.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgoatt.c/1.9/Thu Aug 13 13:34:51 2009//
+/exgoea.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgotv.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgp.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgpa.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgpem.c/1.4/Thu Aug 13 13:34:51 2009//
+/exgpn.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgqa.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgset.c/1.9/Tue Jul 20 21:36:59 2010//
+/exgsetd.c/1.9/Tue Jul 20 21:36:59 2010//
+/exgsetp.c/1.9/Tue Jul 20 21:36:59 2010//
+/exgsnl.c/1.13/Mon Oct 4 13:58:10 2010//
+/exgsp.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgss.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgssc.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgssd.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgssi.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgssn.c/1.13/Tue Jul 20 21:36:59 2010//
+/exgsstt.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgssv.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgssvid.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgtim.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgtt.c/1.9/Wed Jul 15 19:17:37 2009//
+/exgvan.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgvar.c/1.8/Wed Jul 15 19:17:37 2009//
+/exgvarnam.c/1.5/Wed Jul 15 19:17:37 2009//
+/exgvarnams.c/1.6/Thu Aug 13 13:34:51 2009//
+/exgvarparam.c/1.5/Wed Jul 15 19:17:37 2009//
+/exgvart.c/1.9/Thu Aug 13 13:34:51 2009//
+/exgvartab.c/1.5/Wed Jul 15 19:17:37 2009//
+/exgvid.c/1.11/Thu Aug 13 13:34:51 2009//
+/exgvnm.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgvp.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgvtt.c/1.10/Wed Jul 15 19:17:37 2009//
+/exgvv.c/1.10/Wed Jul 15 19:17:37 2009//
+/exinq.c/1.13/Mon Oct 4 13:58:10 2010//
+/exopen.c/1.10/Wed Jul 15 19:17:37 2009//
+/exopts.c/1.10/Wed Jul 15 19:17:37 2009//
+/expatn.c/1.9/Thu Aug 13 13:34:51 2009//
+/expatt.c/1.9/Thu Aug 13 13:34:51 2009//
+/expattp.c/1.2/Wed Feb 20 19:49:27 2008//
+/expblk.c/1.11/Wed Feb 24 13:48:30 2010//
+/expcab.c/1.6/Tue Jul 20 21:36:59 2010//
+/expclb.c/1.7/Sat Oct 10 22:24:41 2009//
+/expcns.c/1.10/Wed Jul 15 19:17:37 2009//
+/expcon.c/1.11/Thu Aug 13 13:34:51 2009//
+/expconn.c/1.11/Tue Jul 20 21:36:59 2010//
+/expcor.c/1.12/Tue Jul 20 21:36:59 2010//
+/expcset.c/1.9/Tue Jul 20 21:36:59 2010//
+/expcss.c/1.10/Wed Jul 15 19:17:37 2009//
+/expean.c/1.9/Wed Jul 15 19:17:37 2009//
+/expeat.c/1.10/Wed Jul 15 19:17:37 2009//
+/expecpp.c/1.2/Tue Jul 20 21:36:59 2010//
+/expelb.c/1.10/Wed Jul 15 19:17:37 2009//
+/expelc.c/1.10/Wed Jul 15 19:17:37 2009//
+/expem.c/1.5/Wed Feb 20 19:49:27 2008//
+/expenm.c/1.5/Wed Feb 20 19:49:28 2008//
+/expev.c/1.10/Wed Jul 15 19:17:37 2009//
+/expfrm.c/1.5/Wed Feb 24 13:48:30 2010//
+/expgv.c/1.10/Wed Jul 15 19:17:37 2009//
+/expidm.c/1.1/Wed Feb 20 19:49:28 2008//
+/expinf.c/1.10/Wed Jul 15 19:17:37 2009//
+/expini.c/1.10/Wed Jul 15 19:17:37 2009//
+/expinix.c/1.11/Mon Oct 4 13:58:10 2010//
+/expmap.c/1.10/Wed Jul 15 19:17:37 2009//
+/expmp.c/1.5/Mon Feb 16 16:20:57 2009//
+/expnam.c/1.9/Wed Jul 15 19:17:37 2009//
+/expnams.c/1.10/Thu Aug 13 13:34:51 2009//
+/expncor.c/1.5/Tue Jul 20 21:36:59 2010//
+/expnm.c/1.5/Wed Feb 20 19:49:28 2008//
+/expnmap.c/1.5/Thu Aug 13 13:34:51 2009//
+/expnnm.c/1.5/Wed Feb 20 19:49:28 2008//
+/expnnv.c/1.3/Wed Jul 15 19:17:37 2009//
+/expnoatt.c/1.4/Thu Aug 13 13:34:51 2009//
+/expnp.c/1.10/Wed Jul 15 19:17:37 2009//
+/expns.c/1.10/Wed Jul 15 19:17:37 2009//
+/expnsd.c/1.10/Wed Jul 15 19:17:37 2009//
+/expnstt.c/1.9/Wed Jul 15 19:17:37 2009//
+/expnsv.c/1.9/Wed Jul 15 19:17:37 2009//
+/expnv.c/1.10/Wed Jul 15 19:17:37 2009//
+/expnvar.c/1.3/Wed Jul 15 19:17:37 2009//
+/expnvv.c/1.10/Wed Jul 15 19:17:37 2009//
+/expoatt.c/1.9/Thu Aug 13 13:34:51 2009//
+/expoea.c/1.9/Wed Jul 15 19:17:37 2009//
+/expp.c/1.10/Wed Jul 15 19:17:37 2009//
+/exppa.c/1.10/Wed Jul 15 19:17:37 2009//
+/exppem.c/1.8/Tue Jul 20 21:36:59 2010//
+/exppn.c/1.10/Wed Jul 15 19:17:37 2009//
+/exppsetd.c/1.2/Tue Jul 20 21:36:59 2010//
+/expqa.c/1.10/Wed Jul 15 19:17:37 2009//
+/expset.c/1.9/Tue Jul 20 21:36:59 2010//
+/expsetd.c/1.9/Tue Jul 20 21:36:59 2010//
+/expsetp.c/1.9/Tue Jul 20 21:36:59 2010//
+/expsp.c/1.10/Wed Jul 15 19:17:37 2009//
+/expss.c/1.10/Wed Jul 15 19:17:37 2009//
+/expssd.c/1.10/Wed Jul 15 19:17:37 2009//
+/expsstt.c/1.9/Wed Jul 15 19:17:37 2009//
+/expssv.c/1.9/Wed Jul 15 19:17:37 2009//
+/exptim.c/1.10/Wed Jul 15 19:17:37 2009//
+/exptt.c/1.9/Wed Jul 15 19:17:37 2009//
+/expvan.c/1.10/Wed Jul 15 19:17:37 2009//
+/expvar.c/1.8/Wed Jul 15 19:17:37 2009//
+/expvarnam.c/1.5/Wed Jul 15 19:17:37 2009//
+/expvarnams.c/1.5/Wed Jul 15 19:17:37 2009//
+/expvarparam.c/1.5/Wed Jul 15 19:17:38 2009//
+/expvartab.c/1.7/Thu Aug 13 13:34:51 2009//
+/expvnm.c/1.10/Wed Jul 15 19:17:38 2009//
+/expvp.c/1.10/Wed Jul 15 19:17:38 2009//
+/expvpa.c/1.9/Wed Jul 15 19:17:38 2009//
+/expvpax.c/1.8/Wed Jul 15 19:17:38 2009//
+/expvpc.c/1.11/Thu Aug 13 13:34:51 2009//
+/expvtt.c/1.10/Wed Jul 15 19:17:38 2009//
+/expvv.c/1.10/Wed Jul 15 19:17:38 2009//
+/exupda.c/1.10/Wed Jul 15 19:17:38 2009//
D
diff --git a/cbind/src/Imakefile b/cbind/src/Imakefile
index e51df1a..9bd8771 100644
--- a/cbind/src/Imakefile
+++ b/cbind/src/Imakefile
@@ -31,42 +31,57 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
XCOMM Use include files locates in exodusii/cbind/include
INCLUDES = IncRef-I../include
-DEFINES = -DEX_ERR_STR -DVERBOSE $(PICFLAGS)
+DEFINES = -DEX_ERR_STR $(PICFLAGS)
-SRCS = ex_conv.c exgelb.c exgnsd.c exgtim.c expelb.c expp.c \
- ex_utils.c exgelc.c exgnsi.c exgvan.c expelc.c exppa.c \
- exclos.c exgenm.c exgnv.c exgvnm.c expenm.c exppn.c \
- excn2s.c exgev.c exgnvt.c exgvp.c expev.c expqa.c \
- excre.c exgevt.c exgp.c exgvtt.c expgv.c expsp.c \
- exerr.c exggv.c exgpa.c exinq.c expinf.c expss.c \
- exgatm.c exggvt.c exgpn.c exopen.c expini.c expssd.c \
- exgcns.c exginf.c exgqa.c exopts.c expmap.c exptim.c \
- exgcon.c exgini.c exgsp.c expcns.c expnnm.c expvan.c \
- exgcor.c exgmap.c exgss.c expcon.c expnp.c expvnm.c \
- exgcss.c exgnnm.c exgssd.c expcor.c expns.c expvp.c \
- exgeat.c exgnp.c exgssi.c expcss.c expnsd.c expvtt.c \
- exgebi.c exgns.c exgssn.c expeat.c expnv.c exupda.c \
- exgsnl.c excopy.c expmp.c exgmp.c expem.c exgem.c \
- expnm.c exgnm.c exgssc.c expclb.c expvpc.c expfrm.c \
- exgfrm.c exgvv.c expvv.c expnvv.c exgnvv.c exgnvid.c \
- exgevid.c expssv.c expnsv.c expnstt.c expsstt.c expvpa.c \
- exgssv.c exgnsv.c exgnstt.c exgsstt.c exgssvid.c exgnsvid.c \
- exgvid.c exgtt.c exptt.c exppem.c exgpem.c expnam.c \
- exgnam.c expnams.c exgnams.c expean.c exgean.c expoea.c exgoea.c \
- exgids.c exgotv.c expinix.c exginix.c expcab.c expconn.c \
- expatn.c expatt.c expvpax.c expvar.c expsetp.c expset.c \
- expsetd.c exgblk.c exgcset.c exgatn.c exgatt.c exgconn.c \
- exgvar.c exgvart.c exgoatt.c exgsetp.c exgset.c exgsetd.c \
- expcset.c expblk.c exgnmap.c expoatt.c expnmap.c
+SRCS = exclos.c exggvt.c exgpa.c exgvp.c expfrm.c expqa.c \
+ excn2s.c exgids.c exgp.c exgvv.c expinf.c expset.c \
+ ex_conv.c exginf.c exgpem.c exinq.c expini.c expsetd.c \
+ excopy.c exgini.c exgpn.c exopen.c expinix.c expsetp.c \
+ excre.c exginix.c exgqa.c exopts.c expmap.c expssv.c \
+ exerr.c exgmap.c exgset.c expatn.c expmp.c exptim.c \
+ exgatm.c exgmp.c exgsetd.c expatt.c expnam.c exptt.c \
+ exgatn.c exgnam.c exgsetp.c expattp.c expnams.c expvan.c \
+ exgatt.c exgnams.c exgsnl.c expblk.c expnmap.c expvar.c \
+ exgattp.c exgnmap.c exgssc.c expcab.c expnnm.c expvnm.c \
+ exgblk.c exgnnm.c exgssn.c expclb.c expnsv.c expvpax.c \
+ exgcon.c exgnsv.c exgssv.c expcon.c expnv.c expvp.c \
+ exgconn.c exgnv.c exgtim.c expconn.c expnvv.c expvv.c \
+ exgcor.c exgnvid.c exgtt.c expcor.c expoatt.c exupda.c \
+ exgcset.c exgnvt.c exgvan.c expcset.c exppa.c expidm.c \
+ exgenm.c exgnvv.c exgvar.c expelc.c expp.c exgfrm.c \
+ exgoatt.c exgvart.c expenm.c exppem.c exggv.c exgotv.c \
+ exgvnm.c expev.c exppn.c exppsetd.c exgidm.c ex_utils.c \
+ exgvarnam.c expvarnam.c exgvarnams.c expvarnams.c \
+ exgvartab.c expvartab.c exgvarparam.c expvarparam.c \
+ exgcns.c exgnstt.c expem.c exgnconn.c \
+ exgcss.c exgnsvid.c expgv.c \
+ exgean.c exgoea.c expnm.c \
+ exgeat.c exgsp.c expnp.c \
+ exgebi.c exgss.c expns.c \
+ exgelb.c exgssd.c expnsd.c \
+ exgelc.c exgssi.c expnstt.c \
+ exgem.c exgsstt.c expoea.c \
+ exgev.c exgssvid.c expsp.c \
+ exgevid.c exgvid.c expss.c \
+ exgevt.c exgvtt.c expssd.c \
+ exgnm.c expcns.c expsstt.c \
+ exgnp.c expcss.c expvpa.c \
+ exgns.c expean.c expvpc.c \
+ exgnsd.c expeat.c expvtt.c \
+ exgnsi.c expelb.c exgncor.c \
+ expncor.c exgnoatt.c expnoatt.c \
+ expnvar.c exgnvar.c expnnv.c exgnnv.c exgcssc.c \
+ expecpp.c exgecpp.c
OBJS = ${SRCS:.c=.o}
-LibraryTargetSubdirsCopy(libexoIIv2c.a,$(OBJS),../../)
+LibraryTargetSubdirsCopy(libexodus.a,$(OBJS),../../)
+
+$(OBJS): ../include/exodusII.h ../include/exodusII_int.h ../include/exodusII_ext.h
DependTarget()
diff --git a/cbind/src/Makefile.standalone b/cbind/src/Makefile.standalone
index 25b069b..410e976 100644
--- a/cbind/src/Makefile.standalone
+++ b/cbind/src/Makefile.standalone
@@ -1,36 +1,36 @@
-SRCS = ex_conv.c exgelb.c exgnsd.c exgtim.c expelb.c expp.c \
- ex_utils.c exgelc.c exgnsi.c exgvan.c expelc.c exppa.c \
- exclos.c exgenm.c exgnv.c exgvnm.c expenm.c exppn.c \
- excn2s.c exgev.c exgnvt.c exgvp.c expev.c expqa.c \
- excre.c exgevt.c exgp.c exgvtt.c expgv.c expsp.c \
- exerr.c exggv.c exgpa.c exinq.c expinf.c expss.c \
- exgatm.c exggvt.c exgpn.c exopen.c expini.c expssd.c \
- exgcns.c exginf.c exgqa.c exopts.c expmap.c exptim.c \
- exgcon.c exgini.c exgsp.c expcns.c expnnm.c expvan.c \
- exgcor.c exgmap.c exgss.c expcon.c expnp.c expvnm.c \
- exgcss.c exgnnm.c exgssd.c expcor.c expns.c expvp.c \
- exgeat.c exgnp.c exgssi.c expcss.c expnsd.c expvtt.c \
- exgebi.c exgns.c exgssn.c expeat.c expnv.c exupda.c \
- exgsnl.c excopy.c expmp.c exgmp.c expem.c exgem.c \
- expnm.c exgnm.c exgssc.c expclb.c expvpc.c expfrm.c \
- exgfrm.c exgvv.c expvv.c expnvv.c exgnvv.c exgnvid.c \
- exgevid.c expssv.c expnsv.c expnstt.c expsstt.c expvpa.c \
- exgssv.c exgnsv.c exgnstt.c exgsstt.c exgssvid.c exgnsvid.c \
- exgvid.c exgtt.c exptt.c exppem.c exgpem.c expnam.c \
- exgnam.c expnams.c exgnams.c expean.c exgean.c expoea.c exgoea.c \
- exgids.c exgotv.c expinix.c exginix.c expcab.c expconn.c \
- expatn.c expatt.c expvpax.c expvar.c expsetp.c expset.c \
- expsetd.c exgblk.c exgcset.c exgatn.c exgatt.c exgconn.c \
- exgvar.c exgvart.c exgoatt.c exgsetp.c exgset.c exgsetd.c \
- expcset.c expblk.c exgnmap.c expoatt.c expnmap.c
+SRCS = exclos.c excn2s.c ex_conv.c excopy.c excre.c exerr.c exgatm.c \
+ exgatn.c exgatt.c exgattp.c exgblk.c exgcns.c exgcon.c exgconn.c \
+ exgcor.c exgcset.c exgcss.c exgcssc.c exgean.c exgeat.c exgebi.c \
+ exgecpp.c exgelb.c exgelc.c exgem.c exgenm.c exgev.c exgevid.c \
+ exgevt.c exgfrm.c exggv.c exggvt.c exgidm.c exgids.c exginf.c exgini.c \
+ exginix.c exgmap.c exgmp.c exgnam.c exgnams.c exgnconn.c exgncor.c \
+ exgnmap.c exgnm.c exgnnm.c exgnnv.c exgnoatt.c exgnp.c exgns.c \
+ exgnsd.c exgnsi.c exgnstt.c exgnsv.c exgnsvid.c exgnvar.c exgnv.c \
+ exgnvid.c exgnvt.c exgnvv.c exgoatt.c exgoea.c exgotv.c exgpa.c exgp.c \
+ exgpem.c exgpn.c exgqa.c exgset.c exgsetd.c exgsetp.c exgsnl.c exgsp.c \
+ exgss.c exgssc.c exgssd.c exgssi.c exgssn.c exgsstt.c exgssv.c \
+ exgssvid.c exgtim.c exgtt.c exgvan.c exgvar.c exgvarnam.c exgvarnams.c \
+ exgvarparam.c exgvartab.c exgvart.c exgvid.c exgvnm.c exgvp.c exgvtt.c \
+ exgvv.c exinq.c exopen.c exopts.c expatn.c expatt.c expattp.c expblk.c \
+ expcab.c expclb.c expcns.c expcon.c expconn.c expcor.c expcset.c \
+ expcss.c expean.c expeat.c expecpp.c expelb.c expelc.c expem.c \
+ expenm.c expev.c expfrm.c expgv.c expidm.c expinf.c expini.c expinix.c \
+ expmap.c expmp.c expnam.c expnams.c expncor.c expnmap.c expnm.c \
+ expnnm.c expnnv.c expnoatt.c expnp.c expns.c expnsd.c expnstt.c \
+ expnsv.c expnvar.c expnv.c expnvv.c expoatt.c expoea.c exppa.c expp.c \
+ exppem.c exppn.c exppsetd.c expqa.c expset.c expsetd.c expsetp.c \
+ expsp.c expss.c expssd.c expsstt.c expssv.c exptim.c exptt.c expvan.c \
+ expvar.c expvarnam.c expvarnams.c expvarparam.c expvartab.c expvnm.c \
+ expvpa.c expvpax.c expvp.c expvpc.c expvtt.c expvv.c exupda.c \
+ ex_utils.c
OBJS = ${SRCS:.c=.o}
-all:: libexoIIv2c.a
-libexoIIv2c.a: $(OBJS)
+all:: libexodus.a
+libexodus.a: $(OBJS)
$(AR) $@ $?
$(RANLIB) $@
- cp libexoIIv2c.a ../../
+ cp libexodus.a ../../
clean::
rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
diff --git a/cbind/src/ex_conv.c b/cbind/src/ex_conv.c
index 2edd8e7..4e1ef92 100644
--- a/cbind/src/ex_conv.c
+++ b/cbind/src/ex_conv.c
@@ -36,18 +36,12 @@
*
* exutils - exodus utilities
*
-* author - James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-* environment - UNIX
-*
* entry conditions -
*
* exit conditions -
*
* revision history -
*
-* $Id: ex_conv.c,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
*
*****************************************************************************/
@@ -55,59 +49,24 @@
#include "exodusII.h"
#include "exodusII_int.h"
-typedef int convert_task;
-/* this file contains code needed to support the various floating point word
+/*! \file
+ * this file contains code needed to support the various floating point word
* size combinations for computation and i/o that applications might want to
- * use. the following discussion uses the C type names "float" and "double".
+ * use. See the netcdf documentation for more details on the floating point
+ * conversion capabilities.
*
* netCDF supports two floating point word sizes for its files:
- * NC_FLOAT - 32 bit IEEE (in XDR parlance, XDR_FLOAT)
- * NC_DOUBLE - 64 bit IEEE (in XDR parlance, XDR_DOUBLE)
- * now, if you want to write an array of NC_FLOATs, netCDF expects as input
- * an array of native floats; NC_DOUBLEs require an input array of native
- * doubles.
- *
- * so, suppose you're computing using variables declared double, but you want
- * to write a netCDF file using NC_FLOATs. you need to copy your array into
- * a buffer array declared as float, which truncates your data from double to
- * float (type conversion). then you can pass the buffer array to netCDF
- * routines for output as NC_FLOATs, and everything will work OK. similarly,
- * if you are computing in floats but want to write NC_DOUBLEs, you need to
- * copy your data into a buffer array declared as double, which promotes it
- * from float to double, and then call the netCDF routine with the buffer array.
- *
- * these routines are designed to do this type conversion, based on information
- * given in the ex_open or ex_create calls. thus, except for when the file is
- * opened, the user is relieved of the burden of caring about compute word size
- * (the size of floating point variables used in the application program, and
- * passed into the EXODUS II calls) and i/o word size (the size of floating
- * point data as written in the netCDF file).
- *
- * this code is supposed to be general enough to handle weird cases like the
- * cray, where in C (and C++) both floats and doubles are 8 byte quantities.
- * thus the same array can be passed into a netCDF routine to write either
- * NC_FLOATs or NC_DOUBLEs.
- *
- * note: 16 byte floating point values, such as might be obtained from an ANSI C
- * "long double", are specifically not handled. Also, I don't know how
- * the vanilla netCDF interface handles double precision on a CRAY, which
- * gives 16 byte values, but these routines as written won't be able to
- * handle it.
- *
- * author: j. a. schutt, sandia national laboratories, department 1425
+ * - NC_FLOAT - 32 bit IEEE
+ * - NC_DOUBLE - 64 bit IEEE
+ *
*/
#define NC_FLOAT_WORDSIZE 4
#define NC_DOUBLE_WORDSIZE 8
-enum conv_action { NO_CONVERSION, CONVERT_UP, CONVERT_DOWN };
-typedef int conv_action;
-
struct file_item {
int file_id;
- conv_action rd_conv_action;
- conv_action wr_conv_action;
nc_type netcdf_type_code;
int user_compute_wordsize;
struct file_item* next;
@@ -115,14 +74,6 @@ struct file_item {
struct file_item* file_list = NULL;
-/*
- * Now recognized at more locations worldwide in this file...
- */
-
-static int cur_len = 0; /* in bytes! */
-static void* buffer_array = NULL;
-static int do_conversion = 0; /* Do any files do a conversion? */
-
#define FIND_FILE(ptr,id) { ptr = file_list; \
while(ptr) { \
if( ptr->file_id == id ) break; \
@@ -130,94 +81,84 @@ static int do_conversion = 0; /* Do any files do a conversion? */
} \
}
-/*............................................................................*/
-/*............................................................................*/
-
int ex_conv_ini( int exoid,
- int* comp_wordsize,
- int* io_wordsize,
- int file_wordsize )
+ int* comp_wordsize,
+ int* io_wordsize,
+ int file_wordsize )
{
char errmsg[MAX_ERR_LENGTH];
struct file_item* new_file;
-/* ex_conv_ini() initializes the floating point conversion process.
- *
- * exoid an integer uniquely identifying the file of interest.
- *
- * word size parameters are specified in bytes. valid values are 0, 4, and 8:
- *
- * comp_wordsize compute floating point word size in the user's code.
- * a zero value indicates that the user is requesting the
- * default float size for the machine. The appropriate
- * value is chosen and returned in comp_wordsize, and used
- * in subsequent conversions. a valid but inappropriate
- * for this parameter cannot be detected.
- *
- * io_wordsize the desired floating point word size for a netCDF file.
- * for an existing file, if this parameter doesn't match
- * the word size of data already stored in the file, a
- * fatal error is generated. a value of 0 for an existing
- * file indicates that the word size of the file was not
- * known a priori, so use whatever is in the file. a value
- * of 0 for a new file means to use the default size, an
- * NC_FLOAT (4 bytes). when a value of 0 is specified the
- * actual value used is returned in io_wordsize.
- *
- * file_wordsize floating point word size in an existing netCDF file.
- * a value of 0 should be passed in for a new netCDF file.
- */
-
-/* check to make sure machine word sizes aren't weird (I'm paranoid) */
+ /*! ex_conv_ini() initializes the floating point conversion process.
+ *
+ * \param exoid an integer uniquely identifying the file of interest.
+ *
+ * \param comp_wordsize compute floating point word size in the user's code.
+ * a zero value indicates that the user is requesting the
+ * default float size for the machine. The appropriate
+ * value is chosen and returned in comp_wordsize, and used
+ * in subsequent conversions. a valid but inappropriate
+ * for this parameter cannot be detected.
+ *
+ * \param io_wordsize the desired floating point word size for a netCDF file.
+ * for an existing file, if this parameter doesn't match
+ * the word size of data already stored in the file, a
+ * fatal error is generated. a value of 0 for an existing
+ * file indicates that the word size of the file was not
+ * known a priori, so use whatever is in the file. a value
+ * of 0 for a new file means to use the default size, an
+ * NC_FLOAT (4 bytes). when a value of 0 is specified the
+ * actual value used is returned in io_wordsize.
+ *
+ * \param file_wordsize floating point word size in an existing netCDF file.
+ * a value of 0 should be passed in for a new netCDF file.
+ *
+ * word size parameters are specified in bytes. valid values are 0, 4, and 8:
+ */
+ /* check to make sure machine word sizes aren't weird */
if ((sizeof(float) != 4 && sizeof(float) != 8) ||
(sizeof(double) != 4 && sizeof(double) != 8 ) )
- {
- sprintf(errmsg,"Error: unsupported compute word size for file id: %d",
- exoid);
- ex_err("ex_conv_ini",errmsg,EX_FATAL);
- return(EX_FATAL);
- }
+ {
+ sprintf(errmsg,"Error: unsupported compute word size for file id: %d",
+ exoid);
+ ex_err("ex_conv_ini",errmsg,EX_FATAL);
+ return(EX_FATAL);
+ }
-/* check to see if requested word sizes are valid */
+ /* check to see if requested word sizes are valid */
- if (!*io_wordsize )
- {
+ if (!*io_wordsize ) {
if (!file_wordsize )
*io_wordsize = NC_FLOAT_WORDSIZE;
else
*io_wordsize = file_wordsize;
}
- else if (*io_wordsize != 4 && *io_wordsize != 8 )
- {
+
+ else if (*io_wordsize != 4 && *io_wordsize != 8 ) {
sprintf(errmsg,"Error: unsupported I/O word size for file id: %d",exoid);
ex_err("ex_conv_ini",errmsg,EX_FATAL);
return(EX_FATAL);
}
- else if (file_wordsize && *io_wordsize != file_wordsize )
- {
+
+ else if (file_wordsize && *io_wordsize != file_wordsize ) {
*io_wordsize = file_wordsize;
sprintf(errmsg,
- "Error: invalid I/O word size specified for existing file id: %d",
+ "Error: invalid I/O word size specified for existing file id: %d",
exoid);
ex_err("ex_conv_ini",errmsg,EX_MSG);
ex_err("ex_conv_ini",
" Requested I/O word size overridden.",
- EX_MSG);
+ EX_MSG);
}
- if (!*comp_wordsize )
- {
- *comp_wordsize = sizeof(float);
- }
- else if (*comp_wordsize != 4 && *comp_wordsize != 8 )
- {
+ if (!*comp_wordsize ) {
+ *comp_wordsize = sizeof(float);
+ } else if (*comp_wordsize != 4 && *comp_wordsize != 8 ) {
ex_err("ex_conv_ini","Error: invalid compute wordsize specified",EX_FATAL);
return(EX_FATAL);
}
-/* finally, set up conversion action */
-
new_file = malloc(sizeof(struct file_item));
new_file->file_id = exoid;
@@ -225,53 +166,12 @@ int ex_conv_ini( int exoid,
new_file->next = file_list;
file_list = new_file;
-/* crays writing NC_FLOATs always hit this case first since on a cray
- * sizeof(float) = sizeof(double)
- */
- if( *comp_wordsize == sizeof(float) &&
- *io_wordsize == NC_FLOAT_WORDSIZE ) {
-
- new_file->rd_conv_action = NO_CONVERSION;
- new_file->wr_conv_action = NO_CONVERSION;
+ if (*io_wordsize == NC_FLOAT_WORDSIZE)
new_file->netcdf_type_code = NC_FLOAT;
- }
-/* crays writing NC_DOUBLEs always hit this case first since on a cray
- * sizeof(float) = sizeof(double)
- */
- else if( *comp_wordsize == sizeof(double) &&
- *io_wordsize == NC_DOUBLE_WORDSIZE ) {
-
- new_file->rd_conv_action = NO_CONVERSION;
- new_file->wr_conv_action = NO_CONVERSION;
+ else
new_file->netcdf_type_code = NC_DOUBLE;
- }
- else if( *comp_wordsize == sizeof(double) &&
- *io_wordsize == NC_FLOAT_WORDSIZE ) {
-
- new_file->rd_conv_action = CONVERT_UP;
- new_file->wr_conv_action = CONVERT_DOWN;
- new_file->netcdf_type_code = NC_FLOAT;
- do_conversion = 1;
- }
- else if( *comp_wordsize == sizeof(float) &&
- *io_wordsize == NC_DOUBLE_WORDSIZE ) {
- new_file->rd_conv_action = CONVERT_DOWN;
- new_file->wr_conv_action = CONVERT_UP;
- new_file->netcdf_type_code = NC_DOUBLE;
- do_conversion = 1;
- }
- else
- {
- /* Invalid compute or io wordsize: i.e. 4 byte compute word on Cray */
- sprintf(errmsg,"Error: invalid compute (%d) or io (%d) wordsize specified",
- *comp_wordsize, *io_wordsize);
- ex_err("ex_conv_ini", errmsg, EX_FATAL);
- return(EX_FATAL);
- }
-
return(EX_NOERR);
-
}
/*............................................................................*/
@@ -279,32 +179,30 @@ int ex_conv_ini( int exoid,
void ex_conv_exit( int exoid )
{
-/* ex_conv_exit() takes the structure identified by "exoid" out of the linked
- * list which describes the files that ex_conv_array() knows how to convert.
- *
- * NOTE: it is absolutely necessary for ex_conv_array() to be called after
- * ncclose(), if the parameter used as "exoid" is the id returned from
- * an ncopen() or nccreate() call, as netCDF reuses file ids!
- * the best place to do this is ex_close(), which is where I did it.
- *
- * "exoid" is some integer which uniquely identifies the file of interest.
- */
+ /*! ex_conv_exit() takes the structure identified by "exoid" out of the linked
+ * list which describes the files that ex_conv_array() knows how to convert.
+ *
+ * \note it is absolutely necessary for ex_conv_exit() to be called after
+ * ncclose(), if the parameter used as "exoid" is the id returned from
+ * an ncopen() or nccreate() call, as netCDF reuses file ids!
+ * the best place to do this is ex_close(), which is where I did it.
+ *
+ * \param exoid integer which uniquely identifies the file of interest.
+ */
char errmsg[MAX_ERR_LENGTH];
struct file_item* file = file_list;
struct file_item* prev = NULL;
exerrval = 0; /* clear error code */
- while( file )
- {
+ while( file ) {
if (file->file_id == exoid ) break;
prev = file;
file = file->next;
}
- if (!file )
- {
+ if (!file ) {
sprintf(errmsg,"Warning: failure to clear file id %d - not in list.",exoid);
ex_err("ex_conv_exit",errmsg,EX_MSG);
exerrval = EX_BADFILEID;
@@ -317,21 +215,6 @@ void ex_conv_exit( int exoid )
file_list = file->next;
free( file );
-
- /*
- * If no other files are opened, any buffer arrays for float/double
- * conversion ought to be cleaned up.
- */
- if ( !file_list )
- {
- if ( cur_len > 0 )
- {
- free(buffer_array); /* Better not be null if condition true! */
- buffer_array = NULL;
- cur_len = 0;
- }
- do_conversion = 0;
- }
}
/*............................................................................*/
@@ -339,12 +222,12 @@ void ex_conv_exit( int exoid )
nc_type nc_flt_code( int exoid )
{
-/* nc_flt_code() returns either NC_FLOAT or NC_DOUBLE, based on the parameters
- * with which ex_conv_ini() was called. nc_flt_code() is used as the nc_type
- * parameter on ncvardef() calls that define floating point variables.
- *
- * "exoid" is some integer which uniquely identifies the file of interest.
- */
+ /* nc_flt_code() returns either NC_FLOAT or NC_DOUBLE, based on the parameters
+ * with which ex_conv_ini() was called. nc_flt_code() is used as the nc_type
+ * parameter on ncvardef() calls that define floating point variables.
+ *
+ * "exoid" is some integer which uniquely identifies the file of interest.
+ */
char errmsg[MAX_ERR_LENGTH];
struct file_item* file;
@@ -352,28 +235,23 @@ nc_type nc_flt_code( int exoid )
exerrval = 0; /* clear error code */
FIND_FILE( file, exoid );
- if (!file )
- {
+ if (!file ) {
exerrval = EX_BADFILEID;
sprintf(errmsg,"Error: unknown file id %d for nc_flt_code().",exoid);
ex_err("nc_flt_code",errmsg,exerrval);
return (nc_type) -1;
}
-
return file->netcdf_type_code;
}
-/*............................................................................*/
-/*............................................................................*/
-
int ex_comp_ws( int exoid )
{
-/* "exoid" is some integer which uniquely identifies the file of interest.
- *
+/*!
* ex_comp_ws() returns 4 (i.e. sizeof(float)) or 8 (i.e. sizeof(double)),
* depending on the value of floating point word size used to initialize
* the conversion facility for this file id (exoid).
- */
+ * \param exoid integer which uniquely identifies the file of interest.
+*/
char errmsg[MAX_ERR_LENGTH];
struct file_item* file;
@@ -381,204 +259,12 @@ int ex_comp_ws( int exoid )
exerrval = 0; /* clear error code */
FIND_FILE( file, exoid );
- if (!file )
- {
+ if (!file ) {
exerrval = EX_BADFILEID;
sprintf(errmsg,"Error: unknown file id %d",exoid);
ex_err("ex_comp_ws",errmsg,exerrval);
return(EX_FATAL);
}
-
return file->user_compute_wordsize;
}
-/*............................................................................*/
-/*............................................................................*/
-
-/* some utility routines for use only by ex_conv_array() */
-
-#define BUFFER_SIZE_UNIT 8192 /* should be even multiple of sizeof(double) */
-
-void* resize_buffer( void* buffer,
- int new_len ) /* in bytes! */
-{
- /*
- * Broaden the scope of this puppy to aid cleanup in ex_conv_exit().
- */
-
- /* static int cur_len = 0; in bytes! */
-
- exerrval = 0; /* clear error code */
- if( new_len > cur_len )
- {
-
- cur_len = BUFFER_SIZE_UNIT * ( new_len/BUFFER_SIZE_UNIT + 1 );
-
- if( buffer ) free( buffer );
- buffer = malloc( cur_len );
-
- if (!buffer )
- {
- exerrval = EX_MEMFAIL;
- ex_err("ex_conv_array","couldn't allocate buffer space",exerrval);
- return (NULL);
- }
- }
- return buffer;
-}
-
-void flt_to_dbl( float* in_vec,
- int len,
- double* out_vec )
-{
- int i;
-
- for( i=0; i<len; i++ ) out_vec[i] = (double)(in_vec[i]);
-}
-
-void dbl_to_flt( double* in_vec,
- int len,
- float* out_vec )
-{
- int i;
-
- for( i=0; i<len; i++ ) out_vec[i] = (float)(in_vec[i]);
-}
-
-
-/*............................................................................*/
-/*............................................................................*/
-
-void* ex_conv_array( int exoid,
- convert_task task,
- const void* usr_array,
- int usr_length )
-{
-/* ex_conv_array() actually performs the floating point size conversion.
- *
- * "exoid" is some integer which uniquely identifies the file of interest.
- *
- * for reads, in conjunction with ncvarget()/ncvarget1(), ex_conv_array() must
- * be called twice per read. the first call must be before ncvarget(), and
- * should be something like ex_conv_array( id, RTN_ADDRESS, usr_array, len ),
- * where "usr_array" is the address of the user's data array, and "len" is
- * the number of floating point values to convert. this call returns an
- * address which should be passed as a parameter in the subsequent ncvarget()
- * call. after ncvarget(), call ex_conv_array() again with something like
- * ex_conv_array( ID, READ_CONVERT, usr_array, len ). here ex_conv_array()
- * should return NULL.
- *
- * for writes, in conjunction with ncvarput()/ncvarput1(), ex_conv_array() need
- * only be called once, before the call to ncvarput(). the call should be
- * something like ex_conv_array( id, WRITE_CONVERT, usr_array, len ), and
- * returns an address that should be passed in the subsequent ncvarput() call.
- */
-
-
- char errmsg[MAX_ERR_LENGTH];
- /* static void* buffer_array = NULL; -- now global! */
- struct file_item* file;
- int len_bytes;
-
- exerrval = 0; /* clear error code */
- if (do_conversion == 0) {
- switch( task ) {
-
- case RTN_ADDRESS:
- return (void*)usr_array;
- break;
- case READ_CONVERT:
- return NULL;
- break;
- case WRITE_CONVERT:
- return (void*)usr_array;
- break;
- default:
- /* Fall through if other task is specified */
- ;
- }
- }
-
- FIND_FILE( file, exoid );
-
- if( !file )
- {
- exerrval = EX_BADFILEID;
- sprintf(errmsg,"Error: unknown file id %d",exoid);
- ex_err("ex_conv_array",errmsg,exerrval);
- return (NULL);
- }
-
-
- switch( task ) {
-
- case RTN_ADDRESS:
-
- switch( file->rd_conv_action ) {
- case NO_CONVERSION:
- return (void*)usr_array;
- case CONVERT_UP: /* file ws: 4 byte, CPU ws: 8 byte */
- len_bytes = usr_length * sizeof(float);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- return buffer_array;
- case CONVERT_DOWN: /* file ws: 8 byte, CPU ws: 4 byte */
- len_bytes = usr_length * sizeof(double);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- return buffer_array;
- }
- break;
-
- case READ_CONVERT:
-
- switch( file->rd_conv_action ) {
- case NO_CONVERSION:
- break;
- case CONVERT_UP:
- flt_to_dbl( buffer_array, usr_length, (void*)usr_array );
- break;
- case CONVERT_DOWN:
- dbl_to_flt( buffer_array, usr_length, (void*)usr_array );
- break;
- }
- return NULL;
-
- case WRITE_CONVERT:
-
- switch( file->wr_conv_action ) {
- case NO_CONVERSION:
- return (void*)usr_array;
- case CONVERT_UP:
- len_bytes = usr_length * sizeof(double);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- flt_to_dbl( (void*)usr_array, usr_length, buffer_array );
- return buffer_array;
- case CONVERT_DOWN:
- len_bytes = usr_length * sizeof(float);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- dbl_to_flt( (void*)usr_array, usr_length, buffer_array );
- return buffer_array;
- }
- break;
-
- case WRITE_CONVERT_DOWN:
-
- len_bytes = usr_length * sizeof(float);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- dbl_to_flt( (void*)usr_array, usr_length, buffer_array );
- return buffer_array;
-
- case WRITE_CONVERT_UP:
-
- len_bytes = usr_length * sizeof(double);
- buffer_array = resize_buffer( buffer_array, len_bytes );
- flt_to_dbl( (void*)usr_array, usr_length, buffer_array );
- return buffer_array;
-
- }
-
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: unknown task code %d specified for converting float array",task);
- ex_err("ex_conv_array",errmsg,exerrval);
- return NULL;
-}
diff --git a/cbind/src/ex_utils.c b/cbind/src/ex_utils.c
index 839ddef..c15518a 100644
--- a/cbind/src/ex_utils.c
+++ b/cbind/src/ex_utils.c
@@ -36,20 +36,6 @@
*
* exutils - utility routines
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-* environment - UNIX
-*
-* entry conditions -
-*
-* exit conditions -
-*
-* revision history -
-*
-* $Id: ex_utils.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*****************************************************************************/
#if defined(DEBUG_QSORT)
@@ -59,21 +45,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include "exodusII.h"
#include "exodusII_int.h"
-struct obj_stats* eb = 0;
-struct obj_stats* ed = 0;
-struct obj_stats* fa = 0;
-struct obj_stats* ns = 0;
-struct obj_stats* es = 0;
-struct obj_stats* fs = 0;
-struct obj_stats* ss = 0;
-struct obj_stats* els = 0;
-struct obj_stats* em = 0;
-struct obj_stats* edm = 0;
-struct obj_stats* fam = 0;
-struct obj_stats* nm = 0;
+struct obj_stats* exoII_eb = 0;
+struct obj_stats* exoII_ed = 0;
+struct obj_stats* exoII_fa = 0;
+struct obj_stats* exoII_ns = 0;
+struct obj_stats* exoII_es = 0;
+struct obj_stats* exoII_fs = 0;
+struct obj_stats* exoII_ss = 0;
+struct obj_stats* exoII_els = 0;
+struct obj_stats* exoII_em = 0;
+struct obj_stats* exoII_edm = 0;
+struct obj_stats* exoII_fam = 0;
+struct obj_stats* exoII_nm = 0;
/*****************************************************************************
@@ -92,6 +79,7 @@ struct obj_stats* nm = 0;
static char ret_string[10*(MAX_VAR_NAME_LENGTH+1)];
static char* cur_string = &ret_string[0];
+/** ex_catstr - concatenate string/number (where number is converted to ASCII) */
char *ex_catstr (const char *string,
int num)
{
@@ -103,6 +91,7 @@ char *ex_catstr (const char *string,
}
+/** ex_catstr2 - concatenate string1num1string2num2 */
char *ex_catstr2 (const char *string1,
int num1,
const char *string2,
@@ -115,10 +104,118 @@ char *ex_catstr2 (const char *string1,
return (tmp_string);
}
-char* ex_dim_num_entries_in_object( int obj_type,
+char* ex_name_of_object(ex_entity_type obj_type)
+{
+ switch (obj_type) {
+ case EX_NODAL:
+ return "nodal";
+ case EX_EDGE_BLOCK:
+ return "edge block";
+ case EX_FACE_BLOCK:
+ return "face block";
+ case EX_ELEM_BLOCK:
+ return "element block";
+ case EX_NODE_SET:
+ return "node set";
+ case EX_EDGE_SET:
+ return "edge set";
+ case EX_FACE_SET:
+ return "face set";
+ case EX_SIDE_SET:
+ return "side set";
+ case EX_ELEM_SET:
+ return "element set";
+ case EX_ELEM_MAP:
+ return "element map";
+ case EX_NODE_MAP:
+ return "node map";
+ case EX_EDGE_MAP:
+ return "edge map";
+ case EX_FACE_MAP:
+ return "face map";
+ case EX_GLOBAL:
+ return "global";
+ default:
+ return "invalid type";
+ }
+}
+
+ex_entity_type ex_var_type_to_ex_entity_type(char var_type)
+{
+ char var_lower = tolower(var_type);
+ if (var_lower == 'n')
+ return EX_NODAL;
+ else if (var_lower == 'l')
+ return EX_EDGE_BLOCK;
+ else if (var_lower == 'f')
+ return EX_FACE_BLOCK;
+ else if (var_lower == 'e')
+ return EX_ELEM_BLOCK;
+ else if (var_lower == 'm')
+ return EX_NODE_SET;
+ else if (var_lower == 'd')
+ return EX_EDGE_SET;
+ else if (var_lower == 'a')
+ return EX_FACE_SET;
+ else if (var_lower == 's')
+ return EX_SIDE_SET;
+ else if (var_lower == 't')
+ return EX_ELEM_SET;
+ else if (var_lower == 'g')
+ return EX_GLOBAL;
+ else
+ return EX_INVALID;
+}
+
+char* ex_dim_num_objects(ex_entity_type obj_type)
+{
+ exerrval = 0; /* clear error code */
+ switch (obj_type)
+ {
+ case EX_NODAL:
+ return DIM_NUM_NODES;
+ case EX_ELEM_BLOCK:
+ return DIM_NUM_EL_BLK;
+ case EX_EDGE_BLOCK:
+ return DIM_NUM_ED_BLK;
+ case EX_FACE_BLOCK:
+ return DIM_NUM_FA_BLK;
+ case EX_NODE_SET:
+ return DIM_NUM_NS;
+ case EX_EDGE_SET:
+ return DIM_NUM_ES;
+ case EX_FACE_SET:
+ return DIM_NUM_FS;
+ case EX_ELEM_SET:
+ return DIM_NUM_ELS;
+ case EX_SIDE_SET:
+ return DIM_NUM_SS;
+ case EX_ELEM_MAP:
+ return DIM_NUM_EM;
+ case EX_FACE_MAP:
+ return DIM_NUM_FAM;
+ case EX_EDGE_MAP:
+ return DIM_NUM_EDM;
+ case EX_NODE_MAP:
+ return DIM_NUM_NM;
+ default:
+ {
+ char errmsg[MAX_ERR_LENGTH];
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported in call to ex_dim_num_objects",
+ obj_type);
+ ex_err("ex_dim_num_objects",errmsg,exerrval);
+ return (NULL);
+ }
+ }
+}
+
+char* ex_dim_num_entries_in_object( ex_entity_type obj_type,
int idx )
{
switch (obj_type) {
+ case EX_NODAL:
+ return DIM_NUM_NODES;
case EX_EDGE_BLOCK:
return DIM_NUM_ED_IN_EBLK(idx);
case EX_FACE_BLOCK:
@@ -140,9 +237,8 @@ char* ex_dim_num_entries_in_object( int obj_type,
}
}
-char* ex_name_var_of_object( int obj_type,
- int i,
- int j )
+char* ex_name_var_of_object(ex_entity_type obj_type,
+ int i, int j)
{
switch (obj_type) {
case EX_EDGE_BLOCK:
@@ -166,7 +262,7 @@ char* ex_name_var_of_object( int obj_type,
}
}
-char* ex_name_of_map( int map_type, int map_index )
+char* ex_name_of_map(ex_entity_type map_type, int map_index)
{
switch (map_type) {
case EX_NODE_MAP:
@@ -186,16 +282,10 @@ char* ex_name_of_map( int map_type, int map_index )
*
* ex_id_lkup - look up id
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
-* int exoid exodus file id
-* char* id_type id type name:
+* int exoid exodus file id
+* ex_entity_type id_type id type name:
* elem_ss
* node_ns
* side_ss
@@ -210,117 +300,106 @@ char* ex_name_of_map( int map_type, int map_index )
*****************************************************************************/
int ex_id_lkup( int exoid,
- const char *id_type,
+ ex_entity_type id_type,
int num)
{
char id_table[MAX_VAR_NAME_LENGTH+1];
char id_dim[MAX_VAR_NAME_LENGTH+1];
char stat_table[MAX_VAR_NAME_LENGTH+1];
- char idtyp[MAX_VAR_NAME_LENGTH+1];
- int varid, dimid, i;
- long dim_len, start[2], count[2];
- nclong *id_vals=NULL, *stat_vals=NULL;
+ int varid, dimid;
+ size_t dim_len, i;
+ int *id_vals=NULL, *stat_vals=NULL;
static int filled=FALSE;
struct obj_stats *tmp_stats;
-
- char errmsg[MAX_ERR_LENGTH];
+ int status;
+ char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
- strcpy(idtyp,id_type);
-
- if (strcmp(idtyp,VAR_ID_EL_BLK) == 0)
- {
+ switch(id_type) {
+ case EX_NODAL:
+ return 0;
+ case EX_GLOBAL:
+ return 0;
+ case EX_ELEM_BLOCK:
strcpy(id_table, VAR_ID_EL_BLK); /* id array name */
strcpy(id_dim, DIM_NUM_EL_BLK); /* id array dimension name*/
strcpy(stat_table, VAR_STAT_EL_BLK); /* id status array name */
- tmp_stats = get_stat_ptr (exoid, &eb);
- }
- else if (strcmp(idtyp,VAR_NS_IDS) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_eb);
+ break;
+ case EX_NODE_SET:
strcpy(id_table, VAR_NS_IDS);
strcpy(id_dim, DIM_NUM_NS);
strcpy(stat_table, VAR_NS_STAT);
- tmp_stats = get_stat_ptr (exoid, &ns);
- }
- else if (strcmp(idtyp,VAR_SS_IDS) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_ns);
+ break;
+ case EX_SIDE_SET:
strcpy(id_table, VAR_SS_IDS);
strcpy(id_dim, DIM_NUM_SS);
strcpy(stat_table, VAR_SS_STAT);
- tmp_stats = get_stat_ptr (exoid, &ss);
- }
- else if (strcmp(idtyp,VAR_EM_PROP(1)) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_ss);
+ break;
+ case EX_ELEM_MAP:
strcpy(id_table, VAR_EM_PROP(1));
strcpy(id_dim, DIM_NUM_EM);
strcpy(stat_table, "");
- tmp_stats = get_stat_ptr (exoid, &em);
- }
- else if (strcmp(idtyp,VAR_NM_PROP(1)) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_em);
+ break;
+ case EX_NODE_MAP:
strcpy(id_table, VAR_NM_PROP(1));
strcpy(id_dim, DIM_NUM_NM);
strcpy(stat_table, "");
- tmp_stats = get_stat_ptr (exoid, &nm);
- }
- else if (strcmp(idtyp,VAR_ID_ED_BLK) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_nm);
+ break;
+ case EX_EDGE_BLOCK:
strcpy(id_table, VAR_ID_ED_BLK);
strcpy(id_dim, DIM_NUM_ED_BLK);
strcpy(stat_table, VAR_STAT_ED_BLK);
- tmp_stats = get_stat_ptr (exoid, &ed);
- }
- else if (strcmp(idtyp,VAR_ID_FA_BLK) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_ed);
+ break;
+ case EX_FACE_BLOCK:
strcpy(id_table, VAR_ID_FA_BLK);
strcpy(id_dim, DIM_NUM_FA_BLK);
strcpy(stat_table, VAR_STAT_FA_BLK);
- tmp_stats = get_stat_ptr (exoid, &fa);
- }
- else if (strcmp(idtyp,VAR_ES_IDS) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_fa);
+ break;
+ case EX_EDGE_SET:
strcpy(id_table, VAR_ES_IDS);
strcpy(id_dim, DIM_NUM_ES);
strcpy(stat_table, VAR_ES_STAT);
- tmp_stats = get_stat_ptr (exoid, &es);
- }
- else if (strcmp(idtyp,VAR_FS_IDS) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_es);
+ break;
+ case EX_FACE_SET:
strcpy(id_table, VAR_FS_IDS);
strcpy(id_dim, DIM_NUM_FS);
strcpy(stat_table, VAR_FS_STAT);
- tmp_stats = get_stat_ptr (exoid, &fs);
- }
- else if (strcmp(idtyp,VAR_ELS_IDS) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_fs);
+ break;
+ case EX_ELEM_SET:
strcpy(id_table, VAR_ELS_IDS);
strcpy(id_dim, DIM_NUM_ELS);
strcpy(stat_table, VAR_ELS_STAT);
- tmp_stats = get_stat_ptr (exoid, &els);
- }
- else if (strcmp(idtyp,VAR_EDM_PROP(1)) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_els);
+ break;
+ case EX_EDGE_MAP:
strcpy(id_table, VAR_EDM_PROP(1));
strcpy(id_dim, DIM_NUM_EDM);
strcpy(stat_table, "");
- tmp_stats = get_stat_ptr (exoid, &edm);
- }
- else if (strcmp(idtyp,VAR_FAM_PROP(1)) == 0)
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_edm);
+ break;
+ case EX_FACE_MAP:
strcpy(id_table, VAR_FAM_PROP(1));
strcpy(id_dim, DIM_NUM_FAM);
strcpy(stat_table, "");
- tmp_stats = get_stat_ptr (exoid, &fam);
- }
- else
- {
+ tmp_stats = ex_get_stat_ptr (exoid, &exoII_fam);
+ break;
+ default:
exerrval = EX_BADPARAM;
sprintf(errmsg,
- "Error: unsupported id array type %s for file id %d",
- idtyp, exoid);
+ "Error: unsupported id array type %d for file id %d",
+ id_type, exoid);
ex_err("ex_id_lkup",errmsg,exerrval);
return (EX_FATAL);
}
@@ -332,9 +411,8 @@ int ex_id_lkup( int exoid,
/* get size of id array */
/* First get dimension id of id array */
- if ((dimid = ncdimid(exoid,id_dim)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid,id_dim,&dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate id array dimension in file id %d",
exoid);
@@ -344,9 +422,8 @@ int ex_id_lkup( int exoid,
/* Next get value of dimension */
- if (ncdiminq (exoid,dimid,(char *) 0,&dim_len) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid,dimid,&dim_len)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate %s array length in file id %d",
id_table,exoid);
@@ -355,9 +432,8 @@ int ex_id_lkup( int exoid,
}
/* get variable id of id array */
- if ((varid = ncvarid (exoid, id_table)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid (exoid, id_table, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate %s array in file id %d",
id_table, exoid);
@@ -366,8 +442,7 @@ int ex_id_lkup( int exoid,
}
/* allocate space for id array */
- if (!(id_vals = malloc((int)dim_len*sizeof(nclong))))
- {
+ if (!(id_vals = malloc((int)dim_len*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
"Error: failed to allocate memory for %s array for file id %d",
@@ -376,15 +451,8 @@ int ex_id_lkup( int exoid,
return (EX_FATAL);
}
- start[0] = 0;
- start[1] = 0;
- count[0] = dim_len;
- count[1] = 0;
-
-
- if (ncvarget (exoid, varid, start, count, (void *)id_vals) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_var_int (exoid, varid, id_vals)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get %s array from file id %d",
id_table,exoid);
@@ -395,8 +463,7 @@ int ex_id_lkup( int exoid,
/* check if values in stored arrays are filled with non-zeroes */
filled = TRUE;
- for (i=0;i<dim_len;i++)
- {
+ for (i=0;i<dim_len;i++) {
if (id_vals[i] == 0 || id_vals[i] == NC_FILL_INT) {
filled = FALSE;
break; /* id array hasn't been completely filled with valid ids yet */
@@ -417,8 +484,7 @@ int ex_id_lkup( int exoid,
/* Do a linear search through the id array to find the array value
corresponding to the passed index number */
- for (i=0;i<dim_len;i++)
- {
+ for (i=0;i<dim_len;i++) {
if (id_vals[i] == num)
break; /* found the id requested */
}
@@ -434,8 +500,7 @@ int ex_id_lkup( int exoid,
/* Now check status array to see if object is null */
/* get variable id of status array */
- if ((varid = ncvarid (exoid, stat_table)) != -1)
- {
+ if (nc_inq_varid (exoid, stat_table, &varid) == NC_NOERR) {
/* if status array exists, use it, otherwise assume object exists
to be backward compatible */
@@ -444,8 +509,7 @@ int ex_id_lkup( int exoid,
/* allocate space for new status array */
- if (!(stat_vals = malloc((int)dim_len*sizeof(nclong))))
- {
+ if (!(stat_vals = malloc((int)dim_len*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
"Error: failed to allocate memory for %s array for file id %d",
@@ -454,14 +518,8 @@ int ex_id_lkup( int exoid,
return (EX_FATAL);
}
- start[0] = 0;
- start[1] = 0;
- count[0] = dim_len;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_var_int (exoid, varid, stat_vals)) != NC_NOERR) {
+ exerrval = status;
free(stat_vals);
sprintf(errmsg,
"Error: failed to get %s array from file id %d",
@@ -480,8 +538,7 @@ int ex_id_lkup( int exoid,
stat_vals = tmp_stats->stat_vals;
}
- if (stat_vals[i] == 0) /* is this object null? */
- {
+ if (stat_vals[i] == 0) /* is this object null? */ {
exerrval = EX_NULLENTITY;
if ( !(tmp_stats->valid_stat) ) {
free (stat_vals);
@@ -501,25 +558,19 @@ int ex_id_lkup( int exoid,
/******************************************************************************
*
-* get_stat_ptr - returns a pointer to a structure of object ids
-*
-* author - Sandia National Laboratories
-* Larry Schoof
-*
-*
-* environment - UNIX
+* ex_get_stat_ptr - returns a pointer to a structure of object ids
*
* revision history -
*
*
*****************************************************************************/
-/* this routine returns a pointer to a structure containing the ids of
+/*! this routine returns a pointer to a structure containing the ids of
* element blocks, node sets, or side sets according to exoid; if there
* is not a structure that matches the exoid, one is created
*/
-struct obj_stats *get_stat_ptr (int exoid, struct obj_stats **obj_ptr)
+struct obj_stats *ex_get_stat_ptr (int exoid, struct obj_stats **obj_ptr)
{
struct obj_stats *tmp_ptr;
@@ -550,26 +601,20 @@ struct obj_stats *get_stat_ptr (int exoid, struct obj_stats **obj_ptr)
/******************************************************************************
*
-* rm_stat_ptr - removes a pointer to a structure of object ids
-*
-* author - Sandia National Laboratories
-* Larry Schoof
-*
-*
-* environment - UNIX
+* ex_rm_stat_ptr - removes a pointer to a structure of object ids
*
* revision history -
*
*
*****************************************************************************/
-/* this routine removes a pointer to a structure containing the ids of
+/*! this routine removes a pointer to a structure containing the ids of
* element blocks, node sets, or side sets according to exoid; this
* is necessary to clean up because netCDF reuses file ids; should be
* called from ex_close
*/
-void rm_stat_ptr (int exoid, struct obj_stats **obj_ptr)
+void ex_rm_stat_ptr (int exoid, struct obj_stats **obj_ptr)
{
struct obj_stats *last_head_list_ptr, *tmp_ptr;
@@ -596,23 +641,63 @@ void rm_stat_ptr (int exoid, struct obj_stats **obj_ptr)
tmp_ptr = tmp_ptr->next; /* Loop back if not */
}
}
+
+/* structures to hold number of blocks of that type for each file id */
+static struct list_item* ed_ctr_list = 0; /* edge blocks */
+static struct list_item* fa_ctr_list = 0; /* face blocks */
+static struct list_item* eb_ctr_list = 0; /* element blocks */
+/* structures to hold number of sets of that type for each file id */
+static struct list_item* ns_ctr_list = 0; /* node sets */
+static struct list_item* es_ctr_list = 0; /* edge sets */
+static struct list_item* fs_ctr_list = 0; /* face sets */
+static struct list_item* ss_ctr_list = 0; /* side sets */
+static struct list_item* els_ctr_list = 0; /* element sets */
+/* structures to hold number of maps of that type for each file id */
+static struct list_item* nm_ctr_list = 0; /* node maps */
+static struct list_item* edm_ctr_list = 0; /* edge maps */
+static struct list_item* fam_ctr_list = 0; /* face maps */
+static struct list_item* em_ctr_list = 0; /* element maps */
+
+struct list_item** ex_get_counter_list(ex_entity_type obj_type)
+{
+ switch(obj_type) {
+ case EX_ELEM_BLOCK:
+ return &eb_ctr_list;
+ case EX_NODE_SET:
+ return &ns_ctr_list;
+ case EX_SIDE_SET:
+ return &ss_ctr_list;
+ case EX_ELEM_MAP:
+ return &em_ctr_list;
+ case EX_NODE_MAP:
+ return &nm_ctr_list;
+ case EX_EDGE_BLOCK:
+ return &ed_ctr_list;
+ case EX_FACE_BLOCK:
+ return &fa_ctr_list;
+ case EX_EDGE_SET:
+ return &es_ctr_list;
+ case EX_FACE_SET:
+ return &fs_ctr_list;
+ case EX_ELEM_SET:
+ return &els_ctr_list;
+ case EX_EDGE_MAP:
+ return &edm_ctr_list;
+ case EX_FACE_MAP:
+ return &fam_ctr_list;
+ default:
+ return (NULL);
+ }
+}
+
/******************************************************************************
*
* ex_inc_file_item - increment file item
*
-* author - Sandia National Laboratories
-* Vic Yarberry
-*
-*
-* environment - UNIX
-*
-* revision history -
-*
-*
*****************************************************************************/
-/* this routine sets up a structure to track and increment a counter for
+/*! this routine sets up a structure to track and increment a counter for
* each open exodus file. it is designed to be used by the routines
* ex_put_elem_block() and ex_put_set_param(),
* to keep track of the number of element blocks, and each type of set,
@@ -671,19 +756,10 @@ int ex_inc_file_item( int exoid, /* file id */
*
* ex_get_file_item - increment file item
*
-* author - Sandia National Laboratories
-* Vic Yarberry
-*
-*
-* environment - UNIX
-*
-* revision history -
-*
-*
*****************************************************************************/
-/* this routine accesses a structure to track and increment a counter for
+/*! this routine accesses a structure to track and increment a counter for
* each open exodus file. it is designed to be used by the routines
* ex_put_elem_block(), and ex_put_set_param(),
* to get the number of element blocks, or a type of set,
@@ -736,19 +812,10 @@ int ex_get_file_item( int exoid, /* file id */
*
* ex_rm_file_item - remove file item
*
-* author - Sandia National Laboratories
-* Vic Yarberry
-*
-*
-* environment - UNIX
-*
-* revision history -
-*
-*
*****************************************************************************/
-/* this routine removes a structure to track and increment a counter for
+/*! this routine removes a structure to track and increment a counter for
* each open exodus file.
*
* The list structure is used as follows:
@@ -801,11 +868,6 @@ void ex_rm_file_item( int exoid, /* file id */
*
* ex_get_num_props - get number of properties
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
*
* exit conditions -
@@ -814,70 +876,74 @@ void ex_rm_file_item( int exoid, /* file id */
*
*
*****************************************************************************/
-int ex_get_num_props (int exoid, int obj_type)
+int ex_get_num_props (int exoid, ex_entity_type obj_type)
{
- int cntr;
- char var_name[MAX_VAR_NAME_LENGTH+1];
- char errmsg[MAX_ERR_LENGTH];
+ int cntr, varid;
+ char var_name[MAX_VAR_NAME_LENGTH+1];
+ char errmsg[MAX_ERR_LENGTH];
- cntr = 0;
+ cntr = 0;
-/* loop until there is not a property variable defined; the name of */
-/* the variables begin with an increment of 1 ("xx_prop1") so use cntr+1 */
+ /* loop until there is not a property variable defined; the name of */
+ /* the variables begin with an increment of 1 ("xx_prop1") so use cntr+1 */
- while (TRUE)
- {
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (var_name, VAR_EB_PROP(cntr+1));
- break;
- case EX_EDGE_BLOCK:
- strcpy (var_name, VAR_ED_PROP(cntr+1));
- break;
- case EX_FACE_BLOCK:
- strcpy (var_name, VAR_FA_PROP(cntr+1));
- break;
- case EX_NODE_SET:
- strcpy (var_name, VAR_NS_PROP(cntr+1));
- break;
- case EX_EDGE_SET:
- strcpy (var_name, VAR_ES_PROP(cntr+1));
- break;
- case EX_FACE_SET:
- strcpy (var_name, VAR_FS_PROP(cntr+1));
- break;
- case EX_SIDE_SET:
- strcpy (var_name, VAR_SS_PROP(cntr+1));
- break;
- case EX_ELEM_SET:
- strcpy (var_name, VAR_ELS_PROP(cntr+1));
- break;
- case EX_ELEM_MAP:
- strcpy (var_name, VAR_EM_PROP(cntr+1));
- break;
- case EX_NODE_MAP:
- strcpy (var_name, VAR_NM_PROP(cntr+1));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_get_prop_names",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if ((ncvarid (exoid, var_name)) == -1)
- {
-
-/* no variable with this name; return cntr which is now the number of */
-/* properties for this type of entity */
-
- return (cntr);
- }
- cntr++;
- }
+ while (TRUE)
+ {
+ switch (obj_type)
+ {
+ case EX_ELEM_BLOCK:
+ strcpy (var_name, VAR_EB_PROP(cntr+1));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (var_name, VAR_ED_PROP(cntr+1));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (var_name, VAR_FA_PROP(cntr+1));
+ break;
+ case EX_NODE_SET:
+ strcpy (var_name, VAR_NS_PROP(cntr+1));
+ break;
+ case EX_EDGE_SET:
+ strcpy (var_name, VAR_ES_PROP(cntr+1));
+ break;
+ case EX_FACE_SET:
+ strcpy (var_name, VAR_FS_PROP(cntr+1));
+ break;
+ case EX_SIDE_SET:
+ strcpy (var_name, VAR_SS_PROP(cntr+1));
+ break;
+ case EX_ELEM_SET:
+ strcpy (var_name, VAR_ELS_PROP(cntr+1));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (var_name, VAR_EM_PROP(cntr+1));
+ break;
+ case EX_FACE_MAP:
+ strcpy (var_name, VAR_FAM_PROP(cntr+1));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (var_name, VAR_EDM_PROP(cntr+1));
+ break;
+ case EX_NODE_MAP:
+ strcpy (var_name, VAR_NM_PROP(cntr+1));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_get_prop_names",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (nc_inq_varid (exoid, var_name, &varid) != NC_NOERR) {
+ /* no variable with this name; return cntr which is now the number of */
+ /* properties for this type of entity */
+ return (cntr);
+ }
+ cntr++;
+ }
}
+
int ex_get_cpu_ws(void)
{
return(sizeof(float));
@@ -885,7 +951,7 @@ int ex_get_cpu_ws(void)
/* swap - interchange v[i] and v[j] */
-void ex_swap (int v[], int i, int j)
+static void ex_swap (int v[], int i, int j)
{
int temp;
@@ -894,7 +960,7 @@ void ex_swap (int v[], int i, int j)
v[j] = temp;
}
-/*
+/*!
* The following 'indexed qsort' routine is modified from Sedgewicks
* algorithm It selects the pivot based on the median of the left,
* right, and center values to try to avoid degenerate cases ocurring
@@ -910,7 +976,7 @@ void ex_swap (int v[], int i, int j)
#define EX_QSORT_CUTOFF 12
-int ex_int_median3(int v[], int iv[], int left, int right)
+static int ex_int_median3(int v[], int iv[], int left, int right)
{
int center;
center = (left + right) / 2;
@@ -926,7 +992,7 @@ int ex_int_median3(int v[], int iv[], int left, int right)
return iv[right-1];
}
-void ex_int_iqsort(int v[], int iv[], int left, int right)
+static void ex_int_iqsort(int v[], int iv[], int left, int right)
{
int pivot;
int i, j;
@@ -952,7 +1018,7 @@ void ex_int_iqsort(int v[], int iv[], int left, int right)
}
}
-void ex_int_iisort(int v[], int iv[], int N)
+static void ex_int_iisort(int v[], int iv[], int N)
{
int i,j;
int ndx = 0;
@@ -992,48 +1058,7 @@ void ex_iqsort(int v[], int iv[], int N)
#endif
}
-/*
- * Convert array of ints to packed array of "nclongs", in malloc'ed space.
- * Returns pointer to "nclongs" or NULL if malloc failed.
- */
-nclong* itol(const int *ints, /* array of ints */
- int len) /* length of array */
-{
- nclong *longs = malloc (len * sizeof (nclong));
- const int *ip;
- nclong *lp = longs;
-
- if (longs != NULL) {
- for (ip = ints; len > 0; len--) {
- *lp++ = (nclong) *ip++;
- }
- } else {
- char errmsg[MAX_ERR_LENGTH];
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for integer to long conversion");
- ex_err("ex_get_side_set_node_list",errmsg,exerrval);
- }
- return longs;
-}
-
-/*
- * Convert array of "nclongs" to array of ints
- */
-int ltoi (const nclong *longs, /* array of longs */
- int *ints, /* array of ints */
- int len) /* length of array */
-{
- int *ip;
- const nclong *lp;
-
- for (ip = ints, lp = longs; len > 0; len--)
- *ip++ = *lp++;
-
- return (0);
-}
-
-/*
+/*!
* Determine whether the new large model storage is being used in this
* file, or old method. Basically, the difference is whether the
* coordinates and nodal variables are stored in a blob (xyz
@@ -1042,6 +1067,7 @@ int ltoi (const nclong *longs, /* array of longs */
*/
int ex_large_model(int exoid)
{
+ static int message_output = FALSE;
if (exoid < 0) {
/* If exoid not specified, then query is to see if user specified
* the large model via an environment variable
@@ -1049,12 +1075,18 @@ int ex_large_model(int exoid)
char *option = getenv("EXODUS_LARGE_MODEL");
if (option != NULL) {
if (option[0] == 'n' || option[0] == 'N') {
- fprintf(stderr,
- "EXODUSII: Small model size selected via EXODUS_LARGE_MODEL environment variable\n");
+ if (!message_output) {
+ fprintf(stderr,
+ "EXODUSII: Small model size selected via EXODUS_LARGE_MODEL environment variable\n");
+ message_output = TRUE;
+ }
return 0;
} else {
- fprintf(stderr,
- "EXODUSII: Large model size selected via EXODUS_LARGE_MODEL environment variable\n");
+ if (!message_output) {
+ fprintf(stderr,
+ "EXODUSII: Large model size selected via EXODUS_LARGE_MODEL environment variable\n");
+ message_output = TRUE;
+ }
return 1;
}
} else {
@@ -1073,35 +1105,36 @@ int ex_large_model(int exoid)
}
int ex_get_dimension(int exoid, const char* DIMENSION, const char *label,
- long *count, const char *routine)
+ size_t *count, int *dimid, const char *routine)
{
char errmsg[MAX_ERR_LENGTH];
- long dimid;
-
+ int status;
+
*count = 0;
- if ((dimid = ncdimid (exoid, DIMENSION)) == -1) {
+ *dimid = -1;
+
+ if ((status = nc_inq_dimid(exoid, DIMENSION, dimid)) != NC_NOERR) {
+ exerrval = status;
if (routine != NULL) {
- if (ncerr == NC_EBADDIM) {
- exerrval = ncerr;
+ if (status == NC_EBADDIM) {
sprintf(errmsg,
"Warning: no %s defined in file id %d",
label, exoid);
ex_err(routine, errmsg,exerrval);
} else {
- exerrval = ncerr;
sprintf(errmsg,
"Error: failed to locate number of %s in file id %d",
label, exoid);
ex_err(routine,errmsg,exerrval);
}
}
- return dimid;
+ return status;
}
- if (ncdiminq (exoid, dimid, (char *) 0, count) == -1) {
+ if ((status = nc_inq_dimlen (exoid, *dimid, count)) != NC_NOERR) {
+ exerrval = status;
if (routine != NULL) {
- exerrval = ncerr;
sprintf(errmsg,
"Error: failed to get number of %s in file id %d",
label, exoid);
@@ -1109,26 +1142,27 @@ int ex_get_dimension(int exoid, const char* DIMENSION, const char *label,
return -1;
}
}
- return dimid;
+ return status;
}
+/*! Calculate the number of words of storage required to store the
+ * header information. Total bytes can be obtained by multiplying
+ * words by 4. Size is slightly underestimated since it only
+ * considers the bulk data storage...
+ */
size_t ex_header_size(int exoid)
{
- /* Calculate the number of words of storage required to store the
- * header information. Total bytes can be obtained by multiplying
- * words by 4. Size is slightly underestimated since it only
- * considers the bulk data storage...
- */
const char *routine = NULL;
int iows = 0;
- long ndim = 0;
- long num_nodes = 0;
- long num_elem = 0;
- long num_eblk = 0;
- long num_map = 0;
- long num_nset = 0;
- long num_sset = 0;
+ size_t ndim = 0;
+ size_t num_nodes = 0;
+ size_t num_elem = 0;
+ size_t num_eblk = 0;
+ size_t num_map = 0;
+ size_t num_nset = 0;
+ size_t num_sset = 0;
int mapid;
+ int temp;
size_t size = 0;
/* Get word size (2 = 8-byte reals, 1 = 4-byte reals */
@@ -1139,40 +1173,37 @@ size_t ex_header_size(int exoid)
iows = 1;
/* coordinates = (ndim * numnp)*iows + maps */
- ex_get_dimension(exoid, DIM_NUM_DIM, "dimension", &ndim, routine);
- ex_get_dimension(exoid, DIM_NUM_NODES, "nodes", &num_nodes, routine);
+ ex_get_dimension(exoid, DIM_NUM_DIM, "dimension", &ndim, &temp, routine);
+ ex_get_dimension(exoid, DIM_NUM_NODES, "nodes", &num_nodes, &temp, routine);
size += iows * ndim * num_nodes;
/* node maps */
- mapid = ncvarid(exoid, VAR_NODE_NUM_MAP);
- if (mapid != -1)
+ if (nc_inq_varid(exoid, VAR_NODE_NUM_MAP, &mapid) != -1)
size += num_nodes;
- ex_get_dimension(exoid, DIM_NUM_NM, "node maps", &num_map, routine);
+ ex_get_dimension(exoid, DIM_NUM_NM, "node maps", &num_map, &temp, routine);
size += num_map * num_nodes;
/* Element Data */
- ex_get_dimension(exoid, DIM_NUM_ELEM, "elements", &num_elem, routine);
+ ex_get_dimension(exoid, DIM_NUM_ELEM, "elements", &num_elem, &temp, routine);
/* Element order map */
- mapid = ncvarid (exoid, VAR_MAP);
- if (mapid != -1)
+ if (nc_inq_varid (exoid, VAR_MAP, &mapid) != -1)
size += num_elem;
- mapid = ncvarid (exoid, VAR_ELEM_NUM_MAP);
- if (mapid != -1)
+ if (nc_inq_varid (exoid, VAR_ELEM_NUM_MAP, &mapid) != -1)
size += num_elem;
/* Element map(s) */
- ex_get_dimension(exoid, DIM_NUM_EM, "element maps", &num_map, routine);
+ ex_get_dimension(exoid, DIM_NUM_EM, "element maps", &num_map, &temp, routine);
size += num_map * num_elem;
/* Element Blocks... */
- ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks", &num_eblk, routine);
+ ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks", &num_eblk, &temp, routine);
if (num_eblk > 0) {
/* Allocate storage for element block parameters... */
int *ids = malloc(num_eblk * sizeof(int));
- int i;
+ size_t i;
size += 2*num_eblk; /* status + ids */
@@ -1191,11 +1222,11 @@ size_t ex_header_size(int exoid)
}
/* Nodesets */
- ex_get_dimension(exoid, DIM_NUM_NS, "nodesets", &num_nset, routine);
+ ex_get_dimension(exoid, DIM_NUM_NS, "nodesets", &num_nset, &temp, routine);
if (num_nset > 0) {
/* Allocate storage for nodeset parameters... */
int *ids = malloc(num_nset * sizeof(int));
- int i;
+ size_t i;
size += 2*num_nset; /* Status + ids */
ex_get_ids(exoid, EX_NODE_SET, ids);
@@ -1210,11 +1241,11 @@ size_t ex_header_size(int exoid)
}
/* Sidesets */
- ex_get_dimension(exoid, DIM_NUM_SS, "sidesets", &num_sset, routine);
+ ex_get_dimension(exoid, DIM_NUM_SS, "sidesets", &num_sset, &temp, routine);
if (num_sset > 0) {
/* Allocate storage for sideset parameters... */
int *ids = malloc(num_sset * sizeof(int));
- int i;
+ size_t i;
size += 2*num_sset; /* Status + ids */
ex_get_ids(exoid, EX_SIDE_SET, ids);
diff --git a/cbind/src/exclos.c b/cbind/src/exclos.c
index cce4fd9..d0c1172 100644
--- a/cbind/src/exclos.c
+++ b/cbind/src/exclos.c
@@ -44,29 +44,12 @@
*
* revision history -
*
-* $Id: exclos.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/* structures to hold number of blocks of that type for each file id */
-struct list_item* ed_ctr_list = 0; /* edge blocks */
-struct list_item* fa_ctr_list = 0; /* face blocks */
-struct list_item* eb_ctr_list = 0; /* element blocks */
-/* structures to hold number of sets of that type for each file id */
-struct list_item* ns_ctr_list = 0; /* node sets */
-struct list_item* es_ctr_list = 0; /* edge sets */
-struct list_item* fs_ctr_list = 0; /* face sets */
-struct list_item* ss_ctr_list = 0; /* side sets */
-struct list_item* els_ctr_list = 0; /* element sets */
-/* structures to hold number of maps of that type for each file id */
-struct list_item* nm_ctr_list = 0; /* node maps */
-struct list_item* edm_ctr_list = 0; /* edge maps */
-struct list_item* fam_ctr_list = 0; /* face maps */
-struct list_item* em_ctr_list = 0; /* element maps */
-
extern char *ret_string; /* cf ex_utils.c */
/*!
@@ -75,50 +58,49 @@ extern char *ret_string; /* cf ex_utils.c */
int ex_close (int exoid)
{
char errmsg[MAX_ERR_LENGTH];
-
+ int status;
+
exerrval = 0; /* clear error code */
- if (ncsync (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_sync(exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to update file id %d",exoid);
ex_err("ex_close",errmsg,exerrval);
return(EX_FATAL);
}
- /* Check header size. Will print message if too big... */
- ex_header_size(exoid);
-
- if (ncclose (exoid) >= 0 ) {
+ if ((status = nc_close (exoid)) == NC_NOERR) {
ex_conv_exit(exoid);
- ex_rm_file_item(exoid, &ed_ctr_list);
- ex_rm_file_item(exoid, &fa_ctr_list);
- ex_rm_file_item(exoid, &eb_ctr_list);
- ex_rm_file_item(exoid, &ns_ctr_list);
- ex_rm_file_item(exoid, &es_ctr_list);
- ex_rm_file_item(exoid, &fs_ctr_list);
- ex_rm_file_item(exoid, &ss_ctr_list);
- ex_rm_file_item(exoid, &els_ctr_list);
- ex_rm_file_item(exoid, &nm_ctr_list);
- ex_rm_file_item(exoid, &edm_ctr_list);
- ex_rm_file_item(exoid, &fam_ctr_list);
- ex_rm_file_item(exoid, &em_ctr_list);
- rm_stat_ptr (exoid, &ed);
- rm_stat_ptr (exoid, &fa);
- rm_stat_ptr (exoid, &eb);
- rm_stat_ptr (exoid, &ns);
- rm_stat_ptr (exoid, &es);
- rm_stat_ptr (exoid, &fs);
- rm_stat_ptr (exoid, &ss);
- rm_stat_ptr (exoid, &els);
- rm_stat_ptr (exoid, &nm);
- rm_stat_ptr (exoid, &edm);
- rm_stat_ptr (exoid, &fam);
- rm_stat_ptr (exoid, &em);
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_NODE_SET));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_EDGE_SET));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_FACE_SET));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_SIDE_SET));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_ELEM_SET));
+ ex_rm_file_item(exoid, ex_get_counter_list(EX_NODE_MAP));
+ 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_stat_ptr (exoid, &exoII_ed);
+ ex_rm_stat_ptr (exoid, &exoII_fa);
+ ex_rm_stat_ptr (exoid, &exoII_eb);
+ ex_rm_stat_ptr (exoid, &exoII_ns);
+ ex_rm_stat_ptr (exoid, &exoII_es);
+ ex_rm_stat_ptr (exoid, &exoII_fs);
+ ex_rm_stat_ptr (exoid, &exoII_ss);
+ ex_rm_stat_ptr (exoid, &exoII_els);
+ ex_rm_stat_ptr (exoid, &exoII_nm);
+ ex_rm_stat_ptr (exoid, &exoII_edm);
+ ex_rm_stat_ptr (exoid, &exoII_fam);
+ ex_rm_stat_ptr (exoid, &exoII_em);
}
else {
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg, "Error: failed to close file id %d",exoid);
- ex_err("ex_close",errmsg,ncerr);
+ ex_err("ex_close",errmsg, status);
return(EX_FATAL);
}
return(EX_NOERR);
diff --git a/cbind/src/excn2s.c b/cbind/src/excn2s.c
index dc1966e..53c48fe 100644
--- a/cbind/src/excn2s.c
+++ b/cbind/src/excn2s.c
@@ -36,12 +36,6 @@
*
* excn2s - ex_cvt_nodes_to_sides: convert nodes to sides
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -57,7 +51,6 @@
*
* revision history -
*
-* $Id: excn2s.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -67,15 +60,25 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* This routine is designed to take the results from retrieving the ExodusI
* style concatenated side sets to the Exodus II V 2.0 definition
* uses the element id to get the coordinate node list, element block
* connectivity, element type to
* convert the side set node list to a side/face list.
- Algorithm:
+ * \param exoid exodus file id
+ * \param *num_elem_per_set number of element per set
+ * \param *num_nodes_per_set number of nodes per set
+ * \param *side_sets_elem_index index array of elements into elem list
+ * \param *side_sets_node_index index array of nodes
+ * \param *side_sets_elem_list array of elements
+ * \param *side_sets_node_list array of nodes
+ * \param[out] *side_sets_side_list array of sides/faces
+
+ <b>Algorithm:</b>
+\verbatim
Read elem_block_ids --> elem_blk_id[array]
Read element block parameters --> elem_blk_parms[array]
@@ -84,40 +87,27 @@
Build side set element to side set node list index --> ss_elem_node_ndx[array]
- For each element in the side_set_elem_list
- {
- If Jth element is not in current element block (e.g. J>elem_ctr)
- {
+ For each element in the side_set_elem_list {
+ If Jth element is not in current element block (e.g. J>elem_ctr) {
get element block parameters (num_elem_in_blk, ...)
-
elem_ctr += num_elem_in_blk
-
free old connectity array space
-
allocate connectivity array: size=num_elem_in_blk*num_nodes_per_elem
-
get connectivity array
}
- If Jth element is in current element block (e.g. J<=elem_ctr)
- {
- For each node in element (linear search of up to num_nodes_per_elem)
- {
- If side set element node[1] == element node[i]
- {
- Case element type = Hex
- {
+ If Jth element is in current element block (e.g. J<=elem_ctr) {
+ For each node in element (linear search of up to num_nodes_per_elem) {
+ If side set element node[1] == element node[i] {
+ Case element type = Hex {
If side set element node[2] == element node[Hex_table[i,1]]
-
Jth side = Hex_table[i,2]
- break
+ break
}
- Case element type = Wedge
- {
+ Case element type = Wedge {
If side set element node[2] == element node[Wedge_table[i,1]]
-
Jth side = Wedge_table[i,2]
break
@@ -126,46 +116,34 @@
}
}
}
-
-
-
-
-
-
+\endverbatim
*/
int ex_cvt_nodes_to_sides(int exoid,
int *num_elem_per_set,
int *num_nodes_per_set,
- int *side_sets_elem_index,
- int *side_sets_node_index,
+ int *side_sets_elem_index, /* unused */
+ int *side_sets_node_index, /* unused */
int *side_sets_elem_list,
int *side_sets_node_list,
int *side_sets_side_list)
{
- int i, j, k, m, n;
+ size_t m;
+ int i, j, k, n;
int num_side_sets, num_elem_blks;
int tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0, ndim;
- int *elem_blk_ids, *connect;
+ int *elem_blk_ids = NULL;
+ int *connect = NULL;
int *ss_elem_ndx, *ss_elem_node_ndx, *ss_parm_ndx;
int elem_ctr, node_ctr, elem_num_pos;
int num_elem_in_blk, num_nodes_per_elem, num_node_per_side, num_attr;
- int *same_elem_type, el_type;
+ int *same_elem_type = NULL;
+ int el_type = 0;
float fdum;
char *cdum, elem_type[MAX_STR_LENGTH+1];
- struct elem_blk_parm
- {
- char elem_type[MAX_STR_LENGTH+1];
- int elem_blk_id;
- int num_elem_in_blk;
- int num_nodes_per_elem;
- int num_nodes_per_side;
- int num_attr;
- int elem_ctr;
- int elem_type_val;
- } *elem_blk_parms;
+ struct elem_blk_parm *elem_blk_parms;
/* node to side translation tables -
These tables are used to look up the side number based on the
@@ -352,150 +330,150 @@ int ex_cvt_nodes_to_sides(int exoid,
for (m=0; m < strlen(elem_type); m++)
elem_blk_parms[i].elem_type[m] =
- toupper((int)elem_type[m]);
+ toupper(elem_type[m]);
elem_blk_parms[i].elem_type[m] = '\0';
if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = CIRCLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_CIRCLE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SPHERE;
+ elem_blk_parms[i].elem_type_val = EX_EL_SPHERE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
{
- elem_blk_parms[i].elem_type_val = QUAD;
+ elem_blk_parms[i].elem_type_val = EX_EL_QUAD;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TRIANGLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRIANGLE;
/* determine side set node stride */
if (ndim == 2) /* 2d TRIs */
{
if (elem_blk_parms[i].num_nodes_per_elem == 3)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (ndim == 3) /* 3d TRIs */
{
- elem_blk_parms[i].elem_type_val = TRISHELL;
- elem_blk_parms[i].num_nodes_per_side =
+ elem_blk_parms[i].elem_type_val = EX_EL_TRISHELL;
+ elem_blk_parms[i].num_nodes_per_side[0] =
elem_blk_parms[i].num_nodes_per_elem;
}
}
else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SHELL;
+ elem_blk_parms[i].elem_type_val = EX_EL_SHELL;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
{
/* 2d SHELL; same as BEAM or TRUSS or BAR */
- elem_blk_parms[i].num_nodes_per_side = 2;
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
}
else if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
{
- elem_blk_parms[i].elem_type_val = HEX;
+ elem_blk_parms[i].elem_type_val = EX_EL_HEX;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 8)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 9)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELL */
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 27)
- elem_blk_parms[i].num_nodes_per_side = 9;
+ elem_blk_parms[i].num_nodes_per_side[0] = 9;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].elem_type_val = EX_EL_TETRA;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
else if (elem_blk_parms[i].num_nodes_per_elem == 8)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 6;
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
}
else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = WEDGE;
+ elem_blk_parms[i].elem_type_val = EX_EL_WEDGE;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 6)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
sprintf(errmsg,
"Warning: WEDGE%d is assumed to have %d nodes per face",
elem_blk_parms[i].num_nodes_per_elem,
- elem_blk_parms[i].num_nodes_per_side);
+ elem_blk_parms[i].num_nodes_per_side[0]);
ex_err("ex_cvt_nodes_to_sides",errmsg,EX_MSG);
}
else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
{
- elem_blk_parms[i].elem_type_val = PYRAMID;
+ elem_blk_parms[i].elem_type_val = EX_EL_PYRAMID;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
sprintf(errmsg,
"Warning: PYRAMID%d is assumed to have %d nodes per face",
elem_blk_parms[i].num_nodes_per_elem,
- elem_blk_parms[i].num_nodes_per_side);
+ elem_blk_parms[i].num_nodes_per_side[0]);
ex_err("ex_cvt_nodes_to_sides",errmsg,EX_MSG);
}
else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
{
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if ( (strncmp(elem_blk_parms[i].elem_type,"TRUSS",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"BAR",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"EDGE",3) == 0) )
{
- elem_blk_parms[i].elem_type_val = TRUSS;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRUSS;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = '\0';
+ elem_blk_parms[i].elem_type_val = EX_EL_NULL_ELEMENT;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
else
{ /* unsupported element type; no problem if no sides specified for
this element block */
- elem_blk_parms[i].elem_type_val = UNK;
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].elem_type_val = EX_EL_UNK;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
elem_blk_parms[i].elem_blk_id = elem_blk_ids[i]; /* save id */
elem_ctr += elem_blk_parms[i].num_elem_in_blk;
@@ -603,7 +581,7 @@ int ex_cvt_nodes_to_sides(int exoid,
(same_elem_type[k])) { /* all side set elements are same type */
node_ctr += num_nodes_per_set[k] /num_elem_per_set[k];
} else {
- node_ctr += elem_blk_parms[j].num_nodes_per_side;
+ node_ctr += elem_blk_parms[j].num_nodes_per_side[0];
}
}
@@ -688,23 +666,23 @@ int ex_cvt_nodes_to_sides(int exoid,
{
switch (elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_type_val)
{
- case CIRCLE:
- case SPHERE:
+ case EX_EL_CIRCLE:
+ case EX_EL_SPHERE:
{
/* simple case: 1st node number is same as side # */
side_sets_side_list[ss_elem_ndx[j]] = n+1;
break;
}
- case QUAD:
- case TRIANGLE:
- case TRUSS:
- case BEAM:
+ case EX_EL_QUAD:
+ case EX_EL_TRIANGLE:
+ case EX_EL_TRUSS:
+ case EX_EL_BEAM:
{
/* simple case: 1st node number is same as side # */
side_sets_side_list[ss_elem_ndx[j]] = n+1;
break;
}
- case TRISHELL:
+ case EX_EL_TRISHELL:
{
/* use table to find which node to compare to next */
num_node_per_side = ss_elem_node_ndx[ss_elem_ndx[j]+1] -
@@ -752,7 +730,7 @@ int ex_cvt_nodes_to_sides(int exoid,
break;
}
- case SHELL:
+ case EX_EL_SHELL:
{
/* use table to find which node to compare to next */
@@ -813,7 +791,7 @@ int ex_cvt_nodes_to_sides(int exoid,
break;
}
- case HEX:
+ case EX_EL_HEX:
{
/* use table to find which node to compare to next */
@@ -849,7 +827,7 @@ int ex_cvt_nodes_to_sides(int exoid,
}
break;
}
- case TETRA:
+ case EX_EL_TETRA:
{
/* use table to find which node to compare to next */
@@ -885,7 +863,7 @@ int ex_cvt_nodes_to_sides(int exoid,
}
break;
}
- case PYRAMID:
+ case EX_EL_PYRAMID:
{
/* NOTE: PYRAMID elements in side set node lists are currently not supported */
exerrval = EX_BADPARAM;
@@ -901,7 +879,7 @@ int ex_cvt_nodes_to_sides(int exoid,
free(ss_elem_ndx);
return (EX_FATAL);
}
- case WEDGE:
+ case EX_EL_WEDGE:
{
#if 1
/* NOTE: WEDGE elements in side set node lists are currently not supported */
diff --git a/cbind/src/excopy.c b/cbind/src/excopy.c
index df2b660..c6943c4 100644
--- a/cbind/src/excopy.c
+++ b/cbind/src/excopy.c
@@ -36,11 +36,6 @@
*
* excopy - ex_copy
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int in_exoid input exodus file id
@@ -53,6 +48,7 @@
*
*****************************************************************************/
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "exodusII.h"
@@ -60,14 +56,14 @@
struct ncdim { /* dimension */
char name[MAX_STR_LENGTH];
- long size;
+ size_t size;
};
struct ncvar { /* variable */
char name[MAX_STR_LENGTH];
nc_type type;
int ndims;
- int dims[MAX_VAR_DIMS];
+ int dims[NC_MAX_VAR_DIMS];
int natts;
};
@@ -75,19 +71,32 @@ struct ncatt { /* attribute */
int var;
char name[MAX_STR_LENGTH];
nc_type type;
- int len;
+ size_t len;
void *val;
};
-void update_internal_structs( int, int, struct list_item** );
-
-/*
- * copies all information (attributes, dimensions, and variables from
- * an opened EXODUS file to another opened EXODUS file
+static size_t type_size(nc_type type);
+static int cpy_att (int, int, int, int);
+static int cpy_var_def(int, int, int, char*);
+static int cpy_var_val(int, int, char*);
+static int cpy_coord_def(int in_id,int out_id,int rec_dim_id,
+ char *var_nm, int in_large, int out_large);
+static int cpy_coord_val(int in_id,int out_id,char *var_nm,
+ int in_large, int out_large);
+static void update_internal_structs( int, ex_inquiry, struct list_item** );
+
+/*!
+ * efficiently copies all non-transient information (attributes,
+ * dimensions, and variables from an opened EXODUS file to another
+ * opened EXODUS file. Will not overwrite a dimension or variable
+ * already defined in the new file.
+ * \param in_exoid exodus file id for input file
+ * \param out_exoid exodus file id for output file
*/
int ex_copy (int in_exoid, int out_exoid)
{
+ int status;
int ndims; /* number of dimensions */
int nvars; /* number of variables */
int ngatts; /* number of global attributes */
@@ -98,14 +107,12 @@ int ex_copy (int in_exoid, int out_exoid)
int var_out_id; /* variable id */
struct ncvar var; /* variable */
struct ncatt att; /* attribute */
- int i, temp;
- long numrec;
- long dim_sz;
- char dim_nm[MAX_NC_NAME];
+ size_t i;
+ size_t numrec;
+ size_t dim_sz;
+ char dim_nm[NC_MAX_NAME];
int in_large, out_large;
- extern int ncopts;
-
exerrval = 0; /* clear error code */
/*
@@ -120,27 +127,24 @@ int ex_copy (int in_exoid, int out_exoid)
* atts, and dimension id of unlimited dimension, if any
*/
- ncinquire(in_exoid, &ndims, &nvars, &ngatts, &recdimid);
- ncdiminq (in_exoid, recdimid, (char *) 0, &numrec);
+ nc_inq(in_exoid, &ndims, &nvars, &ngatts, &recdimid);
+ nc_inq_dimlen(in_exoid, recdimid, &numrec);
/* put output file into define mode */
- ncredef(out_exoid);
+ nc_redef(out_exoid);
/* copy global attributes */
- for (i = 0; i < ngatts; i++) {
+ for (i = 0; i < (size_t)ngatts; i++) {
- ncattname(in_exoid, NC_GLOBAL, i, att.name);
+ nc_inq_attname(in_exoid, NC_GLOBAL, i, att.name);
- ncattinq(in_exoid, NC_GLOBAL, att.name, &att.type, &att.len);
-
- /* if attribute exists in output file, don't overwrite it; compute
- * word size, I/O word size etc. are global attributes stored when
- * file is created with ex_create; we don't want to overwrite those
- */
-
- if (ncattinq (out_exoid, NC_GLOBAL, att.name, &att.type, &att.len) == -1){
+ /* if attribute exists in output file, don't overwrite it; compute
+ * word size, I/O word size etc. are global attributes stored when
+ * file is created with ex_create; we don't want to overwrite those
+ */
+ if ((status = nc_inq_att(out_exoid, NC_GLOBAL, att.name, &att.type, &att.len)) != NC_NOERR) {
/* The "last_written_time" attribute is a special attribute
used by the Sierra IO system to determine whether a
@@ -150,7 +154,7 @@ int ex_copy (int in_exoid, int out_exoid)
*/
if (strcmp(att.name,"last_written_time") != 0) {
/* attribute doesn't exist in new file so OK to create it */
- ncattcopy (in_exoid,NC_GLOBAL,att.name,out_exoid,NC_GLOBAL);
+ nc_copy_att(in_exoid,NC_GLOBAL,att.name,out_exoid,NC_GLOBAL);
}
}
}
@@ -161,48 +165,43 @@ int ex_copy (int in_exoid, int out_exoid)
for(dimid = 0; dimid < ndims; dimid++){
- ncdiminq(in_exoid,dimid,dim_nm,&dim_sz);
-
- /* See if the dimension has already been defined */
-
- temp = ncopts;
- ncopts = 0;
- dim_out_id = ncdimid(out_exoid,dim_nm);
- ncopts = temp;
-
- /* If the dimension isn't one we specifically don't want
- * to copy (ie, number of QA or INFO records) and it
- * hasn't been defined, copy it */
-
- if ( ( strcmp(dim_nm,DIM_NUM_QA) != 0) &&
- ( strcmp(dim_nm,DIM_NUM_INFO) != 0) &&
- ( strcmp(dim_nm,DIM_NUM_NOD_VAR) != 0) &&
- ( strcmp(dim_nm,DIM_NUM_EDG_VAR) != 0) &&
- ( 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) ) {
-
- if(dim_out_id == -1){
- if(dimid != recdimid){
- dim_out_id=ncdimdef(out_exoid,dim_nm,dim_sz);
- }else{
- dim_out_id=ncdimdef(out_exoid,dim_nm,NC_UNLIMITED);
- } /* end else */
- } /* end if */
- } /* end if */
+ nc_inq_dim(in_exoid,dimid,dim_nm,&dim_sz);
+
+ /* If the dimension isn't one we specifically don't want
+ * to copy (ie, number of QA or INFO records) and it
+ * hasn't been defined, copy it */
+
+ if ( ( strcmp(dim_nm,DIM_NUM_QA) != 0) &&
+ ( strcmp(dim_nm,DIM_NUM_INFO) != 0) &&
+ ( strcmp(dim_nm,DIM_NUM_NOD_VAR) != 0) &&
+ ( strcmp(dim_nm,DIM_NUM_EDG_VAR) != 0) &&
+ ( 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) ) {
+
+ /* See if the dimension has already been defined */
+ status = nc_inq_dimid(out_exoid, dim_nm, &dim_out_id);
+
+ if(status != NC_NOERR) {
+ if(dimid != recdimid) {
+ status = nc_def_dim(out_exoid, dim_nm, dim_sz, &dim_out_id);
+ } else {
+ status = nc_def_dim(out_exoid, dim_nm, NC_UNLIMITED, &dim_out_id);
+ } /* end else */
+ } /* end if */
+ } /* end if */
} /* end loop over dim */
/* copy variable definitions and variable attributes */
-
for (varid = 0; varid < nvars; varid++) {
- ncvarinq(in_exoid, varid, var.name, &var.type, &var.ndims,
- var.dims, &var.natts);
+ nc_inq_var(in_exoid, varid, var.name, &var.type, &var.ndims,
+ var.dims, &var.natts);
/* we don't want to copy some variables because there is not a
* simple way to add to them;
@@ -210,28 +209,28 @@ int ex_copy (int in_exoid, int out_exoid)
* element, and global results) are examples
*/
- if ( ( strcmp(var.name,VAR_QA_TITLE) != 0) &&
- ( strcmp(var.name,VAR_INFO) != 0) &&
- ( 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) &&
- ( 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) &&
+ if ( ( strcmp(var.name,VAR_QA_TITLE) != 0) &&
+ ( strcmp(var.name,VAR_INFO) != 0) &&
+ ( 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) &&
+ ( 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) &&
@@ -256,13 +255,13 @@ int ex_copy (int in_exoid, int out_exoid)
}
/* take the output file out of define mode */
- ncendef (out_exoid);
+ nc_enddef (out_exoid);
/* output variable data */
for (varid = 0; varid < nvars; varid++) {
- ncvarinq(in_exoid, varid, var.name, &var.type, &var.ndims,
- var.dims, &var.natts);
+ nc_inq_var(in_exoid, varid, var.name, &var.type, &var.ndims,
+ var.dims, &var.natts);
/* we don't want to copy some variable values;
* QA records and info records shouldn't be copied because there
@@ -317,28 +316,27 @@ int ex_copy (int in_exoid, int out_exoid)
/* ensure internal data structures are updated */
/* if number of blocks > 0 */
- update_internal_structs( out_exoid, EX_INQ_EDGE_BLK, &ed_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_FACE_BLK, &fa_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_ELEM_BLK, &eb_ctr_list );
+ 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));
/* if number of sets > 0 */
- update_internal_structs( out_exoid, EX_INQ_NODE_SETS, &ns_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_EDGE_SETS, &es_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_FACE_SETS, &fs_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_SIDE_SETS, &ss_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_ELEM_SETS, &els_ctr_list );
+ 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));
+ update_internal_structs( out_exoid, EX_INQ_FACE_SETS, ex_get_counter_list(EX_FACE_SET));
+ update_internal_structs( out_exoid, EX_INQ_SIDE_SETS, ex_get_counter_list(EX_SIDE_SET));
+ update_internal_structs( out_exoid, EX_INQ_ELEM_SETS, ex_get_counter_list(EX_ELEM_SET));
/* if number of maps > 0 */
- update_internal_structs( out_exoid, EX_INQ_NODE_MAP, &nm_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_EDGE_MAP, &edm_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_FACE_MAP, &fam_ctr_list );
- update_internal_structs( out_exoid, EX_INQ_ELEM_MAP, &em_ctr_list );
+ update_internal_structs( out_exoid, EX_INQ_NODE_MAP, ex_get_counter_list(EX_NODE_MAP));
+ update_internal_structs( out_exoid, EX_INQ_EDGE_MAP, ex_get_counter_list(EX_EDGE_MAP));
+ update_internal_structs( out_exoid, EX_INQ_FACE_MAP, ex_get_counter_list(EX_FACE_MAP));
+ update_internal_structs( out_exoid, EX_INQ_ELEM_MAP, ex_get_counter_list(EX_ELEM_MAP));
return(EX_NOERR);
}
-int
-cpy_att(int in_id,int out_id,int var_in_id,int var_out_id)
+int cpy_att(int in_id,int out_id,int var_in_id,int var_out_id)
/*
int in_id: input netCDF input-file ID
int out_id: input netCDF output-file ID
@@ -354,30 +352,25 @@ cpy_att(int in_id,int out_id,int var_in_id,int var_out_id)
int idx;
int nbr_att;
- if(var_in_id == NC_GLOBAL){
- ncinquire(in_id,(int *)NULL,(int *)NULL,&nbr_att,(int *)NULL);
-
- }else{
- ncvarinq(in_id,var_in_id,(char *)NULL,(nc_type *)NULL,
- (int *)NULL,(int*)NULL,&nbr_att);
- } /* end else */
+ if(var_in_id == NC_GLOBAL) {
+ nc_inq_natts(in_id,&nbr_att);
+ } else {
+ nc_inq_varnatts(in_id, var_in_id, &nbr_att);
+ }
/* Get the attributes names, types, lengths, and values */
- for(idx=0;idx<nbr_att;idx++){
+ for (idx=0; idx<nbr_att; idx++) {
char att_nm[MAX_STR_LENGTH];
- ncattname(in_id,var_in_id,idx,att_nm);
-
- ncattcopy(in_id,var_in_id,att_nm,out_id,var_out_id);
- } /* end loop over attributes */
+ nc_inq_attname(in_id, var_in_id, idx, att_nm);
+ nc_copy_att(in_id, var_in_id, att_nm, out_id, var_out_id);
+ }
return(EX_NOERR);
+}
-} /* end cpy_att() */
-
-int
-cpy_coord_def(int in_id,int out_id,int rec_dim_id,char *var_nm,
- int in_large, int out_large)
+int cpy_coord_def(int in_id,int out_id,int rec_dim_id,char *var_nm,
+ int in_large, int out_large)
/*
int in_id: input netCDF input-file ID
int out_id: input netCDF output-file ID
@@ -389,7 +382,8 @@ cpy_coord_def(int in_id,int out_id,int rec_dim_id,char *var_nm,
*/
{
const char *routine = NULL;
- long spatial_dim;
+ int status;
+ size_t spatial_dim;
int nbr_dim;
int temp;
@@ -404,70 +398,59 @@ cpy_coord_def(int in_id,int out_id,int rec_dim_id,char *var_nm,
/* At this point, know that in_large != out_large, so some change to
the coord variable definition is needed. Also will need the
spatial dimension, so get that now.*/
- ex_get_dimension(in_id, DIM_NUM_DIM, "dimension", &spatial_dim, routine);
+ ex_get_dimension(in_id, DIM_NUM_DIM, "dimension", &spatial_dim, &temp, routine);
if (in_large == 0 && out_large == 1) {
/* output file will have coordx, coordy, coordz (if 3d). See if
they are already defined in output file. Assume either all or
none are defined. */
- temp = ncopts;
- ncopts=0;
{
- int var_out_idx = ncvarid(out_id, VAR_COORD_X);
- int var_out_idy = ncvarid(out_id, VAR_COORD_Y);
- int var_out_idz = ncvarid(out_id, VAR_COORD_Z);
- ncopts = temp;
- if (var_out_idx != -1 && var_out_idy != -1 &&
- (spatial_dim == 2 || var_out_idz != -1)) {
- return var_out_idx;
+ int var_out_idx, var_out_idy, var_out_idz;
+ int status1 = nc_inq_varid(out_id, VAR_COORD_X, &var_out_idx);
+ int status2 = nc_inq_varid(out_id, VAR_COORD_Y, &var_out_idy);
+ int status3 = nc_inq_varid(out_id, VAR_COORD_Y, &var_out_idz);
+
+ if (status1 == NC_NOERR && status2 == NC_NOERR &&
+ (spatial_dim == 2 || status3 == NC_NOERR)) {
+ return NC_NOERR; /* already defined in output file */
}
}
/* Get dimid of the num_nodes dimension in output file... */
- dim_out_id[0]=ncdimid(out_id,DIM_NUM_NODES);
+ nc_inq_dimid(out_id, DIM_NUM_NODES, &dim_out_id[0]);
/* Define the variables in the output file */
/* Define according to the EXODUS file's IO_word_size */
nbr_dim = 1;
- var_out_id=ncvardef(out_id,VAR_COORD_X,nc_flt_code(out_id),
- nbr_dim, dim_out_id);
- var_out_id=ncvardef(out_id,VAR_COORD_Y,nc_flt_code(out_id),
- nbr_dim, dim_out_id);
+ nc_def_var(out_id, VAR_COORD_X, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id);
+ nc_def_var(out_id, VAR_COORD_Y, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id);
if (spatial_dim == 3)
- var_out_id=ncvardef(out_id,VAR_COORD_Z,nc_flt_code(out_id),
- nbr_dim, dim_out_id);
-
+ nc_def_var(out_id, VAR_COORD_Z, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id);
}
if (in_large == 1 && out_large == 0) {
/* input file has coordx, coordy, coordz (if 3d); output will only
have "coord". See if is already defined in output file. */
- temp = ncopts;
- ncopts=0;
- var_out_id = ncvarid(out_id, VAR_COORD);
- ncopts = temp;
-
- if (var_out_id != -1)
- return var_out_id;
+ status = nc_inq_varid(out_id, VAR_COORD, &var_out_id);
+ if (status == NC_NOERR)
+ return NC_NOERR; /* already defined in output file */
/* Get dimid of the spatial dimension and num_nodes dimensions in output file... */
- dim_out_id[0]=ncdimid(out_id,DIM_NUM_DIM);
- dim_out_id[1]=ncdimid(out_id,DIM_NUM_NODES);
+ nc_inq_dimid(out_id, DIM_NUM_DIM, &dim_out_id[0]);
+ nc_inq_dimid(out_id, DIM_NUM_NODES, &dim_out_id[1]);
/* Define the variable in the output file */
/* Define according to the EXODUS file's IO_word_size */
nbr_dim = 2;
- var_out_id=ncvardef(out_id,VAR_COORD,nc_flt_code(out_id),
- nbr_dim, dim_out_id);
+ nc_def_var(out_id, VAR_COORD, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id);
}
return var_out_id;
}
-int
-cpy_var_def(int in_id,int out_id,int rec_dim_id,char *var_nm)
+int cpy_var_def(int in_id,int out_id,int rec_dim_id,char *var_nm)
/*
int in_id: input netCDF input-file ID
int out_id: input netCDF output-file ID
@@ -480,31 +463,27 @@ cpy_var_def(int in_id,int out_id,int rec_dim_id,char *var_nm)
* to an output netCDF file.
*/
+ int status;
int *dim_in_id;
int *dim_out_id;
int idx;
int nbr_dim;
int var_in_id;
int var_out_id;
- int temp;
-
- extern int ncopts;
nc_type var_type;
/* See if the requested variable is already in the output file. */
- temp = ncopts;
- ncopts=0;
- var_out_id=ncvarid(out_id,var_nm);
- ncopts = temp;
- if(var_out_id != -1) return var_out_id;
+ status = nc_inq_varid(out_id, var_nm, &var_out_id);
+ if(status == NC_NOERR)
+ return var_out_id;
/* See if the requested variable is in the input file. */
- var_in_id=ncvarid(in_id,var_nm);
+ nc_inq_varid(in_id, var_nm, &var_in_id);
/* Get the type of the variable and the number of dimensions. */
- ncvarinq(in_id,var_in_id,(char *)NULL,&var_type,&nbr_dim,
- (int *)NULL,(int *)NULL);
+ nc_inq_vartype (in_id, var_in_id, &var_type);
+ nc_inq_varndims(in_id, var_in_id, &nbr_dim);
/* Recall:
1. The dimensions must be defined before the variable.
@@ -515,31 +494,27 @@ cpy_var_def(int in_id,int out_id,int rec_dim_id,char *var_nm)
dim_out_id=malloc(nbr_dim*sizeof(int));
/* Get the dimension IDs */
- ncvarinq(in_id,var_in_id,(char *)NULL,(nc_type *)NULL,
- (int *)NULL,dim_in_id,(int *)NULL);
+ nc_inq_vardimid(in_id, var_in_id, dim_in_id);
/* Get the dimension sizes and names */
for(idx=0;idx<nbr_dim;idx++){
- char dim_nm[MAX_NC_NAME];
- long dim_sz;
+ char dim_nm[NC_MAX_NAME];
+ size_t dim_sz;
- ncdiminq(in_id,dim_in_id[idx],dim_nm,&dim_sz);
+ nc_inq_dim(in_id, dim_in_id[idx], dim_nm, &dim_sz);
/* See if the dimension has already been defined */
- temp = ncopts;
- ncopts = 0;
- dim_out_id[idx]=ncdimid(out_id,dim_nm);
- ncopts = temp;
+ status = nc_inq_dimid(out_id, dim_nm, &dim_out_id[idx]);
/* If the dimension hasn't been defined, copy it */
- if(dim_out_id[idx] == -1){
- if(dim_in_id[idx] != rec_dim_id){
- dim_out_id[idx]=ncdimdef(out_id,dim_nm,dim_sz);
- }else{
- dim_out_id[idx]=ncdimdef(out_id,dim_nm,NC_UNLIMITED);
- } /* end else */
- } /* end if */
- } /* end loop over dim */
+ if (status != NC_NOERR) {
+ if (dim_in_id[idx] != rec_dim_id) {
+ nc_def_dim(out_id, dim_nm, dim_sz, &dim_out_id[idx]);
+ } else {
+ nc_def_dim(out_id, dim_nm, NC_UNLIMITED, &dim_out_id[idx]);
+ }
+ }
+ }
/* Define the variable in the output file */
@@ -547,10 +522,9 @@ cpy_var_def(int in_id,int out_id,int rec_dim_id,char *var_nm)
file's IO_word_size */
if ((var_type == NC_FLOAT) || (var_type == NC_DOUBLE)) {
- var_out_id=ncvardef(out_id,var_nm,nc_flt_code(out_id),
- nbr_dim,dim_out_id);
+ nc_def_var(out_id, var_nm, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id);
} else {
- var_out_id=ncvardef(out_id,var_nm,var_type,nbr_dim,dim_out_id);
+ nc_def_var(out_id, var_nm, var_type, nbr_dim, dim_out_id, &var_out_id);
}
/* Free the space holding the dimension IDs */
@@ -577,40 +551,36 @@ cpy_var_val(int in_id,int out_id,char *var_nm)
int nbr_dim;
int var_in_id;
int var_out_id;
- long *dim_cnt;
- long *dim_sz;
- long *dim_srt;
- long var_sz=1L;
-
+ size_t *dim_cnt;
+ size_t *dim_sz;
+ size_t *dim_srt;
+ size_t var_sz=1L;
nc_type var_type_in, var_type_out;
void *void_ptr;
/* Get the var_id for the requested variable from both files. */
- var_in_id=ncvarid(in_id,var_nm);
-
- var_out_id=ncvarid(out_id,var_nm);
+ nc_inq_varid(in_id, var_nm, &var_in_id);
+ nc_inq_varid(out_id,var_nm, &var_out_id);
/* Get the number of dimensions for the variable. */
+ nc_inq_vartype( out_id, var_out_id, &var_type_out);
+ nc_inq_varndims(out_id, var_out_id, &nbr_dim);
- ncvarinq(out_id,var_out_id,(char *)NULL,&var_type_out,&nbr_dim,
- (int *)NULL,(int *)NULL);
-
- ncvarinq(in_id,var_in_id,(char *)NULL,&var_type_in,&nbr_dim,
- (int *)NULL,(int *)NULL);
+ nc_inq_vartype( in_id, var_in_id, &var_type_in);
+ nc_inq_varndims(in_id, var_in_id, &nbr_dim);
/* Allocate space to hold the dimension IDs */
- dim_cnt = malloc(nbr_dim*sizeof(long));
+ dim_cnt = malloc(nbr_dim*sizeof(size_t));
dim_id=malloc(nbr_dim*sizeof(int));
- dim_sz=malloc(nbr_dim*sizeof(long));
+ dim_sz=malloc(nbr_dim*sizeof(size_t));
- dim_srt=malloc(nbr_dim*sizeof(long));
+ dim_srt=malloc(nbr_dim*sizeof(size_t));
/* Get the dimension IDs from the input file */
- ncvarinq(in_id,var_in_id,(char *)NULL,(nc_type *)NULL,
- (int *)NULL,dim_id,(int *)NULL);
+ nc_inq_vardimid(in_id, var_in_id, dim_id);
/* Get the dimension sizes and names from the input file */
for(idx=0;idx<nbr_dim;idx++){
@@ -622,7 +592,7 @@ cpy_var_val(int in_id,int out_id,char *var_nm)
the reason for always reading the input file for the dimension
sizes. */
- ncdiminq(in_id,dim_id[idx],(char *)NULL,dim_cnt+idx);
+ nc_inq_dimlen(in_id,dim_id[idx],dim_cnt+idx);
/* Initialize the indicial offset and stride arrays */
dim_srt[idx]=0L;
@@ -630,7 +600,7 @@ cpy_var_val(int in_id,int out_id,char *var_nm)
} /* end loop over dim */
/* Allocate enough space to hold the variable */
- void_ptr=malloc(var_sz*nctypelen(var_type_in));
+ void_ptr=malloc(var_sz * type_size(var_type_in));
/* Get the variable */
@@ -638,64 +608,54 @@ cpy_var_val(int in_id,int out_id,char *var_nm)
if(nbr_dim==0){ /* variable is a scalar */
- ncvarget1(in_id,var_in_id,0L,void_ptr);
-
- if ( ( (var_type_in == NC_FLOAT) && (var_type_out == NC_FLOAT) ) ||
- ( (var_type_in == NC_DOUBLE) && (var_type_out == NC_DOUBLE) ) ) {
- /* no conversion necessary */
-
- ncvarput1(out_id,var_out_id,0L,void_ptr);
-
- } else if ( (var_type_in == NC_FLOAT) && (var_type_out == NC_DOUBLE) ) {
- /* convert up */
-
- ncvarput1(out_id,var_out_id,0L,
- ex_conv_array (out_id, WRITE_CONVERT_UP, void_ptr, 1));
-
- } else if ( (var_type_in == NC_DOUBLE) && (var_type_out == NC_FLOAT) ) {
- /* convert down */
-
- ncvarput1(out_id,var_out_id,0L,
- ex_conv_array (out_id, WRITE_CONVERT_DOWN, void_ptr, 1));
-
- } else { /* variable isn't float or double */
+ if (var_type_in == NC_INT && var_type_out == NC_INT) {
+ nc_get_var1_int(in_id, var_in_id, 0L, void_ptr);
+ nc_put_var1_int(out_id, var_out_id, 0L, void_ptr);
+ }
- /* no conversion necessary */
+ else if (var_type_in == NC_FLOAT) {
+ nc_get_var1_float(in_id, var_in_id, 0L, void_ptr);
+ nc_put_var1_float(out_id, var_out_id, 0L, void_ptr);
+ }
- ncvarput1(out_id,var_out_id,0L,void_ptr);
+ else if (var_type_in == NC_DOUBLE) {
+ nc_get_var1_double(in_id, var_in_id, 0L, void_ptr);
+ nc_put_var1_double(out_id, var_out_id, 0L, void_ptr);
+ }
+ else if (var_type_in == NC_CHAR) {
+ nc_get_var1_text(in_id, var_in_id, 0L, void_ptr);
+ nc_put_var1_text(out_id, var_out_id, 0L, void_ptr);
}
+ else {
+ assert(1==0);
+ }
} else { /* variable is a vector */
- ncvarget(in_id,var_in_id,dim_srt,dim_cnt,void_ptr);
-
- if ( ( (var_type_in == NC_FLOAT) && (var_type_out == NC_FLOAT) ) ||
- ( (var_type_in == NC_DOUBLE) && (var_type_out == NC_DOUBLE) ) ) {
- /* no conversion necessary */
-
- ncvarput(out_id,var_out_id,dim_srt,dim_cnt,void_ptr);
-
- } else if ( (var_type_in == NC_FLOAT) && (var_type_out == NC_DOUBLE) ) {
- /* convert up */
-
- ncvarput(out_id,var_out_id,dim_srt,dim_cnt,
- ex_conv_array (out_id,WRITE_CONVERT_UP,void_ptr,var_sz));
-
- } else if ( (var_type_in == NC_DOUBLE) && (var_type_out == NC_FLOAT) ) {
- /* convert down */
-
- ncvarput(out_id,var_out_id,dim_srt,dim_cnt,
- ex_conv_array (out_id,WRITE_CONVERT_DOWN,void_ptr,var_sz));
-
- } else { /* variable isn't float or double */
+ if (var_type_in == NC_INT && var_type_out == NC_INT) {
+ nc_get_var_int(in_id, var_in_id, void_ptr);
+ nc_put_var_int(out_id, var_out_id, void_ptr);
+ }
- /* no conversion necessary */
+ else if (var_type_in == NC_FLOAT) {
+ nc_get_var_float(in_id, var_in_id, void_ptr);
+ nc_put_var_float(out_id, var_out_id, void_ptr);
+ }
- ncvarput(out_id,var_out_id,dim_srt,dim_cnt,void_ptr);
+ else if (var_type_in == NC_DOUBLE) {
+ nc_get_var_double(in_id, var_in_id, void_ptr);
+ nc_put_var_double(out_id, var_out_id, void_ptr);
+ }
+ else if (var_type_in == NC_CHAR) {
+ nc_get_var_text(in_id, var_in_id, void_ptr);
+ nc_put_var_text(out_id, var_out_id, void_ptr);
}
+ else {
+ assert(1==0);
+ }
} /* end if variable is an array */
/* Free the space that held the dimension IDs */
@@ -725,9 +685,10 @@ cpy_coord_val(int in_id,int out_id,char *var_nm,
*/
const char *routine = NULL;
- int i;
- long spatial_dim, num_nodes;
- long start[2], count[2];
+ int temp;
+ size_t i;
+ size_t spatial_dim, num_nodes;
+ size_t start[2], count[2];
nc_type var_type_in, var_type_out;
void *void_ptr;
@@ -738,96 +699,76 @@ cpy_coord_val(int in_id,int out_id,char *var_nm,
/* At this point, know that in_large != out_large, so will need to
either copy a vector to multiple scalars or vice-versa. Also
- will a couple dimensions, so get them now.*/
- ex_get_dimension(in_id, DIM_NUM_DIM, "dimension", &spatial_dim, routine);
- ex_get_dimension(in_id, DIM_NUM_NODES, "nodes", &num_nodes, routine);
+ will need a couple dimensions, so get them now.*/
+ ex_get_dimension(in_id, DIM_NUM_DIM, "dimension", &spatial_dim, &temp, routine);
+ ex_get_dimension(in_id, DIM_NUM_NODES, "nodes", &num_nodes, &temp, routine);
if (in_large == 0 && out_large == 1) {
/* output file will have coordx, coordy, coordz (if 3d). */
/* Get the var_id for the requested variable from both files. */
int var_in_id, var_out_id[3];
- var_in_id = ncvarid(in_id, VAR_COORD);
- var_out_id[0] = ncvarid(out_id,VAR_COORD_X);
- var_out_id[1] = ncvarid(out_id,VAR_COORD_Y);
- var_out_id[2] = ncvarid(out_id,VAR_COORD_Z);
+ nc_inq_varid(in_id, VAR_COORD, &var_in_id);
- ncvarinq(in_id,var_in_id,(char *)NULL,&var_type_in,(int*)NULL,
- (int *)NULL,(int *)NULL);
- ncvarinq(out_id,var_out_id[0],(char *)NULL,&var_type_out,(int *)NULL,
- (int *)NULL,(int *)NULL);
+ nc_inq_varid(out_id, VAR_COORD_X, &var_out_id[0]);
+ nc_inq_varid(out_id, VAR_COORD_Y, &var_out_id[1]);
+ nc_inq_varid(out_id, VAR_COORD_Z, &var_out_id[2]);
- void_ptr=malloc(num_nodes * nctypelen(var_type_in));
+ nc_inq_vartype( in_id, var_in_id, &var_type_in);
+ nc_inq_vartype(out_id, var_out_id[0], &var_type_out);
+
+ void_ptr=malloc(num_nodes * type_size(var_type_in));
/* Copy each component of the variable... */
for (i=0; i < spatial_dim; i++) {
start[0] = i; start[1] = 0;
count[0] = 1; count[1] = num_nodes;
- ncvarget(in_id, var_in_id, start, count, void_ptr);
-
- if (var_type_in == var_type_out) {
- if (var_type_out == NC_FLOAT) {
- nc_put_var_float(out_id, var_out_id[i], void_ptr);
- } else {
- nc_put_var_double(out_id, var_out_id[i], void_ptr);
- }
- } else if (var_type_in == NC_FLOAT && var_type_out == NC_DOUBLE) {
- nc_put_var_double(out_id, var_out_id[i],
- ex_conv_array(out_id, WRITE_CONVERT_UP, void_ptr, num_nodes));
- } else if (var_type_in == NC_DOUBLE && var_type_out == NC_FLOAT) {
- nc_put_var_float(out_id, var_out_id[i],
- ex_conv_array(out_id, WRITE_CONVERT_DOWN, void_ptr, num_nodes));
+ if (var_type_in == NC_FLOAT) {
+ nc_get_vara_float(in_id, var_in_id, start, count, void_ptr);
+ nc_put_var_float(out_id, var_out_id[i], void_ptr);
+ } else {
+ assert(var_type_in == NC_DOUBLE);
+ nc_get_vara_double(in_id, var_in_id, start, count, void_ptr);
+ nc_put_var_double(out_id, var_out_id[i], void_ptr);
}
}
}
if (in_large == 1 && out_large == 0) {
- /* input file will have coordx, coordy, coordz (if 3d); output has
- only "coord" */
+ /* input file will have coordx, coordy, coordz (if 3d); output has only "coord" */
int var_in_id[3], var_out_id;
- var_in_id[0] = ncvarid(in_id, VAR_COORD_X);
- var_in_id[1] = ncvarid(in_id, VAR_COORD_Y);
- var_in_id[2] = ncvarid(in_id, VAR_COORD_Z);
- var_out_id = ncvarid(out_id, VAR_COORD);
+ nc_inq_varid(in_id, VAR_COORD_X, &var_in_id[0]);
+ nc_inq_varid(in_id, VAR_COORD_Y, &var_in_id[1]);
+ nc_inq_varid(in_id, VAR_COORD_Z, &var_in_id[2]);
+ nc_inq_varid(out_id, VAR_COORD, &var_out_id);
- ncvarinq(in_id,var_in_id[0],(char *)NULL,&var_type_in,(int *)NULL,
- (int *)NULL,(int *)NULL);
-
- ncvarinq(out_id,var_out_id,(char *)NULL,&var_type_out,(int*)NULL,
- (int *)NULL,(int *)NULL);
+ nc_inq_vartype(in_id, var_in_id[0], &var_type_in);
+ nc_inq_vartype(out_id, var_out_id, &var_type_out);
- void_ptr=malloc(num_nodes * nctypelen(var_type_in));
+ void_ptr=malloc(num_nodes * type_size(var_type_in));
/* Copy each component of the variable... */
for (i=0; i < spatial_dim; i++) {
- if (var_type_in == NC_FLOAT) {
- nc_get_var_float(in_id, var_in_id[i], void_ptr);
- } else {
- nc_get_var_double(in_id, var_in_id[i], void_ptr);
- }
-
start[0] = i; start[1] = 0;
count[0] = 1; count[1] = num_nodes;
- if (var_type_in == var_type_out) {
- ncvarput(out_id, var_out_id, start, count, void_ptr);
- } else if (var_type_in == NC_FLOAT && var_type_out == NC_DOUBLE) {
- ncvarput(out_id, var_out_id, start, count,
- ex_conv_array(out_id, WRITE_CONVERT_UP, void_ptr, num_nodes));
- } else if (var_type_in == NC_DOUBLE && var_type_out == NC_FLOAT) {
- ncvarput(out_id, var_out_id, start, count,
- ex_conv_array(out_id, WRITE_CONVERT_DOWN, void_ptr, num_nodes));
+
+ if (var_type_in == NC_FLOAT) {
+ nc_get_var_float( in_id, var_in_id[i], void_ptr);
+ nc_put_vara_float(out_id, var_out_id, start, count, void_ptr);
+
+ } else {
+ nc_get_var_double( in_id, var_in_id[i], void_ptr);
+ nc_put_vara_double(out_id, var_out_id, start, count, void_ptr);
}
}
}
/* Free the space that held the variable */
(void)free(void_ptr);
-
return(EX_NOERR);
-
} /* end cpy_coord_val() */
-void update_internal_structs( int out_exoid, int inqcode, struct list_item** ctr_list )
+void update_internal_structs( int out_exoid, ex_inquiry inqcode, struct list_item** ctr_list )
{
int i;
int number;
@@ -841,3 +782,17 @@ void update_internal_structs( int out_exoid, int inqcode, struct list_item** ctr
ex_inc_file_item (out_exoid, ctr_list);
}
}
+
+size_t type_size(nc_type type)
+{
+ if (type == NC_CHAR)
+ return sizeof(char);
+ else if (type == NC_INT)
+ return sizeof(int);
+ else if (type == NC_FLOAT)
+ return sizeof(float);
+ else if (type == NC_DOUBLE)
+ return sizeof(double);
+ else
+ return 0;
+}
diff --git a/cbind/src/excre.c b/cbind/src/excre.c
index 323ce05..efed293 100644
--- a/cbind/src/excre.c
+++ b/cbind/src/excre.c
@@ -48,173 +48,197 @@
*
* revision history -
*
-* $Id: excre.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* creates a new EXODUS II file and returns an id that can subsequently
- * be used to refer to the file
+ * be used to refer to the file. This in an internal function; the external
+ * name of this function ix ex_create()
+ * \param path filename of file to create.
+ * \param cmode access mode. Any of the defines in the \ref FileVars group or'd together.
+ * \param comp_ws The word size in bytes (0, 4 or 8) of the floating
+ * point variables used in the application program. If 0 (zero) is
+ * passed, the default sizeof(float) will be used and returned in this
+ * variable. WARNING: all EXODUS II functions requiring floats must be
+ * passed floats declared with this passed in or returned compute word
+ * size (4 or 8).
+ * \param io_ws The word size in bytes (4 or 8) of the floating point data as they
+ * are to be stored in the EXODUS II file.
+ * \param run_version (internally generated) used to verify compatability of libary and include files.
*/
-int ex_create (const char *path,
- int cmode,
- int *comp_ws,
- int *io_ws)
+int ex_create_int (const char *path,
+ int cmode,
+ int *comp_ws,
+ int *io_ws,
+ int run_version)
{
- int exoid, time_dim, dims[1];
- nclong lio_ws;
- nclong filesiz;
- float vers;
- char errmsg[MAX_ERR_LENGTH];
- char *mode_name;
- int mode = 0;
+ int exoid, time_dim, dims[1];
+ int status;
+ int dimid;
+ int old_fill;
+ int lio_ws;
+ int filesiz;
+ float vers;
+ char errmsg[MAX_ERR_LENGTH];
+ char *mode_name;
+ int mode = 0;
#if defined(NC_NETCDF4)
- static int netcdf4_mode = -1;
- char *option;
+ static int netcdf4_mode = -1;
+ char *option;
#endif /* NC_NETCDF4 */
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
+ if (run_version != EX_API_VERS_NODOT) {
+ int run_version_major = run_version / 100;
+ int run_version_minor = run_version % 100;
+ int lib_version_major = EX_API_VERS_NODOT / 100;
+ int lib_version_minor = EX_API_VERS_NODOT % 100;
+ fprintf(stderr, "EXODUSII: Warning: This code was compiled with exodusII version %d.%02d,\n but was linked with exodusII library version %d.%02d\n This is probably an error in the build process of this code.\n",
+ run_version_major, run_version_minor, lib_version_major, lib_version_minor);
+ }
#if defined(NC_NETCDF4)
- if (cmode & EX_NETCDF4) {
- mode |= NC_NETCDF4;
- } else {
- if (netcdf4_mode == -1) {
- option = getenv("EXODUS_NETCDF4");
- if (option != NULL) {
- fprintf(stderr, "EXODUSII: Using netcdf version 4 selected via EXODUS_NETCDF4 environment variable\n");
- netcdf4_mode = NC_NETCDF4;
- } else {
- netcdf4_mode = 0;
- }
- }
- mode |= netcdf4_mode;
- }
+ if (cmode & EX_NETCDF4) {
+ mode |= (NC_NETCDF4|NC_CLASSIC_MODEL);
+ } else {
+ if (netcdf4_mode == -1) {
+ option = getenv("EXODUS_NETCDF4");
+ if (option != NULL) {
+ fprintf(stderr, "EXODUSII: Using netcdf version 4 selected via EXODUS_NETCDF4 environment variable\n");
+ netcdf4_mode = NC_NETCDF4|NC_CLASSIC_MODEL;
+ } else {
+ netcdf4_mode = 0;
+ }
+ }
+ mode |= netcdf4_mode;
+ }
#endif
- /*
- * See if "large file" mode was specified in a ex_create cmode. If
- * so, then pass the NC_64BIT_OFFSET flag down to netcdf.
- * If netcdf4 mode specified, don't use NC_64BIT_OFFSET mode.
- */
- if ( (cmode & EX_LARGE_MODEL) && (cmode & EX_NORMAL_MODEL)) {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: conflicting mode specification for file %s, mode %d. Using normal",
- path, cmode);
- ex_err("ex_create",errmsg,exerrval);
- }
- if ((cmode & EX_NORMAL_MODEL) != 0)
- filesiz = 0;
- else
- filesiz = (nclong)(((cmode & EX_LARGE_MODEL) != 0) || (ex_large_model(-1) == 1));
+ /*
+ * See if "large file" mode was specified in a ex_create cmode. If
+ * so, then pass the NC_64BIT_OFFSET flag down to netcdf.
+ * If netcdf4 mode specified, don't use NC_64BIT_OFFSET mode.
+ */
+ if ( (cmode & EX_LARGE_MODEL) && (cmode & EX_NORMAL_MODEL)) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: conflicting mode specification for file %s, mode %d. Using normal",
+ path, cmode);
+ ex_err("ex_create",errmsg,exerrval);
+ }
+ if ((cmode & EX_NORMAL_MODEL) != 0)
+ filesiz = 0;
+#if defined(NC_NETCDF4)
+ else if ((mode & NC_NETCDF4) != 0)
+ filesiz = 1;
+#endif
+ else
+ filesiz = (int)(((cmode & EX_LARGE_MODEL) != 0) || (ex_large_model(-1) == 1));
- if (
+ if (
#if defined(NC_NETCDF4)
- !(mode & NC_NETCDF4) &&
+ !(mode & NC_NETCDF4) &&
#endif
- filesiz == 1) {
- mode |= NC_64BIT_OFFSET;
- }
+ filesiz == 1) {
+ mode |= NC_64BIT_OFFSET;
+ }
- if (cmode & EX_SHARE) {
- mode |= NC_SHARE;
- }
+ if (cmode & EX_SHARE) {
+ mode |= NC_SHARE;
+ }
-/*
- * set error handling mode to no messages, non-fatal errors
- */
+ /*
+ * set error handling mode to no messages, non-fatal errors
+ */
ex_opts(exoptval); /* call required to set ncopts first time through */
- if (cmode & EX_CLOBBER) {
- mode |= NC_CLOBBER;
- mode_name = "CLOBBER";
- } else {
- mode |= NC_NOCLOBBER;
- mode_name = "NOCLOBBER";
- }
+ if (cmode & EX_CLOBBER) {
+ mode |= NC_CLOBBER;
+ mode_name = "CLOBBER";
+ } else {
+ mode |= NC_NOCLOBBER;
+ mode_name = "NOCLOBBER";
+ }
- if ((exoid = nccreate (path, mode)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: file create failed for %s, mode: %s",
- path, mode_name);
- ex_err("ex_create",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_create (path, mode, &exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: file create failed for %s, mode: %s",
+ path, mode_name);
+ ex_err("ex_create",errmsg,exerrval);
+ return (EX_FATAL);
+ }
-/* turn off automatic filling of netCDF variables
- */
+ /* turn off automatic filling of netCDF variables
+ */
- if (ncsetfill (exoid, NC_NOFILL) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to set nofill mode in file id %d",
- exoid);
+ "Error: failed to set nofill mode in file id %d",
+ exoid);
ex_err("ex_create", errmsg, exerrval);
return (EX_FATAL);
}
-/* initialize floating point size conversion. since creating new file,
- * i/o wordsize attribute from file is zero.
- */
+ /* initialize floating point size conversion. since creating new file,
+ * i/o wordsize attribute from file is zero.
+ */
- if (ex_conv_ini( exoid, comp_ws, io_ws, 0 ) != EX_NOERR) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: failed to init conversion routines in file id %d",
+ if (ex_conv_ini( exoid, comp_ws, io_ws, 0 ) != EX_NOERR) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: failed to init conversion routines in file id %d",
exoid);
- ex_err("ex_create", errmsg, exerrval);
- return (EX_FATAL);
- }
+ ex_err("ex_create", errmsg, exerrval);
+ return (EX_FATAL);
+ }
-/* put the EXODUS version number, and i/o floating point word size as
- * netcdf global attributes
- */
+ /* put the EXODUS version number, and i/o floating point word size as
+ * netcdf global attributes
+ */
-/* store Exodus API version # as an attribute */
+ /* store Exodus API version # as an attribute */
vers = EX_API_VERS;
- if (ncattput (exoid, NC_GLOBAL, ATT_API_VERSION, NC_FLOAT, 1, &vers) == -1)
- {
- exerrval = ncerr;
+ if ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_API_VERSION,
+ NC_FLOAT, 1, &vers)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store Exodus II API version attribute in file id %d",
- exoid);
+ "Error: failed to store Exodus II API version attribute in file id %d",
+ exoid);
ex_err("ex_create",errmsg, exerrval);
return (EX_FATAL);
}
-
-/* store Exodus file version # as an attribute */
+
+ /* store Exodus file version # as an attribute */
vers = EX_VERS;
- if (ncattput (exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers) == -1)
- {
- exerrval = ncerr;
+ if ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store Exodus II file version attribute in file id %d",
- exoid);
+ "Error: failed to store Exodus II file version attribute in file id %d",
+ exoid);
ex_err("ex_create",errmsg, exerrval);
return (EX_FATAL);
}
-/* store Exodus file float word size as an attribute */
- lio_ws = (nclong)(*io_ws);
- if (ncattput (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, NC_LONG, 1, &lio_ws) == -1)
- {
- exerrval = ncerr;
+ /* store Exodus file float word size as an attribute */
+ lio_ws = (int)(*io_ws);
+ if ((status=nc_put_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, NC_INT, 1, &lio_ws)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store Exodus II file float word size attribute in file id %d",
- exoid);
+ "Error: failed to store Exodus II file float word size attribute in file id %d",
+ exoid);
ex_err("ex_create",errmsg, exerrval);
return (EX_FATAL);
}
/* store Exodus file size (1=large, 0=normal) as an attribute */
- if (ncattput (exoid, NC_GLOBAL, ATT_FILESIZE, NC_LONG, 1, &filesiz) == -1) {
- exerrval = ncerr;
+ if ((status = nc_put_att_int (exoid, NC_GLOBAL, ATT_FILESIZE, NC_INT, 1, &filesiz)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store Exodus II file size attribute in file id %d",
exoid);
@@ -226,62 +250,56 @@ int ex_create (const char *path,
*/
/* create string length dimension */
- if (ncdimdef (exoid, DIM_STR, (MAX_STR_LENGTH+1)) == -1)
- {
- exerrval = ncerr;
+ if ((status=nc_def_dim (exoid, DIM_STR, (MAX_STR_LENGTH+1), &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define string length in file id %d",exoid);
+ "Error: failed to define string length in file id %d",exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
/* create line length dimension */
- if (ncdimdef (exoid, DIM_LIN, (MAX_LINE_LENGTH+1)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid, DIM_LIN, (MAX_LINE_LENGTH+1), &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define line length in file id %d",exoid);
+ "Error: failed to define line length in file id %d",exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
/* create number "4" dimension; must be of type long */
- if (ncdimdef (exoid, DIM_N4, 4L) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid, DIM_N4, 4L, &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define number \"4\" dimension in file id %d",exoid);
+ "Error: failed to define number \"4\" dimension in file id %d",exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
- if ((time_dim = ncdimdef (exoid, DIM_TIME, NC_UNLIMITED)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid, DIM_TIME, NC_UNLIMITED, &time_dim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define time dimension in file id %d", exoid);
+ "Error: failed to define time dimension in file id %d", exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
dims[0] = time_dim;
- if ((ncvardef (exoid, VAR_WHOLE_TIME, nc_flt_code(exoid), 1, dims)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid, VAR_WHOLE_TIME, nc_flt_code(exoid), 1, dims, &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define whole time step variable in file id %d",
- exoid);
+ "Error: failed to define whole time step variable in file id %d",
+ exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to complete definition for file id %d", exoid);
+ "Error: failed to complete definition for file id %d", exoid);
ex_err("ex_create",errmsg,exerrval);
return (EX_FATAL);
}
diff --git a/cbind/src/exerr.c b/cbind/src/exerr.c
index 3710e03..2ef1609 100644
--- a/cbind/src/exerr.c
+++ b/cbind/src/exerr.c
@@ -36,12 +36,6 @@
*
* exerr - ex_err
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* char* pname procedure name
@@ -52,20 +46,15 @@
*
* revision history -
*
-* $Id: exerr.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
-/* Generalized error reporting function
- * global integer used for suppressing error messages and determining
- * the fatality of errors.
- */
-
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "netcdf.h"
#include "exodusII.h"
+#include "exodusII_int.h"
int exerrval = 0; /* clear initial global error code value */
@@ -73,9 +62,28 @@ static char last_pname[MAX_ERR_LENGTH];
static char last_errmsg[MAX_ERR_LENGTH];
static int last_errcode;
-void ex_err( const char *pname, /* procedure name */
- const char *err_string, /* error message string */
- int errcode) /* error code */
+/**
+ * Generalized error reporting function.
+ * global integer used for
+ * suppressing error messages and determining the fatality of errors.
+ * \param pname string containing the name of the calling function.
+ * \param err_string string containing a message explaining the error or problem.
+ * If EX_VERBOSE (see ex_opts()) is true, this message will be
+ * printed to stderr. Otherwise, nothing will be printed.
+ * Maximum length is #MAX_ERR_LENGTH.
+
+ * \param errcode code identifying the error. EXODUS II C functions
+ * place an error code value in exerrval, an external int. Negative
+ * values are considered fatal errors while positive values are
+ * warnings. There is a set of predefined values defined in
+ * exodusII.h, see group \ref ErrorReturnCodes.
+ * The predefined constant #EX_PRTLASTMSG will cause the
+ * last error message to be output, regardless of the setting of the
+ * error reporting level (see ex_opts()).
+ */
+void ex_err(const char *pname,
+ const char *err_string,
+ int errcode)
{
if (errcode == 0) /* zero is no error, ignore and return */
return;
@@ -97,8 +105,8 @@ void ex_err( const char *pname, /* procedure name */
case NC_ESTS:
fprintf (stderr," In FORTRAN interface, string too small\n");
break;
- case NC_ENTOOL:
- fprintf (stderr," length of name exceeds MAX_NC_NAME\n");
+ case NC_EMAXNAME:
+ fprintf (stderr," length of name exceeds NC_MAX_NAME\n");
break;
case EX_MSG:
break;
@@ -116,3 +124,11 @@ void ex_err( const char *pname, /* procedure name */
if ((errcode > 0) && (exoptval & EX_ABORT))
exit (errcode);
}
+
+void ex_get_err( const char** msg, const char** func, int* errcode )
+ {
+ (*msg) = last_errmsg;
+ (*func) = last_pname;
+ (*errcode) = last_errcode;
+ }
+
diff --git a/cbind/src/exgatm.c b/cbind/src/exgatm.c
index f5e8287..fe401ef 100644
--- a/cbind/src/exgatm.c
+++ b/cbind/src/exgatm.c
@@ -36,13 +36,6 @@
*
* exgatm - get all time values
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +45,6 @@
*
* revision history -
*
-* $Id: exgatm.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -60,72 +52,47 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
- * reads all the time values for history or whole time steps
+/*!
+ * reads the time values for all time steps. Memory must be allocated
+ * for the time values array before this function is invoked. The
+ * storage requirements (equal to the number of time steps) can be
+ * determined by using the ex_inquire() routine.
+ * \param exoid exodus file id
+ * \param[out] time_values Returned array of time values at all time steps.
*/
int ex_get_all_times (int exoid,
void *time_values)
-
{
- int dimid, varid;
- long start[1], count[1];
- char var_name[MAX_VAR_NAME_LENGTH+1];
+ int varid;
+ int status;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0;
-/* inquire previously defined dimensions */
-
- strcpy (var_name, VAR_WHOLE_TIME);
- if (((dimid = ncdimid (exoid, DIM_TIME))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate whole time step dimension in file id %d",
- exoid);
- ex_err("ex_get_all_times",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-/* inquire previously defined variable */
-
- if ((varid = ncvarid (exoid, var_name)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to locate time variable %s in file id %d",
- var_name,exoid);
+ VAR_WHOLE_TIME, exoid);
ex_err("ex_get_all_times",errmsg,exerrval);
return(EX_FATAL);
}
-
-/*read time values */
-
- start[0] = 0;
-
- if (ncdiminq (exoid, dimid, (char *) 0, count) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %s time values in file id %d",
- var_name,exoid);
- ex_err("ex_get_all_times",errmsg,exerrval);
- return(EX_FATAL);
+ /*read time values */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var_float(exoid, varid, time_values);
+ } else {
+ status = nc_get_var_double(exoid, varid, time_values);
}
-
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,time_values,(int)count[0])) == -1)
- {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get %s time values from file id %d",
- var_name,exoid);
+ "Error: failed to get time values from file id %d",
+ exoid);
ex_err("ex_get_all_times",errmsg,exerrval);
return(EX_FATAL);
}
- ex_conv_array( exoid, READ_CONVERT, time_values, count[0] );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgatn.c b/cbind/src/exgatn.c
index f31b1b3..9109e53 100644
--- a/cbind/src/exgatn.c
+++ b/cbind/src/exgatn.c
@@ -46,9 +46,7 @@
* char* names[] ptr array of attribute names
*
* revision history -
-* 20061003 - David Thompson - adapted from ex_get_elem_attr_names
*
-* $Id: exgatn.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,67 +57,66 @@
* reads the attribute names for an element block
*/
int ex_get_attr_names( int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
char **names)
{
+ int status;
int varid, numattrdim, obj_id_ndx;
- long num_attr, start[2];
+ size_t num_attr, start[2], i;
char *ptr;
char errmsg[MAX_ERR_LENGTH];
- int i, j;
- const char* tname;
- const char* vobjids;
+ int j;
const char* dnumobjatt;
const char* vattrbname;
- switch (obj_type) {
- case EX_EDGE_BLOCK:
- tname = "edge block";
- vobjids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face block";
- vobjids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element block";
- vobjids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Error: Invalid object type (%d) specified for file id %d",
- obj_type, exoid );
- ex_err( "ex_get_attr_names", errmsg, exerrval );
- return (EX_FATAL);
- }
-
exerrval = 0; /* clear error code */
/* Determine index of obj_id in vobjids array */
- obj_id_ndx = ex_id_lkup(exoid,vobjids,obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no attributes found for NULL block %d in file id %d",
- obj_id,exoid);
- ex_err("ex_get_attr_names",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this object */
- }
- else
- {
- sprintf(errmsg,
- "Warning: failed to locate %s id %d in %s array in file id %d",
- tname, obj_id,vobjids, exoid);
- ex_err("ex_get_attr_names",errmsg,exerrval);
- return (EX_WARN);
+ if (obj_type != EX_NODAL) {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes found for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_get_attr_names",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this object */
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_get_attr_names",errmsg,exerrval);
+ return (EX_WARN);
+ }
}
}
-
switch (obj_type) {
+ case EX_NODE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vattrbname = VAR_NAME_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_SIDE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vattrbname = VAR_NAME_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vattrbname = VAR_NAME_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vattrbname = VAR_NAME_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vattrbname = VAR_NAME_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vattrbname = VAR_NAME_NATTRIB;
+ break;
case EX_EDGE_BLOCK:
dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
vattrbname = VAR_NAME_EATTRIB(obj_id_ndx);
@@ -132,25 +129,30 @@ int ex_get_attr_names( int exoid,
dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
vattrbname = VAR_NAME_ATTRIB(obj_id_ndx);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
+ ex_err("ex_get_attr_names",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
}
-/* inquire id's of previously defined dimensions */
+ /* inquire id's of previously defined dimensions */
- if ((numattrdim = ncdimid(exoid, dnumobjatt)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, dnumobjatt, &numattrdim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Warning: no attributes found for %s %d in file id %d",
- tname,obj_id,exoid);
+ "Warning: no attributes found for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
ex_err("ex_get_attr_names",errmsg,EX_MSG);
return (EX_WARN); /* no attributes for this object */
}
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of attributes for block %d in file id %d",
- obj_id,exoid);
+ "Error: failed to get number of attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
ex_err("ex_get_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
@@ -158,11 +160,11 @@ int ex_get_attr_names( int exoid,
/* It is OK if we don't find the attribute names since they were
added at version 4.26; earlier databases won't have the names.
*/
- varid = ncvarid (exoid, vattrbname);
+ status = nc_inq_varid(exoid, vattrbname, &varid);
-/* read in the attributes */
+ /* read in the attributes */
- if (varid != -1) {
+ if (status == NC_NOERR) {
/* read the names */
for (i=0; i < num_attr; i++) {
start[0] = i;
@@ -171,40 +173,40 @@ int ex_get_attr_names( int exoid,
j = 0;
ptr = names[i];
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var1_text (exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get names for %s %d in file id %d",
- tname, obj_id, exoid);
+ ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_get_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {
start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get names for %s %d in file id %d",
- tname, obj_id, exoid);
+ ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_get_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
- }
- --ptr;
- if (ptr > names[i]) {
- /* get rid of trailing blanks */
- while (*(--ptr) == ' ');
- }
- *(++ptr) = '\0';
- }
- } else {
- /* Names variable does not exist on the database; probably since this is an
- * older version of the database. Return an empty array...
- */
- for (i=0; i<num_attr; i++) {
- names[i][0] = '\0';
- }
- }
+ }
+ --ptr;
+ if (ptr > names[i]) {
+ /* get rid of trailing blanks */
+ while (--ptr >= names[i] && *ptr == ' ');
+ }
+ *(++ptr) = '\0';
+ }
+ } else {
+ /* Names variable does not exist on the database; probably since this is an
+ * older version of the database. Return an empty array...
+ */
+ for (i=0; i<num_attr; i++) {
+ names[i][0] = '\0';
+ }
+ }
return(EX_NOERR);
}
diff --git a/cbind/src/exgatt.c b/cbind/src/exgatt.c
index e097086..a0e6cec 100644
--- a/cbind/src/exgatt.c
+++ b/cbind/src/exgatt.c
@@ -36,14 +36,6 @@
*
* exgatt - ex_get_attr
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,9 +46,7 @@
* float* attrib array of attributes
*
* revision history -
-* 20061003 - David Thompson - Adapted from ex_get_elem_attr
*
-* $Id: exgatt.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -68,160 +58,103 @@
*/
int ex_get_attr( int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
void* attrib )
{
- int numobjentdim, numattrdim, attrid, obj_id_ndx;
- long num_entries_this_obj, num_attr, start[2], count[2];
+ int status;
+ int attrid, obj_id_ndx;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* vobjids;
- const char* dnumobjent;
- const char* dnumobjatt;
const char* vattrbname;
- switch (obj_type) {
- case EX_EDGE_BLOCK:
- tname = "edge block";
- vobjids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face block";
- vobjids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element block";
- vobjids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Error: Invalid object type (%d) specified for file id %d",
- obj_type, exoid );
- ex_err( "ex_get_attr", errmsg, exerrval );
- return (EX_FATAL);
- }
-
exerrval = 0; /* clear error code */
/* Determine index of obj_id in vobjids array */
- obj_id_ndx = ex_id_lkup(exoid,vobjids,obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no attributes found for NULL block %d in file id %d",
- obj_id,exoid);
- ex_err("ex_get_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this object */
- }
- else
- {
- sprintf(errmsg,
- "Warning: failed to locate %s id %d in %s array in file id %d",
- tname,obj_id,vobjids, exoid);
- ex_err("ex_get_attr",errmsg,exerrval);
- return (EX_WARN);
+ if (obj_type == EX_NODAL)
+ obj_id_ndx = 0;
+ else {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes found for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_get_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this object */
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type),obj_id, exoid);
+ ex_err("ex_get_attr",errmsg,exerrval);
+ return (EX_WARN);
+ }
}
}
switch (obj_type) {
+ case EX_SIDE_SET:
+ vattrbname = VAR_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ vattrbname = VAR_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ vattrbname = VAR_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ vattrbname = VAR_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ vattrbname = VAR_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ vattrbname = VAR_NATTRIB;
+ break;
case EX_EDGE_BLOCK:
- dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
- dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
vattrbname = VAR_EATTRIB(obj_id_ndx);
break;
case EX_FACE_BLOCK:
- dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx);
- dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
vattrbname = VAR_FATTRIB(obj_id_ndx);
break;
case EX_ELEM_BLOCK:
- dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx);
- dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
vattrbname = VAR_ATTRIB(obj_id_ndx);
break;
- }
-
-/* inquire id's of previously defined dimensions */
-
- if ((numobjentdim = ncdimid (exoid, dnumobjent)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entries for %s %d in file id %d",
- tname, obj_id, exoid);
- ex_err("ex_get_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, numobjentdim, (char *) 0, &num_entries_this_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_get_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if ((numattrdim = ncdimid(exoid, dnumobjatt)) == -1)
- {
- exerrval = ncerr;
+ default:
+ exerrval = 1005;
sprintf(errmsg,
- "Warning: no attributes found for block %d in file id %d",
- obj_id,exoid);
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
ex_err("ex_get_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this object */
+ return (EX_FATAL); /* number of attributes not defined */
}
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
+ /* inquire id's of previously defined dimensions */
+ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of attributes for block %d in file id %d",
- obj_id,exoid);
+ "Error: failed to locate attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type), obj_id,exoid);
ex_err("ex_get_attr",errmsg,exerrval);
return (EX_FATAL);
}
- if ((attrid = ncvarid (exoid, vattrbname)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate attributes for block %d in file id %d",
- obj_id,exoid);
- ex_err("ex_get_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* read in the attributes */
-
- start[0] = 0;
- start[1] = 0;
- count[0] = num_entries_this_obj;
- count[1] = num_attr;
+ /* read in the attributes */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var_float(exoid, attrid, attrib);
+ } else {
+ status = nc_get_var_double(exoid, attrid, attrib);
+ }
- if (ncvarget (exoid, attrid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,attrib,
- (int)num_attr*num_entries_this_obj)) == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get attributes for block %d in file id %d",
- obj_id,exoid);
+ "Error: failed to get attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
ex_err("ex_get_attr",errmsg,exerrval);
return (EX_FATAL);
}
-
-
- ex_conv_array( exoid, READ_CONVERT, attrib, num_attr*num_entries_this_obj );
-
return(EX_NOERR);
-
}
diff --git a/cbind/src/exgattp.c b/cbind/src/exgattp.c
new file mode 100644
index 0000000..7b5a162
--- /dev/null
+++ b/cbind/src/exgattp.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expmp - ex_get_attr_param
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type block/set type (node, edge, face, elem)
+* int obj_id block/set id (ignored for NODAL)
+* int num_attrs number of attributes
+*
+* exit conditions -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * retrieves the number of attributes.
+ */
+
+int ex_get_attr_param (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int* num_attrs)
+{
+ int status;
+ int dimid;
+
+ char errmsg[MAX_ERR_LENGTH];
+ const char *dnumobjatt;
+
+ int obj_id_ndx;
+ size_t lnum_attr_per_entry;
+
+ /* Determine index of obj_id in vobjids array */
+ if (obj_type == EX_NODAL)
+ obj_id_ndx = 0;
+ else {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ *num_attrs = 0;
+ return (EX_NOERR);
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_get_attr_param",errmsg,exerrval);
+ return (EX_WARN);
+ }
+ }
+ }
+
+ switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ break;
+ case EX_EDGE_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
+ break;
+ case EX_FACE_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
+ break;
+ case EX_ELEM_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
+ obj_type, exoid );
+ ex_err("ex_get_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ exerrval = 0; /* clear error code */
+
+ if ((status = nc_inq_dimid(exoid, dnumobjatt, &dimid)) != NC_NOERR) {
+ /* dimension is undefined */
+ *num_attrs = 0;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, dimid, &lnum_attr_per_entry)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of attributes in %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id, exoid);
+ ex_err("ex_get_attr_param",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ *num_attrs = lnum_attr_per_entry;
+ }
+ return (EX_NOERR);
+}
+
diff --git a/cbind/src/exgblk.c b/cbind/src/exgblk.c
index 17985c5..fd036b2 100644
--- a/cbind/src/exgblk.c
+++ b/cbind/src/exgblk.c
@@ -36,10 +36,6 @@
*
* exgblk - read block parameters
*
-* author - Victor R. Yarberry, Sandia National Laboratories
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int idexo exodus file id
@@ -53,9 +49,7 @@
* int* num_attr_per_entry number of attributes
*
* revision history -
-* 20060929 - David Thompson - Edge/face elem support (adapted from ex_get_block)
*
-* $Id: exgblk.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*/
@@ -65,290 +59,248 @@
#include "exodusII_int.h"
/*
- * reads the parameters used to describe an element block
+ * reads the parameters used to describe an edge, face, or element block
*/
int ex_get_block( int exoid,
- int blk_type,
- int blk_id,
- char* elem_type,
- int* num_entries_this_blk,
- int* num_nodes_per_entry,
- int* num_edges_per_entry,
- int* num_faces_per_entry,
- int* num_attr_per_entry )
+ ex_entity_type blk_type,
+ int blk_id,
+ char* elem_type,
+ int* num_entries_this_blk,
+ int* num_nodes_per_entry,
+ int* num_edges_per_entry,
+ int* num_faces_per_entry,
+ int* num_attr_per_entry )
{
- int dimid, connid, len, blk_id_ndx;
- long lnum_entries_this_blk, lnum_nodes_per_entry, lnum_attr_per_entry;
- long lnum_edges_per_entry, lnum_faces_per_entry;
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
- nc_type dummy;
- const char* tname;
- const char* dnument;
- const char* dnumnod;
- const char* dnumedg;
- const char* dnumfac;
- const char* dnumatt;
- const char* ablknam;
- const char* vblkcon;
- const char* vblkids;
-
- exerrval = 0;
-
- /* First, locate index of element block id in VAR_ID_EL_BLK array */
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- tname = "edge";
- vblkids = VAR_ID_ED_BLK;
- blk_id_ndx = ex_id_lkup(exoid,vblkids,blk_id);
- dnument = DIM_NUM_ED_IN_EBLK(blk_id_ndx);
- dnumnod = DIM_NUM_NOD_PER_ED(blk_id_ndx);
- dnumedg = 0;
- dnumfac = 0;
- dnumatt = DIM_NUM_ATT_IN_EBLK(blk_id_ndx);
- vblkcon = VAR_EBCONN(blk_id_ndx);
- ablknam = ATT_NAME_ELB;
- break;
- case EX_FACE_BLOCK:
- tname = "face";
- vblkids = VAR_ID_FA_BLK;
- blk_id_ndx = ex_id_lkup(exoid,vblkids,blk_id);
- dnument = DIM_NUM_FA_IN_FBLK(blk_id_ndx);
- dnumnod = DIM_NUM_NOD_PER_FA(blk_id_ndx);
- dnumedg = 0; /* it is possible this might be non-NULL some day */
- dnumfac = 0;
- dnumatt = DIM_NUM_ATT_IN_FBLK(blk_id_ndx);
- vblkcon = VAR_FBCONN(blk_id_ndx);
- ablknam = ATT_NAME_ELB;
- break;
- case EX_ELEM_BLOCK:
- tname = "element";
- vblkids = VAR_ID_EL_BLK;
- blk_id_ndx = ex_id_lkup(exoid,vblkids,blk_id);
- dnument = DIM_NUM_EL_IN_BLK(blk_id_ndx);
- dnumnod = DIM_NUM_NOD_PER_EL(blk_id_ndx);
- dnumedg = DIM_NUM_EDG_PER_EL(blk_id_ndx);
- dnumfac = DIM_NUM_FAC_PER_EL(blk_id_ndx);
- dnumatt = DIM_NUM_ATT_IN_BLK(blk_id_ndx);
- vblkcon = VAR_CONN(blk_id_ndx);
- ablknam = ATT_NAME_ELB;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Bad block type parameter (%d) specified for file id %d.",
- blk_type, exoid );
- return (EX_FATAL);
- }
+ int dimid, connid, blk_id_ndx;
+ size_t len;
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+ int status;
+ const char* dnument;
+ const char* dnumnod;
+ const char* dnumedg;
+ const char* dnumfac;
+ const char* dnumatt;
+ const char* ablknam;
+ const char* vblkcon;
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY) /* NULL element block? */
- {
- if ( elem_type )
- strcpy(elem_type, "NULL"); /* NULL element type name */
- *num_entries_this_blk = 0; /* no elements */
- *num_nodes_per_entry = 0; /* no nodes */
- *num_attr_per_entry = 0; /* no attributes */
- return (EX_NOERR);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate element block id %d in %s array in file id %d",
- blk_id,vblkids,exoid);
- ex_err("ex_get_block",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ exerrval = 0;
- /* inquire values of some dimensions */
- if ( num_entries_this_blk )
- {
- if ((dimid = ncdimid (exoid, dnument)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of %ss in block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
+ /* First, locate index of element block id in VAR_ID_EL_BLK array */
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) { /* NULL element block? */
+ if ( elem_type )
+ strcpy(elem_type, "NULL"); /* NULL element type name */
+ *num_entries_this_blk = 0; /* no elements */
+ *num_nodes_per_entry = 0; /* no nodes */
+ *num_attr_per_entry = 0; /* no attributes */
+ return (EX_NOERR);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_get_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_entries_this_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %ss in block %d in file id %d",
- tname,blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- *num_entries_this_blk = lnum_entries_this_blk;
- }
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ dnument = DIM_NUM_ED_IN_EBLK(blk_id_ndx);
+ dnumnod = DIM_NUM_NOD_PER_ED(blk_id_ndx);
+ dnumedg = 0;
+ dnumfac = 0;
+ dnumatt = DIM_NUM_ATT_IN_EBLK(blk_id_ndx);
+ vblkcon = VAR_EBCONN(blk_id_ndx);
+ ablknam = ATT_NAME_ELB;
+ break;
+ case EX_FACE_BLOCK:
+ dnument = DIM_NUM_FA_IN_FBLK(blk_id_ndx);
+ dnumnod = DIM_NUM_NOD_PER_FA(blk_id_ndx);
+ dnumedg = 0; /* it is possible this might be non-NULL some day */
+ dnumfac = 0;
+ dnumatt = DIM_NUM_ATT_IN_FBLK(blk_id_ndx);
+ vblkcon = VAR_FBCONN(blk_id_ndx);
+ ablknam = ATT_NAME_ELB;
+ break;
+ case EX_ELEM_BLOCK:
+ dnument = DIM_NUM_EL_IN_BLK(blk_id_ndx);
+ dnumnod = DIM_NUM_NOD_PER_EL(blk_id_ndx);
+ dnumedg = DIM_NUM_EDG_PER_EL(blk_id_ndx);
+ dnumfac = DIM_NUM_FAC_PER_EL(blk_id_ndx);
+ dnumatt = DIM_NUM_ATT_IN_BLK(blk_id_ndx);
+ vblkcon = VAR_CONN(blk_id_ndx);
+ ablknam = ATT_NAME_ELB;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Bad block type parameter (%d) specified for file id %d.",
+ blk_type, exoid );
+ return (EX_FATAL);
+ }
- if ( num_nodes_per_entry )
- {
- if ((dimid = ncdimid (exoid, dnumnod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes/%s in block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_nodes_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes/%s in block %d in file id %d",
- tname,blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- *num_nodes_per_entry = lnum_nodes_per_entry;
- }
+ /* inquire values of some dimensions */
+ if ( num_entries_this_blk ) {
+ if ((status = nc_inq_dimid (exoid, dnument, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of entities in %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
- if ( num_edges_per_entry )
- {
- if ( blk_type != EX_ELEM_BLOCK )
- {
- exerrval = (EX_WARN);
- sprintf(errmsg,
- "Warning: non-NULL pointer passed to num_edges_per_entry for %s block query in file id %d",
- tname,exoid);
- ex_err("ex_get_block",errmsg,exerrval);
- }
- else
- {
- if ((dimid = ncdimid (exoid, dnumedg)) == -1)
- {
- /* undefined => no edge entries per element */
- lnum_edges_per_entry = 0;
- }
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_edges_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of edges/%s in block %d in file id %d",
- tname,blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- }
- *num_edges_per_entry = lnum_edges_per_entry;
- }
- }
+ if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of %ss in block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ *num_entries_this_blk = len;
+ }
- if ( num_faces_per_entry )
- {
- if ( blk_type != EX_ELEM_BLOCK )
- {
- exerrval = (EX_WARN);
- sprintf(errmsg,
- "Warning: non-NULL pointer passed to num_faces_per_entry for %s block query in file id %d",
- tname,exoid);
- ex_err("ex_get_block",errmsg,exerrval);
- }
- else
- {
- if ((dimid = ncdimid (exoid, dnumfac)) == -1)
- {
- /* undefined => no face entries per element */
- lnum_faces_per_entry = 0;
- }
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_faces_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of faces/%s in block %d in file id %d",
- tname,blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- }
- *num_faces_per_entry = lnum_faces_per_entry;
- }
- }
+ if ( num_nodes_per_entry ) {
+ if ((status = nc_inq_dimid (exoid, dnumnod, &dimid)) != NC_NOERR) {
+ /* undefined => no node entries per element */
+ len = 0;
+ } else {
+ if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes/entity in %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+ *num_nodes_per_entry = len;
+ }
- if ( num_attr_per_entry )
- {
- if ((dimid = ncdimid (exoid, dnumatt)) == -1)
- {
- /* dimension is undefined */
- *num_attr_per_entry = 0;
- }
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_attr_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of attributes in %s block %d in file id %d",
- tname,blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
- *num_attr_per_entry = lnum_attr_per_entry;
- }
- }
+ if ( num_edges_per_entry ) {
+ if ( blk_type != EX_ELEM_BLOCK ) {
+ exerrval = (EX_WARN);
+ sprintf(errmsg,
+ "Warning: non-NULL pointer passed to num_edges_per_entry for %s query in file id %d",
+ ex_name_of_object(blk_type),exoid);
+ ex_err("ex_get_block",errmsg,exerrval);
+ } else {
+ if ((status = nc_inq_dimid (exoid, dnumedg, &dimid)) != NC_NOERR) {
+ /* undefined => no edge entries per element */
+ len = 0;
+ } else {
+ if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of edges/entry in %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+ *num_edges_per_entry = len;
+ }
+ }
- if ( elem_type )
- {
- /* look up connectivity array for this element block id */
- if ((connid = ncvarid (exoid, vblkcon)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate connectivity array for element block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
+ if ( num_faces_per_entry ) {
+ if ( blk_type != EX_ELEM_BLOCK ) {
+ exerrval = (EX_WARN);
+ sprintf(errmsg,
+ "Warning: non-NULL pointer passed to num_faces_per_entry for %s query in file id %d",
+ ex_name_of_object(blk_type),exoid);
+ ex_err("ex_get_block",errmsg,exerrval);
+ } else {
+ if ((status = nc_inq_dimid (exoid, dnumfac, &dimid)) != NC_NOERR) {
+ /* undefined => no face entries per element */
+ len = 0;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, dimid, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of faces/entity in %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+ *num_faces_per_entry = len;
+ }
+ }
- if (ncattinq (exoid, connid, ablknam, &dummy, &len) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get element block %d type in file id %d",
- blk_id,exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
+ if ( num_attr_per_entry ) {
+ if ((status = nc_inq_dimid (exoid, dnumatt, &dimid)) != NC_NOERR) {
+ /* dimension is undefined */
+ *num_attr_per_entry = 0;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, dimid, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of attributes in %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ *num_attr_per_entry = len;
+ }
+ }
- if (len > (MAX_STR_LENGTH+1))
- {
- len = MAX_STR_LENGTH;
- sprintf (errmsg,
- "Warning: element block %d type will be truncated to %d chars",
- blk_id,len);
- ex_err("ex_get_block",errmsg,EX_MSG);
- }
- /* get the element type name */
+ if ( elem_type ) {
+ if (*num_nodes_per_entry > 0) {
+ ; /* Do nothing, vblkcon should be correctly set already */
+ } else if (*num_edges_per_entry > 0) {
+ vblkcon = VAR_EBCONN(blk_id_ndx);
+ } else if (*num_faces_per_entry > 0) {
+ vblkcon = VAR_FCONN(blk_id_ndx);
+ }
- if (ncattget (exoid, connid, ablknam, elem_type) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,"Error: failed to get element block %d type in file id %d",
- blk_id, exoid);
- ex_err("ex_get_block",errmsg, exerrval);
- return(EX_FATAL);
- }
+ if (vblkcon) {
+ /* look up connectivity array for this element block id */
+ if ((status = nc_inq_varid (exoid, vblkcon, &connid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
- /* get rid of trailing blanks */
- ptr = elem_type;
- /* fprintf(stderr,"[exgblk] %s, len: %d\n",ptr,len); */
- while (ptr < elem_type + len && *ptr != ' ')
- {
- ptr++;
- }
- *(ptr) = '\0';
- }
+ if ((status = nc_inq_attlen (exoid, connid, ablknam, &len)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s %d type in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
- return (EX_NOERR);
+ if (len > (MAX_STR_LENGTH+1)) {
+ len = MAX_STR_LENGTH;
+ sprintf (errmsg,
+ "Warning: %s %d type will be truncated to %ld chars",
+ ex_name_of_object(blk_type), blk_id, (long)len);
+ ex_err("ex_get_block",errmsg,EX_MSG);
+ }
+
+ /* get the element type name */
+ if ((status = nc_get_att_text (exoid, connid, ablknam, elem_type)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to get %s %d type in file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_get_block",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ /* get rid of trailing blanks */
+ ptr = elem_type;
+ /* fprintf(stderr,"[exgblk] %s, len: %d\n",ptr,len); */
+ while (ptr < elem_type + len && *ptr != ' ') {
+ ptr++;
+ }
+ *(ptr) = '\0';
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgcns.c b/cbind/src/exgcns.c
index 4d15ed0..91e8165 100644
--- a/cbind/src/exgcns.c
+++ b/cbind/src/exgcns.c
@@ -36,14 +36,6 @@
*
* exgcns - read concatenated side sets
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -59,17 +51,17 @@
*
* revision history -
*
-* $Id: exgcns.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the node set ID's, node set count array, node set pointers array,
* node set node list, and node set distribution factors for all of the
* node sets
+ * \deprecated Use ex_get_concat_sets()(exoid, EX_NODE_SET, set_specs) instead
*/
int ex_get_concat_node_sets (int exoid,
diff --git a/cbind/src/exgcon.c b/cbind/src/exgcon.c
index 87d86f7..48a6bc2 100644
--- a/cbind/src/exgcon.c
+++ b/cbind/src/exgcon.c
@@ -36,14 +36,6 @@
*
* exgcon - ex_get_coord_names
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,100 +45,96 @@
*
* revision history -
*
-* $Id: exgcon.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
- * reads the names of the coordinate arrays from the database
+/*!
+ * reads the names (#MAX_STR_LENGTH characters in length) of the
+ * coordinate arrays from the database. Memory must be allocated for
+ * the character strings before this function is invoked.
+ * \param exoid exodus file id
+ * \param[out] coord_names Returned pointer to a vector containing
+ * 'num_dim' names of the nodal coordinate arrays.
*/
int ex_get_coord_names (int exoid,
char **coord_names)
{
- int i, j, ndimdim, varid;
- long num_dim, start[2];
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0;
-
-/* inquire previously defined dimensions and variables */
-
- if ((ndimdim = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, ndimdim, (char *) 0, &num_dim) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ int status;
+ size_t i;
+ int j, ndimdim, varid;
+ size_t num_dim, start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0;
+
+ /* inquire previously defined dimensions and variables */
+
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_get_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((varid = ncvarid (exoid, VAR_NAME_COOR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: failed to locate coordinate names in file id %d",
- exoid);
- ex_err("ex_get_coord_names",errmsg,exerrval);
- return (EX_WARN);
- }
-
-
-/* read the coordinate names */
-
- for (i=0; i<num_dim; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- j = 0;
- ptr = coord_names[i];
-
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get coordinate names in file id %d", exoid);
- ex_err("ex_get_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
+ exoid);
+ ex_err("ex_get_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, VAR_NAME_COOR, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Warning: failed to locate coordinate names in file id %d",
+ exoid);
+ ex_err("ex_get_coord_names",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+
+ /* read the coordinate names */
+ for (i=0; i<num_dim; i++) {
+ start[0] = i;
+ start[1] = 0;
+
+ j = 0;
+ ptr = coord_names[i];
+
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get coordinate names in file id %d", exoid);
+ ex_err("ex_get_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH))
- {
- start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get coordinate names in file id %d", exoid);
- ex_err("ex_get_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- --ptr;
- if (ptr > coord_names[i]) {
- /* get rid of trailing blanks */
- while (*(--ptr) == ' ');
+ while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {
+ start[1] = ++j;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get coordinate names in file id %d", exoid);
+ ex_err("ex_get_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
}
- *(++ptr) = '\0';
- }
-
- return (EX_NOERR);
-
+ }
+ --ptr;
+ if (ptr > coord_names[i]) {
+ /* get rid of trailing blanks */
+ while (--ptr >= coord_names[i] && *ptr == ' ');
+ }
+ *(++ptr) = '\0';
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgconn.c b/cbind/src/exgconn.c
index 403bb10..83e0c81 100644
--- a/cbind/src/exgconn.c
+++ b/cbind/src/exgconn.c
@@ -36,13 +36,6 @@
*
* exgconn - exodusII read edge/face/element block connectivity
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-* environment - UNIX
-*
* entry conditions -
* expelb must be called first to establish element block parameters.
* input parameters:
@@ -56,9 +49,7 @@
* int* faceconn face connectivity array (where applicable)
*
* revision history -
-* 20061001 - David Thompson - Generalized from ex_get_conn.
*
-* $Id: exgconn.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*/
#include <stdlib.h>
#include "exodusII.h"
@@ -69,23 +60,18 @@
*/
int ex_get_conn( int exoid,
- int blk_type,
+ ex_entity_type blk_type,
int blk_id,
int* nodeconn,
int* edgeconn,
int* faceconn )
{
- int numblkentriesdim, connid, econnid, fconnid, blk_id_ndx, iresult;
+ int connid, econnid, fconnid, blk_id_ndx, status;
int numnodperentdim, numedgperentdim, numfacperentdim;
int iexit = (EX_NOERR); /* exit status */
- long num_entries_this_blk, num_nodes_per_entry, num_edges_per_entry, num_faces_per_entry;
- long start[2], count[2];
- nclong *longs;
+ size_t num_nodes_per_entry, num_edges_per_entry, num_faces_per_entry;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* vblkids;
- const char* dnumblkent;
const char* dnumnodent;
const char* dnumedgent;
const char* dnumfacent;
@@ -98,46 +84,26 @@ int ex_get_conn( int exoid,
* However, we will warn if edgeconn or faceconn are NULL but num_edges_per_entry
* or num_faces_per_entry (respectively) are positive.
*/
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- tname = "edge";
- vblkids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face";
- vblkids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element";
- vblkids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Error: Invalid block type (%d) specified in file id %d", blk_type, exoid );
- ex_err( "ex_get_conn", errmsg, exerrval );
- return (EX_FATAL);
- }
-
exerrval = 0; /* clear error code */
/* Locate index of element block id in VAR_ID_EL_BLK array */
- blk_id_ndx = ex_id_lkup(exoid,vblkids,blk_id);
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
if (exerrval != 0)
{
if (exerrval == EX_NULLENTITY)
{
sprintf(errmsg,
- "Warning: no connectivity array for NULL %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Warning: no connectivity array for NULL %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg,EX_MSG);
return (EX_WARN); /* no connectivity array for this element block */
}
else
{
sprintf(errmsg,
- "Error: failed to locate %s block id %d in %s array in file id %d",
- tname,blk_id,vblkids,exoid);
+ "Error: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg,exerrval);
return (EX_FATAL);
}
@@ -145,7 +111,6 @@ int ex_get_conn( int exoid,
switch (blk_type) {
case EX_EDGE_BLOCK:
- dnumblkent = DIM_NUM_ED_IN_EBLK(blk_id_ndx);
dnumnodent = DIM_NUM_NOD_PER_ED(blk_id_ndx);
dnumedgent = 0;
dnumfacent = 0;
@@ -154,7 +119,6 @@ int ex_get_conn( int exoid,
vfaceconn = 0;
break;
case EX_FACE_BLOCK:
- dnumblkent = DIM_NUM_FA_IN_FBLK(blk_id_ndx);
dnumnodent = DIM_NUM_NOD_PER_FA(blk_id_ndx);
dnumedgent = 0;
dnumfacent = 0;
@@ -163,7 +127,6 @@ int ex_get_conn( int exoid,
vfaceconn = 0;
break;
case EX_ELEM_BLOCK:
- dnumblkent = DIM_NUM_EL_IN_BLK(blk_id_ndx);
dnumnodent = DIM_NUM_NOD_PER_EL(blk_id_ndx);
dnumedgent = DIM_NUM_EDG_PER_EL(blk_id_ndx);
dnumfacent = DIM_NUM_FAC_PER_EL(blk_id_ndx);
@@ -171,239 +134,140 @@ int ex_get_conn( int exoid,
vedgeconn = VAR_ECONN(blk_id_ndx);
vfaceconn = VAR_FCONN(blk_id_ndx);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_get_conn",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
}
/* inquire id's of previously defined dimensions */
- if ((numblkentriesdim = ncdimid (exoid, dnumblkent)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of elements in %s block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_get_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq (exoid, numblkentriesdim, (char *) 0, &num_entries_this_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries in %s block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_get_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
- if ((numnodperentdim = ncdimid (exoid, dnumnodent)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes/elem for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_get_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq (exoid, numnodperentdim, (char *) 0, &num_nodes_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes/elem for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_get_conn",errmsg, exerrval);
- return(EX_FATAL);
+ num_nodes_per_entry = 0;
+ if ((status = nc_inq_dimid (exoid, dnumnodent, &numnodperentdim)) != NC_NOERR) {
+ numnodperentdim = -1;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, numnodperentdim, &num_nodes_per_entry)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
}
if ( dnumedgent ) {
num_edges_per_entry = 0;
- if ((numedgperentdim = ncdimid (exoid, dnumedgent)) == -1) {
+ if ((status = nc_inq_dimid(exoid, dnumedgent, &numedgperentdim)) != NC_NOERR) {
numedgperentdim = -1;
} else {
- if (ncdiminq (exoid, numedgperentdim, (char *) 0, &num_edges_per_entry) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, numedgperentdim, &num_edges_per_entry)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of edges/entry for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to get number of edges/entry for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
- if ( num_edges_per_entry < 0 )
- num_edges_per_entry = 0;
- }
- if ( num_edges_per_entry > 0 && (!edgeconn) ) {
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Edge connectivity present but NULL pointer passed for file id %d", exoid );
- ex_err( "ex_get_conn", errmsg, exerrval );
- iexit = exerrval;
}
}
if ( dnumfacent ) {
num_faces_per_entry = 0;
- if ((numfacperentdim = ncdimid (exoid, dnumfacent)) == -1) {
+ if ((status = nc_inq_dimid(exoid, dnumfacent, &numfacperentdim)) != NC_NOERR) {
numfacperentdim = -1;
} else {
- if (ncdiminq (exoid, numfacperentdim, (char *) 0, &num_faces_per_entry) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, numfacperentdim, &num_faces_per_entry)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of faces/entry for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to get number of faces/entry for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
- if ( num_faces_per_entry < 0 )
- num_faces_per_entry = 0;
- }
- if ( num_faces_per_entry > 0 && (!faceconn) ) {
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Face connectivity present but NULL pointer passed for file id %d", exoid );
- ex_err( "ex_get_conn", errmsg, exerrval );
- iexit = exerrval;
}
}
- if ((connid = ncvarid (exoid, vnodeconn)) == -1)
+ status = 0;
+ if (nodeconn && (numnodperentdim >= 0) &&
+ ((status = nc_inq_varid(exoid, vnodeconn, &connid)) != NC_NOERR))
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate connectivity array for block %d in file id %d",
- blk_id,exoid);
+ "Error: failed to locate node connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
- if ( edgeconn && (numedgperentdim > 0) && ((econnid = ncvarid (exoid, vedgeconn)) == -1) )
+ status = 0;
+ if (edgeconn && (numedgperentdim >= 0) &&
+ ((status = nc_inq_varid (exoid, vedgeconn, &econnid)) != NC_NOERR))
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate edge connectivity array for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to locate edge connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
- if ( faceconn && (numfacperentdim > 0) && ((fconnid = ncvarid (exoid, vfaceconn)) == -1) )
+ if (faceconn && (numfacperentdim >= 0) &&
+ ((status = nc_inq_varid (exoid, vfaceconn, &fconnid)) != NC_NOERR))
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate face connectivity array for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to locate face connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
-/* read in the connectivity array */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- start[1] = 0;
+ /* read in the connectivity array */
+ if ( edgeconn && num_edges_per_entry > 0) {
+ status = nc_get_var_int(exoid, econnid, edgeconn);
- if ( edgeconn && num_edges_per_entry ) {
- count[0] = num_entries_this_blk;
- count[1] = num_edges_per_entry;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, econnid, start, count, edgeconn);
- } else {
- if (!(longs = malloc (num_entries_this_blk*num_edges_per_entry * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for edge connectivity array for file id %d",
- exoid);
- ex_err("ex_get_conn",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, econnid, start, count, longs);
- }
-
- if (iresult == -1)
+ if (status != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get edge connectivity array for block %d in file id %d",
- blk_id,exoid);
+ "Error: failed to get edge connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, edgeconn, num_entries_this_blk*num_edges_per_entry);
- free (longs);
- }
}
- if ( faceconn && num_faces_per_entry ) {
- count[0] = num_entries_this_blk;
- count[1] = num_faces_per_entry;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, fconnid, start, count, faceconn);
- } else {
- if (!(longs = malloc (num_entries_this_blk*num_faces_per_entry * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for face connectivity array of %s blockfor file id %d",
- tname,exoid);
- ex_err("ex_get_conn",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, fconnid, start, count, longs);
- }
-
- if (iresult == -1)
+ if ( faceconn && num_faces_per_entry > 0) {
+ status = nc_get_var_int(exoid, fconnid, faceconn);
+
+ if (status != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get face connectivity array for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to get face connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, faceconn, num_entries_this_blk*num_faces_per_entry);
- free (longs);
- }
}
- if ( nodeconn && num_nodes_per_entry ) {
- count[0] = num_entries_this_blk;
- count[1] = num_nodes_per_entry;
+ if ( nodeconn && num_nodes_per_entry > 0) {
+ status = nc_get_var_int(exoid, connid, nodeconn);
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, connid, start, count, nodeconn);
- } else {
- if (!(longs = malloc (num_entries_this_blk*num_nodes_per_entry * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for element connectivity array for file id %d",
- exoid);
- ex_err("ex_get_conn",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, connid, start, count, longs);
- }
-
- if (iresult == -1)
+ if (status != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get connectivity array for block %d in file id %d",
- blk_id,exoid);
+ "Error: failed to get node connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_get_conn",errmsg, exerrval);
return(EX_FATAL);
}
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, nodeconn, num_entries_this_blk*num_nodes_per_entry);
- free (longs);
- }
}
return iexit;
diff --git a/cbind/src/exgcor.c b/cbind/src/exgcor.c
index 126bf9a..5055157 100644
--- a/cbind/src/exgcor.c
+++ b/cbind/src/exgcor.c
@@ -47,7 +47,6 @@
*
* revision history -
*
-* $Id: exgcor.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -55,8 +54,20 @@
#include "exodusII_int.h"
/*!
- * reads the coordinates of the nodes
- * Only fills in the 'non-null' arrays.
+ * reads the coordinates of the nodes.
+ * Memory must be allocated for the coordinate arrays (x_coor, y_coor,
+ * and z_coor) before this call is made. The length of each of these
+ * arrays is the number of nodes in the mesh. Because the coordinates
+ * are floating point values, the application code must declare the
+ * arrays passed to be the appropriate type "float" or "double"
+ * to match the compute word size passed in ex_create() or ex_open()
+ * \param exoid exodus file id
+ * \param[out] x_coor Returned X coordinates of the nodes. These are
+ * returned only if x_coor is non-NULL.
+ * \param[out] y_coor Returned Y coordinates of the nodes. These are
+ * returned only if y_coor is non-NULL.
+ * \param[out] z_coor Returned Z coordinates of the nodes. These are
+ * returned only if z_coor is non-NULL.
*/
int ex_get_coord (int exoid,
@@ -64,27 +75,33 @@ int ex_get_coord (int exoid,
void *y_coor,
void *z_coor)
{
+ int status;
int coordid;
int coordidx, coordidy, coordidz;
- int numnoddim, ndimdim, i;
- long num_nod, num_dim, start[2], count[2];
+ int numnoddim, ndimdim;
+ size_t num_nod, num_dim, start[2], count[2], i;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0;
/* inquire id's of previously defined dimensions */
- if ((numnoddim = ncdimid (exoid, DIM_NUM_NODES)) == -1)
+ if (ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions",
+ &num_dim, &ndimdim, "ex_get_coord") != NC_NOERR) {
+ return(EX_FATAL);
+ }
+
+ if (nc_inq_dimid (exoid, DIM_NUM_NODES, &numnoddim) != NC_NOERR)
{
/* If not found, then this file is storing 0 nodes.
Return immediately */
return (EX_NOERR);
}
- if (ncdiminq (exoid, numnoddim, (char *) 0, &num_nod) == -1)
+ if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of nodes in file id %d",
exoid);
@@ -92,123 +109,87 @@ int ex_get_coord (int exoid,
return (EX_FATAL);
}
-
- if ((ndimdim = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, ndimdim, (char *) 0, &num_dim) == -1)
- {
- sprintf(errmsg,
- "Error: failed to get number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
-
/* read in the coordinates */
if (ex_large_model(exoid) == 0) {
- if ((coordid = ncvarid (exoid, VAR_COORD)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid (exoid, VAR_COORD, &coordid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate nodal coordinates in file id %d", exoid);
ex_err("ex_get_coord",errmsg,exerrval);
return (EX_FATAL);
}
- for (i=0; i<num_dim; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_nod;
-
- if (i == 0 && x_coor != NULL)
- {
- if (ncvarget (exoid, coordid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,x_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get X coord array in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- ex_conv_array( exoid, READ_CONVERT, x_coor, (int)num_nod );
- }
- else if (i == 1 && y_coor != NULL)
- {
- if (ncvarget (exoid, coordid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,y_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get Y coord array in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- ex_conv_array( exoid, READ_CONVERT, y_coor, (int)num_nod );
- }
-
- else if (i == 2 && z_coor != NULL)
- {
- if (ncvarget (exoid, coordid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,z_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get Z coord array in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
-
+ for (i=0; i<num_dim; i++) {
+ char *which;
+ start[0] = i;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = num_nod;
+
+ if (i == 0 && x_coor != NULL) {
+ which = "X";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, x_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, x_coor);
+ }
+ }
+ else if (i == 1 && y_coor != NULL) {
+ which = "Y";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, y_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, y_coor);
+ }
+ }
+ else if (i == 2 && z_coor != NULL) {
+ which = "Z";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, z_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, z_coor);
+ }
+ }
- ex_conv_array( exoid, READ_CONVERT, z_coor, (int)num_nod );
- }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s coord array in file id %d", which, exoid);
+ ex_err("ex_get_coord",errmsg,exerrval);
+ return (EX_FATAL);
}
+ }
+
} else {
- if ((coordidx = ncvarid (exoid, VAR_COORD_X)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate x nodal coordinates in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_varid (exoid, VAR_COORD_X, &coordidx)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate x nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
if (num_dim > 1) {
- if ((coordidy = ncvarid (exoid, VAR_COORD_Y)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate y nodal coordinates in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_varid (exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate y nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
} else {
coordidy = 0;
}
if (num_dim > 2) {
- if ((coordidz = ncvarid (exoid, VAR_COORD_Z)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate z nodal coordinates in file id %d", exoid);
- ex_err("ex_get_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_varid (exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate z nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
} else {
coordidz = 0;
}
@@ -216,9 +197,8 @@ int ex_get_coord (int exoid,
/* write out the coordinates */
for (i=0; i<num_dim; i++)
{
- const void *coor;
- char *which;
- int status;
+ void *coor = NULL;
+ char *which = NULL;
if (i == 0) {
coor = x_coor;
@@ -234,26 +214,20 @@ int ex_get_coord (int exoid,
coordid = coordidz;
}
- if (coor != NULL) {
- if (nc_flt_code(exoid) == NC_FLOAT) {
- status = nc_get_var_float(exoid, coordid,
- ex_conv_array(exoid,RTN_ADDRESS,
- coor,(int)num_nod));
+ if (coor != NULL && coordid != 0) {
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var_float(exoid, coordid, coor);
} else {
- status = nc_get_var_double(exoid, coordid,
- ex_conv_array(exoid,RTN_ADDRESS,
- coor,(int)num_nod));
+ status = nc_get_var_double(exoid, coordid, coor);
}
- if (status == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get %s coord array in file id %d", which, exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
- ex_conv_array( exoid, READ_CONVERT, coor, (int)num_nod );
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
}
}
}
diff --git a/cbind/src/exgcset.c b/cbind/src/exgcset.c
index 7c2dc6e..99c4e5d 100644
--- a/cbind/src/exgcset.c
+++ b/cbind/src/exgcset.c
@@ -36,25 +36,16 @@
*
* exgcss - ex_get_concat_sets
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
-* int set_type type of set
+* ex_entity_type set_type type of set
*
* exit conditions -
* struct ex_set_specs* set_specs set specs structure
*
* revision history -
*
-* $Id: exgcset.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,202 +53,169 @@
#include "exodusII_int.h"
/*
- * reads the set ID's, set entry count array, set entry pointers array,
- * set entry list, set extra list, and set distribution factors for
- * all sets of the specified type.
+ * reads the set ID's, set entry count array, set entry pointers
+ * array, set entry list, set extra list, and set distribution factors
+ * for all sets of the specified type.
*/
int ex_get_concat_sets (int exoid,
- int set_type,
+ ex_entity_type set_type,
struct ex_set_specs* set_specs)
{
- int *set_ids = set_specs->sets_ids;
- int *num_entries_per_set = set_specs->num_entries_per_set;
- int *num_dist_per_set = set_specs->num_dist_per_set;
- int *sets_entry_index = set_specs->sets_entry_index;
- int *sets_dist_index = set_specs->sets_dist_index;
- int *sets_entry_list = set_specs->sets_entry_list;
- int *sets_extra_list = set_specs->sets_extra_list;
- void *sets_dist_fact = set_specs->sets_dist_fact;
- char *cdum;
- int num_sets, i;
- float fdum;
- float *flt_dist_fact;
- double *dbl_dist_fact;
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- int ex_inq_val;
- int *extra_list;
-
- exerrval = 0; /* clear error code */
-
- cdum = 0; /* initialize even though it is not used */
+ int status, dimid;
+ int *set_ids = set_specs->sets_ids;
+ int *num_entries_per_set = set_specs->num_entries_per_set;
+ int *num_dist_per_set = set_specs->num_dist_per_set;
+ int *sets_entry_index = set_specs->sets_entry_index;
+ int *sets_dist_index = set_specs->sets_dist_index;
+ int *sets_entry_list = set_specs->sets_entry_list;
+ int *sets_extra_list = set_specs->sets_extra_list;
+ void *sets_dist_fact = set_specs->sets_dist_fact;
+ char *cdum;
+ int num_sets, i;
+ float fdum;
+ float *flt_dist_fact;
+ double *dbl_dist_fact;
+ char errmsg[MAX_ERR_LENGTH];
+ ex_inquiry ex_inq_val;
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
/* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
-
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- ex_inq_val = EX_INQ_NODE_SETS;
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- ex_inq_val = EX_INQ_EDGE_SETS;
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- ex_inq_val = EX_INQ_FACE_SETS;
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- ex_inq_val = EX_INQ_SIDE_SETS;
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- ex_inq_val = EX_INQ_ELEM_SETS;
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if (ncdimid (exoid, dimptr) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no %s sets defined for file id %d", typeName, exoid);
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return (EX_WARN);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s sets defined in file id %d",
- typeName, exoid);
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-/* inquire how many sets have been stored */
-
- if (ex_inquire(exoid, ex_inq_val, &num_sets, &fdum, cdum) == -1)
- {
- sprintf(errmsg,
- "Error: failed to get number of %s sets defined for file id %d",
- typeName, exoid);
- /* use error val from inquire */
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_ids (exoid, set_type, set_ids) == -1)
- {
- sprintf(errmsg,
- "Error: failed to get %s set ids for file id %d",
- typeName, exoid);
- /* use error val from inquire */
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- sets_entry_index[0] = 0;
- sets_dist_index[0] = 0;
-
- for (i=0; i<num_sets; i++)
- {
- if (ex_get_set_param(exoid, set_type, set_ids[i],
- &(num_entries_per_set[i]), &(num_dist_per_set[i])) == -1)
- return(EX_FATAL); /* error will be reported by sub */
-
- if (i < num_sets-1)
- {
- /* fill in entry and dist factor index arrays */
- sets_entry_index[i+1] = sets_entry_index[i]+num_entries_per_set[i];
- sets_dist_index[i+1] = sets_dist_index[i]+num_dist_per_set[i];
- }
-
- if (num_entries_per_set[i] == 0) /* NULL set? */
- continue;
-
- /* Now, use ExodusII call to get sets */
-
- if (set_type == EX_EDGE_SET || set_type == EX_FACE_SET ||
- set_type == EX_SIDE_SET)
- extra_list = &(sets_extra_list[sets_entry_index[i]]);
- else
- extra_list = NULL;
-
- if (ex_comp_ws(exoid) == sizeof(float))
- {
- if (ex_get_set(exoid, set_type, set_ids[i],
- &(sets_entry_list[sets_entry_index[i]]),
- &(sets_extra_list[sets_entry_index[i]])) == -1)
- return(EX_FATAL); /* error will be reported by subroutine */
-
- /* get distribution factors for this set */
- flt_dist_fact = sets_dist_fact;
- if (num_dist_per_set[i] > 0) /* only get df if they exist */
- {
- if (ex_get_set_dist_fact(exoid, set_type, set_ids[i],
- &(flt_dist_fact[sets_dist_index[i]])) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get %s set %d dist factors in file id %d",
- typeName, set_ids[i], exoid);
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return(EX_FATAL);
- }
- } else { /* fill distribution factor array with 1's */
- }
- }
- else if (ex_comp_ws(exoid) == sizeof(double))
- {
- if (ex_get_set(exoid, set_type, set_ids[i],
- &(sets_entry_list[sets_entry_index[i]]),
- &(sets_extra_list[sets_entry_index[i]])) == -1)
- return(EX_FATAL); /* error will be reported by subroutine */
-
- /* get distribution factors for this set */
- dbl_dist_fact = sets_dist_fact;
- if (num_dist_per_set[i] > 0) /* only get df if they exist */
- {
- if (ex_get_set_dist_fact(exoid, set_type, set_ids[i],
- &(dbl_dist_fact[sets_dist_index[i]])) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get %s set %d dist factors in file id %d",
- typeName, set_ids[i], exoid);
- ex_err("ex_get_concat_sets",errmsg,exerrval);
- return(EX_FATAL);
- }
- } else { /* fill distribution factor array with 1's */
- }
- }
- }
-
- return(EX_NOERR);
-
+ NOTE: there is another block that sets more stuff later ... */
+
+ if (set_type == EX_NODE_SET) {
+ ex_inq_val = EX_INQ_NODE_SETS;
+ }
+ else if (set_type == EX_EDGE_SET) {
+ ex_inq_val = EX_INQ_EDGE_SETS;
+ }
+ else if (set_type == EX_FACE_SET) {
+ ex_inq_val = EX_INQ_FACE_SETS;
+ }
+ else if (set_type == EX_SIDE_SET) {
+ ex_inq_val = EX_INQ_SIDE_SETS;
+ }
+ else if (set_type == EX_ELEM_SET) {
+ ex_inq_val = EX_INQ_ELEM_SETS;
+ }
+ else {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: invalid set type (%d)", set_type);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* first check if any sets are specified */
+
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_EBADDIM) {
+ sprintf(errmsg,
+ "Warning: no %ss defined for file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %ss defined in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* inquire how many sets have been stored */
+
+ if (ex_inquire(exoid, ex_inq_val, &num_sets, &fdum, cdum) != NC_NOERR) {
+ sprintf(errmsg,
+ "Error: failed to get number of %ss defined for file id %d",
+ ex_name_of_object(set_type), exoid);
+ /* use error val from inquire */
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_ids (exoid, set_type, set_ids) != NC_NOERR) {
+ sprintf(errmsg,
+ "Error: failed to get %s ids for file id %d",
+ ex_name_of_object(set_type), exoid);
+ /* use error val from inquire */
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ sets_entry_index[0] = 0;
+ sets_dist_index[0] = 0;
+
+ for (i=0; i<num_sets; i++) {
+ if (ex_get_set_param(exoid, set_type, set_ids[i],
+ &(num_entries_per_set[i]), &(num_dist_per_set[i])) != NC_NOERR)
+ return(EX_FATAL); /* error will be reported by sub */
+
+ if (i < num_sets-1) {
+ /* fill in entry and dist factor index arrays */
+ sets_entry_index[i+1] = sets_entry_index[i]+num_entries_per_set[i];
+ sets_dist_index[i+1] = sets_dist_index[i]+num_dist_per_set[i];
+ }
+
+ if (num_entries_per_set[i] == 0) /* NULL set? */
+ continue;
+
+ /* Now, use ExodusII call to get sets */
+
+ if (ex_comp_ws(exoid) == sizeof(float)) {
+ int *extra_sets = NULL;
+ if (sets_extra_list != NULL)
+ extra_sets = &(sets_extra_list[sets_entry_index[i]]);
+
+ if (ex_get_set(exoid, set_type, set_ids[i],
+ &(sets_entry_list[sets_entry_index[i]]),
+ extra_sets) == -1)
+ return(EX_FATAL); /* error will be reported by subroutine */
+
+ /* get distribution factors for this set */
+ if (sets_dist_fact != 0) {
+ flt_dist_fact = sets_dist_fact;
+ if (num_dist_per_set[i] > 0) { /* only get df if they exist */
+ if (ex_get_set_dist_fact(exoid, set_type, set_ids[i],
+ &(flt_dist_fact[sets_dist_index[i]])) != NC_NOERR) {
+ sprintf(errmsg,
+ "Error: failed to get %s %d dist factors in file id %d",
+ ex_name_of_object(set_type), set_ids[i], exoid);
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ } else { /* fill distribution factor array with 1's */
+ }
+ }
+ }
+ else if (ex_comp_ws(exoid) == sizeof(double))
+ {
+ if (ex_get_set(exoid, set_type, set_ids[i],
+ &(sets_entry_list[sets_entry_index[i]]),
+ &(sets_extra_list[sets_entry_index[i]])) != NC_NOERR)
+ return(EX_FATAL); /* error will be reported by subroutine */
+
+ /* get distribution factors for this set */
+ if (sets_dist_fact != 0) {
+ dbl_dist_fact = sets_dist_fact;
+ if (num_dist_per_set[i] > 0) { /* only get df if they exist */
+ if (ex_get_set_dist_fact(exoid, set_type, set_ids[i],
+ &(dbl_dist_fact[sets_dist_index[i]])) != NC_NOERR) {
+ sprintf(errmsg,
+ "Error: failed to get %s %d dist factors in file id %d",
+ ex_name_of_object(set_type), set_ids[i], exoid);
+ ex_err("ex_get_concat_sets",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ } else { /* fill distribution factor array with 1's */
+ }
+ }
+ }
+ }
+ return(EX_NOERR);
}
diff --git a/cbind/src/exgcss.c b/cbind/src/exgcss.c
index 03e3cb9..3134396 100644
--- a/cbind/src/exgcss.c
+++ b/cbind/src/exgcss.c
@@ -33,44 +33,36 @@
*
*/
/*****************************************************************************
-*
-* exgcss - ex_get_concat_side_sets
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
-* entry conditions -
-* input parameters:
-* int exoid exodus file id
-*
-* exit conditions -
-* int *side_set_ids array of side set ids
-* int *num_elem_per_set number of elements/sides/faces per set
-* int *num_dist_per_set number of distribution factors per set
-* int *side_sets_elem_index index array of elements into elem list
-* int *side_sets_dist_index index array of df into df list
-* int *side_sets_elem_list array of elements
-* int *side_sets_side_list array of sides
-* void *side_sets_dist_fact array of distribution factors
-*
-* revision history -
-*
-* $Id: exgcss.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
-*
-*****************************************************************************/
+ *
+ * exgcss - ex_get_concat_side_sets
+ *
+ * entry conditions -
+ * input parameters:
+ * int exoid exodus file id
+ *
+ * exit conditions -
+ * int *side_set_ids array of side set ids
+ * int *num_elem_per_set number of elements/sides/faces per set
+ * int *num_dist_per_set number of distribution factors per set
+ * int *side_sets_elem_index index array of elements into elem list
+ * int *side_sets_dist_index index array of df into df list
+ * int *side_sets_elem_list array of elements
+ * int *side_sets_side_list array of sides
+ * void *side_sets_dist_fact array of distribution factors
+ *
+ * revision history -
+ *
+ *
+ *****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the side set ID's, side set element count array, side set node count
* array, side set element pointers array, side set node pointers array, side
* set element list, side set node list, and side set distribution factors
+ * \deprecated Use ex_get_concat_sets()(exoid, EX_SIDE_SET, set_specs) instead
*/
int ex_get_concat_side_sets (int exoid,
diff --git a/cbind/src/exgssc.c b/cbind/src/exgcssc.c
similarity index 71%
copy from cbind/src/exgssc.c
copy to cbind/src/exgcssc.c
index a6cde36..16f26a2 100644
--- a/cbind/src/exgssc.c
+++ b/cbind/src/exgcssc.c
@@ -34,25 +34,17 @@
*/
/*****************************************************************************
*
-* exgssc - ex_get_side_set_node_count
-*
-* author - Sandia National Laboratories
-* Greg Sjaardema; modified from exgssn.c
-*
-*
-* environment - UNIX
+* exgcssc - ex_get_concat_side_set_node_count
*
* entry conditions -
* input parameters:
* int exoid exodus file id
-* int side_set_id side set id
*
* exit conditions -
* int *side_set_node_cnt_list returned array of number of nodes for
-* side or face
+* side or face for all sidesets
* revision history -
*
-* $Id: exgssc.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*****************************************************************************/
#include <ctype.h>
@@ -62,6 +54,12 @@
#include "exodusII.h"
#include "exodusII_int.h"
+void *safe_free(void *array)
+{
+ if (array != 0) free(array);
+ return 0;
+}
+
/* Generic error message for element type/node count mapping...*/
#define EL_NODE_COUNT_ERROR sprintf(errmsg, \
"Error: An element of type '%s' with %d nodes is not valid.",\
@@ -70,33 +68,25 @@
ex_err("ex_get_side_set_node_count",errmsg,EX_MSG);\
return(EX_FATAL);\
-int ex_get_side_set_node_count(int exoid,
- int side_set_id,
- int *side_set_node_cnt_list)
+int ex_get_concat_side_set_node_count(int exoid,
+ int *side_set_node_cnt_list)
{
- int ii, i, j, m;
+ size_t m;
+ int ii, i, j, iss, ioff;
+ int side_set_id;
int num_side_sets, num_elem_blks, num_df, ndim;
int tot_num_elem = 0, tot_num_ss_elem = 0, side, elem;
- int *elem_blk_ids;
- int *ss_elem_ndx;
- int *side_set_elem_list, *side_set_side_list;
+ int *elem_blk_ids = NULL;
+ int *side_set_ids = NULL;
+ int *ss_elem_ndx = NULL;
+ int *side_set_elem_list = NULL;
+ int *side_set_side_list = NULL;
int elem_ctr;
int num_elem_in_blk, num_nodes_per_elem, num_attr;
float fdum;
char *cdum, elem_type[MAX_STR_LENGTH+1];
- struct elem_blk_parm
- {
- char elem_type[MAX_STR_LENGTH+1];
- int elem_blk_id;
- int num_elem_in_blk;
- int num_nodes_per_elem;
- int num_sides;
- int num_nodes_per_side[6];
- int num_attr;
- int elem_ctr;
- int elem_type_val;
- } *elem_blk_parms;
+ struct elem_blk_parm *elem_blk_parms;
char errmsg[MAX_ERR_LENGTH];
@@ -110,7 +100,7 @@ int ex_get_side_set_node_count(int exoid,
{
sprintf(errmsg,
"Error: failed to get number of side sets in file id %d",exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
return(EX_FATAL);
}
@@ -118,38 +108,15 @@ int ex_get_side_set_node_count(int exoid,
{
sprintf(errmsg,
"Warning: no side sets defined in file id %d",exoid);
- ex_err("ex_get_side_set_node_count",errmsg,EX_WARN);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,EX_WARN);
return(EX_WARN);
}
- /* Lookup index of side set id in VAR_SS_IDS array */
- ex_id_lkup(exoid,VAR_SS_IDS,side_set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: side set %d is NULL in file id %d",
- side_set_id,exoid);
- ex_err("ex_get_side_set_node_count",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
-
- sprintf(errmsg,
- "Error: failed to locate side set id %d in VAR_SS_IDS array in file id %d",
- side_set_id,exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
if ((ex_inquire(exoid, EX_INQ_ELEM_BLK, &num_elem_blks, &fdum, cdum)) == -1)
{
sprintf(errmsg,
"Error: failed to get number of element blocks in file id %d",exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
return(EX_FATAL);
}
@@ -157,7 +124,7 @@ int ex_get_side_set_node_count(int exoid,
{
sprintf(errmsg,
"Error: failed to get total number of elements in file id %d",exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
return(EX_FATAL);
}
@@ -171,128 +138,48 @@ int ex_get_side_set_node_count(int exoid,
return(EX_FATAL);
}
- /* First determine the # of elements in the side set*/
- if ((ex_get_side_set_param(exoid,side_set_id,&tot_num_ss_elem,&num_df)) == -1)
- {
- sprintf(errmsg,
- "Error: failed to get number of elements in side set %d in file id %d",
- side_set_id, exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- /* Allocate space for the side set element list */
- if (!(side_set_elem_list=malloc(tot_num_ss_elem*sizeof(int))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate space for side set element list for file id %d",
- exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* Allocate space for the side set side list */
- if (!(side_set_side_list=malloc(tot_num_ss_elem*sizeof(int))))
- {
- free(side_set_elem_list);
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate space for side set side list for file id %d",
- exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_side_set(exoid, side_set_id,
- side_set_elem_list, side_set_side_list) == -1)
- {
- free(side_set_elem_list);
- free(side_set_side_list);
- sprintf(errmsg,
- "Error: failed to get side set %d in file id %d",
- side_set_id, exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* Allocate space for the ss element index array */
- if (!(ss_elem_ndx=malloc(tot_num_ss_elem*sizeof(int))))
- {
- free(side_set_elem_list);
- free(side_set_side_list);
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate space for side set elem sort array for file id %d",
- exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* Sort side set element list into index array - non-destructive */
- for (i=0;i<tot_num_ss_elem;i++) {
- ss_elem_ndx[i] = i; /* init index array to current position */
- }
- ex_iqsort(side_set_elem_list, ss_elem_ndx,tot_num_ss_elem);
-
-
/* Allocate space for the element block ids */
if (!(elem_blk_ids=malloc(num_elem_blks*sizeof(int))))
{
exerrval = EX_MEMFAIL;
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
sprintf(errmsg,
"Error: failed to allocate space for element block ids for file id %d",
exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
}
- if (ex_get_elem_blk_ids(exoid, elem_blk_ids) == -1)
+ if (ex_get_ids(exoid, EX_ELEM_BLOCK, elem_blk_ids) == -1)
{
- free(elem_blk_ids);
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
sprintf(errmsg,
"Error: failed to get element block ids in file id %d",
exoid);
- ex_err("ex_get_side_set_node_count",errmsg,EX_MSG);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,EX_MSG);
return(EX_FATAL);
}
/* Allocate space for the element block params */
if (!(elem_blk_parms=malloc(num_elem_blks*sizeof(struct elem_blk_parm))))
{
- free(elem_blk_ids);
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
exerrval = EX_MEMFAIL;
sprintf(errmsg,
"Error: failed to allocate space for element block params for file id %d",
exoid);
- ex_err("ex_get_side_set_node_count",errmsg,exerrval);
- return (EX_FATAL);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
}
elem_ctr = 0;
for (i=0; i<num_elem_blks; i++)
{
/* read in an element block parameter */
- if ((ex_get_elem_block (exoid, elem_blk_ids[i], elem_type, &num_elem_in_blk,
+ if ((ex_get_elem_block (exoid, elem_blk_ids[i], elem_type,
+ &num_elem_in_blk,
&num_nodes_per_elem, &num_attr)) == -1) {
- free(elem_blk_parms);
- free(elem_blk_ids);
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
sprintf(errmsg,
"Error: failed to get element block %d parameters in file id %d",
elem_blk_ids[i], exoid);
- ex_err("ex_get_side_set_node_count",errmsg,EX_MSG);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,EX_MSG);
return(EX_FATAL);
}
@@ -301,25 +188,25 @@ int ex_get_side_set_node_count(int exoid,
elem_blk_parms[i].num_attr = num_attr;
for (m=0; m < strlen(elem_type); m++) {
- elem_blk_parms[i].elem_type[m] = toupper((int)elem_type[m]);
+ elem_blk_parms[i].elem_type[m] = toupper(elem_type[m]);
}
elem_blk_parms[i].elem_type[m] = '\0';
if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = CIRCLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_CIRCLE;
elem_blk_parms[i].num_sides = 1;
elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SPHERE;
+ elem_blk_parms[i].elem_type_val = EX_EL_SPHERE;
elem_blk_parms[i].num_sides = 1;
elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
{
- elem_blk_parms[i].elem_type_val = QUAD;
+ elem_blk_parms[i].elem_type_val = EX_EL_QUAD;
elem_blk_parms[i].num_sides = 4;
if (elem_blk_parms[i].num_nodes_per_elem == 4) {
elem_blk_parms[i].num_nodes_per_side[0] = 2;
@@ -343,7 +230,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TRIANGLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRIANGLE;
if (ndim == 2) { /* 2d TRIs */
elem_blk_parms[i].num_sides = 3;
if (elem_blk_parms[i].num_nodes_per_elem == 3) {
@@ -376,7 +263,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SHELL;
+ elem_blk_parms[i].elem_type_val = EX_EL_SHELL;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {/* KLUDGE for 2D Shells*/
elem_blk_parms[i].num_sides = 2;
@@ -407,7 +294,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
{
- elem_blk_parms[i].elem_type_val = HEX;
+ elem_blk_parms[i].elem_type_val = EX_EL_HEX;
elem_blk_parms[i].num_sides = 6;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 8) { /* 8-node bricks */
@@ -451,7 +338,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].elem_type_val = EX_EL_TETRA;
elem_blk_parms[i].num_sides = 4;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4) {
@@ -475,7 +362,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = WEDGE;
+ elem_blk_parms[i].elem_type_val = EX_EL_WEDGE;
elem_blk_parms[i].num_sides = 5;
if (elem_blk_parms[i].num_nodes_per_elem == 6) {
elem_blk_parms[i].num_nodes_per_side[0] = 4;
@@ -495,7 +382,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
{
- elem_blk_parms[i].elem_type_val = PYRAMID;
+ elem_blk_parms[i].elem_type_val = EX_EL_PYRAMID;
elem_blk_parms[i].num_sides = 5;
if (elem_blk_parms[i].num_nodes_per_elem == 5) {
elem_blk_parms[i].num_nodes_per_side[0] = 3;
@@ -515,7 +402,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
{
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
elem_blk_parms[i].num_sides = 2;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {
@@ -532,7 +419,7 @@ int ex_get_side_set_node_count(int exoid,
(strncmp(elem_blk_parms[i].elem_type,"BAR",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"EDGE",3) == 0) )
{
- elem_blk_parms[i].elem_type_val = TRUSS;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRUSS;
elem_blk_parms[i].num_sides = 2;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {
@@ -547,14 +434,14 @@ int ex_get_side_set_node_count(int exoid,
}
/* Used for an empty block in a parallel decomposition */
else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0) {
- elem_blk_parms[i].elem_type_val = '\0';
+ elem_blk_parms[i].elem_type_val = EX_EL_NULL_ELEMENT;
elem_blk_parms[i].num_sides = 0;
elem_blk_parms[i].num_nodes_per_side[0] = 0;
elem_blk_parms[i].num_elem_in_blk = 0;
} else {
/* unsupported element type; no problem if no sides specified for
this element block */
- elem_blk_parms[i].elem_type_val = UNK;
+ elem_blk_parms[i].elem_type_val = EX_EL_UNK;
elem_blk_parms[i].num_sides = 0;
elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
@@ -568,53 +455,143 @@ int ex_get_side_set_node_count(int exoid,
/* Finally... Create the list of node counts for each face in the
* side set.
*/
+ /* Allocate space for the sideset ids */
+ if (!(side_set_ids=malloc(num_side_sets*sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for side set ids for file id %d",
+ exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
+ }
- j = 0; /* The current element block... */
- for (ii=0;ii<tot_num_ss_elem;ii++) {
-
- i = ss_elem_ndx[ii];
- elem = side_set_elem_list[i];
- side = side_set_side_list[i]-1; /* Convert to 0-based sides */
+ if (ex_get_ids(exoid, EX_SIDE_SET, side_set_ids) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set ids in file id %d",
+ exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,EX_MSG);
+ goto error_ret;
+ }
- /*
- * Since the elements are being accessed in sorted, order, the
- * block that contains the elements must progress sequentially
- * from block 0 to block[num_elem_blks-1]. Once we find an element
- * not in this block, find a following block that contains it...
- */
- for ( ; j<num_elem_blks; j++) {
- if (elem <= elem_blk_parms[j].elem_ctr) {
- break;
+ /* Lookup index of side set id in VAR_SS_IDS array */
+ ioff = 0;
+ for (iss=0; iss<num_side_sets; iss++) {
+ side_set_id = side_set_ids[iss];
+
+ /* First determine the # of elements in the side set*/
+ if ((ex_get_set_param(exoid,EX_SIDE_SET, side_set_id,
+ &tot_num_ss_elem,&num_df)) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of elements in side set %d in file id %d",
+ side_set_id, exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ if (tot_num_ss_elem == 0)
+ continue;
+
+ /* Allocate space for the side set element list */
+ if (!(side_set_elem_list=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for side set element list for file id %d",
+ exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
}
+
+ /* Allocate space for the side set side list */
+ if (!(side_set_side_list=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for side set side list for file id %d",
+ exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ if (ex_get_set(exoid, EX_SIDE_SET, side_set_id,
+ side_set_elem_list, side_set_side_list) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set %d in file id %d",
+ side_set_id, exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ /* Allocate space for the ss element index array */
+ if (!(ss_elem_ndx=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for side set elem sort array for file id %d",
+ exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ /* Sort side set element list into index array - non-destructive */
+ for (i=0;i<tot_num_ss_elem;i++) {
+ ss_elem_ndx[i] = i; /* init index array to current position */
}
-
- if (j < num_elem_blks) {
- assert(side < elem_blk_parms[j].num_sides);
- side_set_node_cnt_list[i] = elem_blk_parms[j].num_nodes_per_side[side];
- } else {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid element number %d found in side set %d in file %d",
- side_set_elem_list[i], side_set_id, exoid);
- free(elem_blk_parms);
- free(elem_blk_ids);
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
- ex_err("ex_get_side_set_node_count",errmsg,EX_MSG);
- return (EX_FATAL);
+ ex_iqsort(side_set_elem_list, ss_elem_ndx,tot_num_ss_elem);
+
+
+ j = 0; /* The current element block... */
+ for (ii=0;ii<tot_num_ss_elem;ii++) {
+
+ i = ss_elem_ndx[ii];
+ elem = side_set_elem_list[i];
+ side = side_set_side_list[i]-1; /* Convert to 0-based sides */
+
+ /*
+ * Since the elements are being accessed in sorted, order, the
+ * block that contains the elements must progress sequentially
+ * from block 0 to block[num_elem_blks-1]. Once we find an element
+ * not in this block, find a following block that contains it...
+ */
+ for ( ; j<num_elem_blks; j++) {
+ if (elem <= elem_blk_parms[j].elem_ctr) {
+ break;
+ }
+ }
+
+ if (j < num_elem_blks) {
+ assert(side < elem_blk_parms[j].num_sides);
+ side_set_node_cnt_list[i+ioff] = elem_blk_parms[j].num_nodes_per_side[side];
+ } else {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid element number %d found in side set %d in file %d",
+ side_set_elem_list[i], side_set_id, exoid);
+ ex_err("ex_get_concat_side_set_node_count",errmsg,EX_MSG);
+ goto error_ret;
+ }
}
+ ss_elem_ndx = safe_free(ss_elem_ndx);
+ side_set_elem_list = safe_free(side_set_elem_list);
+ side_set_side_list = safe_free(side_set_side_list);
+ ioff += tot_num_ss_elem;
}
-
- /* All done: release connectivity array space, element block ids
- * array, element block parameters array, and side set element index
- * array
- */
- free(elem_blk_ids);
- free(elem_blk_parms);
- free(ss_elem_ndx);
- free(side_set_side_list);
- free(side_set_elem_list);
+
+ /* All done: release allocated memory */
+ elem_blk_ids = safe_free(elem_blk_ids);
+ side_set_ids = safe_free(side_set_ids);
return(EX_NOERR);
+
+ error_ret:
+ elem_blk_ids = safe_free(elem_blk_ids);
+ side_set_ids = safe_free(side_set_ids);
+ ss_elem_ndx = safe_free(ss_elem_ndx);
+ side_set_elem_list = safe_free(side_set_elem_list);
+ side_set_side_list = safe_free(side_set_side_list);
+ return (EX_FATAL);
}
diff --git a/cbind/src/exgean.c b/cbind/src/exgean.c
index 2756c08..d421bd4 100644
--- a/cbind/src/exgean.c
+++ b/cbind/src/exgean.c
@@ -44,18 +44,15 @@
* exit conditions -
* char* names[] ptr array of attribute names
*
-* revision history -
-* 20061003 - David Thompson - moved to ex_get_attr_names
-*
-* $Id: exgean.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the attribute names for an element block
+ * \deprecated Use ex_get_attr_names()(exoid, EX_ELEM_BLOCK, elem_blk_id, names) instead
*/
int ex_get_elem_attr_names (int exoid,
int elem_blk_id,
diff --git a/cbind/src/exgeat.c b/cbind/src/exgeat.c
index 360ec49..c381373 100644
--- a/cbind/src/exgeat.c
+++ b/cbind/src/exgeat.c
@@ -36,14 +36,6 @@
*
* exgeat - ex_get_elem_attr
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,18 +44,15 @@
* exit conditions -
* float* attrib array of attributes
*
-* revision history -
-* 20061003 - David Thompson - moved to ex_get_att
-*
-* $Id: exgeat.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the attributes for an element block
+ * \deprecated Use ex_get_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib) instead
*/
int ex_get_elem_attr (int exoid,
diff --git a/cbind/src/exgebi.c b/cbind/src/exgebi.c
index f8d832d..d151925 100644
--- a/cbind/src/exgebi.c
+++ b/cbind/src/exgebi.c
@@ -36,14 +36,6 @@
*
* exgebi - ex_get_elem_blk_ids
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-* David Thompson - Moved to ex_get_ids.
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: exgebi.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,8 +52,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the element block ids from the database
+ * \deprecated Use ex_get_ids()(exoid, EX_ELEM_BLOCK, ids) instead
*/
int ex_get_elem_blk_ids (int exoid,
diff --git a/cbind/src/exgecpp.c b/cbind/src/exgecpp.c
new file mode 100644
index 0000000..27d4212
--- /dev/null
+++ b/cbind/src/exgecpp.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgecpp - ex_get_entity_count_per_polyhedra
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * reads in the number of entities (nodes/faces) per polyhedra
+ * (nsided/nfaced) in this element block.
+ * \param exoid exodus file id
+ * \param blk_type type of block (face, or element)
+ * \param blk_id block identifer
+ * \param entity_counts entity_per_polyhedra count array
+ */
+
+int ex_get_entity_count_per_polyhedra (int exoid,
+ ex_entity_type blk_type,
+ int blk_id,
+ int *entity_counts)
+{
+ int npeid=-1, blk_id_ndx, status;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != 0)
+ {
+ if (exerrval == EX_NULLENTITY)
+ {
+ sprintf(errmsg,
+ "Warning: entity_counts array not allowed for NULL %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_entity_count_per_polyhedra",errmsg,EX_MSG);
+ return (EX_WARN);
+ }
+ else
+ {
+ sprintf(errmsg,
+ "Error: failed to locate %s block id %d in id array in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_get_entity_count_per_polyhedra",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+/* inquire id's of previously defined dimensions */
+ switch (blk_type) {
+ case EX_ELEM_BLOCK:
+ status = nc_inq_varid (exoid, VAR_EBEPEC(blk_id_ndx), &npeid);
+ break;
+ case EX_FACE_BLOCK:
+ status = nc_inq_varid (exoid, VAR_FBEPEC(blk_id_ndx), &npeid);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_get_entity_count_per_polyhedra",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate entity_counts array for %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_entity_count_per_polyhedra",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ status = nc_get_var_int(exoid, npeid, entity_counts);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to read node counts array for %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_entity_count_per_polyhedra",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgelb.c b/cbind/src/exgelb.c
index d4e1885..bf81e75 100644
--- a/cbind/src/exgelb.c
+++ b/cbind/src/exgelb.c
@@ -36,10 +36,6 @@
*
* exgelb - read element block parameters
*
-* author - Victor R. Yarberry, Sandia National Laboratories
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int idexo exodus file id
@@ -53,7 +49,6 @@
*
* revision history -
*
-* $Id: exgelb.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*/
@@ -62,8 +57,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/**
* reads the parameters used to describe an element block
+ * \deprecated Use ex_get_block()(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type, num_elem_this_blk, num_nodes_per_elem, num_attr) instead
*/
int ex_get_elem_block (int exoid,
diff --git a/cbind/src/exgelc.c b/cbind/src/exgelc.c
index a0e8729..62eefb1 100644
--- a/cbind/src/exgelc.c
+++ b/cbind/src/exgelc.c
@@ -36,13 +36,6 @@
*
* exgelc - exodusII read element block connectivity
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-* environment - UNIX
-*
* entry conditions -
* expelb must be called first to establish element block parameters.
* input parameters:
@@ -52,17 +45,15 @@
* exit conditions -
* int* connect connectivity array
*
-* revision history -
-* 20061001 - David Thompson - Moved to exgconn (ex_get_conn)
*
-* $Id: exgelc.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*/
#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the connectivity array for an element block
+ * \deprecated Use ex_get_conn()(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0) instead
*/
int ex_get_elem_conn (int exoid,
diff --git a/cbind/src/exgem.c b/cbind/src/exgem.c
index 5ac731e..bae6b2a 100644
--- a/cbind/src/exgem.c
+++ b/cbind/src/exgem.c
@@ -36,12 +36,6 @@
*
* exgem - ex_get_elem_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -50,18 +44,15 @@
* exit conditions -
* int* elem_map element map
*
-* revision history -
-* 20061127 - David Thompson - moved functionality to ex_get_num_map
-*
-*
*****************************************************************************/
#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the element map with specified ID
+ * \deprecated Use ex_get_num_map()(exoid, EX_ELEM_MAP, map_id, elem_map) instead
*/
int ex_get_elem_map (int exoid,
diff --git a/cbind/src/exgenm.c b/cbind/src/exgenm.c
index d6f51ce..17aff32 100644
--- a/cbind/src/exgenm.c
+++ b/cbind/src/exgenm.c
@@ -36,14 +36,6 @@
*
* exgenm - ex_get_elem_num_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -65,88 +57,7 @@
*/
int ex_get_elem_num_map (int exoid,
- int *elem_map)
+ int *elem_map)
{
- int numelemdim, mapid, i, iresult;
- long num_elem, start[1], count[1];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* inquire id's of previously defined dimensions and variables */
-
- /* See if file contains any elements...*/
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
- return(EX_NOERR);
- }
-
- if (ncdiminq (exoid, numelemdim, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in file id %d",
- exoid);
- ex_err("ex_get_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if ((mapid = ncvarid (exoid, VAR_ELEM_NUM_MAP)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
-"Warning: elem numbering map not stored in file id %d; returning default map",
- exoid);
- ex_err("ex_get_elem_num_map",errmsg,exerrval);
-
-/* generate default map of 1..n, where n is num_elem */
- for (i=0; i<num_elem; i++)
- elem_map[i] = i+1;
-
- return (EX_WARN);
- }
-
-
-/* read in the element numbering map */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_elem;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, mapid, start, count, elem_map);
- } else {
- if (!(longs = malloc(num_elem * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for element number map for file id %d",
- exoid);
- ex_err("ex_get_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, mapid, start, count, longs);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get element number map in file id %d",
- exoid);
- ex_err("ex_get_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, elem_map, num_elem);
- free (longs);
- }
-
- return(EX_NOERR);
-
+ return ex_get_id_map(exoid, EX_ELEM_MAP, elem_map);
}
diff --git a/cbind/src/exgev.c b/cbind/src/exgev.c
index eb5591d..6a35a9a 100644
--- a/cbind/src/exgev.c
+++ b/cbind/src/exgev.c
@@ -36,14 +36,6 @@
*
* exgev - ex_get_elem_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -59,17 +51,17 @@
*
* revision history -
*
-* $Id: exgev.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the values of a single element variable for one element block at
* one time step in the database; assume the first time step and
* element variable index is 1
+ * \deprecated Use ex_get_var()(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, num_elem_this_blk, elem_var_vals) instead
*/
int ex_get_elem_var (int exoid,
diff --git a/cbind/src/exgevid.c b/cbind/src/exgevid.c
index 3d97409..e29c861 100644
--- a/cbind/src/exgevid.c
+++ b/cbind/src/exgevid.c
@@ -45,18 +45,18 @@
*
* revision history -
*
-* $Id: exgevid.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
-/*
+/*!
* reads the EXODUS II variable varids from the database
+ * \deprecated Use ex_get_varid()(exoid, EX_ELEM_BLOCK, varid)
*/
int ex_get_elem_varid (int exoid,
int *varid)
{
- return ex_get_varid(exoid, "e", varid);
+ return ex_get_varid(exoid, EX_ELEM_BLOCK, varid);
}
diff --git a/cbind/src/exgevt.c b/cbind/src/exgevt.c
index 91fb1f0..cc97573 100644
--- a/cbind/src/exgevt.c
+++ b/cbind/src/exgevt.c
@@ -36,14 +36,6 @@
*
* exgevt - ex_get_elem_var_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -64,10 +56,11 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the values of an element variable for a single element through a
* specified number of time steps in the database; assume the first element
* variable index, element number, and time step are 1
+ * \deprecated Use ex_get_var_time()(exoid, EX_ELEM_BLOCK, elem_var_index, elem_number, beg_time_step, end_time_step, elem_var_vals)
*/
int ex_get_elem_var_time (int exoid,
diff --git a/cbind/src/exgfrm.c b/cbind/src/exgfrm.c
index 2f35879..1e91ba8 100644
--- a/cbind/src/exgfrm.c
+++ b/cbind/src/exgfrm.c
@@ -36,11 +36,6 @@
*
* exgfrm - ex_get_coordinate_frames: read coordinate frames
*
-* author - Sandia National Laboratories
-* Garth Reese - created this function. Nov 2002
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -81,69 +76,113 @@
/* -------------------- local defines --------------------------- */
#define PROCNAME "ex_get_coordinate_frames"
/* -------------------- end of local defines -------------------- */
-int ex_get_coordinate_frames( int exoid, int *nframes, int *cf_ids,
- void* pt_coordinates, char* tags)
+/*!
+ * Coordinate frames are stored in the database as a series of three
+ * points (defined in the basic cartesian coordinate system). The
+ * first of these points describes the origin of the new system. The
+ * second point lies on the 3 axis (or Z axis) of the frame. The third
+ * point is in the 1-3 (xz) plane. Each coordinate frame is identified
+ * by a unique, integer coordinate ID, and by a character tag
+ * indicating whether the frame is rectangular cartesian
+ * "R", cylindrical "C, or spherical "S".
+ * Because the coordinates are floating point values,
+ * the application code must declare the arrays passed to be the
+ * appropriate type "float" or "double" to match the
+ * compute word size passed in ex_create() or
+ * ex_open().
+ * \param exoid exodus file id
+ * \param[in,out] nframes if 'cf_ids' is NULL, then nframes is returned with the number
+ * of defined coordinate frames. Else it is the number of coordinate
+ * frames to read.
+ * \param[out] cf_ids The (nframes) coordinate frame Ids. If cf_ids is
+ * NULL, no data will be returned in this or any other array. Only
+ * nframes will be modified. Otherwise, space must be allocated to
+ * store 'nframes' integers before making this call.
+ * \param[out] pt_coordinates The (9*nframes) coordinates of the three
+ * points defining each coordinate axis. The first three values are
+ * the origin of the first frame. The next three values are the
+ * coordinates of a point on the 3rd axis of the first frame. The next
+ * three values are the coordinates of a point in the plane of the 1-3
+ * axis. The pattern is repeated for each frame. If 'cf_ids'
+ * is null, no data will be returned in this array. Otherwise, space
+ * must be allocated for 9*nframes floating point values. The size of
+ * the allocation depends upon the compute word size.
+ * \param[out] tags The (nframes) character tags associated with each
+ * coordinate frame. If 'cf_ids' is NULL, no data will be
+ * returned in this array. Otherwise, space must be allocated for
+ * 'nframes' characters.
+ */
+
+ int ex_get_coordinate_frames( int exoid, int *nframes, int *cf_ids, void* pt_coordinates,
+ char* tags)
+
{
- int dimid; /* ID of the dimension of # frames */
+ int status;
+ int dimid; /* ID of the dimension of # frames */
char errmsg[MAX_ERR_LENGTH];
- int exerrval; /* returned error value */
int varids; /* variable id for the frame ids */
- long int start=0; /* start value for varputs */
- long int count; /* number vars to put in varput */
- long int count9; /* ditto, but for coordinates */
- void* pt_c=0; /* pointer to converted array */
+ size_t start=0; /* start value for varputs */
+ size_t count; /* number vars to put in varput */
/* get the dimensions */
assert( nframes !=NULL );
- dimid = ncdimid(exoid,NUM_CFRAMES);
- if ( dimid<0 ){
+ status = nc_inq_dimid(exoid, DIM_NUM_CFRAMES, &dimid);
+ if (status != NC_NOERR){
*nframes=0;
return EX_NOERR;
}
- ncdiminq(exoid,dimid,(char*)0,&count);
+
+ nc_inq_dimlen(exoid,dimid,&count);
*nframes=(int)count;
- count9=count*9;
if ( count==0 )
return (EX_NOERR);
if ( cf_ids )
- if ( (varids=ncvarid(exoid,FRAME_IDS))==-1 ||
- ncvarget(exoid,varids,&start,&count,cf_ids)== -1 ) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid,VAR_FRAME_IDS, &varids))!= NC_NOERR ||
+ (nc_get_var_int(exoid,varids,cf_ids)!= NC_NOERR)) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to read number coordinate ids from file id %d",
exoid);
- ex_err((char*)PROCNAME,errmsg,exerrval);
+ ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
if ( tags )
- if ( (varids=ncvarid(exoid,FRAME_TAGS))==-1 ||
- ncvarget(exoid,varids,&start,&count,tags)== -1 ) {
- exerrval = ncerr;
+ if ( (status = nc_inq_varid(exoid,VAR_FRAME_TAGS,&varids))!= NC_NOERR ||
+ (nc_get_vara_text(exoid,varids,&start,&count,tags) != NC_NOERR)) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to read number coordinate tags from file id %d",
exoid);
- ex_err((char*)PROCNAME,errmsg,exerrval);
+ ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
if (pt_coordinates ){
- pt_c=ex_conv_array(exoid,RTN_ADDRESS,pt_coordinates,count9);
- assert(pt_c!=0);
- if ( (varids=ncvarid(exoid,FRAME_COORDS))==-1 ||
- ncvarget(exoid,varids,&start,&count9,pt_c)== -1 ) {
- exerrval = ncerr;
+ if ( (status = nc_inq_varid(exoid,VAR_FRAME_COORDS,&varids))!= NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to read number coordinate tags from file id %d",
exoid);
- ex_err((char*)PROCNAME,errmsg,exerrval);
+ ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
- else {
- pt_c=ex_conv_array( exoid, READ_CONVERT,pt_coordinates,count9);
- assert(pt_c==0);
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var_float(exoid,varids,pt_coordinates);
+ } else {
+ status = nc_get_var_double(exoid,varids,pt_coordinates);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to read number coordinate tags from file id %d",
+ exoid);
+ ex_err(PROCNAME,errmsg,exerrval);
+ return (EX_FATAL);
}
}
diff --git a/cbind/src/exggv.c b/cbind/src/exggv.c
index a07d637..aa4a8dc 100644
--- a/cbind/src/exggv.c
+++ b/cbind/src/exggv.c
@@ -36,14 +36,6 @@
*
* exggv - ex_get_glob_vars
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: exggv.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -73,16 +64,15 @@ int ex_get_glob_vars (int exoid,
void *glob_var_vals)
{
int varid;
- long start[2], count[2];
+ int status;
+ size_t start[2], count[2];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
-/* inquire previously defined variable */
-
- if ((varid = ncvarid (exoid, VAR_GLO_VAR)) == -1)
- {
- exerrval = ncerr;
+ /* inquire previously defined variable */
+ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: failed to locate global variables in file id %d",
exoid);
@@ -90,28 +80,26 @@ int ex_get_glob_vars (int exoid,
return (EX_WARN);
}
-
-/* read values of global variables */
-
+ /* read values of global variables */
start[0] = --time_step;
start[1] = 0;
count[0] = 1;
count[1] = num_glob_vars;
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,glob_var_vals,num_glob_vars)) == -1)
- {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, glob_var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, glob_var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get global variable values from file id %d",
exoid);
ex_err("ex_get_glob_vars",errmsg,exerrval);
return (EX_FATAL);
}
-
-
- ex_conv_array( exoid, READ_CONVERT, glob_var_vals, num_glob_vars );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exggvt.c b/cbind/src/exggvt.c
index 0b606f4..9e38fa9 100644
--- a/cbind/src/exggvt.c
+++ b/cbind/src/exggvt.c
@@ -36,14 +36,6 @@
*
* exggvt - get_glob_var_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,7 +48,6 @@
*
* revision history -
*
-* $Id: exggvt.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -75,22 +66,18 @@ int ex_get_glob_var_time (int exoid,
int end_time_step,
void *glob_var_vals)
{
+ int status;
int varid;
- long start[2], count[2];
+ size_t start[2], count[2];
float fdum;
- char *cdum;
+ char *cdum = 0;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
- cdum = 0; /* initialize even though it is not used */
-
-
-/* inquire previously defined variable */
-
- if ((varid = ncvarid (exoid, VAR_GLO_VAR)) == -1)
- {
- exerrval = ncerr;
+ /* inquire previously defined variable */
+ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate global variables in file id %d",
exoid);
@@ -98,20 +85,16 @@ int ex_get_glob_var_time (int exoid,
return (EX_WARN);
}
-/* read values of global variables */
-
+ /* read values of global variables */
start[0] = --beg_time_step;
start[1] = --glob_var_index;
- if (end_time_step < 0)
- {
-
-/* user is requesting the maximum time step; we find this out using the
- * database inquire function to get the number of time steps
- */
- if (ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum) == -1)
- {
- exerrval = ncerr;
+ if (end_time_step < 0) {
+ /* user is requesting the maximum time step; we find this out using the
+ * database inquire function to get the number of time steps
+ */
+ if ((status = ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of time steps in file id %d",
exoid);
@@ -125,18 +108,19 @@ int ex_get_glob_var_time (int exoid,
count[0] = end_time_step - beg_time_step + 1;
count[1] = 1;
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,glob_var_vals,count[0])) == -1)
- {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, glob_var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, glob_var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get global variable %d values from file id %d",
glob_var_index, exoid);
ex_err("ex_get_glob_var_time",errmsg,exerrval);
return (EX_FATAL);
}
-
- ex_conv_array( exoid, READ_CONVERT, glob_var_vals, count[0] );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgnvid.c b/cbind/src/exgidm.c
similarity index 51%
copy from cbind/src/exgnvid.c
copy to cbind/src/exgidm.c
index f7cb35a..18efe5e 100644
--- a/cbind/src/exgnvid.c
+++ b/cbind/src/exgidm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * Copyright (c) 2007 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
* retains certain rights in this software.
*
@@ -34,18 +34,15 @@
*/
/*****************************************************************************
*
-* exgnvid - ex_get_nodal_varid
+* exgnm - ex_get_id_map
*
* entry conditions -
* input parameters:
-* int exoid exodus file id
+* int exoid exodus file id
+* int map_type type of map (node, edge, face, element)
*
* exit conditions -
-* int* varid array of nodal variable varids
-*
-* revision history -
-*
-* $Id: exgnvid.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+* int* map map
*
*****************************************************************************/
@@ -54,67 +51,85 @@
#include "exodusII_int.h"
/*
- * returns the varids for the nodal variables.
+ * reads the id map
*/
-int ex_get_nodal_varid(int exoid, int *varid)
+int ex_get_id_map ( int exoid,
+ ex_entity_type map_type,
+ int* map )
{
- int i, dimid, nvarid;
- long num_vars;
+ int dimid, mapid, status;
+ size_t i;
+ size_t num_entries;
char errmsg[MAX_ERR_LENGTH];
+ const char* dnumentries;
+ const char* vmap;
+ const char* tname;
+ switch (map_type) {
+ case EX_NODE_MAP:
+ tname = "node";
+ dnumentries = DIM_NUM_NODES;
+ vmap = VAR_NODE_NUM_MAP;
+ break;
+ case EX_EDGE_MAP:
+ tname = "edge";
+ dnumentries = DIM_NUM_EDGE;
+ vmap = VAR_EDGE_NUM_MAP;
+ break;
+ case EX_FACE_MAP:
+ tname = "face";
+ dnumentries = DIM_NUM_FACE;
+ vmap = VAR_FACE_NUM_MAP;
+ break;
+ case EX_ELEM_MAP:
+ tname = "element";
+ dnumentries = DIM_NUM_ELEM;
+ vmap = VAR_ELEM_NUM_MAP;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg,
+ "Error: Bad map type (%d) specified for file id %d",
+ map_type, exoid );
+ ex_err( "ex_get_id_map", errmsg, exerrval );
+ return (EX_FATAL);
+ }
exerrval = 0; /* clear error code */
- if ((dimid = ncdimid (exoid, DIM_NUM_NOD_VAR)) == -1) {
- num_vars = 0;
- if (ncerr == NC_EBADDIM)
- return(EX_NOERR); /* no nodal variables defined */
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodal variable names in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* See if any entries are stored in this file */
+ if (nc_inq_dimid(exoid, dnumentries,&dimid) != NC_NOERR) {
+ return (EX_NOERR);
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_vars) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodal variables in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_large_model(exoid) == 0) {
- /* All varids are the same; */
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) {
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_entries)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Warning: could not find nodal variables in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_WARN);
- }
- for (i=0; i < num_vars; i++) {
- varid[i] = nvarid;
+ "Error: failed to get number of %ss in file id %d", tname, exoid);
+ ex_err("ex_get_id_map",errmsg,exerrval);
+ return (EX_FATAL);
}
- } else {
- /* Variables stored separately; each has a unique varid */
- for (i=0; i < num_vars; i++) {
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR_NEW(i+1))) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: could not find nodal variable %d in file id %d",
- i+1, exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_WARN);
- }
- varid[i] = nvarid;
+
+ /* generate default map of 1..n, where n is num_entries */
+ for (i=0; i<num_entries; i++) {
+ map[i] = (int)i+1;
}
+
+ return (EX_NOERR);
}
+
+ /* read in the id map */
+ status = nc_get_var_int(exoid, mapid, map);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s id map in file id %d",
+ tname, exoid);
+ ex_err("ex_get_id_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
return(EX_NOERR);
}
diff --git a/cbind/src/exgids.c b/cbind/src/exgids.c
index 338e482..c4d80ba 100644
--- a/cbind/src/exgids.c
+++ b/cbind/src/exgids.c
@@ -33,7 +33,6 @@
*
*/
/*
- * $Id: exgids.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -46,79 +45,51 @@
*/
int ex_get_ids (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int *ids)
{
- int dimid, varid, iresult;
- long numobj, start[1], count[1];
- nclong *longs;
+ int varid, status;
char errmsg[MAX_ERR_LENGTH];
- const char* dimnumobj;
const char* varidobj;
- const char* tname;
exerrval = 0; /* clear error code */
switch (obj_type) {
case EX_EDGE_BLOCK:
- tname = "edge block";
- dimnumobj = DIM_NUM_ED_BLK;
varidobj = VAR_ID_ED_BLK;
break;
case EX_FACE_BLOCK:
- tname = "face block";
- dimnumobj = DIM_NUM_FA_BLK;
varidobj = VAR_ID_FA_BLK;
break;
case EX_ELEM_BLOCK:
- tname = "element block";
- dimnumobj = DIM_NUM_EL_BLK;
varidobj = VAR_ID_EL_BLK;
break;
case EX_NODE_SET:
- tname = "node set";
- dimnumobj = DIM_NUM_NS;
varidobj = VAR_NS_IDS;
break;
case EX_EDGE_SET:
- tname = "edge set";
- dimnumobj = DIM_NUM_ES;
varidobj = VAR_ES_IDS;
break;
case EX_FACE_SET:
- tname = "face set";
- dimnumobj = DIM_NUM_FS;
varidobj = VAR_FS_IDS;
break;
case EX_SIDE_SET:
- tname = "side set";
- dimnumobj = DIM_NUM_SS;
varidobj = VAR_SS_IDS;
break;
case EX_ELEM_SET:
- tname = "element set";
- dimnumobj = DIM_NUM_ELS;
varidobj = VAR_ELS_IDS;
break;
case EX_NODE_MAP:
- tname = "node map";
- dimnumobj = DIM_NUM_NM;
varidobj = VAR_NM_PROP(1);
break;
case EX_EDGE_MAP:
- tname = "edge map";
- dimnumobj = DIM_NUM_EDM;
varidobj = VAR_EDM_PROP(1);
break;
case EX_FACE_MAP:
- tname = "face map";
- dimnumobj = DIM_NUM_FAM;
varidobj = VAR_FAM_PROP(1);
break;
case EX_ELEM_MAP:
- tname = "element map";
- dimnumobj = DIM_NUM_EM;
varidobj = VAR_EM_PROP(1);
break;
default:/* invalid variable type */
@@ -128,77 +99,37 @@ int ex_get_ids (int exoid,
return(EX_FATAL);
}
- /* inquire id's of previously defined dimensions and variables */
-
- if ((dimid = ncdimid (exoid, dimnumobj)) == -1)
- {
- exerrval = ncerr;
+ /* Determine if there are any 'obj-type' objects */
+ if ((status = nc_inq_dimid (exoid, ex_dim_num_objects(obj_type), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate dimension %s in file id %d",
- dimnumobj,exoid);
+ "Warning: no %s defined in file id %d",
+ ex_name_of_object(obj_type), exoid);
ex_err("ex_get_ids",errmsg,exerrval);
- return (EX_FATAL);
- }
+ return (EX_WARN);
+ }
+
- if (ncdiminq (exoid, dimid, (char*)0, &numobj) == -1)
- {
- exerrval = ncerr;
+ /* inquire id's of previously defined dimensions and variables */
+ if ((status = nc_inq_varid(exoid, varidobj, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to return number of %ss in file id %d",
- tname,exoid);
+ "Error: failed to locate %s ids variable in file id %d",
+ ex_name_of_object(obj_type),exoid);
ex_err("ex_get_ids",errmsg,exerrval);
return (EX_FATAL);
- }
-
-
- if ((varid = ncvarid (exoid, varidobj)) == -1)
- {
- exerrval = ncerr;
+ }
+
+ /* read in the element block ids */
+ status = nc_get_var_int(exoid, varid, ids);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s ids variable in file id %d",
- tname,exoid);
+ "Error: failed to return %s ids in file id %d",
+ ex_name_of_object(obj_type),exoid);
ex_err("ex_get_ids",errmsg,exerrval);
return (EX_FATAL);
- }
-
-
- /* read in the element block ids */
-
- /* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = numobj;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, varid, start, count, ids);
- } else {
- if (!(longs = malloc(numobj * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for %s ids for file id %d",
- tname,exoid);
- ex_err("ex_get_ids",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, varid, start, count, longs);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to return %s ids in file id %d",
- tname,exoid);
- ex_err("ex_get_ids",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, ids, numobj);
- free (longs);
- }
-
- return(EX_NOERR);
+ }
+ return(EX_NOERR);
}
diff --git a/cbind/src/exginf.c b/cbind/src/exginf.c
index 7fd2664..7420739 100644
--- a/cbind/src/exginf.c
+++ b/cbind/src/exginf.c
@@ -36,14 +36,6 @@
*
* exginf - ex_get_info
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: exginf.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -67,91 +58,77 @@
int ex_get_info (int exoid,
char **info)
{
- int i, j, dimid, varid;
- long num_info, start[2];
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* inquire previously defined dimensions and variables */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_INFO)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ int status;
+ size_t i;
+ int j, dimid, varid;
+ size_t num_info, start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire previously defined dimensions and variables */
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_INFO, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Warning: failed to locate number of info records in file id %d",
- exoid);
- ex_err("ex_get_info",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_info) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ exoid);
+ ex_err("ex_get_info",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_info)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get number of info records in file id %d",
- exoid);
- ex_err("ex_get_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
+ exoid);
+ ex_err("ex_get_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
-/* do this only if there are any information records */
- if (num_info > 0)
- {
- if ((varid = ncvarid (exoid, VAR_INFO)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* do this only if there are any information records */
+ if (num_info > 0) {
+ if ((status = nc_inq_varid(exoid, VAR_INFO, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to locate info record data in file id %d", exoid);
- ex_err("ex_get_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* read the information records */
-
- for (i=0; i<num_info; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- j = 0;
- ptr = info[i];
-
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get info record data in file id %d", exoid);
- ex_err("ex_get_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- while ((*ptr++ != '\0') && (j < MAX_LINE_LENGTH))
- {
- start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get info record data in file id %d", exoid);
- ex_err("ex_get_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- }
-/* delete trailing blanks */
- --ptr;
- while ( --ptr >= info[i] && *ptr == ' ' );
- *(++ptr) = '\0';
+ ex_err("ex_get_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* read the information records */
+ for (i=0; i<num_info; i++) {
+ start[0] = i;
+ start[1] = 0;
+
+ j = 0;
+ ptr = info[i];
+
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get info record data in file id %d", exoid);
+ ex_err("ex_get_info",errmsg,exerrval);
+ return (EX_FATAL);
}
- }
-
- return (EX_NOERR);
+ while ((*ptr++ != '\0') && (j < MAX_LINE_LENGTH)) {
+ start[1] = ++j;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get info record data in file id %d", exoid);
+ ex_err("ex_get_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ /* delete trailing blanks */
+ --ptr;
+ while ( --ptr >= info[i] && *ptr == ' ' );
+ *(++ptr) = '\0';
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgini.c b/cbind/src/exgini.c
index 81cd99b..2ff39ed 100644
--- a/cbind/src/exgini.c
+++ b/cbind/src/exgini.c
@@ -36,14 +36,6 @@
*
* exgini - ex_get_init
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -60,7 +52,6 @@
* revision history -
* David Thompson - Moved to exginix.c (exgini.c now a special case)
*
-* $Id: exgini.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -68,9 +59,18 @@
#include "exodusII_int.h"
#include <string.h>
-/*
+/*!
* reads the initialization parameters from an opened EXODUS II file
- */
+ * \param exoid exodus file id
+ * \param[out] title Title of the mesh, String length may be up to #MAX_LINE_LENGTH characters.
+ * \param[out] num_dim Dimensionality of the database. This is the number of coordinates per node.
+ * \param[out] num_nodes Number of nodes
+ * \param[out] num_elem Number of elements
+ * \param[out] num_elem_blk Number of element blocks
+ * \param[out] num_node_sets Number of node sets
+ * \param[out] num_side_sets Number of side sets
+ * \sa ex_get_init_ext()
+ */
int ex_get_init (int exoid,
char *title,
diff --git a/cbind/src/exginix.c b/cbind/src/exginix.c
index 92f109c..505fe1b 100644
--- a/cbind/src/exginix.c
+++ b/cbind/src/exginix.c
@@ -36,15 +36,6 @@
*
* exgini - ex_get_init
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-* David Thompson - Added edge/face blocks/sets
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,150 +45,112 @@
*
* revision history -
*
-* $Id: exginix.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
+#include <stdlib.h>
+#include <string.h>
-/*
+/* Used to reduce repeated code below */
+#define EX_GET_DIM_VALUE(TNAME,DNAME,DIMVAR,SDIMVAL) \
+ if ((status = nc_inq_dimid (exoid, DNAME, &DIMVAR)) != NC_NOERR) { \
+ /* TNAME are optional and default to zero. */ \
+ SDIMVAL = 0; \
+ } else { \
+ if ((status = nc_inq_dimlen(exoid, DIMVAR, &lnum)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, "Error: failed to get number of " TNAME " in file id %d", \
+ exoid); \
+ ex_err("ex_get_init",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ SDIMVAL = lnum; \
+ }
+
+/*!
* reads the initialization parameters from an opened EXODUS II file
+ * \param exoid exodus file id
+ * \param[out] info #ex_init_params structure containing metadata for mesh.
+ * \sa ex_get_init()
*/
int ex_get_init_ext (int exoid,
ex_init_params *info)
{
int dimid;
- long lnum_dim, lnum_nodes, lnum_elem, lnum_elem_blk, lnum_node_sets;
- long lnum_side_sets, lnum_edge_sets, lnum_face_sets, lnum_elem_sets;
- long lnum_node_maps, lnum_edge_maps, lnum_face_maps, lnum_elem_maps;
- long lnum_edge, lnum_face, lnum_edge_blk, lnum_face_blk;
+ size_t lnum;
char errmsg[MAX_ERR_LENGTH];
- int title_len;
+ int status;
+ size_t title_len;
nc_type title_type;
exerrval = 0; /* clear error code */
- if (ncattinq (exoid, NC_GLOBAL, ATT_TITLE, &title_type, &title_len) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_att(exoid, NC_GLOBAL, ATT_TITLE, &title_type, &title_len)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to inquire title in file id %d", exoid);
ex_err("ex_get_init",errmsg,exerrval);
return (EX_FATAL);
}
- /* Check title length to avoid overrunning clients memory space;
- include trailing null */
+ /* Check title length to avoid overrunning clients memory space; include trailing null */
if (title_len > MAX_LINE_LENGTH+1) {
+ char *title = malloc(title_len+1);
+ if ((status = nc_get_att_text(exoid, NC_GLOBAL, ATT_TITLE, title)) == NC_NOERR) {
+ strncpy(info->title, title, MAX_LINE_LENGTH+1);
+ info->title[MAX_LINE_LENGTH] = '\0';
+ }
+ free(title);
+ } else {
+ status = nc_get_att_text(exoid, NC_GLOBAL, ATT_TITLE, info->title);
+ info->title[title_len] = '\0';
+ }
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: Title is too long (%d characters) in file id %d",
- title_len-1, exoid);
- exerrval = -1;
+ "Error: failed to get title in file id %d", exoid);
ex_err("ex_get_init",errmsg,exerrval);
return (EX_FATAL);
}
- /* printf("[ex_get_init] title length: %d\n",title_len); */
-
- if (ncattget (exoid, NC_GLOBAL, ATT_TITLE, info->title) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get title in file id %d", exoid);
- ex_err("ex_get_init",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* printf("[ex_get_init] title: %s\n",info->title); */
-
-
- if ((dimid = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_init",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_dim) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dimensions in file id %d",
- exoid);
- ex_err("ex_get_init",errmsg,exerrval);
- return (EX_FATAL);
- }
- info->num_dim = lnum_dim;
+
+ status = ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions", &lnum, &dimid, "ex_get_init");
+ if (status != NC_NOERR) return status;
+ info->num_dim = lnum;
/* Handle case with zero-nodes */
-#define EX_GET_DIM_VALUE(TNAME,DNAME,DIMVAR,LDIMVAL,SDIMVAL) \
- if ((DIMVAR = ncdimid (exoid, DNAME)) == -1) { \
- /* TNAME are optional and default to zero. */ \
- SDIMVAL = 0; \
- } else { \
- \
- if (ncdiminq (exoid, DIMVAR, (char *) 0, &LDIMVAL) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get number of " TNAME " in file id %d", \
- exoid); \
- ex_err("ex_get_init",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- SDIMVAL = LDIMVAL; \
- }
- EX_GET_DIM_VALUE( "nodes",DIM_NUM_NODES,dimid,lnum_nodes,info->num_nodes);
- EX_GET_DIM_VALUE( "edges", DIM_NUM_EDGE,dimid, lnum_edge, info->num_edge);
- EX_GET_DIM_VALUE( "faces", DIM_NUM_FACE,dimid, lnum_face, info->num_face);
- EX_GET_DIM_VALUE("elements", DIM_NUM_ELEM,dimid, lnum_elem, info->num_elem);
+ EX_GET_DIM_VALUE( "nodes",DIM_NUM_NODES,dimid,info->num_nodes);
+ EX_GET_DIM_VALUE( "edges", DIM_NUM_EDGE,dimid,info->num_edge);
+ EX_GET_DIM_VALUE( "faces", DIM_NUM_FACE,dimid,info->num_face);
+ EX_GET_DIM_VALUE("elements", DIM_NUM_ELEM,dimid,info->num_elem);
- if (info->num_elem > 0) {
- if ((dimid = ncdimid (exoid, DIM_NUM_EL_BLK)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of element blocks in file id %d",
- exoid);
- ex_err("ex_get_init",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_elem_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element blocks in file id %d",
- exoid);
- ex_err("ex_get_init",errmsg,exerrval);
- return (EX_FATAL);
- }
- info->num_elem_blk = lnum_elem_blk;
- } else {
- info->num_elem_blk = 0;
+ EX_GET_DIM_VALUE("element blocks", DIM_NUM_EL_BLK,dimid,info->num_elem_blk);
+ if (info->num_elem_blk == 0 && info->num_elem > 0) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of element blocks in file id %d",
+ exoid);
+ ex_err("ex_get_init",errmsg,exerrval);
+ return (EX_FATAL);
}
+ EX_GET_DIM_VALUE("node sets", DIM_NUM_NS,dimid,info->num_node_sets);
+ EX_GET_DIM_VALUE("edge sets", DIM_NUM_ES,dimid,info->num_edge_sets);
+ EX_GET_DIM_VALUE("face sets", DIM_NUM_FS,dimid,info->num_face_sets);
+ EX_GET_DIM_VALUE("side sets", DIM_NUM_SS,dimid,info->num_side_sets);
+ EX_GET_DIM_VALUE("elem sets",DIM_NUM_ELS,dimid,info->num_elem_sets);
- EX_GET_DIM_VALUE("node sets", DIM_NUM_NS,dimid,lnum_node_sets,info->num_node_sets);
- EX_GET_DIM_VALUE("edge sets", DIM_NUM_ES,dimid,lnum_edge_sets,info->num_edge_sets);
- EX_GET_DIM_VALUE("face sets", DIM_NUM_FS,dimid,lnum_face_sets,info->num_face_sets);
- EX_GET_DIM_VALUE("side sets", DIM_NUM_SS,dimid,lnum_side_sets,info->num_side_sets);
- EX_GET_DIM_VALUE("elem sets",DIM_NUM_ELS,dimid,lnum_elem_sets,info->num_elem_sets);
-
- EX_GET_DIM_VALUE("node maps", DIM_NUM_NM,dimid,lnum_node_maps,info->num_node_maps);
- EX_GET_DIM_VALUE("edge maps",DIM_NUM_EDM,dimid,lnum_edge_maps,info->num_edge_maps);
- EX_GET_DIM_VALUE("face maps",DIM_NUM_FAM,dimid,lnum_face_maps,info->num_face_maps);
- EX_GET_DIM_VALUE("elem maps", DIM_NUM_EM,dimid,lnum_elem_maps,info->num_elem_maps);
+ EX_GET_DIM_VALUE("node maps", DIM_NUM_NM,dimid,info->num_node_maps);
+ EX_GET_DIM_VALUE("edge maps",DIM_NUM_EDM,dimid,info->num_edge_maps);
+ EX_GET_DIM_VALUE("face maps",DIM_NUM_FAM,dimid,info->num_face_maps);
+ EX_GET_DIM_VALUE("elem maps", DIM_NUM_EM,dimid,info->num_elem_maps);
/* Edge and face blocks are also optional (for backwards compatability) */
- EX_GET_DIM_VALUE("edge blocks",DIM_NUM_ED_BLK,dimid,lnum_edge_blk,info->num_edge_blk);
- EX_GET_DIM_VALUE("face blocks",DIM_NUM_FA_BLK,dimid,lnum_face_blk,info->num_face_blk);
+ EX_GET_DIM_VALUE("edge blocks",DIM_NUM_ED_BLK,dimid,info->num_edge_blk);
+ EX_GET_DIM_VALUE("face blocks",DIM_NUM_FA_BLK,dimid,info->num_face_blk);
return (EX_NOERR);
}
diff --git a/cbind/src/exgmap.c b/cbind/src/exgmap.c
index 46d1551..30f60b2 100644
--- a/cbind/src/exgmap.c
+++ b/cbind/src/exgmap.c
@@ -36,14 +36,6 @@
*
* exgmap - ex_get_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: exgmap.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,16 +52,16 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the element order map from the database
+ * \deprecated Use ex_get_num_map() instead.
*/
int ex_get_map (int exoid,
int *elem_map)
{
- int numelemdim, mapid, i, iresult;
- long num_elem, start[1], count[1];
- nclong *longs;
+ int numelemdim, mapid, status;
+ size_t num_elem, i;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -78,14 +69,12 @@ int ex_get_map (int exoid,
/* inquire id's of previously defined dimensions and variables */
/* See if file contains any elements...*/
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_ELEM, &numelemdim)) != NC_NOERR) {
return (EX_NOERR);
}
- if (ncdiminq (exoid, numelemdim, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, numelemdim, &num_elem)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of elements in file id %d",
exoid);
@@ -94,48 +83,19 @@ int ex_get_map (int exoid,
}
- if ((mapid = ncvarid (exoid, VAR_MAP)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: element order map not stored in file id %d; returning default map",
- exoid);
- ex_err("ex_get_map",errmsg,exerrval);
-
-/* generate default map of 1..n, where n is num_elem */
+ if (nc_inq_varid(exoid, VAR_MAP, &mapid) != NC_NOERR) {
+ /* generate default map of 1..n, where n is num_elem */
for (i=0; i<num_elem; i++)
- elem_map[i] = i+1;
-
- return (EX_WARN);
+ elem_map[i] = i+1;
+
+ return (EX_NOERR);
}
+ /* read in the element order map */
+ status = nc_get_var_int(exoid, mapid, elem_map);
-/* read in the element order map */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_elem;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, mapid, start, count, elem_map);
- } else {
- if (!(longs = malloc(num_elem * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for element order map for file id %d",
- exoid);
- ex_err("ex_get_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, mapid, start, count, longs);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get element order map in file id %d",
exoid);
@@ -143,11 +103,6 @@ int ex_get_map (int exoid,
return (EX_FATAL);
}
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, elem_map, num_elem);
- free (longs);
- }
-
return(EX_NOERR);
}
diff --git a/cbind/src/exgmp.c b/cbind/src/exgmp.c
index 986b97e..2f71229 100644
--- a/cbind/src/exgmp.c
+++ b/cbind/src/exgmp.c
@@ -36,11 +36,6 @@
*
* exgmp - ex_get_map_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -64,46 +59,42 @@ int ex_get_map_param (int exoid,
int *num_node_maps,
int *num_elem_maps)
{
- int dimid;
- long lnum_node_maps, lnum_elem_maps;
- char errmsg[MAX_ERR_LENGTH];
+ int status;
+ int dimid;
+ size_t lnum_node_maps, lnum_elem_maps;
+ char errmsg[MAX_ERR_LENGTH];
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
- /* node maps are optional */
- if ((dimid = ncdimid (exoid, DIM_NUM_NM)) == -1)
- *num_node_maps = 0;
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_node_maps) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of node maps in file id %d",
- exoid);
- ex_err("ex_get_map_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- *num_node_maps = lnum_node_maps;
- }
+ /* node maps are optional */
+ if (nc_inq_dimid(exoid, DIM_NUM_NM, &dimid) != NC_NOERR) {
+ *num_node_maps = 0;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, dimid, &lnum_node_maps)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of node maps in file id %d",
+ exoid);
+ ex_err("ex_get_map_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ *num_node_maps = lnum_node_maps;
+ }
- /* element maps are optional */
- if ((dimid = ncdimid (exoid, DIM_NUM_EM)) == -1)
- *num_elem_maps = 0;
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_elem_maps) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* element maps are optional */
+ if (nc_inq_dimid(exoid, DIM_NUM_EM, &dimid) != NC_NOERR) {
+ *num_elem_maps = 0;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, dimid, &lnum_elem_maps)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get number of element maps in file id %d",
- exoid);
- ex_err("ex_get_map_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- *num_elem_maps = lnum_elem_maps;
- }
-
- return (EX_NOERR);
+ exoid);
+ ex_err("ex_get_map_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ *num_elem_maps = lnum_elem_maps;
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgnam.c b/cbind/src/exgnam.c
index 0e70307..cc7572a 100644
--- a/cbind/src/exgnam.c
+++ b/cbind/src/exgnam.c
@@ -36,8 +36,6 @@
*
* exgnam - ex_get_name
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -49,7 +47,6 @@
*
* revision history -
*
-* $Id: exgnam.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,66 +58,70 @@
*/
int ex_get_name (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int entity_id,
char *name)
{
+ int status;
int j, varid, ent_ndx;
- long num_entity, start[2];
+ size_t start[2];
char *ptr;
char errmsg[MAX_ERR_LENGTH];
+ char *vobj = NULL;
const char *routine = "ex_get_name";
exerrval = 0;
- /* inquire previously defined dimensions and variables */
-
- if (obj_type == EX_ELEM_BLOCK) {
- ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_EL_BLK);
- ent_ndx = ex_id_lkup(exoid, VAR_ID_EL_BLK, entity_id);
- }
- else if (obj_type == EX_EDGE_BLOCK) {
- ex_get_dimension(exoid, DIM_NUM_ED_BLK, "edge block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_ED_BLK);
- ent_ndx = ex_id_lkup(exoid, VAR_ID_ED_BLK, entity_id);
- }
- else if (obj_type == EX_FACE_BLOCK) {
- ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_FA_BLK);
- ent_ndx = ex_id_lkup(exoid, VAR_ID_FA_BLK, entity_id);
- }
- else if (obj_type == EX_NODE_SET) {
- ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_NS);
- ent_ndx = ex_id_lkup(exoid, VAR_NS_IDS, entity_id);
- }
- else if (obj_type == EX_SIDE_SET) {
- ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_SS);
- ent_ndx = ex_id_lkup(exoid, VAR_SS_IDS, entity_id);
- }
- else if (obj_type == EX_NODE_MAP) {
- ex_get_dimension(exoid, DIM_NUM_NM, "node map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_NM);
- ent_ndx = ex_id_lkup(exoid, VAR_NM_PROP(1), entity_id);
- }
- else if (obj_type == EX_ELEM_MAP) {
- ex_get_dimension(exoid, DIM_NUM_EM, "element map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_EM);
- ent_ndx = ex_id_lkup(exoid, VAR_EM_PROP(1), entity_id);
- }
- else {/* invalid variable type */
+ switch(obj_type) {
+ case EX_ELEM_BLOCK:
+ vobj = VAR_NAME_EL_BLK;
+ break;
+ case EX_EDGE_BLOCK:
+ vobj = VAR_NAME_ED_BLK;
+ break;
+ case EX_FACE_BLOCK:
+ vobj = VAR_NAME_FA_BLK;
+ break;
+ case EX_NODE_SET:
+ vobj = VAR_NAME_NS;
+ break;
+ case EX_SIDE_SET:
+ vobj = VAR_NAME_SS;
+ break;
+ case EX_EDGE_SET:
+ vobj = VAR_NAME_ES;
+ break;
+ case EX_FACE_SET:
+ vobj = VAR_NAME_FS;
+ break;
+ case EX_ELEM_SET:
+ vobj = VAR_NAME_ELS;
+ break;
+ case EX_NODE_MAP:
+ vobj = VAR_NAME_NM;
+ break;
+ case EX_EDGE_MAP:
+ vobj = VAR_NAME_EDM;
+ break;
+ case EX_FACE_MAP:
+ vobj = VAR_NAME_FAM;
+ break;
+ case EX_ELEM_MAP:
+ vobj = VAR_NAME_EM;
+ break;
+ default:
+ /* invalid variable type */
exerrval = EX_BADPARAM;
sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid);
ex_err(routine,errmsg,exerrval);
return(EX_FATAL);
}
- if (varid != -1) {
+ if ((status = nc_inq_varid(exoid, vobj, &varid)) == NC_NOERR) {
/* If this is a null entity, then 'ent_ndx' will be negative.
* We don't care in this routine, so make it positive and continue...
*/
+ ent_ndx = ex_id_lkup(exoid, obj_type, entity_id);
if (ent_ndx < 0) ent_ndx = -ent_ndx;
/* read the name */
@@ -130,8 +131,8 @@ int ex_get_name (int exoid,
j = 0;
ptr = name;
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get entity name for id %d in file id %d",
ent_ndx, exoid);
@@ -139,11 +140,10 @@ int ex_get_name (int exoid,
return (EX_FATAL);
}
-
while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {
start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get name in file id %d", exoid);
ex_err(routine,errmsg,exerrval);
@@ -152,7 +152,7 @@ int ex_get_name (int exoid,
}
--ptr;
if (ptr > name) {
- while (*(--ptr) == ' '); /* get rid of trailing blanks */
+ while (--ptr >= name && *ptr == ' '); /* get rid of trailing blanks */
}
*(++ptr) = '\0';
} else {
diff --git a/cbind/src/exgnams.c b/cbind/src/exgnams.c
index 53dde0f..b1cf9e1 100644
--- a/cbind/src/exgnams.c
+++ b/cbind/src/exgnams.c
@@ -36,8 +36,6 @@
*
* exgnam - ex_get_names
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -48,7 +46,6 @@
*
* revision history -
*
-* $Id: exgnams.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -60,125 +57,126 @@
*/
int ex_get_names (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
char **names)
{
- int i, j, varid;
- long num_entity, start[2];
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
- const char *routine = "ex_get_names";
+ int status;
+ int j, varid, temp;
+ size_t num_entity, i;
+ size_t start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+ const char *routine = "ex_get_names";
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
-/* inquire previously defined dimensions and variables */
+ /* inquire previously defined dimensions and variables */
- switch (obj_type) {
- /* ======== BLOCKS ========= */
- case EX_EDGE_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_ED_BLK, "edge block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_ED_BLK);
- break;
- case EX_FACE_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_FA_BLK);
- break;
- case EX_ELEM_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element block", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_EL_BLK);
- break;
+ switch (obj_type) {
+ /* ======== BLOCKS ========= */
+ case EX_EDGE_BLOCK:
+ ex_get_dimension(exoid, DIM_NUM_ED_BLK, "edge block", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_ED_BLK, &varid);
+ break;
+ case EX_FACE_BLOCK:
+ ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face block", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_FA_BLK, &varid);
+ break;
+ case EX_ELEM_BLOCK:
+ ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element block", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_EL_BLK, &varid);
+ break;
- /* ======== SETS ========= */
- case EX_NODE_SET:
- ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_NS);
- break;
- case EX_EDGE_SET:
- ex_get_dimension(exoid, DIM_NUM_ES, "edgeset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_ES);
- break;
- case EX_FACE_SET:
- ex_get_dimension(exoid, DIM_NUM_FS, "faceset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_FS);
- break;
- case EX_SIDE_SET:
- ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_SS);
- break;
- case EX_ELEM_SET:
- ex_get_dimension(exoid, DIM_NUM_ELS, "elemset", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_ELS);
- break;
+ /* ======== SETS ========= */
+ case EX_NODE_SET:
+ ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_NS, &varid);
+ break;
+ case EX_EDGE_SET:
+ ex_get_dimension(exoid, DIM_NUM_ES, "edgeset", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_ES, &varid);
+ break;
+ case EX_FACE_SET:
+ ex_get_dimension(exoid, DIM_NUM_FS, "faceset", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_FS, &varid);
+ break;
+ case EX_SIDE_SET:
+ ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_SS, &varid);
+ break;
+ case EX_ELEM_SET:
+ ex_get_dimension(exoid, DIM_NUM_ELS, "elemset", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_ELS, &varid);
+ break;
- /* ======== MAPS ========= */
- case EX_NODE_MAP:
- ex_get_dimension(exoid, DIM_NUM_NM, "node map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_NM);
- break;
- case EX_EDGE_MAP:
- ex_get_dimension(exoid, DIM_NUM_EDM, "edge map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_EDM);
- break;
- case EX_FACE_MAP:
- ex_get_dimension(exoid, DIM_NUM_FAM, "face map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_FAM);
- break;
- case EX_ELEM_MAP:
- ex_get_dimension(exoid, DIM_NUM_EM, "element map", &num_entity, routine);
- varid = ncvarid (exoid, VAR_NAME_EM);
- break;
+ /* ======== MAPS ========= */
+ case EX_NODE_MAP:
+ ex_get_dimension(exoid, DIM_NUM_NM, "node map", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_NM, &varid);
+ break;
+ case EX_EDGE_MAP:
+ ex_get_dimension(exoid, DIM_NUM_EDM, "edge map", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_EDM, &varid);
+ break;
+ case EX_FACE_MAP:
+ ex_get_dimension(exoid, DIM_NUM_FAM, "face map", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_FAM, &varid);
+ break;
+ case EX_ELEM_MAP:
+ ex_get_dimension(exoid, DIM_NUM_EM, "element map", &num_entity, &temp, routine);
+ status = nc_inq_varid(exoid, VAR_NAME_EM, &varid);
+ break;
- /* invalid variable type */
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: Invalid type specified in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return(EX_FATAL);
- }
+ /* invalid variable type */
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: Invalid type specified in file id %d",
+ exoid);
+ ex_err(routine,errmsg,exerrval);
+ return(EX_FATAL);
+ }
- if (varid != -1) {
- /* read the names */
- for (i=0; i<num_entity; i++) {
- start[0] = i;
- start[1] = 0;
+ if (status == NC_NOERR) {
+ /* read the names */
+ for (i=0; i<num_entity; i++) {
+ start[0] = i;
+ start[1] = 0;
- j = 0;
- ptr = names[i];
+ j = 0;
+ ptr = names[i];
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get names in file id %d", exoid);
- ex_err("ex_get_names",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get names in file id %d", exoid);
+ ex_err("ex_get_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {
- start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get names in file id %d", exoid);
- ex_err("ex_get_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- --ptr;
- if (ptr > names[i]) {
- /* get rid of trailing blanks */
- while (*(--ptr) == ' ');
- }
- *(++ptr) = '\0';
- }
- } else {
- /* Names variable does not exist on the database; probably since this is an
- * older version of the database. Return an empty array...
- */
- for (i=0; i<num_entity; i++) {
- names[i][0] = '\0';
- }
- }
- return (EX_NOERR);
+ while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {
+ start[1] = ++j;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get names in file id %d", exoid);
+ ex_err("ex_get_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ --ptr;
+ if (ptr > names[i]) {
+ while (--ptr >= names[i] && *ptr == ' '); /* get rid of trailing blanks */
+ }
+ *(++ptr) = '\0';
+ }
+ } else {
+ /* Names variable does not exist on the database; probably since this is an
+ * older version of the database. Return an empty array...
+ */
+ for (i=0; i<num_entity; i++) {
+ names[i][0] = '\0';
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgnconn.c b/cbind/src/exgnconn.c
new file mode 100644
index 0000000..24fe1f4
--- /dev/null
+++ b/cbind/src/exgnconn.c
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnconn - exodusII read partial edge/face/element block connectivity
+*
+* entry conditions -
+* expelb must be called first to establish element block parameters.
+* input parameters:
+* int exoid exodus file id
+* int blk_type block type (edge, face, element)
+* int blk_id block id
+* int start_num The starting index (1-based) of entities to read
+* int num_ent The number of entities to read connectivity info for.
+*
+* exit conditions -
+* int* nodeconn nodal connectivity array
+* int* edgeconn edge connectivity array (where applicable)
+* int* faceconn face connectivity array (where applicable)
+*
+* revision history -
+*
+*/
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the connectivity array for an element block
+ */
+
+int ex_get_n_conn( int exoid,
+ ex_entity_type blk_type,
+ int blk_id,
+ int start_num,
+ int num_ent,
+ int* nodeconn,
+ int* edgeconn,
+ int* faceconn )
+{
+ int connid, econnid, fconnid, blk_id_ndx, status;
+ int numnodperentdim, numedgperentdim, numfacperentdim;
+ int iexit = (EX_NOERR); /* exit status */
+ size_t num_nodes_per_entry, num_edges_per_entry, num_faces_per_entry;
+ char errmsg[MAX_ERR_LENGTH];
+
+ const char* dnumnodent;
+ const char* dnumedgent;
+ const char* dnumfacent;
+ const char* vnodeconn;
+ const char* vedgeconn;
+ const char* vfaceconn;
+
+ /* The partial connectivity input function can currently only handle nodal
+ * connectivity. Print a warning if edgeconn or faceconn is non-NULL
+ */
+ if (edgeconn != NULL || faceconn != NULL) {
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Warning: ex_get_n_conn only supports nodal connectivity at this time. %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg,EX_MSG);
+ }
+
+ exerrval = 0; /* clear error code */
+
+ /* Locate index of element block id in VAR_ID_EL_BLK array */
+
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != 0)
+ {
+ if (exerrval == EX_NULLENTITY)
+ {
+ sprintf(errmsg,
+ "Warning: no connectivity array for NULL %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg,EX_MSG);
+ return (EX_WARN); /* no connectivity array for this element block */
+ }
+ else
+ {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ dnumnodent = DIM_NUM_NOD_PER_ED(blk_id_ndx);
+ dnumedgent = 0;
+ dnumfacent = 0;
+ vnodeconn = VAR_EBCONN(blk_id_ndx);
+ vedgeconn = 0;
+ vfaceconn = 0;
+ break;
+ case EX_FACE_BLOCK:
+ dnumnodent = DIM_NUM_NOD_PER_FA(blk_id_ndx);
+ dnumedgent = 0;
+ dnumfacent = 0;
+ vnodeconn = VAR_FBCONN(blk_id_ndx);
+ vedgeconn = 0;
+ vfaceconn = 0;
+ break;
+ case EX_ELEM_BLOCK:
+ dnumnodent = DIM_NUM_NOD_PER_EL(blk_id_ndx);
+ dnumedgent = DIM_NUM_EDG_PER_EL(blk_id_ndx);
+ dnumfacent = DIM_NUM_FAC_PER_EL(blk_id_ndx);
+ vnodeconn = VAR_CONN(blk_id_ndx);
+ vedgeconn = VAR_ECONN(blk_id_ndx);
+ vfaceconn = VAR_FCONN(blk_id_ndx);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_get_n_conn",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
+ }
+ /* inquire id's of previously defined dimensions */
+
+ if ((status = nc_inq_dimid (exoid, dnumnodent, &numnodperentdim)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of nodes/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (nc_inq_dimlen(exoid, numnodperentdim, &num_nodes_per_entry) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ if ( dnumedgent ) {
+ num_edges_per_entry = 0;
+ if ((status = nc_inq_dimid(exoid, dnumedgent, &numedgperentdim)) != NC_NOERR) {
+ numedgperentdim = -1;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, numedgperentdim, &num_edges_per_entry)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of edges/entry for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+ }
+
+ if ( dnumfacent ) {
+ num_faces_per_entry = 0;
+ if ((status = nc_inq_dimid(exoid, dnumfacent, &numfacperentdim)) != NC_NOERR) {
+ numfacperentdim = -1;
+ } else {
+ if ((status = nc_inq_dimlen(exoid, numfacperentdim, &num_faces_per_entry)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of faces/entry for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+ }
+
+
+ if ((status = nc_inq_varid(exoid, vnodeconn, &connid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ status = 0;
+ if (edgeconn && (numedgperentdim > 0) &&
+ ((status = nc_inq_varid (exoid, vedgeconn, &econnid)) != NC_NOERR))
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate edge connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ if (faceconn && (numfacperentdim > 0) &&
+ ((status = nc_inq_varid (exoid, vfaceconn, &fconnid)) != NC_NOERR))
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate face connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+
+ /* read in the connectivity array */
+ if ( edgeconn && num_edges_per_entry > 0) {
+ status = nc_get_var_int(exoid, econnid, edgeconn);
+
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get edge connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+
+ if ( faceconn && num_faces_per_entry > 0) {
+ status = nc_get_var_int(exoid, fconnid, faceconn);
+
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get face connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+
+ if ( nodeconn && num_nodes_per_entry > 0) {
+ size_t start[1], count[1];
+
+ start[0] = (start_num-1) * num_nodes_per_entry;
+ count[0] = num_ent * num_nodes_per_entry;
+
+ status = nc_get_vara_int(exoid, connid, start, count, nodeconn);
+
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_get_n_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ }
+
+ return iexit;
+}
diff --git a/cbind/src/exgncor.c b/cbind/src/exgncor.c
new file mode 100644
index 0000000..bab6e86
--- /dev/null
+++ b/cbind/src/exgncor.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgcor - ex_get_n_coord
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int start_node_num starting index of coordinates to be returned.
+* int num_nodes number of nodes to read coordinates for.
+*
+* exit conditions -
+* float* x_coord X coord array
+* float* y_coord y coord array
+* float* z_coord z coord array
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the coordinates of the nodes.
+ * Memory must be allocated for the coordinate arrays (x_coor, y_coor,
+ * and z_coor) before this call is made. The length of each of these
+ * arrays is the number of nodes in the mesh. Because the coordinates
+ * are floating point values, the application code must declare the
+ * arrays passed to be the appropriate type "float" or "double"
+ * to match the compute word size passed in ex_create() or ex_open()
+ * \param exoid exodus file id
+ * \param start_node_num the starting index of the coordinates to be returned.
+ * \param num_nodes the number of nodes to read coordinates for.
+ * \param[out] x_coor Returned X coordinates of the nodes. These are
+ * returned only if x_coor is non-NULL.
+ * \param[out] y_coor Returned Y coordinates of the nodes. These are
+ * returned only if y_coor is non-NULL.
+ * \param[out] z_coor Returned Z coordinates of the nodes. These are
+ * returned only if z_coor is non-NULL.
+ */
+
+int ex_get_n_coord (int exoid,
+ int start_node_num,
+ int num_nodes,
+ void *x_coor,
+ void *y_coor,
+ void *z_coor)
+{
+ int status;
+ int coordid;
+ int coordidx, coordidy, coordidz;
+
+ int numnoddim, ndimdim;
+ size_t num_nod, num_dim, start[2], count[2], i;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0;
+
+ /* inquire id's of previously defined dimensions */
+
+ if (nc_inq_dimid (exoid, DIM_NUM_NODES, &numnoddim) != NC_NOERR)
+ {
+ /* If not found, then this file is storing 0 nodes.
+ Return immediately */
+ return (EX_NOERR);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes in file id %d",
+ exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (start_node_num + num_nodes -1 > (int)num_nod) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: start index (%d) + node count (%d) is larger than total number of nodes (%d) in file id %d",
+ start_node_num, num_nodes, (int)num_nod, exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions",
+ &num_dim, &ndimdim, "ex_get_n_coord") != NC_NOERR) {
+ return(EX_FATAL);
+ }
+
+ --start_node_num;
+
+ /* read in the coordinates */
+ if (ex_large_model(exoid) == 0) {
+ if ((status = nc_inq_varid (exoid, VAR_COORD, &coordid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ for (i=0; i<num_dim; i++) {
+ char *which;
+ start[0] = i;
+ start[1] = start_node_num;
+
+ count[0] = 1;
+ count[1] = num_nodes;
+
+ if (i == 0 && x_coor != NULL) {
+ which = "X";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, x_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, x_coor);
+ }
+ }
+ else if (i == 1 && y_coor != NULL) {
+ which = "Y";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, y_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, y_coor);
+ }
+ }
+ else if (i == 2 && z_coor != NULL) {
+ which = "Z";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, z_coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, z_coor);
+ }
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s coord array in file id %d", which, exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ } else {
+ if ((status = nc_inq_varid (exoid, VAR_COORD_X, &coordidx)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate x nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_dim > 1) {
+ if ((status = nc_inq_varid (exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate y nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ } else {
+ coordidy = 0;
+ }
+
+ if (num_dim > 2) {
+ if ((status = nc_inq_varid (exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate z nodal coordinates in file id %d", exoid);
+ ex_err("ex_get_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ } else {
+ coordidz = 0;
+ }
+
+ /* write out the coordinates */
+ for (i=0; i<num_dim; i++)
+ {
+ void *coor = NULL;
+ char *which = NULL;
+
+ start[0] = start_node_num;
+ count[0] = num_nodes;
+
+ if (i == 0) {
+ coor = x_coor;
+ which = "X";
+ coordid = coordidx;
+ } else if (i == 1) {
+ coor = y_coor;
+ which = "Y";
+ coordid = coordidy;
+ } else if (i == 2) {
+ coor = z_coor;
+ which = "Z";
+ coordid = coordidz;
+ }
+
+ if (coor != NULL && coordid != 0) {
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, coordid, start, count, coor);
+ } else {
+ status = nc_get_vara_double(exoid, coordid, start, count, coor);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgnm.c b/cbind/src/exgnm.c
index f8c3ac7..062c96e 100644
--- a/cbind/src/exgnm.c
+++ b/cbind/src/exgnm.c
@@ -36,12 +36,6 @@
*
* exgnm - ex_get_node_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -59,8 +53,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the node map with specified ID
+ * \deprecated Use ex_get_num_map()(exoid, EX_NODE_MAP, map_id, node_map
*/
int ex_get_node_map( int exoid,
diff --git a/cbind/src/exgnmap.c b/cbind/src/exgnmap.c
index 23f2092..676d019 100644
--- a/cbind/src/exgnmap.c
+++ b/cbind/src/exgnmap.c
@@ -36,12 +36,6 @@
*
* exgnm - ex_get_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -65,43 +59,31 @@
*/
int ex_get_num_map ( int exoid,
- int map_type,
+ ex_entity_type map_type,
int map_id,
int* map )
{
- int dimid, var_id, id_ndx, iresult;
- long num_entries, start[1], count[1];
- nclong *longs;
+ int dimid, var_id, id_ndx, status;
char errmsg[MAX_ERR_LENGTH];
const char* dim_map_size;
const char* dim_num_maps;
- const char* prop_map_id;
- const char* tname;
switch (map_type) {
case EX_NODE_MAP:
- tname = "node";
dim_map_size = DIM_NUM_NODES;
dim_num_maps = DIM_NUM_NM;
- prop_map_id = VAR_NM_PROP(1);
break;
case EX_EDGE_MAP:
- tname = "edge";
dim_map_size = DIM_NUM_EDGE;
dim_num_maps = DIM_NUM_EDM;
- prop_map_id = VAR_EDM_PROP(1);
break;
case EX_FACE_MAP:
- tname = "face";
dim_map_size = DIM_NUM_FACE;
dim_num_maps = DIM_NUM_FAM;
- prop_map_id = VAR_FAM_PROP(1);
break;
case EX_ELEM_MAP:
- tname = "elem";
dim_map_size = DIM_NUM_ELEM;
dim_num_maps = DIM_NUM_EM;
- prop_map_id = VAR_EM_PROP(1);
break;
default:
exerrval = EX_BADPARAM;
@@ -113,96 +95,51 @@ int ex_get_num_map ( int exoid,
exerrval = 0; /* clear error code */
/* See if any entries are stored in this file */
- if ((dimid = ncdimid (exoid, dim_map_size)) == -1)
- {
+ if (nc_inq_dimid (exoid, dim_map_size, &dimid) != NC_NOERR) {
return (EX_NOERR);
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entries) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries in file id %d", exoid);
- ex_err("ex_get_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any maps have been defined */
-
- if ((dimid = ncdimid (exoid, dim_num_maps)) == -1)
- {
- exerrval = ncerr;
+ /* first check if any maps have been defined */
+ if ((status = nc_inq_dimid(exoid, dim_num_maps, &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Warning: no %s maps defined in file id %d",
- tname,exoid);
+ "Warning: no %ss defined in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_get_map",errmsg,exerrval);
return (EX_WARN);
}
-/* Lookup index of map id property array */
-
- id_ndx = ex_id_lkup(exoid,prop_map_id,map_id);
- if (exerrval != 0)
- {
-
+ /* Lookup index of map id property array */
+ id_ndx = ex_id_lkup(exoid,map_type,map_id);
+ if (exerrval != 0) {
sprintf(errmsg,
- "Error: failed to locate %s map id %d in %s in file id %d",
- tname,map_id,prop_map_id,exoid);
+ "Error: failed to locate %s id %d in id variable in file id %d",
+ ex_name_of_object(map_type),map_id,exoid);
ex_err("ex_get_map",errmsg,exerrval);
return (EX_FATAL);
}
-/* inquire id's of previously defined dimensions and variables */
-
- if ((var_id = ncvarid (exoid, ex_name_of_map(map_type,id_ndx))) == -1)
- {
- exerrval = ncerr;
+ /* inquire id's of previously defined dimensions and variables */
+ if ((status = nc_inq_varid(exoid, ex_name_of_map(map_type,id_ndx), &var_id)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s map %d in file id %d",
- tname,map_id,exoid);
+ "Error: failed to locate %s %d in file id %d",
+ ex_name_of_object(map_type),map_id,exoid);
ex_err("ex_get_map",errmsg,exerrval);
return (EX_FATAL);
}
-
-/* read in the map */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_entries;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, var_id, start, count, map);
- } else {
- if (!(longs = malloc(num_entries * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for %s map for file id %d",
- tname,exoid);
- ex_err("ex_get_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, var_id, start, count, longs);
- }
+ /* read in the map */
+ status = nc_get_var_int(exoid, var_id, map);
- if (iresult == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get %s map in file id %d",
- tname,exoid);
+ "Error: failed to get %s in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_get_map",errmsg,exerrval);
return (EX_FATAL);
}
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, map, num_entries);
- free (longs);
- }
-
return (EX_NOERR);
-
}
diff --git a/cbind/src/exgnnm.c b/cbind/src/exgnnm.c
index 6ae5122..10b9912 100644
--- a/cbind/src/exgnnm.c
+++ b/cbind/src/exgnnm.c
@@ -36,14 +36,6 @@
*
* exgnnm - ex_get_node_num_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -67,85 +59,5 @@
int ex_get_node_num_map (int exoid,
int *node_map)
{
- int numnodedim, mapid, i, iresult;
- long num_nodes, start[1], count[1];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* inquire id's of previously defined dimensions and variables */
- if ((numnodedim = ncdimid (exoid, DIM_NUM_NODES)) == -1)
- {
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, numnodedim, (char *) 0, &num_nodes) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes in file id %d",
- exoid);
- ex_err("ex_get_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if ((mapid = ncvarid (exoid, VAR_NODE_NUM_MAP)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: node numbering map not stored in file id %d; returning default map",
- exoid);
- ex_err("ex_get_node_num_map",errmsg,exerrval);
-
-/* generate default map of 1..n, where n is num_nodes */
- for (i=0; i<num_nodes; i++)
- node_map[i] = i+1;
-
- return (EX_WARN);
- }
-
-
-/* read in the node numbering map */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_nodes;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, mapid, start, count, node_map);
- } else {
- if (!(longs = malloc(num_nodes * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for node numbering map for file id %d",
- exoid);
- ex_err("ex_get_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, mapid, start, count, longs);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get node numbering map in file id %d",
- exoid);
- ex_err("ex_get_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, node_map, num_nodes);
- free (longs);
- }
-
-
- return(EX_NOERR);
-
+ return ex_get_id_map(exoid, EX_NODE_MAP, node_map);
}
diff --git a/cbind/src/exgnv.c b/cbind/src/exgnnv.c
similarity index 68%
copy from cbind/src/exgnv.c
copy to cbind/src/exgnnv.c
index ebd7efb..8ef5d03 100644
--- a/cbind/src/exgnv.c
+++ b/cbind/src/exgnnv.c
@@ -34,21 +34,14 @@
*/
/*****************************************************************************
*
-* exgnv - ex_get_nodal_var
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
+* exgnv - ex_get_n_nodal_var
*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int time_step whole time step number
-* int nodeal_var_index index of desired nodal variable
+* int nodal_var_index index of desired nodal variable
+* int start_node index (1-based) of first node to get
* int num_nodes number of nodal points
*
* exit conditions -
@@ -56,26 +49,34 @@
*
* revision history -
*
-* $Id: exgnv.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
- * reads the values of a single nodal variable for a single time step from
- * the database; assume the first time step and nodal variable index is 1
+/*!
+ * reads the values of a single nodal variable for a partial block at one time
+ * step from the database; assume the first time step and variable index
+ * and start_node are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param nodal_var_index index of desired nodal variable (1-based)
+ * \param start_node index of first node to read (1-based)
+ * \param num_nodes number of nodes to read
+ * \param var_vals the values to be read
*/
-int ex_get_nodal_var (int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- void *nodal_var_vals)
+int ex_get_n_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int start_node,
+ int num_nodes,
+ void *var_vals)
{
int varid;
- long start[3], count[3];
+ int status;
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -84,18 +85,18 @@ int ex_get_nodal_var (int exoid,
if (ex_large_model(exoid) == 0) {
/* read values of the nodal variable */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variables in file id %d",
exoid);
- ex_err("ex_get_nodal_var",errmsg,exerrval);
+ ex_err("ex_get_n_nodal_var",errmsg,exerrval);
return (EX_WARN);
}
start[0] = --time_step;
start[1] = --nodal_var_index;
- start[2] = 0;
+ start[2] = --start_node;
count[0] = 1;
count[1] = 1;
@@ -104,34 +105,35 @@ int ex_get_nodal_var (int exoid,
} else {
/* read values of the nodal variable -- stored as separate variables... */
/* Get the varid.... */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR_NEW(nodal_var_index))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
- ex_err("ex_get_nodal_var",errmsg,exerrval);
+ ex_err("ex_get_n_nodal_var",errmsg,exerrval);
return (EX_WARN);
}
start[0] = --time_step;
- start[1] = 0;
+ start[1] = --start_node;
count[0] = 1;
count[1] = num_nodes;
+ }
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, var_vals);
}
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,nodal_var_vals,num_nodes)) == -1)
- {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get nodal variables in file id %d",
exoid);
- ex_err("ex_get_nodal_var",errmsg,exerrval);
+ ex_err("ex_get_n_nodal_var",errmsg,exerrval);
return (EX_FATAL);
}
-
- ex_conv_array( exoid, READ_CONVERT,nodal_var_vals, num_nodes );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgnoatt.c b/cbind/src/exgnoatt.c
new file mode 100644
index 0000000..246e35b
--- /dev/null
+++ b/cbind/src/exgnoatt.c
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgeat - ex_get_n_one_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type object type (edge, face, elem block)
+* int obj_id object id (edge face, elem block ID)
+* int start_num starting index of attributes to be returned.
+* int num_ent number of entities to read attributes for.
+*
+* exit conditions -
+* float* attrib array of attributes
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the specified attribute for a subsect of a block
+ * \param exoid exodus file id
+ * \param obj_type object type (edge, face, elem block)
+ * \param obj_id object id (edge, face, elem block ID)
+ * \param start_num the starting index of the attributes to be returned.
+ * \param num_ent the number of entities to read attributes for.
+ * \param attrib_index index of attribute to write
+ * \param attrib array of attributes
+ */
+/*
+ */
+int ex_get_n_one_attr( int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int start_num,
+ int num_ent,
+ int attrib_index,
+ void* attrib )
+
+{
+ int status;
+ int attrid, obj_id_ndx;
+ int temp;
+ size_t num_entries_this_obj, num_attr;
+ size_t start[2], count[2];
+ ptrdiff_t stride[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* dnumobjent;
+ const char* dnumobjatt;
+ const char* vattrbname;
+
+ exerrval = 0; /* clear error code */
+
+ /* Determine index of obj_id in vobjids array */
+ if (obj_type != EX_NODAL) {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes found for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_get_n_one_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this object */
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type),obj_id, exoid);
+ ex_err("ex_get_n_one_attr",errmsg,exerrval);
+ return (EX_WARN);
+ }
+ }
+ }
+
+ switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vattrbname = VAR_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vattrbname = VAR_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vattrbname = VAR_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vattrbname = VAR_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vattrbname = VAR_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjent = DIM_NUM_NODES;
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vattrbname = VAR_NATTRIB;
+ break;
+ case EX_EDGE_BLOCK:
+ dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
+ vattrbname = VAR_EATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_BLOCK:
+ dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
+ vattrbname = VAR_FATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_BLOCK:
+ dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
+ vattrbname = VAR_ATTRIB(obj_id_ndx);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
+ ex_err("ex_get_n_one_attr",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
+ }
+
+ /* inquire id's of previously defined dimensions */
+ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_get_n_one_attr") != NC_NOERR)
+ return EX_FATAL;
+
+ if (start_num + num_ent -1 > (int)num_entries_this_obj) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: start index (%d) + count (%d) is larger than total number of entities (%d) in file id %d",
+ start_num, num_ent, (int)num_entries_this_obj, exoid);
+ ex_err("ex_get_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_get_n_one_attr") != NC_NOERR)
+ return EX_FATAL;
+
+ if (attrib_index < 1 || attrib_index > (int)num_attr) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %d in file id %d",
+ attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_get_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_get_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* read in the attributes */
+ start[0] = start_num-1;
+ start[1] = attrib_index-1;
+
+ count[0] = num_ent;
+ count[1] = 1;
+
+ stride[0] = 1;
+ stride[1] = num_attr;
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vars_float(exoid, attrid, start, count, stride, attrib);
+ } else {
+ status = nc_get_vars_double(exoid, attrid, start, count, stride, attrib);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get attribute %d for %s %d in file id %d",
+ attrib_index, ex_name_of_object(obj_type), obj_id,exoid);
+ ex_err("ex_get_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgnp.c b/cbind/src/exgnp.c
index 308e2b4..dc66524 100644
--- a/cbind/src/exgnp.c
+++ b/cbind/src/exgnp.c
@@ -36,14 +36,6 @@
*
* exgnp - ex_get_node_set_parameters
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,15 +47,15 @@
*
* revision history -
*
-* $Id: exgnp.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the information which describe a single node set
+ * \deprecated Use ex_get_set_param()(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_df_in_set)
*/
int ex_get_node_set_param (int exoid,
diff --git a/cbind/src/exgns.c b/cbind/src/exgns.c
index 652b8c5..eece0de 100644
--- a/cbind/src/exgns.c
+++ b/cbind/src/exgns.c
@@ -36,14 +36,6 @@
*
* exgns - ex_get_node_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: exgns.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,8 +53,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the node list for a single node set
+ * \deprecated Use ex_get_set()(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL)
*/
int ex_get_node_set (int exoid,
diff --git a/cbind/src/exgnsd.c b/cbind/src/exgnsd.c
index 1d4b85d..0d7fd05 100644
--- a/cbind/src/exgnsd.c
+++ b/cbind/src/exgnsd.c
@@ -36,14 +36,6 @@
*
* exgnsd - ex_get_node_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,15 +46,15 @@
*
* revision history -
*
-* $Id: exgnsd.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the distribution factors for a single node set
+ * \deprecated Use ex_get_set_dist_fact()(exoid, EX_NODE_SET, node_set_id, node_set_dist_fact)
*/
int ex_get_node_set_dist_fact (int exoid,
diff --git a/cbind/src/exgnsi.c b/cbind/src/exgnsi.c
index bdf6089..57306ea 100644
--- a/cbind/src/exgnsi.c
+++ b/cbind/src/exgnsi.c
@@ -36,14 +36,6 @@
*
* exgnsi - ex_get_node_set_ids
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: exgnsi.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,8 +52,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the node set ids from the database
+ * \deprecated Use ex_get_ids()(exoid, EX_NODE_SET, ids)
*/
int ex_get_node_set_ids (int exoid,
diff --git a/cbind/src/exgnstt.c b/cbind/src/exgnstt.c
index 7c53bdf..9e12c80 100644
--- a/cbind/src/exgnstt.c
+++ b/cbind/src/exgnstt.c
@@ -45,7 +45,6 @@
* exit conditions -
* int* nset_var_tab nodeset variable truth table array
*
-* $Id: exgnstt.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -53,8 +52,9 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the EXODUS II nodeset variable truth table from the database
+ * \deprecated Use ex_get_truth_table()(exoid, EX_NODE_SET, num_nodesets, num_nset_var, nset_var_tab)
*/
int ex_get_nset_var_tab (int exoid,
@@ -62,5 +62,5 @@ int ex_get_nset_var_tab (int exoid,
int num_nset_var,
int *nset_var_tab)
{
- return ex_get_var_tab(exoid, "M", num_nodesets, num_nset_var, nset_var_tab);
+ return ex_get_truth_table(exoid, EX_NODE_SET, num_nodesets, num_nset_var, nset_var_tab);
}
diff --git a/cbind/src/exgnsv.c b/cbind/src/exgnsv.c
index 37e3dec..875783d 100644
--- a/cbind/src/exgnsv.c
+++ b/cbind/src/exgnsv.c
@@ -36,14 +36,6 @@
*
* exgssv - ex_get_nset_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -59,17 +51,17 @@
*
* revision history -
*
-* $Id: exgnsv.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the values of a single nodeset variable for one nodeset at
* one time step in the database; assume the first time step and
* nodeset variable index is 1
+ * \deprecated Use ex_get_var()(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_node_this_nset, nset_var_vals) instead
*/
int ex_get_nset_var (int exoid,
@@ -79,68 +71,6 @@ int ex_get_nset_var (int exoid,
int num_node_this_nset,
void *nset_var_vals)
{
- int varid, nset_id_ndx;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of nset_id in VAR_NS_IDS array */
- nset_id_ndx = ex_id_lkup(exoid,VAR_NS_IDS,nset_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no nodeset variables for NULL nodeset %d in file id %d",
- nset_id,exoid);
- ex_err("ex_get_nset_var",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate nodeset id %d in %s variable in file id %d",
- nset_id, VAR_ID_EL_BLK, exoid);
- ex_err("ex_get_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* inquire previously defined variable */
-
- if((varid=ncvarid(exoid,VAR_NS_VAR(nset_var_index,nset_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodeset variable %d for nodeset %d in file id %d",
- nset_var_index,nset_id,exoid); /* this msg needs to be improved */
- ex_err("ex_get_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* read values of nodeset variable */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_node_this_nset;
-
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,nset_var_vals,num_node_this_nset)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get nodeset variable %d for nodeset %d in file id %d",
- nset_var_index,nset_id,exoid);/*this msg needs to be improved*/
- ex_err("ex_get_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- ex_conv_array( exoid, READ_CONVERT, nset_var_vals, num_node_this_nset );
-
- return (EX_NOERR);
+ return ex_get_var(exoid, time_step, EX_NODE_SET, nset_var_index,
+ nset_id, num_node_this_nset, nset_var_vals);
}
diff --git a/cbind/src/exgnsvid.c b/cbind/src/exgnsvid.c
index 1a2c847..496a5ce 100644
--- a/cbind/src/exgnsvid.c
+++ b/cbind/src/exgnsvid.c
@@ -45,7 +45,6 @@
*
* revision history -
*
-* $Id: exgnsvid.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -53,12 +52,13 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the EXODUS II variable varids from the database
+ * \deprecated Use ex_get_varid()(exoid, EX_NODE_SET, varid)
*/
int ex_get_nset_varid (int exoid,
int *varid)
{
- return ex_get_varid(exoid, "m", varid);
+ return ex_get_varid(exoid, EX_NODE_SET, varid);
}
diff --git a/cbind/src/exgnv.c b/cbind/src/exgnv.c
index ebd7efb..1f99629 100644
--- a/cbind/src/exgnv.c
+++ b/cbind/src/exgnv.c
@@ -36,14 +36,6 @@
*
* exgnv - ex_get_nodal_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,7 +48,6 @@
*
* revision history -
*
-* $Id: exgnv.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -75,7 +66,8 @@ int ex_get_nodal_var (int exoid,
void *nodal_var_vals)
{
int varid;
- long start[3], count[3];
+ int status;
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -84,8 +76,8 @@ int ex_get_nodal_var (int exoid,
if (ex_large_model(exoid) == 0) {
/* read values of the nodal variable */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variables in file id %d",
exoid);
@@ -104,8 +96,8 @@ int ex_get_nodal_var (int exoid,
} else {
/* read values of the nodal variable -- stored as separate variables... */
/* Get the varid.... */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR_NEW(nodal_var_index))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
@@ -118,20 +110,21 @@ int ex_get_nodal_var (int exoid,
count[0] = 1;
count[1] = num_nodes;
+ }
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, nodal_var_vals);
}
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,nodal_var_vals,num_nodes)) == -1)
- {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get nodal variables in file id %d",
exoid);
ex_err("ex_get_nodal_var",errmsg,exerrval);
return (EX_FATAL);
}
-
- ex_conv_array( exoid, READ_CONVERT,nodal_var_vals, num_nodes );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgnvar.c b/cbind/src/exgnvar.c
new file mode 100644
index 0000000..54ef953
--- /dev/null
+++ b/cbind/src/exgnvar.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgev - ex_get_n_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* ex_entity_type var_type block/variable type
+* node, edge/face/element block, or
+* node/edge/face/side/element set
+* int var_index variable index
+* int obj_id object id
+* int start_num starting index of the variables to be written
+* int num_ent number of entities to write variables for.
+*
+*
+* exit conditions -
+* float* var_vals array of element variable values
+*
+*
+* revision history -
+* 20061002 - David Thompson - Adapted from ex_get_elem_var
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the values of a single element variable for one element block at
+ * one time step in the database; assume the first time step and
+ * element variable index is 1
+ */
+
+/*!
+ * reads the values of a single variable for a partial block at one time
+ * step from the database; assume the first time step and variable index
+ * and start_index are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param var_type type (edge block, face block, edge set, ... )
+ * \param var_index element variable index
+ * \param obj_id element block id
+ * \param start_index index of first entity in block to read (1-based)
+ * \param num_entities number of entries to read in this block/set
+ * \param var_vals the values to read
+ */
+
+int ex_get_n_var( int exoid,
+ int time_step,
+ ex_entity_type var_type,
+ int var_index,
+ int obj_id,
+ int start_index,
+ int num_entities,
+ void* var_vals )
+{
+ int status;
+ int varid, obj_id_ndx;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+
+ if (var_type == EX_NODAL) {
+ /* FIXME: Special case: ignore obj_id, possible large_file complications, etc. */
+ return ex_get_n_nodal_var( exoid, time_step, var_index, start_index, num_entities, var_vals );
+ } else if (var_type == EX_GLOBAL) {
+ /* FIXME: Special case: all vars stored in 2-D single array. */
+ return ex_get_glob_vars( exoid, time_step, num_entities, var_vals );
+ }
+
+ exerrval = 0; /* clear error code */
+
+ /* Determine index of obj_id in VAR_ID_EL_BLK array */
+ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no %s variables for NULL block %d in file id %d",
+ ex_name_of_object(var_type), obj_id,exoid);
+ ex_err("ex_get_n_var",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in id variable in file id %d",
+ ex_name_of_object(var_type), obj_id, exoid);
+ ex_err("ex_get_n_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* inquire previously defined variable */
+
+ if((status = nc_inq_varid(exoid, ex_name_var_of_object(var_type,var_index,
+ obj_id_ndx), &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s %d var %d in file id %d",
+ ex_name_of_object(var_type),obj_id,var_index,exoid);
+ ex_err("ex_get_n_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* read values of element variable */
+ start[0] = --time_step;
+ start[1] = start_index-1;
+
+ count[0] = 1;
+ count[1] = num_entities;
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s %d variable %d in file id %d",
+ ex_name_of_object(var_type), obj_id, var_index,exoid);
+ ex_err("ex_get_n_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgnvid.c b/cbind/src/exgnvid.c
index f7cb35a..900c3a8 100644
--- a/cbind/src/exgnvid.c
+++ b/cbind/src/exgnvid.c
@@ -45,7 +45,6 @@
*
* revision history -
*
-* $Id: exgnvid.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,19 +58,20 @@
int ex_get_nodal_varid(int exoid, int *varid)
{
- int i, dimid, nvarid;
- long num_vars;
+ int status;
+ int dimid, nvarid;
+ size_t num_vars, i;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
- if ((dimid = ncdimid (exoid, DIM_NUM_NOD_VAR)) == -1) {
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_NOD_VAR, &dimid)) != NC_NOERR) {
num_vars = 0;
- if (ncerr == NC_EBADDIM)
+ if (status == NC_EBADDIM)
return(EX_NOERR); /* no nodal variables defined */
else
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate nodal variable names in file id %d",
exoid);
@@ -80,8 +80,8 @@ int ex_get_nodal_varid(int exoid, int *varid)
}
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_vars) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_vars)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of nodal variables in file id %d",
exoid);
@@ -91,25 +91,27 @@ int ex_get_nodal_varid(int exoid, int *varid)
if (ex_large_model(exoid) == 0) {
/* All varids are the same; */
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &nvarid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variables in file id %d",
exoid);
ex_err("ex_get_nodal_varid",errmsg,exerrval);
return (EX_WARN);
}
+
for (i=0; i < num_vars; i++) {
varid[i] = nvarid;
}
+
} else {
/* Variables stored separately; each has a unique varid */
for (i=0; i < num_vars; i++) {
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR_NEW(i+1))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(i+1), &nvarid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
- i+1, exoid);
+ (int)i+1, exoid);
ex_err("ex_get_nodal_varid",errmsg,exerrval);
return (EX_WARN);
}
diff --git a/cbind/src/exgnvt.c b/cbind/src/exgnvt.c
index 59be7ff..72dc1b6 100644
--- a/cbind/src/exgnvt.c
+++ b/cbind/src/exgnvt.c
@@ -36,14 +36,6 @@
*
* exgnvt - ex_get_nodal_var_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -57,7 +49,6 @@
*
* revision history -
*
-* $Id: exgnvt.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -77,34 +68,29 @@ int ex_get_nodal_var_time (int exoid,
int end_time_step,
void *nodal_var_vals)
{
+ int status;
int varid;
- long start[3], count[3];
+ size_t start[3], count[3];
float fdum;
- char *cdum;
+ char *cdum = 0;
char errmsg[MAX_ERR_LENGTH];
/* inquire previously defined variable */
+ if (end_time_step < 0) {
- cdum = 0; /* initialize even though it is not used */
-
- if (end_time_step < 0)
- {
-
- /* user is requesting the maximum time step; we find this out using the
- * database inquire function to get the number of time steps; the ending
- * time step number is 1 less due to 0 based array indexing in C
- */
- if (ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum) == -1)
- {
-
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of time steps in file id %d",
- exoid);
- ex_err("ex_get_nodal_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* user is requesting the maximum time step; we find this out using the
+ * database inquire function to get the number of time steps; the ending
+ * time step number is 1 less due to 0 based array indexing in C
+ */
+ if ((status = ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of time steps in file id %d",
+ exoid);
+ ex_err("ex_get_nodal_var_time",errmsg,exerrval);
+ return (EX_FATAL);
}
+ }
end_time_step--;
@@ -113,14 +99,15 @@ int ex_get_nodal_var_time (int exoid,
* assume node number is 1-based (first node is numbered 1); adjust
* so it is 0-based
*/
- if ((varid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
ex_err("ex_get_nodal_var",errmsg,exerrval);
return (EX_WARN);
}
+
start[0] = --beg_time_step;
start[1] = --nodal_var_index;
start[2] = --node_number;
@@ -128,10 +115,9 @@ int ex_get_nodal_var_time (int exoid,
count[0] = end_time_step - beg_time_step + 1;
count[1] = 1;
count[2] = 1;
-
} else {
- if ((varid = ncvarid (exoid, VAR_NOD_VAR_NEW(nodal_var_index))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
@@ -149,20 +135,21 @@ int ex_get_nodal_var_time (int exoid,
count[0] = end_time_step - beg_time_step + 1;
count[1] = 1;
-
}
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,nodal_var_vals,count[0])) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get nodal variables in file id %d",
- exoid);
- ex_err("ex_get_nodal_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
- ex_conv_array( exoid, READ_CONVERT, nodal_var_vals, count[0] );
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, nodal_var_vals);
+ }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get nodal variables in file id %d",
+ exoid);
+ ex_err("ex_get_nodal_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
}
diff --git a/cbind/src/exgnvv.c b/cbind/src/exgnvv.c
index 381c308..3877258 100644
--- a/cbind/src/exgnvv.c
+++ b/cbind/src/exgnvv.c
@@ -36,14 +36,6 @@
*
* exgnv - ex_get_nodal_varid_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -57,7 +49,6 @@
*
* revision history -
*
-* $Id: exgnvv.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -76,9 +67,9 @@ int ex_get_nodal_varid_var(int exoid,
int varid,
void *nodal_var_vals)
{
- long start[3], count[3];
+ int status;
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
- void *array;
exerrval = 0; /* clear error code */
@@ -100,9 +91,15 @@ int ex_get_nodal_varid_var(int exoid,
count[0] = 1;
count[1] = num_nodes;
}
- array = ex_conv_array(exoid,RTN_ADDRESS,nodal_var_vals,num_nodes);
- if (ncvarget (exoid, varid, start, count, array) == -1) {
- exerrval = ncerr;
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, nodal_var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get nodal variables in file id %d",
exoid);
@@ -110,8 +107,5 @@ int ex_get_nodal_varid_var(int exoid,
return (EX_FATAL);
}
- if (array != nodal_var_vals)
- ex_conv_array( exoid, READ_CONVERT,nodal_var_vals, num_nodes );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgoatt.c b/cbind/src/exgoatt.c
index 3e4c09c..3fe17ef 100644
--- a/cbind/src/exgoatt.c
+++ b/cbind/src/exgoatt.c
@@ -46,9 +46,7 @@
* float* attrib array of attributes
*
* revision history -
-* 20061003 - David Thompson - adapted from ex_get_one_attr
*
-* $Id: exgoatt.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,70 +57,76 @@
* reads the attributes for an edge, face, or element block
*/
int ex_get_one_attr( int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
int attrib_index,
void* attrib )
{
- int numobjentdim, numattrdim, attrid, obj_id_ndx;
- long num_entries_this_obj, num_attr;
+ int status;
+ int attrid, obj_id_ndx;
+ int temp;
+ size_t num_entries_this_obj, num_attr;
size_t start[2], count[2];
ptrdiff_t stride[2];
- int error;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* vobjids;
const char* dnumobjent;
const char* dnumobjatt;
const char* vattrbname;
- switch (obj_type) {
- case EX_EDGE_BLOCK:
- tname = "edge block";
- vobjids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face block";
- vobjids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element block";
- vobjids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
- obj_type, exoid );
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
exerrval = 0; /* clear error code */
/* Determine index of obj_id in vobjids array */
- obj_id_ndx = ex_id_lkup(exoid,vobjids,obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no attributes found for NULL %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_get_one_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this object */
- }
- else
- {
- sprintf(errmsg,
- "Warning: failed to locate %s id %d in %s array in file id %d",
- tname,obj_id,vobjids, exoid);
- ex_err("ex_get_one_attr",errmsg,exerrval);
- return (EX_WARN);
+ if (obj_type != EX_NODAL) {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes found for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_get_one_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this object */
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type),obj_id, exoid);
+ ex_err("ex_get_one_attr",errmsg,exerrval);
+ return (EX_WARN);
+ }
}
}
switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vattrbname = VAR_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vattrbname = VAR_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vattrbname = VAR_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vattrbname = VAR_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vattrbname = VAR_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjent = DIM_NUM_NODES;
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vattrbname = VAR_NATTRIB;
+ break;
case EX_EDGE_BLOCK:
dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
@@ -138,65 +142,36 @@ int ex_get_one_attr( int exoid,
dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
vattrbname = VAR_ATTRIB(obj_id_ndx);
break;
- }
-
- /* inquire id's of previously defined dimensions */
- if ((numobjentdim = ncdimid (exoid, dnumobjent)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entries for %s %d in file id %d",
- tname, obj_id, exoid);
- ex_err("ex_get_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, numobjentdim, (char *) 0, &num_entries_this_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_get_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if ((numattrdim = ncdimid(exoid, dnumobjatt)) == -1)
- {
- exerrval = ncerr;
+ default:
+ exerrval = 1005;
sprintf(errmsg,
- "Warning: no attributes found for %s %d in file id %d",
- tname,obj_id,exoid);
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
ex_err("ex_get_one_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this object */
+ return (EX_FATAL); /* number of attributes not defined */
}
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of attributes for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_get_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* inquire id's of previously defined dimensions */
+ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_get_one_attr") != NC_NOERR)
+ return EX_FATAL;
+
+ if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_get_one_attr") != NC_NOERR)
+ return EX_FATAL;
- if (attrib_index < 1 || attrib_index > num_attr) {
+ if (attrib_index < 1 || attrib_index > (int)num_attr) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: Invalid attribute index specified: %d. Valid range is 1 to %ld for %s %d in file id %d",
- attrib_index, num_attr, tname, obj_id, exoid);
+ "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %d in file id %d",
+ attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_get_one_attr",errmsg,exerrval);
return (EX_FATAL);
}
- if ((attrid = ncvarid (exoid, vattrbname)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate attributes for %s %d in file id %d",
- tname,obj_id,exoid);
+ "Error: failed to locate attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
ex_err("ex_get_one_attr",errmsg,exerrval);
return (EX_FATAL);
}
@@ -212,25 +187,19 @@ int ex_get_one_attr( int exoid,
stride[0] = 1;
stride[1] = num_attr;
- if (nc_flt_code(exoid) == NC_FLOAT) {
- error = nc_get_vars_float(exoid, attrid, start, count, stride,
- ex_conv_array(exoid,RTN_ADDRESS,attrib,
- (int)num_attr*num_entries_this_obj));
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vars_float(exoid, attrid, start, count, stride, attrib);
} else {
- error = nc_get_vars_double(exoid, attrid, start, count, stride,
- ex_conv_array(exoid,RTN_ADDRESS,attrib,
- (int)num_attr*num_entries_this_obj));
+ status = nc_get_vars_double(exoid, attrid, start, count, stride, attrib);
}
- if (error == -1) {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get attribute %d for %s %d in file id %d",
- attrib_index, tname, obj_id,exoid);
+ attrib_index, ex_name_of_object(obj_type), obj_id,exoid);
ex_err("ex_get_one_attr",errmsg,exerrval);
return (EX_FATAL);
}
-
- ex_conv_array( exoid, READ_CONVERT, attrib, num_attr*num_entries_this_obj );
-
return(EX_NOERR);
}
diff --git a/cbind/src/exgoea.c b/cbind/src/exgoea.c
index 146a001..5d9cf8d 100644
--- a/cbind/src/exgoea.c
+++ b/cbind/src/exgoea.c
@@ -45,17 +45,16 @@
* float* attrib array of attributes
*
* revision history -
-* 20061003 - David Thompson - moved to ex_get_one_attr
*
-* $Id: exgoea.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* reads the attributes for an element block
+ * \deprecated Use ex_get_one_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib)
*/
int ex_get_one_elem_attr (int exoid,
int elem_blk_id,
diff --git a/cbind/src/exgotv.c b/cbind/src/exgotv.c
index 7272b83..e993d40 100644
--- a/cbind/src/exgotv.c
+++ b/cbind/src/exgotv.c
@@ -34,22 +34,10 @@
*/
/*****************************************************************************
*
-* exgvtt - ex_get_object_truth_vector
-*
-* environment - UNIX
-*
-* entry conditions -
-* input parameters:
-* int exoid exodus file id
-* int num_blk number of blocks
-* int num_var number of variables
-*
-* exit conditions -
-* int* var_tab element variable truth vector array
+* exgotv - ex_get_object_truth_vector
*
* revision history -
*
-* $Id: exgotv.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,137 +50,147 @@
*/
int ex_get_object_truth_vector (int exoid,
- const char *obj_type,
+ ex_entity_type obj_type,
int entity_id,
int num_var,
int *var_vec)
{
- int varid, tabid, i, iresult, ent_ndx;
- long num_var_db = -1;
- long start[2], count[2];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
- const char* routine = "ex_get_object_truth_vector";
-
- /*
- * The ent_type and the var_name are used to build the netcdf
- * variables name. Normally this is done via a macro defined in
- * exodusII_int.h
- */
- const char* ent_type = NULL;
- const char* var_name = NULL;
-
- exerrval = 0; /* clear error code */
+ int statust;
+ int varid, tabid, i, status, ent_ndx;
+ size_t num_var_db = 0;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* routine = "ex_get_object_truth_vector";
+
+ /*
+ * The ent_type and the var_name are used to build the netcdf
+ * variables name. Normally this is done via a macro defined in
+ * exodusII_int.h
+ */
+ const char* ent_type = NULL;
+ const char* var_name = NULL;
+
+ exerrval = 0; /* clear error code */
- if (*obj_type == 'e' || *obj_type == 'E') {
- varid = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_ELEM_TAB);
- var_name = "vals_elem_var";
- ent_ndx = ex_id_lkup(exoid, VAR_ID_EL_BLK, entity_id);
- ent_type = "eb";
- }
- else if (*obj_type == 'm' || *obj_type == 'M') {
- varid = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_NSET_TAB);
- var_name = "vals_nset_var";
- ent_ndx = ex_id_lkup(exoid, VAR_NS_IDS, entity_id);
- ent_type = "ns";
- }
- else if (*obj_type == 's' || *obj_type == 'S') {
- varid = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_SSET_TAB);
- var_name = "vals_sset_var";
- ent_ndx = ex_id_lkup(exoid, VAR_SS_IDS, entity_id);
- ent_type = "ss";
- }
- else { /* invalid variable type */
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *obj_type, exoid);
- ex_err("ex_get_varid",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if (varid == -1) {
- exerrval = ncerr;
- return (EX_WARN);
- }
-
-
- if (num_var_db != num_var) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # of variables doesn't match those defined in file id %d", exoid);
- ex_err("ex_get_object_truth_vector",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (tabid == -1) {
- /* since truth vector isn't stored in the data file, derive it dynamically */
- for (i=0; i<num_var; i++) {
- /* NOTE: names are 1-based */
- if ((tabid = ncvarid (exoid, ex_catstr2(var_name, i+1, ent_type, ent_ndx))) == -1) {
-
- /* variable doesn't exist; put a 0 in the truth vector */
- var_vec[i] = 0;
- } else {
- /* variable exists; put a 1 in the truth vector */
- var_vec[i] = 1;
- }
- }
- } else {
-
- /* read in the truth vector */
-
- /*
- * application code has allocated an array of ints but netcdf is
- * expecting a pointer to nclongs; if ints are different sizes
- * than nclongs, we must allocate an array of nclongs then
- * convert them to ints with ltoi
- */
-
- /* If this is a null entity, then 'ent_ndx' will be negative.
- * We don't care in this routine, so make it positive and continue...
- */
- if (ent_ndx < 0) ent_ndx = -ent_ndx;
-
- start[0] = ent_ndx-1;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_var;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, tabid, start, count, var_vec);
- } else {
- if (!(longs = malloc (num_var * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for truth vector for file id %d",
- exoid);
- ex_err("ex_get_object_truth_vector",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, tabid, start, count, longs);
- }
+ switch (obj_type) {
+ case EX_EDGE_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid(exoid, VAR_EBLK_TAB, &tabid);
+ var_name = "vals_edge_var";
+ ent_type = "eb";
+ break;
+ case EX_FACE_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_FBLK_TAB, &tabid);
+ var_name = "vals_face_var";
+ ent_type = "fb";
+ break;
+ case EX_ELEM_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_ELEM_TAB, &tabid);
+ var_name = "vals_elem_var";
+ ent_type = "eb";
+ break;
+ case EX_NODE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_NSET_TAB, &tabid);
+ var_name = "vals_nset_var";
+ ent_type = "ns";
+ break;
+ case EX_EDGE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_ESET_TAB, &tabid);
+ var_name = "vals_eset_var";
+ ent_type = "es";
+ break;
+ case EX_FACE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_FSET_TAB, &tabid);
+ var_name = "vals_fset_var";
+ ent_type = "fs";
+ break;
+ case EX_SIDE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_SSET_TAB, &tabid);
+ var_name = "vals_sset_var";
+ ent_type = "ss";
+ break;
+ case EX_ELEM_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elemset variables", &num_var_db, &varid, routine);
+ statust = nc_inq_varid (exoid, VAR_ELSET_TAB, &tabid);
+ var_name = "vals_elset_var";
+ ent_type = "es";
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid variable type %d specified in file id %d",
+ obj_type, exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ return (EX_WARN);
+ }
+
+ /* Determine index of entity_id in id array */
+ ent_ndx = ex_id_lkup(exoid,obj_type,entity_id);
+ if (exerrval != 0) {
+ if (exerrval != EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in id variable in file id %d",
+ ex_name_of_object(obj_type), entity_id, exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* If this is a null entity, then 'ent_ndx' will be negative.
+ * We don't care in this routine, so make it positive and continue...
+ */
+ if (ent_ndx < 0) ent_ndx = -ent_ndx;
+
+ if ((int)num_var_db != num_var) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: # of variables doesn't match those defined in file id %d", exoid);
+ ex_err("ex_get_object_truth_vector",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (statust != NC_NOERR) {
+ /* since truth vector isn't stored in the data file, derive it dynamically */
+ for (i=0; i<num_var; i++) {
+ /* NOTE: names are 1-based */
+ if (nc_inq_varid(exoid, ex_catstr2(var_name, i+1, ent_type, ent_ndx), &tabid) != NC_NOERR) {
+ /* variable doesn't exist; put a 0 in the truth vector */
+ var_vec[i] = 0;
+ } else {
+ /* variable exists; put a 1 in the truth vector */
+ var_vec[i] = 1;
+ }
+ }
+ } else {
+
+ /* read in the truth vector */
+
+ start[0] = ent_ndx-1;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = num_var;
+
+ status = nc_get_vara_int(exoid, tabid, start, count, var_vec);
- if (iresult == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get truth vector from file id %d", exoid);
- ex_err("ex_get_object_truth_vector",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, var_vec, num_var);
- free (longs);
- }
-
- }
-
-
- return (EX_NOERR);
-
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get truth vector from file id %d", exoid);
+ ex_err("ex_get_object_truth_vector",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgp.c b/cbind/src/exgp.c
index a050c86..b5346c0 100644
--- a/cbind/src/exgp.c
+++ b/cbind/src/exgp.c
@@ -36,15 +36,10 @@
*
* expp - ex_get_prop: read object property
*
-* author - Larry A. Schoof, Sandia National Laboratories
-* Victor R. Yarberry, Sandia National Laboratories
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
-* int obj_type type of object (element block, node
+* ex_entity_type obj_type type of object (element block, node
* set or side set)
* int obj_id id of object for which value
* is desired
@@ -56,7 +51,6 @@
*
* revision history -
*
-* $Id: exgp.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -69,19 +63,18 @@
*/
int ex_get_prop (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
const char *prop_name,
int *value)
{
+ int status;
int num_props, i, propid;
int found = FALSE;
- long start[1];
- nclong l_val;
+ size_t start[1];
+ int l_val;
char name[MAX_VAR_NAME_LENGTH+1];
char tmpstr[MAX_STR_LENGTH+1];
- char obj_stype[MAX_VAR_NAME_LENGTH+1];
- char obj_vtype[MAX_VAR_NAME_LENGTH+1];
char errmsg[MAX_ERR_LENGTH];
@@ -91,51 +84,41 @@ int ex_get_prop (int exoid,
num_props = ex_get_num_props(exoid,obj_type);
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (obj_stype, "element block");
- strcpy (obj_vtype, VAR_ID_EL_BLK);
- break;
- case EX_NODE_SET:
- strcpy (obj_stype, "node set");
- strcpy (obj_vtype, VAR_NS_IDS);
- break;
- case EX_SIDE_SET:
- strcpy (obj_stype, "side set");
- strcpy (obj_vtype, VAR_SS_IDS);
- break;
- case EX_ELEM_MAP:
- strcpy (obj_stype, "element map");
- strcpy (obj_vtype, VAR_EM_PROP(1));
- break;
- case EX_NODE_MAP:
- strcpy (obj_stype, "node map");
- strcpy (obj_vtype, VAR_NM_PROP(1));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_get_prop",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- for (i=1; i<=num_props; i++)
- {
+ for (i=1; i<=num_props; i++) {
switch (obj_type){
case EX_ELEM_BLOCK:
strcpy (name, VAR_EB_PROP(i));
break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(i));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(i));
+ break;
case EX_NODE_SET:
strcpy (name, VAR_NS_PROP(i));
break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(i));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(i));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(i));
+ break;
case EX_SIDE_SET:
strcpy (name, VAR_SS_PROP(i));
break;
case EX_ELEM_MAP:
strcpy (name, VAR_EM_PROP(i));
break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(i));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(i));
+ break;
case EX_NODE_MAP:
strcpy (name, VAR_NM_PROP(i));
break;
@@ -147,9 +130,8 @@ int ex_get_prop (int exoid,
return(EX_FATAL);
}
- if ((propid = ncvarid (exoid, name)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate property array %s in file id %d",
name, exoid);
@@ -157,20 +139,17 @@ int ex_get_prop (int exoid,
return (EX_FATAL);
}
-/* compare stored attribute name with passed property name */
-
+ /* compare stored attribute name with passed property name */
memset(tmpstr, 0, MAX_STR_LENGTH+1);
- if ((ncattget (exoid, propid, ATT_PROP_NAME, tmpstr)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get property name in file id %d", exoid);
ex_err("ex_get_prop",errmsg,exerrval);
return (EX_FATAL);
}
- if (strcmp(tmpstr, prop_name) == 0)
- {
+ if (strcmp(tmpstr, prop_name) == 0) {
found = TRUE;
break;
}
@@ -178,12 +157,11 @@ int ex_get_prop (int exoid,
/* if property is not found, return warning */
- if (!found)
- {
+ if (!found) {
exerrval = EX_BADPARAM;
sprintf(errmsg,
"Warning: %s property %s not defined in file id %d",
- obj_stype, prop_name, exoid);
+ ex_name_of_object(obj_type), prop_name, exoid);
ex_err("ex_get_prop",errmsg,exerrval);
return (EX_WARN);
}
@@ -192,35 +170,30 @@ int ex_get_prop (int exoid,
/* array at proper index; ex_id_lkup returns an index that is 1-based, */
/* but netcdf expects 0-based arrays so subtract 1 */
- start[0] = ex_id_lkup (exoid, obj_vtype, obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
+ start[0] = ex_id_lkup (exoid, obj_type, obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
sprintf(errmsg,
"Warning: %s id %d is NULL in file id %d",
- obj_stype, obj_id, exoid);
+ ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_get_prop",errmsg,EX_MSG);
return (EX_WARN);
- }
- else
- {
- exerrval = ncerr;
+ } else {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate id %d in %s property array in file id %d",
- obj_id, obj_stype, exoid);
+ obj_id, ex_name_of_object(obj_type), exoid);
ex_err("ex_get_prop",errmsg,exerrval);
return (EX_FATAL);
}
}
start[0] = start[0] - 1;
- if (ncvarget1 (exoid, propid, start, &l_val) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_var1_int (exoid, propid, start, &l_val)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to read value in %s property array in file id %d",
- obj_stype, exoid);
+ ex_name_of_object(obj_type), exoid);
ex_err("ex_get_prop",errmsg,exerrval);
return (EX_FATAL);
}
diff --git a/cbind/src/exgpa.c b/cbind/src/exgpa.c
index d3bf1c2..3b7a1d2 100644
--- a/cbind/src/exgpa.c
+++ b/cbind/src/exgpa.c
@@ -36,11 +36,6 @@
*
* exgpa - ex_get_prop_array: read object property array
*
-* author - Larry A. Schoof, Sandia National Laboratories
-* Victor R. Yarberry, Sandia National Laboratories
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +49,6 @@
*
* revision history -
*
-* $Id: exgpa.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -68,18 +62,14 @@
*/
int ex_get_prop_array (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
const char *prop_name,
int *values)
{
- int num_props, i, propid, dimid, iresult;
+ int num_props, i, propid, status;
int found = FALSE;
- long start[1], count[1], num_obj;
- nclong *longs;
char name[MAX_VAR_NAME_LENGTH+1];
char tmpstr[MAX_STR_LENGTH+1];
- char obj_stype[MAX_VAR_NAME_LENGTH+1];
- char dim_name[MAX_VAR_NAME_LENGTH+1];
char errmsg[MAX_ERR_LENGTH];
@@ -89,52 +79,42 @@ int ex_get_prop_array (int exoid,
num_props = ex_get_num_props(exoid, obj_type);
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (obj_stype, VAR_ID_EL_BLK);
- strcpy (dim_name, DIM_NUM_EL_BLK);
- break;
- case EX_NODE_SET:
- strcpy (obj_stype, VAR_NS_IDS);
- strcpy (dim_name, DIM_NUM_NS);
- break;
- case EX_SIDE_SET:
- strcpy (obj_stype, VAR_SS_IDS);
- strcpy (dim_name, DIM_NUM_SS);
- break;
- case EX_ELEM_MAP:
- strcpy (obj_stype, VAR_EM_PROP(1));
- strcpy (dim_name, DIM_NUM_EM);
- break;
- case EX_NODE_MAP:
- strcpy (obj_stype, VAR_NM_PROP(1));
- strcpy (dim_name, DIM_NUM_NM);
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_get_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
for (i=1; i<=num_props; i++)
{
switch (obj_type){
case EX_ELEM_BLOCK:
strcpy (name, VAR_EB_PROP(i));
break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(i));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(i));
+ break;
case EX_NODE_SET:
strcpy (name, VAR_NS_PROP(i));
break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(i));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(i));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(i));
+ break;
case EX_SIDE_SET:
strcpy (name, VAR_SS_PROP(i));
break;
case EX_ELEM_MAP:
strcpy (name, VAR_EM_PROP(i));
break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(i));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(i));
+ break;
case EX_NODE_MAP:
strcpy (name, VAR_NM_PROP(i));
break;
@@ -146,9 +126,8 @@ int ex_get_prop_array (int exoid,
return(EX_FATAL);
}
- if ((propid = ncvarid (exoid, name)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate property array %s in file id %d",
name, exoid);
@@ -156,29 +135,24 @@ int ex_get_prop_array (int exoid,
return (EX_FATAL);
}
-/* compare stored attribute name with passed property name */
-
+ /* compare stored attribute name with passed property name */
memset(tmpstr, 0, MAX_STR_LENGTH+1);
- if ((ncattget (exoid, propid, ATT_PROP_NAME, tmpstr)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get property name in file id %d", exoid);
ex_err("ex_get_prop_array",errmsg,exerrval);
return (EX_FATAL);
}
- if (strcmp(tmpstr, prop_name) == 0)
- {
+ if (strcmp(tmpstr, prop_name) == 0) {
found = TRUE;
break;
}
}
-/* if property is not found, return warning */
-
- if (!found)
- {
+ /* if property is not found, return warning */
+ if (!found) {
exerrval = EX_BADPARAM;
sprintf(errmsg,
"Warning: object type %d, property %s not defined in file id %d",
@@ -187,65 +161,17 @@ int ex_get_prop_array (int exoid,
return (EX_WARN);
}
- if ((dimid = ncdimid (exoid, dim_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of objects in file id %d",
- exoid);
- ex_err("ex_get_prop_array",errmsg, exerrval);
- return(EX_FATAL);
- }
-
-/* get number of objects */
-
- if (ncdiminq (exoid, dimid, dim_name, &num_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %s objects in file id %d",
- obj_stype, exoid);
- ex_err("ex_get_prop_array",errmsg, exerrval);
- return (EX_FATAL);
- }
-
-/* read num_obj values from property variable */
+ /* read num_obj values from property variable */
+ status = nc_get_var_int(exoid, propid, values);
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_obj;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, propid, start, count, values);
- } else {
- if (!(longs = malloc(num_obj * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for %s property array for file id %d",
- obj_stype, exoid);
- ex_err("ex_get_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, propid, start, count, longs);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to read values in %s property array in file id %d",
- obj_stype, exoid);
+ ex_name_of_object(obj_type), exoid);
ex_err("ex_get_prop_array",errmsg,exerrval);
return (EX_FATAL);
}
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, values, num_obj);
- free (longs);
- }
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgpem.c b/cbind/src/exgpem.c
index e6fa05c..15b4d26 100644
--- a/cbind/src/exgpem.c
+++ b/cbind/src/exgpem.c
@@ -36,12 +36,6 @@
*
* exgpem - ex_get_partial_elem_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -65,36 +59,33 @@
* reads the element map with specified ID
*/
-int ex_get_partial_elem_map (int exoid,
- int map_id,
- int ent_start,
- int ent_count,
- int *elem_map)
+int ex_get_partial_elem_map (int exoid,
+ int map_id,
+ int ent_start,
+ int ent_count,
+ int *elem_map)
{
- int dimid, var_id, id_ndx, iresult;
- long num_elem, start[1], count[1];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
+ int dimid, var_id, id_ndx, status;
+ size_t num_elem, start[1], count[1];
+ char errmsg[MAX_ERR_LENGTH];
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
- /* See if file contains any elements...*/
- if ((dimid = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
- return (EX_NOERR);
- }
+ /* See if file contains any elements...*/
+ if (nc_inq_dimid (exoid, DIM_NUM_ELEM, &dimid) != NC_NOERR) {
+ return (EX_NOERR);
+ }
- if (ncdiminq (exoid, dimid, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_elem)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get number of elements in file id %d", exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* Check input parameters for a valid range of numbers */
- if (ent_start <= 0 || ent_start > num_elem) {
+ if (ent_start <= 0 || ent_start > (int)num_elem) {
exerrval = EX_FATAL;
sprintf(errmsg,
"Error: start count is invalid in file id %d",
@@ -102,6 +93,7 @@ int ex_get_partial_elem_map (int exoid,
ex_err("ex_get_partial_elem_map",errmsg,exerrval);
return (EX_FATAL);
}
+
if (ent_count < 0) {
exerrval = EX_FATAL;
sprintf(errmsg,
@@ -110,7 +102,8 @@ int ex_get_partial_elem_map (int exoid,
ex_err("ex_get_partial_elem_map",errmsg,exerrval);
return (EX_FATAL);
}
- if (ent_start+ent_count-1 > num_elem) {
+
+ if (ent_start+ent_count-1 > (int)num_elem) {
exerrval = EX_FATAL;
sprintf(errmsg,
"Error: start+count-1 is larger than element count in file id %d",
@@ -119,82 +112,49 @@ int ex_get_partial_elem_map (int exoid,
return (EX_FATAL);
}
-/* first check if any element maps have been defined */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_EM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* first check if any element maps have been defined */
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_EM, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Warning: no element maps defined in file id %d",
- exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_WARN);
- }
-
-/* Lookup index of element map id property array */
-
- id_ndx = ex_id_lkup(exoid,VAR_EM_PROP(1),map_id);
- if (exerrval != 0)
- {
-
- sprintf(errmsg,
- "Error: failed to locate element map id %d in %s in file id %d",
- map_id,VAR_EM_PROP(1),exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_WARN);
+ }
-/* inquire id's of previously defined dimensions and variables */
+ /* Lookup index of element map id property array */
+ id_ndx = ex_id_lkup(exoid,EX_ELEM_MAP,map_id);
+ if (exerrval != 0) {
+ sprintf(errmsg,
+ "Error: failed to locate element map id %d in %s in file id %d",
+ map_id,VAR_EM_PROP(1),exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if ((var_id = ncvarid (exoid, VAR_ELEM_MAP(id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* inquire id's of previously defined dimensions and variables */
+ if ((status = nc_inq_varid(exoid, VAR_ELEM_MAP(id_ndx), &var_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to locate element map %d in file id %d",
- map_id,exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* read in the element map */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
+ map_id,exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- start[0] = ent_start-1;
- count[0] = ent_count;
+ /* read in the element map */
+ start[0] = ent_start-1;
+ count[0] = ent_count;
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, var_id, start, count, elem_map);
- } else {
- if (!(longs = malloc(ent_count * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for element map for file id %d",
- exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, var_id, start, count, longs);
- }
+ status = nc_get_vara_int(exoid, var_id, start, count, elem_map);
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if (status == -1) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get element map in file id %d",
- exoid);
- ex_err("ex_get_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, elem_map, ent_count);
- free (longs);
- }
-
- return (EX_NOERR);
-
+ exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgpn.c b/cbind/src/exgpn.c
index 94e6ea1..e6b8218 100644
--- a/cbind/src/exgpn.c
+++ b/cbind/src/exgpn.c
@@ -36,13 +36,6 @@
*
* exgpn - ex_get_prop_names
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +47,6 @@
*
* revision history -
*
-* $Id: exgpn.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -67,69 +59,84 @@
*/
int ex_get_prop_names (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
char **prop_names)
{
- int i, num_props, propid;
- char var_name[12];
-
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0;
-
-/* determine which type of object property names are desired for */
+ int status;
+ int i, num_props, propid;
+ char var_name[12];
- num_props = ex_get_num_props (exoid, obj_type);
+ char errmsg[MAX_ERR_LENGTH];
- for (i=0; i<num_props; i++)
- {
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (var_name, VAR_EB_PROP(i+1));
- break;
- case EX_NODE_SET:
- strcpy (var_name, VAR_NS_PROP(i+1));
- break;
- case EX_SIDE_SET:
- strcpy (var_name, VAR_SS_PROP(i+1));
- break;
- case EX_ELEM_MAP:
- strcpy (var_name, VAR_EM_PROP(i+1));
- break;
- case EX_NODE_MAP:
- strcpy (var_name, VAR_NM_PROP(i+1));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_get_prop_names",errmsg,EX_BADPARAM);
- return(EX_FATAL);
- }
+ exerrval = 0;
- if ((propid = ncvarid (exoid, var_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate property array %s in file id %d",
- var_name, exoid);
- ex_err("ex_get_prop_names",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* determine which type of object property names are desired for */
-/* for each property, read the "name" attribute of property array variable */
+ num_props = ex_get_num_props (exoid, obj_type);
- if ((ncattget (exoid, propid, ATT_PROP_NAME, prop_names[i])) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get property name in file id %d", exoid);
- ex_err("ex_get_prop_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ for (i=0; i<num_props; i++) {
+ switch (obj_type) {
+ case EX_ELEM_BLOCK:
+ strcpy (var_name, VAR_EB_PROP(i+1));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (var_name, VAR_FA_PROP(i+1));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (var_name, VAR_ED_PROP(i+1));
+ break;
+ case EX_NODE_SET:
+ strcpy (var_name, VAR_NS_PROP(i+1));
+ break;
+ case EX_SIDE_SET:
+ strcpy (var_name, VAR_SS_PROP(i+1));
+ break;
+ case EX_EDGE_SET:
+ strcpy (var_name, VAR_ES_PROP(i+1));
+ break;
+ case EX_FACE_SET:
+ strcpy (var_name, VAR_FS_PROP(i+1));
+ break;
+ case EX_ELEM_SET:
+ strcpy (var_name, VAR_ELS_PROP(i+1));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (var_name, VAR_EM_PROP(i+1));
+ break;
+ case EX_FACE_MAP:
+ strcpy (var_name, VAR_FAM_PROP(i+1));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (var_name, VAR_EDM_PROP(i+1));
+ break;
+ case EX_NODE_MAP:
+ strcpy (var_name, VAR_NM_PROP(i+1));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_get_prop_names",errmsg,EX_BADPARAM);
+ return(EX_FATAL);
+ }
- return (EX_NOERR);
+ if ((status = nc_inq_varid(exoid, var_name, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate property array %s in file id %d",
+ var_name, exoid);
+ ex_err("ex_get_prop_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ /* for each property, read the "name" attribute of property array variable */
+ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, prop_names[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get property name in file id %d", exoid);
+ ex_err("ex_get_prop_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgqa.c b/cbind/src/exgqa.c
index b91bceb..f07a2e5 100644
--- a/cbind/src/exgqa.c
+++ b/cbind/src/exgqa.c
@@ -36,14 +36,6 @@
*
* exgqa - ex_get_qa
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: exgqa.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -67,101 +58,86 @@
int ex_get_qa (int exoid,
char *qa_record[][4])
{
- int i, j, k, dimid, varid;
- long num_qa_records, start[3];
-
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
+ int status;
+ int j, k, dimid, varid;
+ size_t i;
+ size_t num_qa_records, start[3];
- exerrval = 0; /* clear error code */
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
-/* inquire previously defined dimensions and variables */
+ exerrval = 0; /* clear error code */
- if ((dimid = ncdimid (exoid, DIM_NUM_QA)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* inquire previously defined dimensions and variables */
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_QA, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Warning: no qa records stored in file id %d",
exoid);
- ex_err("ex_get_qa",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_qa_records) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ ex_err("ex_get_qa",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_qa_records)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get number of qa records in file id %d",
- exoid);
- ex_err("ex_get_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* do this only if there are any QA records */
-
- if (num_qa_records > 0)
- {
- if ((varid = ncvarid (exoid, VAR_QA_TITLE)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate qa record data in file id %d", exoid);
- ex_err("ex_get_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* read the QA records */
-
- for (i=0; i<num_qa_records; i++)
- {
- for (j=0; j<4; j++)
- {
- start[0] = i;
- start[1] = j;
- start[2] = 0;
-
- k = 0;
- ptr = qa_record[i][j];
-
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get qa record data in file id %d", exoid);
- ex_err("ex_get_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- while ((*(ptr++) != '\0') && (k < MAX_STR_LENGTH))
- {
- start[2] = ++k;
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get qa record data in file id %d", exoid);
- ex_err("ex_get_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- }
-
-/* remove trailing blanks */
-
- if(start[2] != 0)
- {
- --ptr;
- while ( --ptr >= qa_record[i][j] && *ptr == ' ' );
- *(++ptr) = '\0';
- }
- }
+ exoid);
+ ex_err("ex_get_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* do this only if there are any QA records */
+ if (num_qa_records > 0) {
+ if ((status = nc_inq_varid(exoid, VAR_QA_TITLE, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate qa record data in file id %d", exoid);
+ ex_err("ex_get_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* read the QA records */
+ for (i=0; i<num_qa_records; i++) {
+ for (j=0; j<4; j++) {
+ start[0] = i;
+ start[1] = j;
+ start[2] = 0;
+
+ k = 0;
+ ptr = qa_record[i][j];
+
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get qa record data in file id %d", exoid);
+ ex_err("ex_get_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ while ((*(ptr++) != '\0') && (k < MAX_STR_LENGTH)) {
+ start[2] = ++k;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get qa record data in file id %d", exoid);
+ ex_err("ex_get_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* remove trailing blanks */
+
+ if(start[2] != 0) {
+ --ptr;
+ while ( --ptr >= qa_record[i][j] && *ptr == ' ' );
+ *(++ptr) = '\0';
+ }
}
-
- }
-
- return (EX_NOERR);
-
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgset.c b/cbind/src/exgset.c
index df47f9c..d1a17d9 100644
--- a/cbind/src/exgset.c
+++ b/cbind/src/exgset.c
@@ -36,14 +36,6 @@
*
* exgset - ex_get_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,7 +48,6 @@
*
* revision history -
*
-* $Id: exgset.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -69,236 +60,123 @@
*/
int ex_get_set (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
int *set_entry_list,
- int *set_extra_list)
+ int *set_extra_list) /* NULL if dont want to retrieve data */
{
- int dimid, entry_list_id, extra_list_id, iresult;
- int set_id_ndx;
- long num_entry_in_set, count[1], start[1];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* numentryptr;
- char* entryptr;
- char* extraptr;
-
- exerrval = 0; /* clear error code */
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no %s sets stored in file id %d",
- typeName, exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_WARN);
- }
-
-/* Lookup index of set id in VAR_*S_IDS array */
-
- set_id_ndx = ex_id_lkup(exoid,idsptr,set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: %s set %d is NULL in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
+ int dimid, entry_list_id, extra_list_id, status;
+ int set_id_ndx;
+ char errmsg[MAX_ERR_LENGTH];
+ char* entryptr = NULL ;
+ char* extraptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Warning: no %ss stored in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_WARN);
+ }
- sprintf(errmsg,
- "Error: failed to locate %s set id %d in VAR_*S_IDS array in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid,set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: %s %d is NULL in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in VAR_*S_IDS array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
/* setup more pointers based on set_type */
-
- if (set_type == EX_NODE_SET) {
- numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
- entryptr = VAR_NODE_NS(set_id_ndx);
- extraptr = NULL;
- }
- else if (set_type == EX_EDGE_SET) {
- numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
- entryptr = VAR_EDGE_ES(set_id_ndx);
- extraptr = VAR_ORNT_ES(set_id_ndx);
+ if (set_type == EX_NODE_SET) {
+ entryptr = VAR_NODE_NS(set_id_ndx);
+ extraptr = NULL;
+ }
+ else if (set_type == EX_EDGE_SET) {
+ entryptr = VAR_EDGE_ES(set_id_ndx);
+ extraptr = VAR_ORNT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ entryptr = VAR_FACE_FS(set_id_ndx);
+ extraptr = VAR_ORNT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ entryptr = VAR_ELEM_SS(set_id_ndx);
+ extraptr = VAR_SIDE_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ entryptr = VAR_ELEM_ELS(set_id_ndx);
+ extraptr = NULL;
}
- else if (set_type == EX_FACE_SET) {
- numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
- entryptr = VAR_FACE_FS(set_id_ndx);
- extraptr = VAR_ORNT_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
- entryptr = VAR_ELEM_SS(set_id_ndx);
- extraptr = VAR_SIDE_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
- entryptr = VAR_ELEM_ELS(set_id_ndx);
- extraptr = NULL;
- }
-
-/* inquire id's of previously defined dimensions and variables */
-
- if ((dimid = ncdimid (exoid, numentryptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entries in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entry_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((entry_list_id = ncvarid (exoid, entryptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate entry list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* only do extra list for edge, face and side sets */
-
- if (extraptr)
- {
- if ((extra_list_id = ncvarid (exoid, extraptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate extra list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* read in the entry list and extra list arrays */
-
-/* application code has allocated an array of ints but netcdf is expecting
- a pointer to nclongs; if ints are different sizes than nclongs,
- we must allocate an array of nclongs then convert them to ints with ltoi */
-
- start[0] = 0;
- count[0] = num_entry_in_set;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget(exoid, entry_list_id, start, count, set_entry_list);
- } else {
- if (!(longs = malloc(num_entry_in_set * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for entry list for %s set %d for file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, entry_list_id, start, count, longs);
- }
-
- if (iresult)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get entry list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* only do extra list for edge, face and side sets */
- if (extraptr)
- {
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, set_entry_list, num_entry_in_set);
- }
+ /* inquire id's of previously defined dimensions and variables */
+ if ((status = nc_inq_varid(exoid, entryptr, &entry_list_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate entry list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget(exoid, extra_list_id, start, count, set_extra_list);
- } else {
- iresult = ncvarget (exoid, extra_list_id, start, count, longs);
- }
+ /* If client doet not pass in an array to store the
+ extra list, don't access it at all */
+ if (set_extra_list == NULL)
+ extraptr = NULL;
+
+ /* only do extra list for edge, face and side sets */
+ if (extraptr) {
+ if ((status = nc_inq_varid (exoid, extraptr, &extra_list_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get extra list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, set_extra_list, num_entry_in_set);
- free (longs);
- }
+ /* read in the entry list and extra list arrays */
+ status = nc_get_var_int(exoid, entry_list_id, set_entry_list);
- return (EX_NOERR);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get entry list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ /* only do extra list for edge, face and side sets */
+ if (extraptr) {
+ status = nc_get_var_int(exoid, extra_list_id, set_extra_list);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgsetd.c b/cbind/src/exgsetd.c
index f1f2a04..66c15d9 100644
--- a/cbind/src/exgsetd.c
+++ b/cbind/src/exgsetd.c
@@ -36,12 +36,6 @@
*
* exgssd - ex_get_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +47,6 @@
*
* revision history -
*
-* $Id: exgsetd.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,184 +58,98 @@
*/
int ex_get_set_dist_fact (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
void *set_dist_fact)
{
- int dimid, dist_id, set_id_ndx;
- long num_df_in_set, count[1], start[1];
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* numdfptr;
- char* factptr;
+ int dimid, dist_id, set_id_ndx;
+ int status;
+ char errmsg[MAX_ERR_LENGTH];
+ char* factptr = NULL;
- exerrval = 0; /* clear error code */
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
+ exerrval = 0; /* clear error code */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid (exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Warning: no %s sets stored in file id %d",
- typeName, exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_WARN);
- }
-
-/* Lookup index of set id in VAR_*S_IDS array */
-
- set_id_ndx = ex_id_lkup(exoid,idsptr,set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid,set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
"Warning: %s set %d is NULL in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate %s set id %d in VAR_*S_IDS array in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s set id %d in VAR_*S_IDS array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
/* setup more pointers based on set_type */
- if (set_type == EX_NODE_SET) {
- /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
- numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
- factptr = VAR_FACT_NS(set_id_ndx);
- }
- else if (set_type == EX_EDGE_SET) {
- numdfptr = DIM_NUM_DF_ES(set_id_ndx);
- factptr = VAR_FACT_ES(set_id_ndx);
- }
- else if (set_type == EX_FACE_SET) {
- numdfptr = DIM_NUM_DF_FS(set_id_ndx);
- factptr = VAR_FACT_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numdfptr = DIM_NUM_DF_SS(set_id_ndx);
- factptr = VAR_FACT_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
- factptr = VAR_FACT_ELS(set_id_ndx);
- }
-
-/* inquire id's of previously defined dimensions and variables */
-
- if ((dimid = ncdimid (exoid, numdfptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: dist factors not stored for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_WARN); /* complain - but not too loud */
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_df_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dist factors in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if ((dist_id = ncvarid (exoid, factptr)) == -1)
- {
- exerrval = ncerr;
- /* not an error for node sets because this is how we check that df's exist */
- if (set_type == EX_NODE_SET)
- {
- sprintf(errmsg,
- "Warning: dist factors not stored for %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_WARN); /* complain - but not too loud */
- }
- /* is an error for other sets */
- else
- {
- sprintf(errmsg,
- "Error: failed to locate dist factors list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* read in the distribution factors array */
-
- start[0] = 0;
-
- count[0] = num_df_in_set;
-
- if (ncvarget (exoid, dist_id, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,set_dist_fact,
- (int)num_df_in_set)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get dist factors list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- ex_conv_array( exoid, READ_CONVERT, set_dist_fact, num_df_in_set );
-
- return (EX_NOERR);
-
+ if (set_type == EX_NODE_SET) {
+ factptr = VAR_FACT_NS(set_id_ndx);
+ }
+ else if (set_type == EX_EDGE_SET) {
+ factptr = VAR_FACT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ factptr = VAR_FACT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ factptr = VAR_FACT_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ factptr = VAR_FACT_ELS(set_id_ndx);
+ }
+
+ /* inquire id's of previously defined dimensions and variables */
+ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) {
+ exerrval = status;
+ /* not an error for node sets because this is how we check that df's exist */
+ if (set_type == EX_NODE_SET) {
+ sprintf(errmsg,
+ "Warning: dist factors not stored for %s set %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,exerrval);
+ return (EX_WARN); /* complain - but not too loud */
+ }
+ /* is an error for other sets */
+ else {
+ sprintf(errmsg,
+ "Error: failed to locate dist factors list for %s set %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* read in the distribution factors array */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var_float(exoid, dist_id, set_dist_fact);
+ } else {
+ status = nc_get_var_double(exoid, dist_id, set_dist_fact);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get dist factors list for %s set %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgsetp.c b/cbind/src/exgsetp.c
index 7fa7d5c..3df5f2b 100644
--- a/cbind/src/exgsetp.c
+++ b/cbind/src/exgsetp.c
@@ -36,14 +36,6 @@
*
* exgsetp - ex_get_set_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -57,7 +49,6 @@
*
* revision history -
*
-* $Id: exgsetp.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -70,192 +61,125 @@
*/
int ex_get_set_param (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
int *num_entry_in_set,
int *num_dist_fact_in_set)
{
- int dimid, set_id_ndx;
- long lnum_entry_in_set, lnum_dist_fact_in_set;
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* numentryptr;
- char* numdfptr;
-
- exerrval = 0; /* clear error code */
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no %s sets stored in file id %d",
- typeName, exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_WARN);
- }
-
-/* Lookup index of set id in VAR_*S_IDS array */
-
- set_id_ndx = ex_id_lkup(exoid,idsptr,set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY) /* NULL set? */
- {
- *num_entry_in_set = 0;
- *num_dist_fact_in_set = 0;
- return (EX_NOERR);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate %s set id %d in %s in file id %d",
- typeName, set_id,idsptr,exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ int status;
+ int varid, dimid, set_id_ndx;
+ size_t lnum_entry_in_set;
+ size_t lnum_dist_fact_in_set;
+ char errmsg[MAX_ERR_LENGTH];
+ char* numentryptr = NULL;
+ char* numdfptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Warning: no %ss stored in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_get_set_param",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid,set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) /* NULL set? */
+ {
+ *num_entry_in_set = 0;
+ *num_dist_fact_in_set = 0;
+ return (EX_NOERR);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
/* setup more pointers based on set_type */
-
- if (set_type == EX_NODE_SET) {
- numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
- /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
- numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
- }
- else if (set_type == EX_EDGE_SET) {
- numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
- numdfptr = DIM_NUM_DF_ES(set_id_ndx);
- }
- else if (set_type == EX_FACE_SET) {
- numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
- numdfptr = DIM_NUM_DF_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
- numdfptr = DIM_NUM_DF_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
- numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
- }
-
-/* inquire values of dimension for number of entities in set */
-
- if ((dimid = ncdimid (exoid, numentryptr)) == -1)
- {
- *num_entry_in_set = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entities in %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_entry_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entities in %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- *num_entry_in_set = lnum_entry_in_set;
-
- /* Inquire value of dimension of number of dist factors for this set.
- NOTE: For node sets, because DIM_NUM_DF_NS is not used, we check to see
- if the dist factor variable for a node set index exits. If it does not,
- the dist factor count is assumed to be zero, otherwise the dist factor
- count will be the same as the number of nodes in the set. */
-
- if (set_type == EX_NODE_SET)
- {
- if ((ncvarid (exoid, VAR_FACT_NS(set_id_ndx))) == -1)
- {
- *num_dist_fact_in_set = 0; /* signal dist factor doesn't exist */
- if (ncerr == NC_ENOTVAR)
- return (EX_NOERR);
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate the dist factors for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- *num_dist_fact_in_set = lnum_entry_in_set; /* # of df = # of nodes */
- }
- else /* all other set types */
- {
- if ((dimid = ncdimid (exoid, numdfptr)) == -1)
- {
- *num_dist_fact_in_set = 0; /* no distribution factors for this set*/
- if (ncerr == NC_EBADDIM)
- return (EX_NOERR);
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dist factors in %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_dist_fact_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dist factors in %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_get_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- *num_dist_fact_in_set = lnum_dist_fact_in_set;
- }
-
- return (EX_NOERR);
+ if (set_type == EX_NODE_SET) {
+ numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
+ /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
+ numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
+ }
+ else if (set_type == EX_EDGE_SET) {
+ numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
+ numdfptr = DIM_NUM_DF_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
+ numdfptr = DIM_NUM_DF_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
+ numdfptr = DIM_NUM_DF_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
+ numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
+ }
+
+ /* inquire values of dimension for number of entities in set */
+ if (ex_get_dimension(exoid, numentryptr,"entries", &lnum_entry_in_set,
+ &dimid, "ex_get_set_param") != NC_NOERR)
+ return EX_FATAL;
+ *num_entry_in_set = lnum_entry_in_set;
+
+ /* Inquire value of dimension of number of dist factors for this set.
+ NOTE: For node sets, because DIM_NUM_DF_NS is not used, we check to see
+ if the dist factor variable for a node set index exits. If it does not,
+ the dist factor count is assumed to be zero, otherwise the dist factor
+ count will be the same as the number of nodes in the set. */
+
+ if (set_type == EX_NODE_SET) {
+ if ((status = nc_inq_varid(exoid, VAR_FACT_NS(set_id_ndx), &varid)) != NC_NOERR) {
+ *num_dist_fact_in_set = 0; /* signal dist factor doesn't exist */
+ if (status == NC_ENOTVAR)
+ return (EX_NOERR);
+ else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate the dist factors for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_get_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ *num_dist_fact_in_set = lnum_entry_in_set; /* # of df = # of nodes */
+ }
+ else {/* all other set types */
+ if ((status = nc_inq_dimid(exoid, numdfptr, &dimid)) != NC_NOERR) {
+ *num_dist_fact_in_set = 0; /* no distribution factors for this set*/
+ if (status == NC_EBADDIM)
+ return (EX_NOERR);
+ else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dist factors in %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_get_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ if ((status = nc_inq_dimlen(exoid, dimid, &lnum_dist_fact_in_set)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of dist factors in %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_get_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ *num_dist_fact_in_set = lnum_dist_fact_in_set;
+ }
+
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgsnl.c b/cbind/src/exgsnl.c
index e6de729..e59722a 100644
--- a/cbind/src/exgsnl.c
+++ b/cbind/src/exgsnl.c
@@ -36,12 +36,6 @@
*
* exgsnl - ex_get_side_set_node_list_len
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +46,6 @@
*
* revision history -
*
-* $Id: exgsnl.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,19 +55,20 @@
#include "exodusII.h"
#include "exodusII_int.h"
-/*
+/*!
* This routine is designed to read the Exodus II V 2.0 side set side
* definition and return the length of a ExodusI style side set node list.
-
-
-
+ * \param exoid exodus file id
+ * \param side_set_id side set id
+ * \param[out] *side_set_node_list_len length of node list
*/
int ex_get_side_set_node_list_len(int exoid,
int side_set_id,
int *side_set_node_list_len)
{
- int i, j, m;
+ int i, j;
+ size_t m;
int num_side_sets, num_elem_blks, num_df, ndim;
int tot_num_elem = 0, tot_num_ss_elem = 0;
int *elem_blk_ids;
@@ -85,17 +79,7 @@ int ex_get_side_set_node_list_len(int exoid,
float fdum;
char *cdum, elem_type[MAX_STR_LENGTH+1];
- struct elem_blk_parm
- {
- char elem_type[MAX_STR_LENGTH+1];
- int elem_blk_id;
- int num_elem_in_blk;
- int num_nodes_per_elem;
- int num_nodes_per_side;
- int num_attr;
- int elem_ctr;
- int elem_type_val;
- } *elem_blk_parms;
+ struct elem_blk_parm *elem_blk_parms;
char errmsg[MAX_ERR_LENGTH];
@@ -107,20 +91,23 @@ int ex_get_side_set_node_list_len(int exoid,
/* first check if any side sets are specified */
/* inquire how many side sets have been stored */
- if ((ex_inquire(exoid, EX_INQ_SIDE_SETS, &num_side_sets, &fdum, cdum)) == -1)
+ /* get the dimensionality of the coordinates; this is necessary to
+ distinguish between 2d TRIs and 3d TRIs */
+
+ if ((ex_inquire(exoid, EX_INQ_DIM, &ndim, &fdum, cdum)) == -1)
{
sprintf(errmsg,
- "Error: failed to get number of side sets in file id %d",exoid);
+ "Error: failed to get dimensionality in file id %d",exoid);
ex_err("ex_get_side_set_node_list_len",errmsg,exerrval);
return(EX_FATAL);
}
- if (num_side_sets == 0)
+ if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
{
sprintf(errmsg,
- "Warning: no side sets defined in file id %d",exoid);
- ex_err("ex_get_side_set_node_list_len",errmsg,EX_WARN);
- return(EX_WARN);
+ "Error: failed to get total number of elements in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list_len",errmsg,exerrval);
+ return(EX_FATAL);
}
if ((ex_inquire(exoid, EX_INQ_ELEM_BLK, &num_elem_blks, &fdum, cdum)) == -1)
@@ -131,23 +118,20 @@ int ex_get_side_set_node_list_len(int exoid,
return(EX_FATAL);
}
- if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
+ if ((ex_inquire(exoid, EX_INQ_SIDE_SETS, &num_side_sets, &fdum, cdum)) == -1)
{
sprintf(errmsg,
- "Error: failed to get total number of elements in file id %d",exoid);
+ "Error: failed to get number of side sets in file id %d",exoid);
ex_err("ex_get_side_set_node_list_len",errmsg,exerrval);
return(EX_FATAL);
}
-/* get the dimensionality of the coordinates; this is necessary to
- distinguish between 2d TRIs and 3d TRIs */
-
- if ((ex_inquire(exoid, EX_INQ_DIM, &ndim, &fdum, cdum)) == -1)
+ if (num_side_sets == 0)
{
sprintf(errmsg,
- "Error: failed to get dimensionality in file id %d",exoid);
- ex_err("ex_get_side_set_node_list_len",errmsg,exerrval);
- return(EX_FATAL);
+ "Warning: no side sets defined in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list_len",errmsg,EX_WARN);
+ return(EX_WARN);
}
/* First determine the # of elements in the side set*/
@@ -163,6 +147,13 @@ int ex_get_side_set_node_list_len(int exoid,
if (tot_num_ss_elem == 0) /* NULL side set? */
return (EX_NOERR); /* return zero */
+ /* Minor optimization/kluge -- If num_df is nonzero, then assume
+ that it matches the number of nodes in the sideset... */
+ if (num_df > 0 && num_df != tot_num_ss_elem) {
+ *side_set_node_list_len = num_df;
+ return(EX_NOERR);
+ }
+
/* Allocate space for the side set element list */
if (!(side_set_elem_list=malloc(tot_num_ss_elem*sizeof(int))))
{
@@ -289,138 +280,137 @@ int ex_get_side_set_node_list_len(int exoid,
elem_blk_parms[i].elem_blk_id = elem_blk_ids[i];
for (m=0; m < strlen(elem_type); m++)
- elem_blk_parms[i].elem_type[m] =
- toupper((int)elem_type[m]);
- elem_blk_parms[i].elem_type[m] = '\0';
+ elem_blk_parms[i].elem_type[m] = toupper(elem_type[m]);
+ elem_blk_parms[i].elem_type[m] = EX_EL_NULL_ELEMENT;
if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = CIRCLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_CIRCLE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SPHERE;
+ elem_blk_parms[i].elem_type_val = EX_EL_SPHERE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
{
- elem_blk_parms[i].elem_type_val = QUAD;
+ elem_blk_parms[i].elem_type_val = EX_EL_QUAD;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TRIANGLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRIANGLE;
/* determine side set node stride */
if (ndim == 2) /* 2d TRIs */
{
if (elem_blk_parms[i].num_nodes_per_elem == 3)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (ndim == 3) /* 3d TRIs */
{ /* set the default number of nodes per side; catch exceptions later */
if (elem_blk_parms[i].num_nodes_per_elem == 3)
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
else
- elem_blk_parms[i].num_nodes_per_side = 6;
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
}
}
else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SHELL;
+ elem_blk_parms[i].elem_type_val = EX_EL_SHELL;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2) /* KLUDGE for 2D Shells*/
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
{
- elem_blk_parms[i].elem_type_val = HEX;
+ elem_blk_parms[i].elem_type_val = EX_EL_HEX;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 8)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 9)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELL */
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 27)
- elem_blk_parms[i].num_nodes_per_side = 9;
+ elem_blk_parms[i].num_nodes_per_side[0] = 9;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].elem_type_val = EX_EL_TETRA;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
else if (elem_blk_parms[i].num_nodes_per_elem == 8)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 6;
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
}
else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = WEDGE;
+ elem_blk_parms[i].elem_type_val = EX_EL_WEDGE;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 6)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
{
- elem_blk_parms[i].elem_type_val = PYRAMID;
+ elem_blk_parms[i].elem_type_val = EX_EL_PYRAMID;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
{
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if ( (strncmp(elem_blk_parms[i].elem_type,"TRUSS",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"BAR",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"EDGE",3) == 0))
{
- elem_blk_parms[i].elem_type_val = TRUSS;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRUSS;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = '\0';
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].elem_type_val = EX_EL_NULL_ELEMENT;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
elem_blk_parms[i].num_elem_in_blk = 0;
}
else
{ /* unsupported element type; no problem if no sides specified for
this element block */
- elem_blk_parms[i].elem_type_val = UNK;
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].elem_type_val = EX_EL_UNK;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
elem_ctr += elem_blk_parms[i].num_elem_in_blk;
@@ -434,7 +424,7 @@ int ex_get_side_set_node_list_len(int exoid,
{
for (j=0; j<num_elem_blks; j++)
{
- if (elem_blk_parms[j].elem_type_val != '\0')
+ if (elem_blk_parms[j].elem_type_val != EX_EL_NULL_ELEMENT)
if (side_set_elem_list[i] <= elem_blk_parms[j].elem_ctr)
break; /* stop because we found the parameters for this element */
}
@@ -456,7 +446,7 @@ int ex_get_side_set_node_list_len(int exoid,
/* Update *side_set_node_list_len (which points to next node in chain */
/* WEDGEs with 3 node sides (side 4 or 5) are special cases */
- if (elem_blk_parms[j].elem_type_val == WEDGE &&
+ if (elem_blk_parms[j].elem_type_val == EX_EL_WEDGE &&
(side_set_side_list[i] == 4 || side_set_side_list[i] == 5))
{
if (elem_blk_parms[j].num_nodes_per_elem == 6)
@@ -465,7 +455,7 @@ int ex_get_side_set_node_list_len(int exoid,
*side_set_node_list_len += 6; /* 6 node side */
}
/* PYRAMIDSs with 3 node sides (sides 1,2,3,4) are also special */
- else if (elem_blk_parms[j].elem_type_val == PYRAMID &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_PYRAMID &&
(side_set_side_list[i] < 5))
{
if (elem_blk_parms[j].num_nodes_per_elem == 5)
@@ -474,7 +464,7 @@ int ex_get_side_set_node_list_len(int exoid,
*side_set_node_list_len += 6; /* 6 node side */
}
/* side numbers 3,4,5,6 for SHELLs are also special */
- else if (elem_blk_parms[j].elem_type_val == SHELL &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_SHELL &&
(side_set_side_list[i] > 2 ))
{
if (elem_blk_parms[j].num_nodes_per_elem == 4)
@@ -483,7 +473,7 @@ int ex_get_side_set_node_list_len(int exoid,
*side_set_node_list_len += 3; /* 3 node side */
}
/* sides 3, 4, and 5 of 3d TRIs are special cases */
- else if (elem_blk_parms[j].elem_type_val == TRIANGLE &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_TRIANGLE &&
ndim == 3 &&
side_set_side_list[i] > 2 )
{
@@ -492,7 +482,7 @@ int ex_get_side_set_node_list_len(int exoid,
else /* 6-node TRI */
*side_set_node_list_len += 3; /* 3 node side */
}
- else if (elem_blk_parms[j].elem_type_val == UNK)
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_UNK)
{
exerrval = EX_BADPARAM;
sprintf(errmsg,
@@ -507,7 +497,7 @@ int ex_get_side_set_node_list_len(int exoid,
return (EX_FATAL);
}
else /* all other element types */
- *side_set_node_list_len += elem_blk_parms[j].num_nodes_per_side;
+ *side_set_node_list_len += elem_blk_parms[j].num_nodes_per_side[0];
}
/* All done: release element block ids array,
diff --git a/cbind/src/exgsp.c b/cbind/src/exgsp.c
index 116d6f3..71cbf07 100644
--- a/cbind/src/exgsp.c
+++ b/cbind/src/exgsp.c
@@ -32,40 +32,36 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+
/*****************************************************************************
-*
-* exgsp - ex_get_side_set_param
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
-* entry conditions -
-* input parameters:
-* int exoid exodus file id
-* int side_set_id side set id
-*
-* exit conditions -
-* int* num_side_in_set number of sides in the side set
-* int* num_dist_fact_in_set number of distribution factors in the
-* side set
-*
-* revision history -
-*
-* $Id: exgsp.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
-*
-*****************************************************************************/
+ *
+ * exgsp - ex_get_side_set_param
+ *
+ * entry conditions -
+ * input parameters:
+ * int exoid exodus file id
+ * int side_set_id side set id
+ *
+ * exit conditions -
+ * int* num_side_in_set number of sides in the side set
+ * int* num_dist_fact_in_set number of distribution factors in the
+ * side set
+ *
+ * revision history -
+ *
+ *
+ *****************************************************************************/
#include "exodusII.h"
-#include "exodusII_int.h"
-/*
+/*!
* reads the number of sides and the number of distribution factors which
* describe a single side set
+ * \param exoid exodus file id
+ * \param side_set_id side set id
+ * \param[out] num_side_in_set number of sides in the side set
+ * \param[out] num_dist_fact_in_set number of distribution factors in the
+ * \deprecated Use ex_get_set_param()(exoid, EX_SIDE_SET, side_set_id, num_side_in_set, num_dist_fact_in_set)
*/
int ex_get_side_set_param (int exoid,
diff --git a/cbind/src/exgss.c b/cbind/src/exgss.c
index f1c04d9..df7539c 100644
--- a/cbind/src/exgss.c
+++ b/cbind/src/exgss.c
@@ -36,14 +36,6 @@
*
* exgss - ex_get_side_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: exgss.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,6 +56,7 @@
/*!
* reads the side set element list and side set side list for a single side set
+ * \deprecated Use ex_get_set()(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list)
*/
int ex_get_side_set (int exoid,
diff --git a/cbind/src/exgssc.c b/cbind/src/exgssc.c
index a6cde36..f360050 100644
--- a/cbind/src/exgssc.c
+++ b/cbind/src/exgssc.c
@@ -36,12 +36,6 @@
*
* exgssc - ex_get_side_set_node_count
*
-* author - Sandia National Laboratories
-* Greg Sjaardema; modified from exgssn.c
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +46,6 @@
* side or face
* revision history -
*
-* $Id: exgssc.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*****************************************************************************/
#include <ctype.h>
@@ -74,7 +67,8 @@ int ex_get_side_set_node_count(int exoid,
int side_set_id,
int *side_set_node_cnt_list)
{
- int ii, i, j, m;
+ size_t m;
+ int ii, i, j;
int num_side_sets, num_elem_blks, num_df, ndim;
int tot_num_elem = 0, tot_num_ss_elem = 0, side, elem;
int *elem_blk_ids;
@@ -85,18 +79,7 @@ int ex_get_side_set_node_count(int exoid,
float fdum;
char *cdum, elem_type[MAX_STR_LENGTH+1];
- struct elem_blk_parm
- {
- char elem_type[MAX_STR_LENGTH+1];
- int elem_blk_id;
- int num_elem_in_blk;
- int num_nodes_per_elem;
- int num_sides;
- int num_nodes_per_side[6];
- int num_attr;
- int elem_ctr;
- int elem_type_val;
- } *elem_blk_parms;
+ struct elem_blk_parm *elem_blk_parms;
char errmsg[MAX_ERR_LENGTH];
@@ -123,7 +106,7 @@ int ex_get_side_set_node_count(int exoid,
}
/* Lookup index of side set id in VAR_SS_IDS array */
- ex_id_lkup(exoid,VAR_SS_IDS,side_set_id);
+ ex_id_lkup(exoid,EX_SIDE_SET,side_set_id);
if (exerrval != 0)
{
if (exerrval == EX_NULLENTITY)
@@ -301,25 +284,25 @@ int ex_get_side_set_node_count(int exoid,
elem_blk_parms[i].num_attr = num_attr;
for (m=0; m < strlen(elem_type); m++) {
- elem_blk_parms[i].elem_type[m] = toupper((int)elem_type[m]);
+ elem_blk_parms[i].elem_type[m] = toupper(elem_type[m]);
}
elem_blk_parms[i].elem_type[m] = '\0';
if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = CIRCLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_CIRCLE;
elem_blk_parms[i].num_sides = 1;
elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SPHERE;
+ elem_blk_parms[i].elem_type_val = EX_EL_SPHERE;
elem_blk_parms[i].num_sides = 1;
elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
{
- elem_blk_parms[i].elem_type_val = QUAD;
+ elem_blk_parms[i].elem_type_val = EX_EL_QUAD;
elem_blk_parms[i].num_sides = 4;
if (elem_blk_parms[i].num_nodes_per_elem == 4) {
elem_blk_parms[i].num_nodes_per_side[0] = 2;
@@ -343,7 +326,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TRIANGLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRIANGLE;
if (ndim == 2) { /* 2d TRIs */
elem_blk_parms[i].num_sides = 3;
if (elem_blk_parms[i].num_nodes_per_elem == 3) {
@@ -376,7 +359,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SHELL;
+ elem_blk_parms[i].elem_type_val = EX_EL_SHELL;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {/* KLUDGE for 2D Shells*/
elem_blk_parms[i].num_sides = 2;
@@ -407,7 +390,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
{
- elem_blk_parms[i].elem_type_val = HEX;
+ elem_blk_parms[i].elem_type_val = EX_EL_HEX;
elem_blk_parms[i].num_sides = 6;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 8) { /* 8-node bricks */
@@ -451,7 +434,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].elem_type_val = EX_EL_TETRA;
elem_blk_parms[i].num_sides = 4;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4) {
@@ -475,7 +458,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = WEDGE;
+ elem_blk_parms[i].elem_type_val = EX_EL_WEDGE;
elem_blk_parms[i].num_sides = 5;
if (elem_blk_parms[i].num_nodes_per_elem == 6) {
elem_blk_parms[i].num_nodes_per_side[0] = 4;
@@ -495,7 +478,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
{
- elem_blk_parms[i].elem_type_val = PYRAMID;
+ elem_blk_parms[i].elem_type_val = EX_EL_PYRAMID;
elem_blk_parms[i].num_sides = 5;
if (elem_blk_parms[i].num_nodes_per_elem == 5) {
elem_blk_parms[i].num_nodes_per_side[0] = 3;
@@ -515,7 +498,7 @@ int ex_get_side_set_node_count(int exoid,
}
else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
{
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
elem_blk_parms[i].num_sides = 2;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {
@@ -532,7 +515,7 @@ int ex_get_side_set_node_count(int exoid,
(strncmp(elem_blk_parms[i].elem_type,"BAR",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"EDGE",3) == 0) )
{
- elem_blk_parms[i].elem_type_val = TRUSS;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRUSS;
elem_blk_parms[i].num_sides = 2;
if (elem_blk_parms[i].num_nodes_per_elem == 2) {
@@ -547,14 +530,14 @@ int ex_get_side_set_node_count(int exoid,
}
/* Used for an empty block in a parallel decomposition */
else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0) {
- elem_blk_parms[i].elem_type_val = '\0';
+ elem_blk_parms[i].elem_type_val = EX_EL_NULL_ELEMENT;
elem_blk_parms[i].num_sides = 0;
elem_blk_parms[i].num_nodes_per_side[0] = 0;
elem_blk_parms[i].num_elem_in_blk = 0;
} else {
/* unsupported element type; no problem if no sides specified for
this element block */
- elem_blk_parms[i].elem_type_val = UNK;
+ elem_blk_parms[i].elem_type_val = EX_EL_UNK;
elem_blk_parms[i].num_sides = 0;
elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
diff --git a/cbind/src/exgssd.c b/cbind/src/exgssd.c
index e8a930a..020688d 100644
--- a/cbind/src/exgssd.c
+++ b/cbind/src/exgssd.c
@@ -36,12 +36,6 @@
*
* exgssd - ex_get_side_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +46,6 @@
*
* revision history -
*
-* $Id: exgssd.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,6 +54,7 @@
/*!
* reads the distribution factors for a single side set
+ * \deprecated Use ex_get_set_dist_fact()(exoid, EX_SIDE_SET, side_set_id, side_set_dist_fact)
*/
int ex_get_side_set_dist_fact (int exoid,
diff --git a/cbind/src/exgssi.c b/cbind/src/exgssi.c
index f5d9171..b42604f 100644
--- a/cbind/src/exgssi.c
+++ b/cbind/src/exgssi.c
@@ -34,15 +34,7 @@
*/
/*****************************************************************************
*
-* exgssi - ex_get_size_set_ids
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
+* exgssi - ex_get_side_set_ids
*
* entry conditions -
* input parameters:
@@ -53,16 +45,15 @@
*
* revision history -
*
-* $Id: exgssi.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
-#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
/*!
* reads the side set ids from the database
+ * \deprecated Use ex_get_ids()(exoid, EX_SIDE_SET, ids)
*/
int ex_get_side_set_ids (int exoid,
diff --git a/cbind/src/exgssn.c b/cbind/src/exgssn.c
index 851be36..6a50452 100644
--- a/cbind/src/exgssn.c
+++ b/cbind/src/exgssn.c
@@ -36,12 +36,6 @@
*
* exgssn - ex_get_side_set_node_list
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +48,6 @@
*
* revision history -
*
-* $Id: exgssn.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -73,29 +66,24 @@ int ex_get_side_set_node_list(int exoid,
int *side_set_node_cnt_list,
int *side_set_node_list)
{
- int i, j, m;
+ size_t m;
+ int i, j;
int num_side_sets, num_elem_blks, num_df, ndim;
int tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0;
int connect_offset, side_num, node_pos;
- int *elem_blk_ids, *connect;
- int *ss_elem_ndx, *ss_elem_node_ndx, *ss_parm_ndx;
- int *side_set_elem_list, *side_set_side_list;
+ int *elem_blk_ids = NULL;
+ int *connect = NULL;
+ int *ss_elem_ndx = NULL;
+ int *ss_elem_node_ndx = NULL;
+ int *ss_parm_ndx = NULL;
+ int *side_set_elem_list = NULL;
+ int *side_set_side_list = NULL;
int elem_ctr, node_ctr, elem_num_pos;
int num_elem_in_blk, num_nodes_per_elem, num_attr;
float fdum;
char *cdum, elem_type[MAX_STR_LENGTH+1];
- struct elem_blk_parm
- {
- char elem_type[MAX_STR_LENGTH+1];
- int elem_blk_id;
- int num_elem_in_blk;
- int num_nodes_per_elem;
- int num_nodes_per_side;
- int num_attr;
- int elem_ctr;
- int elem_type_val;
- } *elem_blk_parms;
+ struct elem_blk_parm *elem_blk_parms;
/* side to node translation tables -
These tables are used to look up the side number based on the
@@ -195,7 +183,7 @@ int ex_get_side_set_node_list(int exoid,
/* Lookup index of side set id in VAR_SS_IDS array */
- ex_id_lkup(exoid,VAR_SS_IDS,side_set_id);
+ ex_id_lkup(exoid,EX_SIDE_SET,side_set_id);
if (exerrval != 0)
{
if (exerrval == EX_NULLENTITY)
@@ -379,138 +367,137 @@ int ex_get_side_set_node_list(int exoid,
elem_blk_parms[i].num_attr = num_attr;
for (m=0; m < strlen(elem_type); m++)
- elem_blk_parms[i].elem_type[m] =
- toupper((int)elem_type[m]);
- elem_blk_parms[i].elem_type[m] = '\0';
+ elem_blk_parms[i].elem_type[m] = toupper(elem_type[m]);
+ elem_blk_parms[i].elem_type[m] = EX_EL_NULL_ELEMENT;
if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = CIRCLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_CIRCLE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SPHERE;
+ elem_blk_parms[i].elem_type_val = EX_EL_SPHERE;
/* set side set node stride */
- elem_blk_parms[i].num_nodes_per_side = 1;
+ elem_blk_parms[i].num_nodes_per_side[0] = 1;
}
else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
{
- elem_blk_parms[i].elem_type_val = QUAD;
+ elem_blk_parms[i].elem_type_val = EX_EL_QUAD;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TRIANGLE;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRIANGLE;
/* set default side set node stride */
if (ndim == 2) /* 2d TRIs */
{
if (elem_blk_parms[i].num_nodes_per_elem == 3)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (ndim == 3) /* 3d TRIs */
{
if (elem_blk_parms[i].num_nodes_per_elem == 3)
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
else
- elem_blk_parms[i].num_nodes_per_side = 6;
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
}
}
else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = SHELL;
+ elem_blk_parms[i].elem_type_val = EX_EL_SHELL;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2) /* KLUDGE for 2D Shells*/
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
{
- elem_blk_parms[i].elem_type_val = HEX;
+ elem_blk_parms[i].elem_type_val = EX_EL_HEX;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 8) /* 8-node bricks */
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 9) /* 9-node bricks */
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELLS */
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else if (elem_blk_parms[i].num_nodes_per_elem == 27) /* 27-node bricks */
- elem_blk_parms[i].num_nodes_per_side = 9;
+ elem_blk_parms[i].num_nodes_per_side[0] = 9;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
{
- elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].elem_type_val = EX_EL_TETRA;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 4)
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
else if (elem_blk_parms[i].num_nodes_per_elem == 8)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 6;
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
}
else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
{
- elem_blk_parms[i].elem_type_val = WEDGE;
+ elem_blk_parms[i].elem_type_val = EX_EL_WEDGE;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 6)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
{
- elem_blk_parms[i].elem_type_val = PYRAMID;
+ elem_blk_parms[i].elem_type_val = EX_EL_PYRAMID;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 5)
- elem_blk_parms[i].num_nodes_per_side = 4;
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
else
- elem_blk_parms[i].num_nodes_per_side = 8;
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
}
else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
{
- elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].elem_type_val = EX_EL_BEAM;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if ( (strncmp(elem_blk_parms[i].elem_type,"TRUSS",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"BAR",3) == 0) ||
(strncmp(elem_blk_parms[i].elem_type,"EDGE",3) == 0) )
{
- elem_blk_parms[i].elem_type_val = TRUSS;
+ elem_blk_parms[i].elem_type_val = EX_EL_TRUSS;
/* determine side set node stride */
if (elem_blk_parms[i].num_nodes_per_elem == 2)
- elem_blk_parms[i].num_nodes_per_side = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
else
- elem_blk_parms[i].num_nodes_per_side = 3;
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
}
else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0)
{
- elem_blk_parms[i].elem_type_val = '\0';
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].elem_type_val = EX_EL_NULL_ELEMENT;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
elem_blk_parms[i].num_elem_in_blk = 0;
}
else
{ /* unsupported element type; no problem if no sides specified for
this element block */
- elem_blk_parms[i].elem_type_val = UNK;
- elem_blk_parms[i].num_nodes_per_side = 0;
+ elem_blk_parms[i].elem_type_val = EX_EL_UNK;
+ elem_blk_parms[i].num_nodes_per_side[0] = 0;
}
elem_blk_parms[i].elem_blk_id = elem_blk_ids[i]; /* save id */
elem_ctr += elem_blk_parms[i].num_elem_in_blk;
@@ -528,8 +515,7 @@ int ex_get_side_set_node_list(int exoid,
free(side_set_elem_list);
exerrval = EX_MEMFAIL;
sprintf(errmsg,
-"Error: failed to allocate space for side set elem parms index for file id %d"
-,
+ "Error: failed to allocate space for side set elem parms index for file id %d",
exoid);
ex_err("ex_get_side_set_node_list",errmsg,exerrval);
return (EX_FATAL);
@@ -547,7 +533,7 @@ int ex_get_side_set_node_list(int exoid,
free(side_set_elem_list);
exerrval = EX_MEMFAIL;
sprintf(errmsg,
-"Error: failed to allocate space for side set elem to node index for file id %d",
+ "Error: failed to allocate space for side set elem to node index for file id %d",
exoid);
ex_err("ex_get_side_set_node_list",errmsg,exerrval);
@@ -558,17 +544,14 @@ int ex_get_side_set_node_list(int exoid,
parameter index.
*/
node_ctr = 0;
- for (i=0;i<tot_num_ss_elem;i++)
- {
- for (j=0; j<num_elem_blks; j++)
- {
- if (elem_blk_parms[j].elem_type_val != '\0')
- if (side_set_elem_list[i] <= elem_blk_parms[j].elem_ctr)
- break;
+ for (i=0;i<tot_num_ss_elem;i++) {
+ for (j=0; j<num_elem_blks; j++) {
+ if (elem_blk_parms[j].elem_type_val != EX_EL_NULL_ELEMENT)
+ if (side_set_elem_list[i] <= elem_blk_parms[j].elem_ctr)
+ break;
}
- if (j >= num_elem_blks)
- {
+ if (j >= num_elem_blks) {
exerrval = EX_BADPARAM;
sprintf(errmsg,
"Error: Invalid element number %d found in side set %d in file %d",
@@ -590,7 +573,7 @@ int ex_get_side_set_node_list(int exoid,
/* Update node_ctr (which points to next node in chain */
/* WEDGEs with 3 node sides (side 4 or 5) are special cases */
- if (elem_blk_parms[j].elem_type_val == WEDGE &&
+ if (elem_blk_parms[j].elem_type_val == EX_EL_WEDGE &&
(side_set_side_list[i] == 4 || side_set_side_list[i] == 5))
{
if (elem_blk_parms[j].num_nodes_per_elem == 6)
@@ -599,7 +582,7 @@ int ex_get_side_set_node_list(int exoid,
node_ctr += 6; /* 6 node side */
}
/* PYRAMIDSs with 3 node sides (sides 1,2,3,4) are also special */
- else if (elem_blk_parms[j].elem_type_val == PYRAMID &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_PYRAMID &&
(side_set_side_list[i] < 5))
{
if (elem_blk_parms[j].num_nodes_per_elem == 5)
@@ -608,7 +591,7 @@ int ex_get_side_set_node_list(int exoid,
node_ctr += 6; /* 6 node side */
}
/* side numbers 3,4,5,6 for SHELLs are also special */
- else if (elem_blk_parms[j].elem_type_val == SHELL &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_SHELL &&
(side_set_side_list[i] > 2 ))
{
if (elem_blk_parms[j].num_nodes_per_elem == 4)
@@ -617,7 +600,7 @@ int ex_get_side_set_node_list(int exoid,
node_ctr += 3; /* 3 node side */
}
/* side numbers 3,4,5 for 3d TRIs are also special */
- else if (elem_blk_parms[j].elem_type_val == TRIANGLE &&
+ else if (elem_blk_parms[j].elem_type_val == EX_EL_TRIANGLE &&
ndim == 3 &&
side_set_side_list[i] > 2 )
{
@@ -627,21 +610,18 @@ int ex_get_side_set_node_list(int exoid,
node_ctr += 3; /* 3 node side */
}
else /* all other element types */
- node_ctr += elem_blk_parms[j].num_nodes_per_side;
+ node_ctr += elem_blk_parms[j].num_nodes_per_side[0];
}
/* All setup, ready to go ... */
elem_ctr=0;
- for (j=0; j < tot_num_ss_elem; j++)
- {
+ for (j=0; j < tot_num_ss_elem; j++) {
- if (side_set_elem_list[ss_elem_ndx[j]] > elem_ctr)
- {
+ if (side_set_elem_list[ss_elem_ndx[j]] > elem_ctr) {
/* release connectivity array space and get next one */
- if (elem_ctr > 0)
- {
+ if (elem_ctr > 0) {
free(connect);
}
@@ -666,10 +646,9 @@ int ex_get_side_set_node_list(int exoid,
}
/* get connectivity array */
- if (ex_get_elem_conn(
- exoid,
- elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
- connect) == -1)
+ if (ex_get_elem_conn(exoid,
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ connect) == -1)
{
free(connect);
free(elem_blk_parms);
@@ -687,8 +666,8 @@ int ex_get_side_set_node_list(int exoid,
}
elem_ctr = elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_ctr;
}
-/* For each side in side set, use the appropriate lookup table to
- determine the nodes from the connect array. */
+ /* For each side in side set, use the appropriate lookup table to
+ determine the nodes from the connect array. */
elem_num = side_set_elem_list[ss_elem_ndx[j]]-1;/* element number 0-based*/
/* calculate the relative element number position in it's block*/
@@ -701,23 +680,22 @@ int ex_get_side_set_node_list(int exoid,
using the ss_elem_node_ndx index into the side_sets_node_index
and adding the element number position * number of nodes per elem */
- num_nodes_per_elem =
- elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_nodes_per_elem;
+ num_nodes_per_elem = elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_nodes_per_elem;
node_pos = ss_elem_node_ndx[ss_elem_ndx[j]];
connect_offset = num_nodes_per_elem*elem_num_pos;
side_num = side_set_side_list[ss_elem_ndx[j]]-1;
switch (elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_type_val)
{
- case CIRCLE:
- case SPHERE:
+ case EX_EL_CIRCLE:
+ case EX_EL_SPHERE:
{ /* Note: no side-node lookup table is used for this simple case */
side_set_node_list[node_pos] = connect[connect_offset];
side_set_node_cnt_list[ss_elem_ndx[j]] = 1; /* 1 node object */
break;
}
- case TRUSS:
- case BEAM:
+ case EX_EL_TRUSS:
+ case EX_EL_BEAM:
{ /* Note: no side-node lookup table is used for this simple case */
side_set_node_list[node_pos] = connect[connect_offset];
side_set_node_list[node_pos+1] = connect[connect_offset+1];
@@ -729,7 +707,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case TRIANGLE:
+ case EX_EL_TRIANGLE:
{
if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
{
@@ -803,7 +781,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case QUAD:
+ case EX_EL_QUAD:
{
if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */
{
@@ -836,7 +814,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case SHELL:
+ case EX_EL_SHELL:
{
if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */
{
@@ -895,7 +873,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case TETRA:
+ case EX_EL_TETRA:
{
if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */
{
@@ -940,7 +918,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case WEDGE:
+ case EX_EL_WEDGE:
{
if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
{
@@ -999,7 +977,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case PYRAMID:
+ case EX_EL_PYRAMID:
{
if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
{
@@ -1058,7 +1036,7 @@ int ex_get_side_set_node_list(int exoid,
}
break;
}
- case HEX:
+ case EX_EL_HEX:
{
if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */
{
diff --git a/cbind/src/exgsstt.c b/cbind/src/exgsstt.c
index eb93c75..2420d76 100644
--- a/cbind/src/exgsstt.c
+++ b/cbind/src/exgsstt.c
@@ -45,16 +45,15 @@
* exit conditions -
* int* sset_var_tab sideset variable truth table array
*
-* $Id: exgsstt.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
-#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
/*!
* reads the EXODUS II sideset variable truth table from the database
+ * \deprecated Use ex_get_truth_table()(exoid, EX_SIDE_SET, num_sidesets, num_sset_var, sset_var_tab)
*/
int ex_get_sset_var_tab (int exoid,
@@ -62,5 +61,5 @@ int ex_get_sset_var_tab (int exoid,
int num_sset_var,
int *sset_var_tab)
{
- return ex_get_var_tab(exoid, "S", num_sidesets, num_sset_var, sset_var_tab);
+ return ex_get_truth_table(exoid, EX_SIDE_SET, num_sidesets, num_sset_var, sset_var_tab);
}
diff --git a/cbind/src/exgssv.c b/cbind/src/exgssv.c
index f5f143e..1087dd7 100644
--- a/cbind/src/exgssv.c
+++ b/cbind/src/exgssv.c
@@ -51,7 +51,6 @@
*
* revision history -
*
-* $Id: exgssv.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,6 +61,7 @@
* reads the values of a single sideset variable for one sideset at
* one time step in the database; assume the first time step and
* sideset variable index is 1
+ * \deprecated Use ex_get_var()(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_side_this_sset, sset_var_vals) instead
*/
int ex_get_sset_var (int exoid,
@@ -71,68 +71,6 @@ int ex_get_sset_var (int exoid,
int num_side_this_sset,
void *sset_var_vals)
{
- int varid, sset_id_ndx;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of sset_id in VAR_SS_IDS array */
- sset_id_ndx = ex_id_lkup(exoid,VAR_SS_IDS,sset_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no sideset variables for NULL sideset %d in file id %d",
- sset_id,exoid);
- ex_err("ex_get_sset_var",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate sideset id %d in %s variable in file id %d",
- sset_id, VAR_ID_EL_BLK, exoid);
- ex_err("ex_get_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* inquire previously defined variable */
-
- if((varid=ncvarid(exoid,VAR_SS_VAR(sset_var_index,sset_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate sideset variable %d for sideset %d in file id %d",
- sset_var_index,sset_id,exoid); /* this msg needs to be improved */
- ex_err("ex_get_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* read values of sideset variable */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_side_this_sset;
-
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,sset_var_vals,num_side_this_sset)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get sset var %d for block %d in file id %d",
- sset_var_index,sset_id,exoid);/*this msg needs to be improved*/
- ex_err("ex_get_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- ex_conv_array( exoid, READ_CONVERT, sset_var_vals, num_side_this_sset );
-
- return (EX_NOERR);
+ return ex_get_var(exoid, time_step, EX_SIDE_SET, sset_var_index,
+ sset_id, num_side_this_sset, sset_var_vals);
}
diff --git a/cbind/src/exgssvid.c b/cbind/src/exgssvid.c
index 20ffa3c..238de4a 100644
--- a/cbind/src/exgssvid.c
+++ b/cbind/src/exgssvid.c
@@ -45,7 +45,6 @@
*
* revision history -
*
-* $Id: exgssvid.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -55,10 +54,11 @@
/*!
* reads the EXODUS II variable varids from the database
+ * \deprecated Use ex_get_varid()(exoid, EX_SIDE_SET, varid)
*/
int ex_get_sset_varid (int exoid,
int *varid)
{
- return ex_get_varid(exoid, "s", varid);
+ return ex_get_varid(exoid, EX_SIDE_SET, varid);
}
diff --git a/cbind/src/exgtim.c b/cbind/src/exgtim.c
index 8145b25..dc54ff5 100644
--- a/cbind/src/exgtim.c
+++ b/cbind/src/exgtim.c
@@ -36,14 +36,6 @@
*
* exgtim - ex_get_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: exgtim.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -71,44 +62,37 @@ int ex_get_time (int exoid,
int time_step,
void *time_value)
{
+ int status;
int varid;
- long start[1];
- char var_name[MAX_VAR_NAME_LENGTH+1];
+ size_t start[1];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
-/* inquire previously defined dimensions */
-
- strcpy (var_name, VAR_WHOLE_TIME);
-
-/* inquire previously defined variable */
-
- if ((varid = ncvarid (exoid, var_name)) < 0)
- {
- exerrval = ncerr;
+ /* inquire previously defined variable */
+ if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate time variable in file id %d", exoid);
ex_err("ex_get_time",errmsg,exerrval);
return (EX_FATAL);
}
-/* read time value */
-
+ /* read time value */
start[0] = --time_step;
- if (ncvarget1 (exoid, varid, start,
- ex_conv_array(exoid,RTN_ADDRESS,time_value,1)) == -1)
- {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_var1_float(exoid, varid, start, time_value);
+ } else {
+ status = nc_get_var1_double(exoid, varid, start, time_value);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get time value in file id %d", exoid);
ex_err("ex_get_time",errmsg,exerrval);
return (EX_FATAL);
}
-
-
- ex_conv_array( exoid, READ_CONVERT, time_value, 1 );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgtt.c b/cbind/src/exgtt.c
index 4665361..99846a7 100644
--- a/cbind/src/exgtt.c
+++ b/cbind/src/exgtt.c
@@ -36,8 +36,6 @@
*
* exgvtt - ex_get_var_tab
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -47,10 +45,6 @@
* exit conditions -
* int* var_tab element variable truth table array
*
-* revision history -
-* 20061002 - David Thompson - Added edge/face element support
-*
-* $Id: exgtt.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,6 +56,7 @@
/*!
* reads the EXODUS II specified variable truth table from the database
+ * \deprecated Use ex_get_truth_table()(exoid, obj_type, num_blk, num_var, var_tab)
*/
int ex_get_var_tab (int exoid,
@@ -70,181 +65,7 @@ int ex_get_var_tab (int exoid,
int num_var,
int *var_tab)
{
- int dimid, varid, tabid, i, j, iresult;
- long num_entity = -1;
- long num_var_db = -1;
- long start[2], count[2];
- nclong *longs;
- char errmsg[MAX_ERR_LENGTH];
- const char* routine = "ex_get_var_tab";
-
- /*
- * The ent_type and the var_name are used to build the netcdf
- * variables name. Normally this is done via a macro defined in
- * exodusII_int.h
- */
- const char* ent_type = NULL;
- const char* var_name = NULL;
- int vartyp = tolower( *var_type );
-
- exerrval = 0; /* clear error code */
-
- switch (vartyp) {
- case 'l':
- dimid = ex_get_dimension(exoid, DIM_NUM_ED_BLK, "edge", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_EBLK_TAB);
- var_name = "vals_edge_var";
- ent_type = "eb";
- break;
- case 'f':
- dimid = ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_FBLK_TAB);
- var_name = "vals_face_var";
- ent_type = "eb";
- break;
- case 'e':
- dimid = ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_ELEM_TAB);
- var_name = "vals_elem_var";
- ent_type = "eb";
- break;
- case 'm':
- dimid = ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_NSET_TAB);
- var_name = "vals_nset_var";
- ent_type = "ns";
- break;
- case 'd':
- dimid = ex_get_dimension(exoid, DIM_NUM_ES, "edgeset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_ESET_TAB);
- var_name = "vals_eset_var";
- ent_type = "ns";
- break;
- case 'a':
- dimid = ex_get_dimension(exoid, DIM_NUM_FS, "faceset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_FSET_TAB);
- var_name = "vals_fset_var";
- ent_type = "ns";
- break;
- case 's':
- dimid = ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_SSET_TAB);
- var_name = "vals_sset_var";
- ent_type = "ss";
- break;
- case 't':
- dimid = ex_get_dimension(exoid, DIM_NUM_ELS, "elemset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elemset variables", &num_var_db, routine);
- tabid = ncvarid (exoid, VAR_ELSET_TAB);
- var_name = "vals_elset_var";
- ent_type = "els";
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
- ex_err("ex_get_varid",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if (dimid == -1) {
- exerrval = ncerr;
- return (EX_FATAL);
- }
-
- if (varid == -1) {
- exerrval = ncerr;
- return (EX_WARN);
- }
-
- if (num_entity != num_blk) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # of blocks doesn't match those defined in file id %d", exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (num_var_db != num_var) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # of variables doesn't match those defined in file id %d", exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (tabid == -1) {
- /* since truth table isn't stored in the data file, derive it dynamically */
- for (j=0; j<num_blk; j++) {
-
- for (i=0; i<num_var; i++) {
- /* NOTE: names are 1-based */
- if ((tabid = ncvarid (exoid, ex_catstr2(var_name, i+1, ent_type, j+1))) == -1) {
-
- /* variable doesn't exist; put a 0 in the truth table */
- var_tab[j*num_var+i] = 0;
- } else {
-
- /* variable exists; put a 1 in the truth table */
- var_tab[j*num_var+i] = 1;
- }
- }
- }
- } else {
-
- /* read in the truth table */
-
- /*
- * application code has allocated an array of ints but netcdf is
- * expecting a pointer to nclongs; if ints are different sizes
- * than nclongs, we must allocate an array of nclongs then
- * convert them to ints with ltoi
- */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_blk;
- count[1] = num_var;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarget (exoid, tabid, start, count, var_tab);
- } else {
- if (!(longs = malloc (num_blk*num_var * sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for truth table for file id %d",
- exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
- iresult = ncvarget (exoid, tabid, start, count, longs);
- }
-
- if (iresult == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get truth table from file id %d", exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (sizeof(int) != sizeof(nclong)) {
- ltoi (longs, var_tab, num_blk*num_var);
- free (longs);
- }
-
- }
-
-
- return (EX_NOERR);
-
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_get_truth_table(exoid, obj_type, num_blk, num_var, var_tab);
}
diff --git a/cbind/src/exgvan.c b/cbind/src/exgvan.c
index 1ac0677..1985eac 100644
--- a/cbind/src/exgvan.c
+++ b/cbind/src/exgvan.c
@@ -36,14 +36,6 @@
*
* exgvan - ex_get_var_names
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: exgvan.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -66,6 +57,7 @@
/*!
* reads the names of the results variables from the database
+ * \deprecated Use ex_get_variable_names()(exoid, obj_type, num_vars, var_names)
*/
int ex_get_var_names (int exoid,
@@ -73,105 +65,7 @@ int ex_get_var_names (int exoid,
int num_vars,
char *var_names[])
{
- int i, varid, status;
- char errmsg[MAX_ERR_LENGTH];
- int vartyp;
- const char* tname;
- const char* vvarname;
-
- exerrval = 0; /* clear error code */
-
- vartyp = tolower( *var_type );
-
- switch (vartyp) {
- case 'g':
- tname = "global";
- vvarname = VAR_NAME_GLO_VAR;
- break;
- case 'n':
- tname = "nodal";
- vvarname = VAR_NAME_NOD_VAR;
- break;
- case 'l':
- tname = "edge block";
- vvarname = VAR_NAME_EDG_VAR;
- break;
- case 'f':
- tname = "face block";
- vvarname = VAR_NAME_FAC_VAR;
- break;
- case 'e':
- tname = "element block";
- vvarname = VAR_NAME_ELE_VAR;
- break;
- case 'm':
- tname = "node set";
- vvarname = VAR_NAME_NSET_VAR;
- break;
- case 'd':
- tname = "edge set";
- vvarname = VAR_NAME_ESET_VAR;
- break;
- case 'a':
- tname = "face set";
- vvarname = VAR_NAME_FSET_VAR;
- break;
- case 's':
- tname = "side set";
- vvarname = VAR_NAME_SSET_VAR;
- break;
- case 't':
- tname = "element set";
- vvarname = VAR_NAME_ELSET_VAR;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: invalid variable type %c requested from file id %d",
- *var_type, exoid);
- ex_err("ex_get_var_param",errmsg,exerrval);
- return (EX_WARN);
- }
-
- /* inquire previously defined variables */
- if ((varid = ncvarid (exoid, vvarname)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg, "Warning: no %s variables names stored in file id %d", tname,exoid);
- ex_err("ex_get_var_names",errmsg,exerrval);
- return (EX_WARN);
- }
-
- /* read the variable names */
-
- /*
- * See if reading into contiguous memory in which case we can load
- * all values in one call. If not, we must load each name individually.
- */
- if (&var_names[num_vars-1][0] - &var_names[0][0] ==
- sizeof(char)*(MAX_STR_LENGTH+1)*(num_vars-1)) {
- status = nc_get_var_text(exoid, varid, &var_names[0][0]);
- if (status == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get results variable names from file id %d", exoid);
- ex_err("ex_get_var_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- } else {
- for (i=0; i<num_vars; i++) {
- size_t start[2];
- size_t count[2];
- start[0] = i; count[0] = 1;
- start[1] = 0; count[1] = MAX_STR_LENGTH+1;
- status = nc_get_vara_text(exoid, varid, start, count, var_names[i]);
- if (status == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get results variable names from file id %d", exoid);
- ex_err("ex_get_var_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- }
- return (EX_NOERR);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_get_variable_names(exoid, obj_type, num_vars, var_names);
}
diff --git a/cbind/src/exgvar.c b/cbind/src/exgvar.c
index 71913fa..95b16cb 100644
--- a/cbind/src/exgvar.c
+++ b/cbind/src/exgvar.c
@@ -36,19 +36,11 @@
*
* exgev - ex_get_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int time_step time step number
-* int var_type block/variable type
+* ex_entity_type var_type block/variable type
* node, edge/face/element block, or
* node/edge/face/side/element set
* int var_index variable index
@@ -63,7 +55,6 @@
* revision history -
* 20061002 - David Thompson - Adapted from ex_get_elem_var
*
-* $Id: exgvar.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -78,123 +69,77 @@
int ex_get_var( int exoid,
int time_step,
- int var_type,
+ ex_entity_type var_type,
int var_index,
int obj_id,
int num_entry_this_obj,
void* var_vals )
{
- int varid, obj_id_ndx;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- const char* vblkids;
- const char* tname;
-
- switch (var_type) {
- case EX_NODAL:
- /* FIXME: Special case: ignore obj_id, possible large_file complications, etc. */
- return ex_get_nodal_var( exoid, time_step, var_index, num_entry_this_obj, var_vals );
- break;
- case EX_GLOBAL:
- /* FIXME: Special case: all vars stored in 2-D single array. */
- return ex_get_glob_vars( exoid, time_step, num_entry_this_obj, var_vals );
- break;
- case EX_EDGE_BLOCK:
- tname = "edge block";
- vblkids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face block";
- vblkids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element block";
- vblkids = VAR_ID_EL_BLK;
- break;
- case EX_NODE_SET:
- tname = "node set";
- vblkids = VAR_NS_IDS;
- break;
- case EX_EDGE_SET:
- tname = "edge set";
- vblkids = VAR_ES_IDS;
- break;
- case EX_FACE_SET:
- tname = "face set";
- vblkids = VAR_FS_IDS;
- break;
- case EX_SIDE_SET:
- tname = "side set";
- vblkids = VAR_SS_IDS;
- break;
- case EX_ELEM_SET:
- tname = "element set";
- vblkids = VAR_ELS_IDS;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Error: Invalid variable type (%d) given for file id %d", var_type, exoid );
- ex_err( "ex_get_var", errmsg, exerrval );
- return (EX_FATAL);
- }
+ int status;
+ int varid, obj_id_ndx;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
- exerrval = 0; /* clear error code */
+ if (var_type == EX_NODAL) {
+ /* FIXME: Special case: ignore obj_id, possible large_file complications, etc. */
+ return ex_get_nodal_var( exoid, time_step, var_index, num_entry_this_obj, var_vals );
+ } else if (var_type == EX_GLOBAL) {
+ /* FIXME: Special case: all vars stored in 2-D single array. */
+ return ex_get_glob_vars( exoid, time_step, num_entry_this_obj, var_vals );
+ }
+
+ exerrval = 0; /* clear error code */
/* Determine index of obj_id in VAR_ID_EL_BLK array */
- obj_id_ndx = ex_id_lkup(exoid,vblkids,obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
+ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
sprintf(errmsg,
- "Warning: no element variables for NULL block %d in file id %d",
- obj_id,exoid);
- ex_err("ex_get_elem_var",errmsg,EX_MSG);
+ "Warning: no %s variables for NULL block %d in file id %d",
+ ex_name_of_object(var_type), obj_id,exoid);
+ ex_err("ex_get_var",errmsg,EX_MSG);
return (EX_WARN);
- }
- else
- {
+ } else {
sprintf(errmsg,
- "Error: failed to locate element block id %d in %s variable in file id %d",
- obj_id, vblkids, exoid);
- ex_err("ex_get_elem_var",errmsg,exerrval);
+ "Error: failed to locate %s id %d in id variable in file id %d",
+ ex_name_of_object(var_type), obj_id, exoid);
+ ex_err("ex_get_var",errmsg,exerrval);
return (EX_FATAL);
}
}
-/* inquire previously defined variable */
-
- if((varid=ncvarid(exoid,ex_name_var_of_object(var_type,var_index,obj_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s %d var %d in file id %d",
- tname,obj_id,var_index,exoid); /* this msg needs to be improved */
- ex_err("ex_get_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* inquire previously defined variable */
-/* read values of element variable */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_entry_this_obj;
+ if((status = nc_inq_varid(exoid, ex_name_var_of_object(var_type,var_index,
+ obj_id_ndx), &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s %d var %d in file id %d",
+ ex_name_of_object(var_type),obj_id,var_index,exoid);
+ ex_err("ex_get_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,var_vals,num_entry_this_obj)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get %s %d var %d in file id %d",
- tname, obj_id, var_index, exoid);/*this msg needs to be improved*/
- ex_err("ex_get_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* read values of element variable */
+ start[0] = --time_step;
+ start[1] = 0;
+ count[0] = 1;
+ count[1] = num_entry_this_obj;
- ex_conv_array( exoid, READ_CONVERT, var_vals, num_entry_this_obj );
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, var_vals);
+ }
- return (EX_NOERR);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s %d variable %d in file id %d",
+ ex_name_of_object(var_type), obj_id, var_index,exoid);
+ ex_err("ex_get_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exgvarnam.c b/cbind/src/exgvarnam.c
new file mode 100644
index 0000000..3cde4d7
--- /dev/null
+++ b/cbind/src/exgvarnam.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgvnm - ex_get_variable_name
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type variable type
+* int var_num variable index to read 1..num_var
+*
+* exit conditions -
+* char* var_name ptr to variable name
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the name of a particular results variable from the database
+ */
+
+int ex_get_variable_name (int exoid,
+ ex_entity_type obj_type,
+ int var_num,
+ char *var_name)
+{
+ int status;
+ int j, varid;
+ size_t start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+ const char *vname = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire previously defined variables */
+
+ switch (obj_type) {
+ case EX_GLOBAL:
+ vname = VAR_NAME_GLO_VAR;
+ break;
+ case EX_NODAL:
+ vname = VAR_NAME_NOD_VAR;
+ break;
+ case EX_EDGE_BLOCK:
+ vname = VAR_NAME_EDG_VAR;
+ break;
+ case EX_FACE_BLOCK:
+ vname = VAR_NAME_FAC_VAR;
+ break;
+ case EX_ELEM_BLOCK:
+ vname = VAR_NAME_ELE_VAR;
+ break;
+ case EX_NODE_SET:
+ vname = VAR_NAME_NSET_VAR;
+ break;
+ case EX_EDGE_SET:
+ vname = VAR_NAME_ESET_VAR;
+ break;
+ case EX_FACE_SET:
+ vname = VAR_NAME_FSET_VAR;
+ break;
+ case EX_SIDE_SET:
+ vname = VAR_NAME_SSET_VAR;
+ break;
+ case EX_ELEM_SET:
+ vname = VAR_NAME_ELSET_VAR;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Error: Invalid variable type (%d) given for file id %d", obj_type, exoid );
+ ex_err( "ex_get_variable_name", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, vname, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Warning: no %s variable names stored in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err("ex_get_variable_name",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ /* read the variable name */
+ start[0] = var_num-1;
+ start[1] = 0;
+
+ j = 0;
+ ptr=var_name;
+
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {/* get first character */
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get results variable name type %s, index %d from file id %d",
+ ex_name_of_object(obj_type), var_num, exoid);
+ ex_err("ex_get_variable_name",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) {/* get remaining chars */
+ start[1] = ++j;
+ if ((status = nc_get_var1_text(exoid, varid, start, ptr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get results variable names from file id %d", exoid);
+ ex_err("ex_get_var_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ if (*(--ptr) != '\0') {
+ --ptr;
+ while (*(--ptr) == ' '); /* strip right trailing blanks */
+ *(++ptr) = '\0';
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgvan.c b/cbind/src/exgvarnams.c
similarity index 74%
copy from cbind/src/exgvan.c
copy to cbind/src/exgvarnams.c
index 1ac0677..874f16b 100644
--- a/cbind/src/exgvan.c
+++ b/cbind/src/exgvarnams.c
@@ -34,20 +34,12 @@
*/
/*****************************************************************************
*
-* exgvan - ex_get_var_names
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
+* ex_get_variable_names
*
* entry conditions -
* input parameters:
* int exoid exodus file id
-* char* var_type variable type: G,N, or E
+* int obj_type type of object
* int num_vars # of variables to read
*
* exit conditions -
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: exgvan.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -68,76 +59,63 @@
* reads the names of the results variables from the database
*/
-int ex_get_var_names (int exoid,
- const char *var_type,
- int num_vars,
- char *var_names[])
+int ex_get_variable_names (int exoid,
+ ex_entity_type obj_type,
+ int num_vars,
+ char *var_names[])
{
int i, varid, status;
char errmsg[MAX_ERR_LENGTH];
- int vartyp;
- const char* tname;
const char* vvarname;
exerrval = 0; /* clear error code */
- vartyp = tolower( *var_type );
-
- switch (vartyp) {
- case 'g':
- tname = "global";
- vvarname = VAR_NAME_GLO_VAR;
- break;
- case 'n':
- tname = "nodal";
+ switch (obj_type) {
+ case EX_NODAL:
vvarname = VAR_NAME_NOD_VAR;
break;
- case 'l':
- tname = "edge block";
+ case EX_EDGE_BLOCK:
vvarname = VAR_NAME_EDG_VAR;
break;
- case 'f':
- tname = "face block";
+ case EX_FACE_BLOCK:
vvarname = VAR_NAME_FAC_VAR;
break;
- case 'e':
- tname = "element block";
+ case EX_ELEM_BLOCK:
vvarname = VAR_NAME_ELE_VAR;
break;
- case 'm':
- tname = "node set";
+ case EX_NODE_SET:
vvarname = VAR_NAME_NSET_VAR;
break;
- case 'd':
- tname = "edge set";
+ case EX_EDGE_SET:
vvarname = VAR_NAME_ESET_VAR;
break;
- case 'a':
- tname = "face set";
+ case EX_FACE_SET:
vvarname = VAR_NAME_FSET_VAR;
break;
- case 's':
- tname = "side set";
+ case EX_SIDE_SET:
vvarname = VAR_NAME_SSET_VAR;
break;
- case 't':
- tname = "element set";
+ case EX_ELEM_SET:
vvarname = VAR_NAME_ELSET_VAR;
break;
+ case EX_GLOBAL:
+ vvarname = VAR_NAME_GLO_VAR;
+ break;
default:
exerrval = EX_BADPARAM;
sprintf(errmsg,
- "Warning: invalid variable type %c requested from file id %d",
- *var_type, exoid);
+ "Warning: invalid variable type %d requested from file id %d",
+ obj_type, exoid);
ex_err("ex_get_var_param",errmsg,exerrval);
return (EX_WARN);
}
/* inquire previously defined variables */
- if ((varid = ncvarid (exoid, vvarname)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg, "Warning: no %s variables names stored in file id %d", tname,exoid);
- ex_err("ex_get_var_names",errmsg,exerrval);
+ if ((status = nc_inq_varid(exoid, vvarname, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg, "Warning: no %s variables names stored in file id %d",
+ ex_name_of_object(obj_type),exoid);
+ ex_err("ex_get_variable_names",errmsg,exerrval);
return (EX_WARN);
}
@@ -147,11 +125,11 @@ int ex_get_var_names (int exoid,
* See if reading into contiguous memory in which case we can load
* all values in one call. If not, we must load each name individually.
*/
- if (&var_names[num_vars-1][0] - &var_names[0][0] ==
+ if ((size_t)(&var_names[num_vars-1][0] - &var_names[0][0]) ==
sizeof(char)*(MAX_STR_LENGTH+1)*(num_vars-1)) {
status = nc_get_var_text(exoid, varid, &var_names[0][0]);
- if (status == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get results variable names from file id %d", exoid);
ex_err("ex_get_var_names",errmsg,exerrval);
@@ -164,8 +142,8 @@ int ex_get_var_names (int exoid,
start[0] = i; count[0] = 1;
start[1] = 0; count[1] = MAX_STR_LENGTH+1;
status = nc_get_vara_text(exoid, varid, start, count, var_names[i]);
- if (status == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get results variable names from file id %d", exoid);
ex_err("ex_get_var_names",errmsg,exerrval);
diff --git a/cbind/src/exgnvid.c b/cbind/src/exgvarparam.c
similarity index 52%
copy from cbind/src/exgnvid.c
copy to cbind/src/exgvarparam.c
index f7cb35a..7bce8c5 100644
--- a/cbind/src/exgnvid.c
+++ b/cbind/src/exgvarparam.c
@@ -34,87 +34,107 @@
*/
/*****************************************************************************
*
-* exgnvid - ex_get_nodal_varid
+* exgvp - ex_get_variable_param
*
* entry conditions -
* input parameters:
-* int exoid exodus file id
+* int exoid exodus file id
+* int obj_type variable type
*
* exit conditions -
-* int* varid array of nodal variable varids
+* int* num_vars number of variables in database
*
* revision history -
*
-* $Id: exgnvid.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
*
*****************************************************************************/
-#include <stdlib.h>
#include "exodusII.h"
#include "exodusII_int.h"
-/*
- * returns the varids for the nodal variables.
+#include <ctype.h>
+
+/*!
+ * reads the number of global, nodal, or element variables that are
+ * stored in the database
*/
-int ex_get_nodal_varid(int exoid, int *varid)
+int ex_get_variable_param (int exoid,
+ ex_entity_type obj_type,
+ int *num_vars)
{
- int i, dimid, nvarid;
- long num_vars;
+ int dimid;
+ size_t dimlen;
char errmsg[MAX_ERR_LENGTH];
-
+ const char* dnumvar;
+ int status;
+
exerrval = 0; /* clear error code */
+ *num_vars = 0;
+
+ switch (obj_type) {
+ case EX_GLOBAL:
+ dnumvar = DIM_NUM_GLO_VAR;
+ break;
+ case EX_NODAL:
+ dnumvar = DIM_NUM_NOD_VAR;
+ break;
+ case EX_EDGE_BLOCK:
+ dnumvar = DIM_NUM_EDG_VAR;
+ break;
+ case EX_FACE_BLOCK:
+ dnumvar = DIM_NUM_FAC_VAR;
+ break;
+ case EX_ELEM_BLOCK:
+ dnumvar = DIM_NUM_ELE_VAR;
+ break;
+ case EX_NODE_SET:
+ dnumvar = DIM_NUM_NSET_VAR;
+ break;
+ case EX_EDGE_SET:
+ dnumvar = DIM_NUM_ESET_VAR;
+ break;
+ case EX_FACE_SET:
+ dnumvar = DIM_NUM_FSET_VAR;
+ break;
+ case EX_SIDE_SET:
+ dnumvar = DIM_NUM_SSET_VAR;
+ break;
+ case EX_ELEM_SET:
+ dnumvar = DIM_NUM_ELSET_VAR;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: invalid variable type %d requested from file id %d",
+ obj_type, exoid);
+ ex_err("ex_get_var_param",errmsg,exerrval);
+ return (EX_WARN);
+ }
- if ((dimid = ncdimid (exoid, DIM_NUM_NOD_VAR)) == -1) {
- num_vars = 0;
- if (ncerr == NC_EBADDIM)
- return(EX_NOERR); /* no nodal variables defined */
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodal variable names in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimid (exoid, dnumvar, &dimid)) != NC_NOERR) {
+ *num_vars = 0;
+ if (status == NC_EBADDIM)
+ return(EX_NOERR); /* no global variables defined */
+ else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s variable names in file id %d",
+ ex_name_of_object(obj_type),exoid);
+ ex_err("ex_get_var_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_vars) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, dimid, &dimlen)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of nodal variables in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
+ "Error: failed to get number of %s variables in file id %d",
+ ex_name_of_object(obj_type),exoid);
+ ex_err("ex_get_var_param",errmsg,exerrval);
return (EX_FATAL);
}
-
- if (ex_large_model(exoid) == 0) {
- /* All varids are the same; */
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: could not find nodal variables in file id %d",
- exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_WARN);
- }
- for (i=0; i < num_vars; i++) {
- varid[i] = nvarid;
- }
- } else {
- /* Variables stored separately; each has a unique varid */
- for (i=0; i < num_vars; i++) {
- if ((nvarid = ncvarid (exoid, VAR_NOD_VAR_NEW(i+1))) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: could not find nodal variable %d in file id %d",
- i+1, exoid);
- ex_err("ex_get_nodal_varid",errmsg,exerrval);
- return (EX_WARN);
- }
- varid[i] = nvarid;
- }
- }
+ *num_vars = dimlen;
+
return(EX_NOERR);
}
diff --git a/cbind/src/exgvart.c b/cbind/src/exgvart.c
index f534f8f..306792d 100644
--- a/cbind/src/exgvart.c
+++ b/cbind/src/exgvart.c
@@ -36,14 +36,6 @@
*
* exgvart - ex_get_var_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -61,7 +53,6 @@
* revision history -
* 20061002 - David Thompson - Adapted from ex_get_var_time
*
-* $Id: exgvart.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -76,21 +67,22 @@
*/
int ex_get_var_time( int exoid,
- int var_type,
+ ex_entity_type var_type,
int var_index,
int id,
int beg_time_step,
int end_time_step,
void* var_vals )
{
- int i, dimid, varid, numel = 0, offset;
- nclong *obj_ids, *stat_vals;
- long num_obj, num_entries_this_obj = 0, start[2], count[2];
+ int dimid, varid, numel = 0, offset;
+ int status;
+ int *obj_ids, *stat_vals;
+ size_t num_obj, i;
+ size_t num_entries_this_obj = 0;
+ size_t start[2], count[2];
float fdum;
char *cdum;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* dimnumobj;
const char* varobjids;
const char* varobstat;
@@ -100,50 +92,34 @@ int ex_get_var_time( int exoid,
case EX_NODAL:
return ex_get_nodal_var_time( exoid, var_index, id, beg_time_step, end_time_step, var_vals );
case EX_EDGE_BLOCK:
- tname = "edge block";
- dimnumobj = DIM_NUM_ED_BLK;
varobjids = VAR_ID_ED_BLK;
varobstat = VAR_STAT_ED_BLK;
break;
case EX_FACE_BLOCK:
- tname = "face block";
- dimnumobj = DIM_NUM_FA_BLK;
varobjids = VAR_ID_FA_BLK;
varobstat = VAR_STAT_FA_BLK;
break;
case EX_ELEM_BLOCK:
- tname = "element block";
- dimnumobj = DIM_NUM_EL_BLK;
varobjids = VAR_ID_EL_BLK;
varobstat = VAR_STAT_EL_BLK;
break;
case EX_NODE_SET:
- tname = "node set";
- dimnumobj = DIM_NUM_NSET_VAR;
varobjids = VAR_NS_IDS;
varobstat = VAR_NS_STAT;
break;
case EX_EDGE_SET:
- tname = "edge set";
- dimnumobj = DIM_NUM_ESET_VAR;
varobjids = VAR_ES_IDS;
varobstat = VAR_ES_STAT;
break;
case EX_FACE_SET:
- tname = "face set";
- dimnumobj = DIM_NUM_FSET_VAR;
varobjids = VAR_FS_IDS;
varobstat = VAR_FS_STAT;
break;
case EX_SIDE_SET:
- tname = "side set";
- dimnumobj = DIM_NUM_SSET_VAR;
varobjids = VAR_SS_IDS;
varobstat = VAR_SS_STAT;
break;
case EX_ELEM_SET:
- tname = "element set";
- dimnumobj = DIM_NUM_ELSET_VAR;
varobjids = VAR_ELS_IDS;
varobstat = VAR_ELS_STAT;
break;
@@ -166,103 +142,73 @@ int ex_get_var_time( int exoid,
/* find what object the entry is in */
/* first, find out how many objects there are */
-
- if ((dimid = ncdimid (exoid, dimnumobj)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of %ss in file id %d",
- tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %ss in file id %d",
- tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ status = ex_get_dimension(exoid, ex_dim_num_objects(var_type), ex_name_of_object(var_type),
+ &num_obj, &dimid, "ex_get_var_time");
+ if (status != NC_NOERR) return status;
/* get the array of object ids */
/* don't think we need this anymore since the netcdf variable names
associated with objects don't contain the object ids */
- if (!(obj_ids = malloc(num_obj*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for %s ids for file id %d",
- tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (!(obj_ids = malloc(num_obj*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s ids for file id %d",
+ ex_name_of_object(var_type),exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ if ((status = nc_inq_varid (exoid, varobjids, &varid )) != NC_NOERR) {
+ exerrval = status;
+ free(obj_ids);
+ sprintf(errmsg,
+ "Error: failed to locate %s ids in file id %d",
+ ex_name_of_object(var_type),exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if ((varid = ncvarid (exoid, varobjids)) == -1)
- {
- exerrval = ncerr;
- free(obj_ids);
- sprintf(errmsg,
- "Error: failed to locate %s ids in file id %d", tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_get_var_int(exoid, varid, obj_ids)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s ids from file id %d",
+ ex_name_of_object(var_type),exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ /* allocate space for stat array */
+ if (!(stat_vals = malloc((int)num_obj*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
+ free (obj_ids);
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s status array for file id %d",
+ ex_name_of_object(var_type),exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- start[0] = 0;
- count[0] = num_obj;
- if (ncvarget (exoid, varid, start, count, obj_ids) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get %s ids from file id %d", tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* get variable id of status array */
+ if (nc_inq_varid (exoid, varobstat, &varid) == NC_NOERR) {
+ /* if status array exists, use it, otherwise assume, object exists
+ to be backward compatible */
- /* allocate space for stat array */
- if (!(stat_vals = malloc((int)num_obj*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
+ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) {
+ exerrval = status;
free (obj_ids);
+ free(stat_vals);
sprintf(errmsg,
- "Error: failed to allocate memory for %s status array for file id %d",
- tname,exoid);
+ "Error: failed to get %s status array from file id %d",
+ ex_name_of_object(var_type),exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
return (EX_FATAL);
}
-
- /* get variable id of status array */
- if ((varid = ncvarid (exoid, varobstat)) != -1)
- {
- /* if status array exists, use it, otherwise assume, object exists
- to be backward compatible */
-
- start[0] = 0;
- start[1] = 0;
- count[0] = num_obj;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1)
- {
- exerrval = ncerr;
- free (obj_ids);
- free(stat_vals);
- sprintf(errmsg,
- "Error: failed to get %s status array from file id %d",
- tname,exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else /* default: status is true */
+ }
+ else { /* default: status is true */
for(i=0;i<num_obj;i++)
stat_vals[i]=1;
-
+ }
/* loop through each object until id is found; since entry
* numbers are sequential (beginning with 1) id is in obj_i
@@ -274,69 +220,66 @@ int ex_get_var_time( int exoid,
i = 0;
if (stat_vals[i] != 0) {
- if ((dimid = ncdimid (exoid, ex_dim_num_entries_in_object(var_type,i+1))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_entries_in_object(var_type,i+1), &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate number of entries in %s %d in file id %d",
- tname, obj_ids[i], exoid);
+ "Error: failed to locate number of entries in %s %d in file id %d",
+ ex_name_of_object(var_type), obj_ids[i], exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
free(stat_vals);
free(obj_ids);
return (EX_FATAL);
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entries_this_obj) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_entries_this_obj)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of entries in %s %d in file id %d",
- tname, obj_ids[i], exoid);
+ "Error: failed to get number of entries in %s %d in file id %d",
+ ex_name_of_object(var_type), obj_ids[i], exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
free(stat_vals);
free(obj_ids);
return (EX_FATAL);
}
-
} /* End NULL object check */
numel = num_entries_this_obj;
while (numel <= id) {
if (stat_vals[++i] != 0) {
- if ((dimid = ncdimid(exoid,ex_dim_num_entries_in_object(var_type,i+1))) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entries in %s %d in file id %d",
- tname, obj_ids[i], exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- free(stat_vals);
- free(obj_ids);
- return (EX_FATAL);
+ if ((status = nc_inq_dimid(exoid,ex_dim_num_entries_in_object(var_type,i+1), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of entries in %s %d in file id %d",
+ ex_name_of_object(var_type), obj_ids[i], exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ free(stat_vals);
+ free(obj_ids);
+ return (EX_FATAL);
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entries_this_obj) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries in %s %d in file id %d",
- tname, obj_ids[i], exoid);
- ex_err("ex_get_var_time",errmsg,exerrval);
- free(stat_vals);
- free(obj_ids);
- return (EX_FATAL);
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_entries_this_obj)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of entries in %s %d in file id %d",
+ ex_name_of_object(var_type), obj_ids[i], exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ free(stat_vals);
+ free(obj_ids);
+ return (EX_FATAL);
}
-
numel += num_entries_this_obj;
}
}
-
offset = id - (numel - num_entries_this_obj);
/* inquire previously defined variable */
- if((varid=ncvarid(exoid,ex_name_var_of_object(var_type,var_index,i+1))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid,ex_name_var_of_object(var_type,var_index,i+1), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate variable %d for %s %d in file id %d",
- var_index,tname,obj_ids[i],exoid);
+ "Error: failed to locate variable %d for %s %d in file id %d",
+ var_index,ex_name_of_object(var_type),obj_ids[i],exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
free(stat_vals);
free(obj_ids);
@@ -347,21 +290,19 @@ int ex_get_var_time( int exoid,
free(obj_ids);
/* read values of object variable */
-
start[0] = --beg_time_step;
start[1] = offset;
if (end_time_step < 0) {
-
/* user is requesting the maximum time step; we find this out using the
* database inquire function to get the number of time steps; the ending
* time step number is 1 less due to 0 based array indexing in C
*/
- if (ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum) == -1) {
- exerrval = ncerr;
+ if ((status = ex_inquire (exoid, EX_INQ_TIME, &end_time_step, &fdum, cdum)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get maximum time step in file id %d",
- exoid);
+ "Error: failed to get maximum time step in file id %d",
+ exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
return (EX_FATAL);
}
@@ -372,16 +313,19 @@ int ex_get_var_time( int exoid,
count[0] = end_time_step - beg_time_step + 1;
count[1] = 1;
- if (ncvarget (exoid, varid, start, count,
- ex_conv_array(exoid,RTN_ADDRESS,var_vals,count[0])) == -1) {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get %s variable values in file id %d", tname,exoid);
+ "Error: failed to get %s variable values in file id %d",
+ ex_name_of_object(var_type),exoid);
ex_err("ex_get_var_time",errmsg,exerrval);
return (EX_FATAL);
}
-
- ex_conv_array( exoid, READ_CONVERT, var_vals, count[0] );
-
return (EX_NOERR);
}
diff --git a/cbind/src/exgvartab.c b/cbind/src/exgvartab.c
new file mode 100644
index 0000000..b475e15
--- /dev/null
+++ b/cbind/src/exgvartab.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgvtt - ex_get_truth_table
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_blk number of blocks
+* int num_var number of variables
+*
+* exit conditions -
+* int* var_tab element variable truth table array
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#include <ctype.h>
+
+/*!
+ * reads the EXODUS II specified variable truth table from the database
+ */
+
+int ex_get_truth_table (int exoid,
+ ex_entity_type obj_type,
+ int num_blk,
+ int num_var,
+ int *var_tab)
+{
+ int dimid, varid, tabid, i, j, status, status1;
+ size_t num_entity = 0;
+ size_t num_var_db = 0;
+ char errmsg[MAX_ERR_LENGTH];
+ const char* routine = "ex_get_truth_table";
+
+ /*
+ * The ent_type and the var_name are used to build the netcdf
+ * variables name. Normally this is done via a macro defined in
+ * exodusII_int.h
+ */
+ const char* ent_type = NULL;
+ const char* var_name = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ switch (obj_type) {
+ case EX_EDGE_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_EBLK_TAB, &tabid);
+ var_name = "vals_edge_var";
+ ent_type = "eb";
+ break;
+ case EX_FACE_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_FBLK_TAB, &tabid);
+ var_name = "vals_face_var";
+ ent_type = "fb";
+ break;
+ case EX_ELEM_BLOCK:
+ status = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_ELEM_TAB, &tabid);
+ var_name = "vals_elem_var";
+ ent_type = "eb";
+ break;
+ case EX_NODE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_NSET_TAB, &tabid);
+ var_name = "vals_nset_var";
+ ent_type = "ns";
+ break;
+ case EX_EDGE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_ESET_TAB, &tabid);
+ var_name = "vals_eset_var";
+ ent_type = "es";
+ break;
+ case EX_FACE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_FSET_TAB, &tabid);
+ var_name = "vals_fset_var";
+ ent_type = "fs";
+ break;
+ case EX_SIDE_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_SSET_TAB, &tabid);
+ var_name = "vals_sset_var";
+ ent_type = "ss";
+ break;
+ case EX_ELEM_SET:
+ status = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elemset variables", &num_var_db, &varid, routine);
+ status1 = nc_inq_varid (exoid, VAR_ELSET_TAB, &tabid);
+ var_name = "vals_elset_var";
+ ent_type = "es";
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid variable type %d specified in file id %d",
+ obj_type, exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ return (EX_WARN);
+ }
+
+ status = ex_get_dimension(exoid, ex_dim_num_objects(obj_type),
+ ex_name_of_object(obj_type), &num_entity, &dimid, routine);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ return (EX_FATAL);
+ }
+
+ if (num_entity != (size_t)num_blk) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: # of %s doesn't match those defined in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_var_db != (size_t)num_var) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: # of %s variables doesn't match those defined in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (status1 != NC_NOERR) {
+ /* since truth table isn't stored in the data file, derive it dynamically */
+ for (j=0; j<num_blk; j++) {
+
+ for (i=0; i<num_var; i++) {
+ /* NOTE: names are 1-based */
+ if (nc_inq_varid (exoid, ex_catstr2(var_name, i+1, ent_type, j+1), &tabid) == NC_NOERR) {
+ /* variable exists; put a 1 in the truth table */
+ var_tab[j*num_var+i] = 1;
+ } else {
+ /* variable doesn't exist; put a 0 in the truth table */
+ var_tab[j*num_var+i] = 0;
+ }
+ }
+ }
+ } else {
+ /* read in the truth table */
+ status = nc_get_var_int(exoid, tabid, var_tab);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get %s truth table from file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgvid.c b/cbind/src/exgvid.c
index b5891cd..64ce4ae 100644
--- a/cbind/src/exgvid.c
+++ b/cbind/src/exgvid.c
@@ -45,7 +45,6 @@
*
* revision history -
*
-* $Id: exgvid.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
*
*****************************************************************************/
@@ -57,14 +56,17 @@
* reads the EXODUS II variable varids from the database
*/
-int ex_get_varid (int exoid, const char *var_type,
- int *varid_arr)
+int ex_get_varid (int exoid,
+ ex_entity_type obj_type,
+ int *varid_arr)
{
- int varid, dimid, i, j;
- long num_entity = -1;
- long num_var = -1;
+ int status1, status2;
+ int varid;
+ size_t i, j;
+ size_t num_entity = 0;
+ size_t num_var = 0;
char errmsg[MAX_ERR_LENGTH];
- const char* routine = "ex_get_elem_varid";
+ const char* routine = "ex_get_varid";
/*
* The ent_type and the var_name are used to build the netcdf
@@ -76,53 +78,76 @@ int ex_get_varid (int exoid, const char *var_type,
exerrval = 0; /* clear error code */
- if (*var_type == 'n' || *var_type == 'N') {
+ if (obj_type == EX_NODAL){
/* Handle nodal variables in a node-specific manner */
return ex_get_nodal_varid(exoid, varid_arr);
}
- else if (*var_type == 'e' || *var_type == 'E') {
- dimid = ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var, routine);
+ else if (obj_type == EX_ELEM_BLOCK) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var, &varid, routine);
var_name = "vals_elem_var";
ent_type = "eb";
}
- else if (*var_type == 'm' || *var_type == 'M') {
- dimid = ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var, routine);
+ else if (obj_type == EX_NODE_SET) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var, &varid, routine);
var_name = "vals_nset_var";
ent_type = "ns";
}
- else if (*var_type == 's' || *var_type == 'S') {
- dimid = ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, routine);
- varid = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var, routine);
+ else if (obj_type == EX_SIDE_SET) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var, &varid, routine);
var_name = "vals_sset_var";
ent_type = "ss";
}
+ else if (obj_type == EX_EDGE_BLOCK) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var, &varid, routine);
+ var_name = "vals_edge_var";
+ ent_type = "eb";
+ }
+ else if (obj_type == EX_EDGE_SET) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var, &varid, routine);
+ var_name = "vals_eset_var";
+ ent_type = "es";
+ }
+ else if (obj_type == EX_FACE_BLOCK) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var, &varid, routine);
+ var_name = "vals_face_var";
+ ent_type = "fb";
+ }
+ else if (obj_type == EX_FACE_SET) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var, &varid, routine);
+ var_name = "vals_fset_var";
+ ent_type = "fs";
+ }
+ else if (obj_type == EX_ELEM_SET) {
+ status1 = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elementset variables", &num_var, &varid, routine);
+ var_name = "vals_elset_var";
+ ent_type = "es";
+ }
else { /* invalid variable type */
exerrval = EX_BADPARAM;
sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
+ "Error: Invalid object type %d specified in file id %d",
+ obj_type, exoid);
ex_err("ex_get_varid",errmsg,exerrval);
return (EX_WARN);
}
- if (dimid < 0 || varid < 0)
+ status2 = ex_get_dimension(exoid, ex_dim_num_objects(obj_type),
+ ex_name_of_object(obj_type), &num_entity, &varid, routine);
+ if (status2 != NC_NOERR || status1 != NC_NOERR)
return(EX_FATAL);
if (num_entity == 0 || num_var == 0)
return(EX_WARN);
- /* since truth table isn't stored in the data file, derive it dynamically */
for (j=0; j<num_entity; j++) {
for (i=0; i<num_var; i++) {
/* NOTE: names are 1-based */
- if ((varid = ncvarid (exoid, ex_catstr2(var_name, i+1, ent_type, j+1))) == -1)
- /* variable doesn't exist; put a 0 in the varid_arr table */
- varid_arr[j*num_var+i] = 0;
- else
- /* variable exists; put varid in the table */
+ if (nc_inq_varid(exoid, ex_catstr2(var_name, i+1, ent_type, j+1), &varid) == NC_NOERR)
+ /* variable exists; put varid in the varid_arr table */
varid_arr[j*num_var+i] = varid;
+ else
+ /* variable doesn't exist; put 0 in the table */
+ varid_arr[j*num_var+i] = 0;
}
}
return (EX_NOERR);
diff --git a/cbind/src/exgvnm.c b/cbind/src/exgvnm.c
index 4ac643f..2292c56 100644
--- a/cbind/src/exgvnm.c
+++ b/cbind/src/exgvnm.c
@@ -36,14 +36,6 @@
*
* exgvnm - ex_get_var_name
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: exgvnm.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -64,6 +55,7 @@
/*!
* reads the name of a particular results variable from the database
+ * \deprecated use ex_get_variable_name()(exoid, obj_type, var_num, *var_name)
*/
int ex_get_var_name (int exoid,
@@ -71,132 +63,7 @@ int ex_get_var_name (int exoid,
int var_num,
char *var_name)
{
- int j, varid;
- long start[2];
- char *ptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* inquire previously defined variables */
-
- if (*var_type == 'g' || *var_type == 'G')
- {
- if ((varid = ncvarid (exoid, VAR_NAME_GLO_VAR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no global variables names stored in file id %d", exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
- }
-
- else if (*var_type == 'n' || *var_type == 'N')
- {
- if ((varid = ncvarid (exoid, VAR_NAME_NOD_VAR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no nodal variable names stored in file id %d",
- exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
-
- }
-
- else if (*var_type == 'e' || *var_type == 'E')
- {
-
- if ((varid = ncvarid (exoid, VAR_NAME_ELE_VAR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no element variable names stored in file id %d",
- exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
- }
-
- else if (*var_type == 'm' || *var_type == 'M')
- {
-
- if ((varid = ncvarid (exoid, VAR_NAME_NSET_VAR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no nodeset variable names stored in file id %d",
- exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
- }
-
- else if (*var_type == 's' || *var_type == 'S')
- {
-
- if ((varid = ncvarid (exoid, VAR_NAME_SSET_VAR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Warning: no sideset variable names stored in file id %d",
- exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
- }
-
- else /* invalid variable type */
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
-
-
-/* read the variable name */
-
- start[0] = var_num-1;
- start[1] = 0;
-
- j = 0;
- ptr=var_name;
-
- if (ncvarget1 (exoid, varid, start, ptr) == -1) /* get first character */
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get results variable name type %c, index %d from file id %d",
- *var_type, var_num, exoid);
- ex_err("ex_get_var_name",errmsg,exerrval);
- return (EX_FATAL);
-
- }
-
- while ((*ptr++ != '\0') && (j < MAX_STR_LENGTH)) /* get remaining chars */
- {
- start[1] = ++j;
- if (ncvarget1 (exoid, varid, start, ptr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get results variable names from file id %d", exoid);
- ex_err("ex_get_var_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if (*(--ptr) != '\0')
- {
- --ptr;
- while (*(--ptr) == ' '); /* strip right trailing blanks */
- *(++ptr) = '\0';
- }
-
- return (EX_NOERR);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_get_variable_name(exoid, obj_type, var_num, var_name);
}
diff --git a/cbind/src/exgvp.c b/cbind/src/exgvp.c
index 1871e0d..5a30204 100644
--- a/cbind/src/exgvp.c
+++ b/cbind/src/exgvp.c
@@ -36,14 +36,6 @@
*
* exgvp - ex_get_var_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: exgvp.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -66,99 +57,14 @@
/*!
* reads the number of global, nodal, or element variables that are
* stored in the database
+ * \deprecated Use ex_get_variable_param()(exoid, obj_type, *num_vars)
*/
int ex_get_var_param (int exoid,
const char *var_type,
int *num_vars)
{
- int dimid;
- long lnum_vars;
- char errmsg[MAX_ERR_LENGTH];
- int vartyp;
- const char* dnumvar;
- const char* tname;
-
- exerrval = 0; /* clear error code */
-
- vartyp = tolower( *var_type );
-
- switch (vartyp) {
- case 'g':
- tname = "global";
- dnumvar = DIM_NUM_GLO_VAR;
- break;
- case 'n':
- tname = "nodal";
- dnumvar = DIM_NUM_NOD_VAR;
- break;
- case 'l':
- tname = "edge block";
- dnumvar = DIM_NUM_EDG_VAR;
- break;
- case 'f':
- tname = "face block";
- dnumvar = DIM_NUM_FAC_VAR;
- break;
- case 'e':
- tname = "element block";
- dnumvar = DIM_NUM_ELE_VAR;
- break;
- case 'm':
- tname = "node set";
- dnumvar = DIM_NUM_NSET_VAR;
- break;
- case 'd':
- tname = "edge set";
- dnumvar = DIM_NUM_ESET_VAR;
- break;
- case 'a':
- tname = "face set";
- dnumvar = DIM_NUM_FSET_VAR;
- break;
- case 's':
- tname = "side set";
- dnumvar = DIM_NUM_SSET_VAR;
- break;
- case 't':
- tname = "element set";
- dnumvar = DIM_NUM_ELSET_VAR;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: invalid variable type %c requested from file id %d",
- *var_type, exoid);
- ex_err("ex_get_var_param",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if ((dimid = ncdimid (exoid, dnumvar)) == -1)
- {
- *num_vars = 0;
- if (ncerr == NC_EBADDIM)
- return(EX_NOERR); /* no global variables defined */
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s variable names in file id %d",
- tname,exoid);
- ex_err("ex_get_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &lnum_vars) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %s variables in file id %d",
- tname,exoid);
- ex_err("ex_get_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- *num_vars = lnum_vars;
-
- return(EX_NOERR);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return (ex_get_variable_param(exoid, obj_type, num_vars));
}
diff --git a/cbind/src/exgvtt.c b/cbind/src/exgvtt.c
index 3d87f46..3e19c33 100644
--- a/cbind/src/exgvtt.c
+++ b/cbind/src/exgvtt.c
@@ -36,8 +36,6 @@
*
* exgvtt - ex_get_elem_var_tab
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -49,7 +47,6 @@
*
* revision history -
*
-* $Id: exgvtt.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,6 +56,7 @@
/*!
* reads the EXODUS II element variable truth table from the database
+ * \deprecated Use ex_get_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab)
*/
int ex_get_elem_var_tab (int exoid,
@@ -66,5 +64,5 @@ int ex_get_elem_var_tab (int exoid,
int num_elem_var,
int *elem_var_tab)
{
- return ex_get_var_tab(exoid, "E", num_elem_blk, num_elem_var, elem_var_tab);
+ return ex_get_truth_table(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab);
}
diff --git a/cbind/src/exgvv.c b/cbind/src/exgvv.c
index 5d364a1..1963e60 100644
--- a/cbind/src/exgvv.c
+++ b/cbind/src/exgvv.c
@@ -36,8 +36,6 @@
*
* exgev - ex_get_varid_var
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +50,6 @@
*
* revision history -
*
-* $Id: exgvv.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -73,13 +70,13 @@ int ex_get_varid_var(int exoid,
int num_entity,
void *var_vals)
{
- long start[2], count[2];
+ int status;
+ size_t start[2], count[2];
char errmsg[MAX_ERR_LENGTH];
- void *array;
exerrval = 0; /* clear error code */
- /* read values of element variable */
+ /* read values of variable */
start[0] = --time_step;
start[1] = 0;
@@ -87,18 +84,19 @@ int ex_get_varid_var(int exoid,
count[0] = 1;
count[1] = num_entity;
- array = ex_conv_array(exoid,RTN_ADDRESS,var_vals,num_entity);
- if (ncvarget (exoid, varid, start, count, array) == -1) {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_get_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_get_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get variable with variable id %d in file id %d",
varid,exoid);/*this msg needs to be improved*/
ex_err("ex_get_varid_var",errmsg,exerrval);
return (EX_FATAL);
}
-
- if (array != var_vals) {
- ex_conv_array(exoid, READ_CONVERT, var_vals, num_entity);
- }
return (EX_NOERR);
}
diff --git a/cbind/src/exinq.c b/cbind/src/exinq.c
index 9ade79a..461c6cc 100644
--- a/cbind/src/exinq.c
+++ b/cbind/src/exinq.c
@@ -36,14 +36,6 @@
*
* exinq - ex_inquire
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,166 +48,163 @@
*
* revision history -
*
-* $Id: exinq.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
#include <stdlib.h>
+#include <string.h>
+
#include "exodusII.h"
#include "exodusII_int.h"
-#define EX_GET_DIMENSION_VALUE(VAR,DEFVAL,DNAME,MISSINGOK) \
- if ( ( dimid = ncdimid( exoid, DNAME ) ) == -1 ) { \
- *VAR = DEFVAL; \
- if ( MISSINGOK ) { \
- return (EX_NOERR); \
- } else { \
- exerrval = ncerr; \
- sprintf( errmsg, \
- "Error: failed to retrieve dimension " DNAME " for file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- } \
- \
- if ( ncdiminq( exoid, dimid, (char*) 0, &ldum ) == -1 ) { \
- *VAR = DEFVAL; \
- exerrval = ncerr; \
- sprintf( errmsg, \
- "Error: failed to retrieve value for dimension " DNAME " for file id %d",\
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- *VAR = ldum
+#define EX_GET_DIMENSION_VALUE(VAR,DEFVAL,DNAME,MISSINGOK) \
+ if ((status = nc_inq_dimid( exoid, DNAME, &dimid)) != NC_NOERR) { \
+ *VAR = DEFVAL; \
+ if ( MISSINGOK ) { \
+ return (EX_NOERR); \
+ } else { \
+ exerrval = status; \
+ sprintf( errmsg, \
+ "Error: failed to retrieve dimension " DNAME " for file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } \
+ if ((status = nc_inq_dimlen( exoid, dimid, &idum)) != NC_NOERR) { \
+ *VAR = DEFVAL; \
+ exerrval = status; \
+ sprintf( errmsg, \
+ "Error: failed to retrieve value for dimension " DNAME " for file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ *VAR = (int)idum;
#define EX_GET_CONCAT_SET_LEN(VAR,TNAME,SETENUM,DNUMSETS,VSETSTAT,DSETSIZE,MISSINGOK) \
- *ret_int = 0; /* default return value */ \
- \
- if ((dimid = ncdimid (exoid, DNUMSETS)) != -1) \
- { \
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sets) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get number of " TNAME " sets in file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- \
- if (!(ids = malloc(num_sets*sizeof(int)))) \
- { \
- exerrval = EX_MEMFAIL; \
- sprintf(errmsg, \
- "Error: failed to allocate memory for " TNAME " set ids for file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if (ex_get_ids (exoid, SETENUM, ids) == EX_FATAL) \
- { \
- sprintf(errmsg, \
- "Error: failed to get " TNAME " set ids in file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- free(ids); \
- return (EX_FATAL); \
- } \
- \
- /* allocate space for stat array */ \
- if (!(stat_vals = malloc((int)num_sets*sizeof(nclong)))) \
- { \
- exerrval = EX_MEMFAIL; \
- free (ids); \
- sprintf(errmsg, \
- "Error: failed to allocate memory for " TNAME " set status array for file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- /* get variable id of status array */ \
- if ((varid = ncvarid (exoid, VSETSTAT)) != -1) \
- { \
- /* if status array exists, use it, otherwise assume, object exists \
- to be backward compatible */ \
- \
- start[0] = 0; \
- start[1] = 0; \
- count[0] = num_sets; \
- count[1] = 0; \
- \
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1) \
- { \
- exerrval = ncerr; \
- free (ids); \
- free(stat_vals); \
- sprintf(errmsg, \
- "Error: failed to get " TNAME " set status array from file id %d", \
- exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- } \
- else /* default: status is true */ \
- for(i=0;i<num_sets;i++) \
- stat_vals[i]=1; \
- \
- for (i=0; i<num_sets; i++) \
- { \
- \
- if (stat_vals[i] == 0) /* is this object null? */ \
- continue; \
- \
- if ((dimid = ncdimid (exoid, DSETSIZE(i+1))) == -1) \
- { \
- if ( MISSINGOK ) { \
- ldum = 0; \
- } else { \
- *ret_int = 0; \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate " TNAME " set %d in file id %d", \
- ids[i],exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- free(stat_vals); \
- free(ids); \
- return (EX_FATAL); \
- } /* MISSINGOK */ \
- } else { \
- \
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1) \
- { \
- *ret_int = 0; \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get size of " TNAME " set %d in file id %d", \
- ids[i], exoid); \
- ex_err("ex_inquire",errmsg,exerrval); \
- free(stat_vals); \
- free(ids); \
- return (EX_FATAL); \
- } \
- } \
- \
- *ret_int += ldum; \
- } \
- \
- free(stat_vals); \
- free (ids); \
- }
+ *ret_int = 0; /* default return value */ \
+ \
+ if ((status = nc_inq_dimid (exoid, DNUMSETS, &dimid)) == NC_NOERR) \
+ { \
+ if ((status = nc_inq_dimlen (exoid, dimid, &num_sets)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to get number of " TNAME " sets in file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ if (!(ids = malloc(num_sets*sizeof(int)))) { \
+ exerrval = EX_MEMFAIL; \
+ sprintf(errmsg, \
+ "Error: failed to allocate memory for " TNAME " set ids for file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ if (ex_get_ids (exoid, SETENUM, ids) == EX_FATAL) { \
+ sprintf(errmsg, \
+ "Error: failed to get " TNAME " set ids in file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ free(ids); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* allocate space for stat array */ \
+ if (!(stat_vals = malloc((int)num_sets*sizeof(int)))) { \
+ exerrval = EX_MEMFAIL; \
+ free (ids); \
+ sprintf(errmsg, \
+ "Error: failed to allocate memory for " TNAME " set status array for file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* get variable id of status array */ \
+ if ((status = nc_inq_varid (exoid, VSETSTAT, &varid)) == NC_NOERR) { \
+ /* if status array exists, use it, otherwise assume, object exists \
+ to be backward compatible */ \
+ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) { \
+ exerrval = status; \
+ free (ids); \
+ free(stat_vals); \
+ sprintf(errmsg, \
+ "Error: failed to get " TNAME " set status array from file id %d", \
+ exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } else /* default: status is true */ \
+ for(i=0;i<num_sets;i++) \
+ stat_vals[i]=1; \
+ \
+ for (i=0; i<num_sets; i++) { \
+ if (stat_vals[i] == 0) /* is this object null? */ \
+ continue; \
+ \
+ if ((status = nc_inq_dimid (exoid, DSETSIZE(i+1), &dimid)) != NC_NOERR) { \
+ if ( MISSINGOK ) { \
+ idum = 0; \
+ } else { \
+ *ret_int = 0; \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate " TNAME " set %d in file id %d", \
+ ids[i],exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ free(stat_vals); \
+ free(ids); \
+ return (EX_FATAL); \
+ } /* MISSINGOK */ \
+ } else { \
+ if ((status = nc_inq_dimlen (exoid, dimid, &idum)) != NC_NOERR) { \
+ *ret_int = 0; \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to get size of " TNAME " set %d in file id %d", \
+ ids[i], exoid); \
+ ex_err("ex_inquire",errmsg,exerrval); \
+ free(stat_vals); \
+ free(ids); \
+ return (EX_FATAL); \
+ } \
+ } \
+ \
+ *ret_int += (int)idum; \
+ } \
+ \
+ free(stat_vals); \
+ free (ids); \
+ }
static void flt_cvt(float *xptr,double x)
{
*xptr = (float)x;
}
+int ex_inquire_int (int exoid, int req_info)
+{
+ char *cdummy = NULL; /* Needed just for function call, unused. */
+ float fdummy = 0; /* Needed just for function call, unused. */
+ int ret_val = 0;
+ int error = ex_inquire(exoid, req_info, &ret_val, &fdummy, cdummy);
+ if (error < 0)
+ ret_val = error;
+
+ return ret_val;
+}
/*!
* returns information about the database
+ * \param exoid exodus file id
+ * \param req_info info request code
+ * \param[out] ret_int returned integer value
+ * \param[out] ret_float returned float value
+ * \param[out] ret_char returned character value
*/
int ex_inquire (int exoid,
@@ -224,920 +213,577 @@ int ex_inquire (int exoid,
void *ret_float,
char *ret_char)
{
- int dimid, varid, i, tmp_num, *ids;
- long ldum, num_sets, start[2], count[2];
- nclong *stat_vals;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- switch (req_info)
- {
- case EX_INQ_FILE_TYPE:
-
- /* obsolete call */
- /*returns "r" for regular EXODUS II file or "h" for history EXODUS file*/
-
- *ret_char = '\0';
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
+ int dimid, varid, tmp_num, *ids;
+ size_t i;
+ size_t ldum = 0;
+ size_t num_sets, idum;
+ int *stat_vals;
+ char errmsg[MAX_ERR_LENGTH];
+ int status;
+ char tmp_title[2048];
+
+ exerrval = 0; /* clear error code */
+
+ if (ret_char) ret_char = '\0';
+ if (ret_int) *ret_int = 0;
+
+ switch (req_info) {
+ case EX_INQ_FILE_TYPE:
+
+ /* obsolete call */
+ /*returns "r" for regular EXODUS II file or "h" for history EXODUS file*/
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
"Warning: file type inquire is obsolete");
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_WARN);
-
- case EX_INQ_API_VERS:
-
-/* returns the EXODUS II API version number */
-
- if (ncattget (exoid, NC_GLOBAL, ATT_API_VERSION, ret_float) == -1)
- { /* try old (prior to db version 2.02) attribute name */
- if (ncattget (exoid, NC_GLOBAL, ATT_API_VERSION_BLANK,ret_float) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get EXODUS API version for file id %d", exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- break;
-
- case EX_INQ_DB_VERS:
-
-/* returns the EXODUS II database version number */
-
- if (ncattget (exoid, NC_GLOBAL, ATT_VERSION, ret_float) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get EXODUS database version for file id %d", exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- break;
-
- case EX_INQ_LIB_VERS:
-
-/* returns the EXODUS II Library version number */
-
- flt_cvt((float *)ret_float, EX_API_VERS);
-
- break;
-
- case EX_INQ_TITLE:
-
-/* returns the title of the database */
-
- if (ncattget (exoid, NC_GLOBAL, ATT_TITLE, ret_char) == -1)
- {
- *ret_char = '\0';
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get database title for file id %d", exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- break;
-
- case EX_INQ_DIM:
-
-/* returns the dimensionality (2 or 3, for 2-d or 3-d) of the database */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate database dimensionality in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get database dimensionality for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
-
- break;
-
- case EX_INQ_NODES:
-
-/* returns the number of nodes */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NODES)) == -1)
- {
- *ret_int = 0;
- } else {
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
- break;
-
- case EX_INQ_ELEM:
-
-/* returns the number of elements */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
- *ret_int = 0;
- } else {
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
- break;
-
- case EX_INQ_ELEM_BLK:
-
-/* returns the number of element blocks */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_EL_BLK)) == -1)
- {
- *ret_int = 0;
- } else {
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element blocks for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
-
- break;
-
- case EX_INQ_NODE_SETS:
-
-/* returns the number of node sets */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NS)) < 0)
- *ret_int = 0; /* no node sets defined */
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of node sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
-
- break;
-
- case EX_INQ_NS_NODE_LEN:
-
-/* returns the length of the concatenated node sets node list */
-
- *ret_int = 0; /* default value if no node sets are defined */
- if ((dimid = ncdimid (exoid, DIM_NUM_NS)) != -1 )
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of node sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if (!(ids = malloc(num_sets*sizeof(int))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for node set ids for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_node_set_ids (exoid, ids) == EX_FATAL)
- {
- sprintf(errmsg,
- "Error: failed to get node sets in file id %d",
- exoid);
- /* pass back error code from ex_get_node_set_ids (in exerrval) */
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
- /* allocate space for stat array */
- if (!(stat_vals = malloc((int)num_sets*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- free (ids);
- sprintf(errmsg,
- "Error: failed to allocate memory for node set status array for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* get variable id of status array */
- if ((varid = ncvarid (exoid, VAR_NS_STAT)) != -1)
- {
- /* if status array exists, use it, otherwise assume, object exists
- to be backward compatible */
-
- start[0] = 0;
- start[1] = 0;
- count[0] = num_sets;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1)
- {
- exerrval = ncerr;
- free (ids);
- free(stat_vals);
- sprintf(errmsg,
- "Error: failed to get node set status array from file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else /* default: status is true */
- for(i=0;i<num_sets;i++)
- stat_vals[i]=1;
-
- for (i=0; i<num_sets; i++)
- {
-
- if (stat_vals[i] == 0) /* is this object null? */
- continue;
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NOD_NS(i+1))) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes in node set %d in file id %d",
- ids[i],exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- free (stat_vals);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes in node set %d in file id %d",
- ids[i],exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (stat_vals);
- free (ids);
- return (EX_FATAL);
- }
-
- *ret_int += ldum;
- }
-
- free (stat_vals);
- free (ids);
- }
-
- break;
-
- case EX_INQ_NS_DF_LEN:
-
-/* returns the length of the concatenated node sets dist factor list */
-
-/*
- Determine the concatenated node sets distribution factor length:
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_WARN);
+
+ case EX_INQ_API_VERS:
+ /* returns the EXODUS II API version number */
+ if (nc_get_att_float(exoid, NC_GLOBAL, ATT_API_VERSION, ret_float) != NC_NOERR)
+ { /* try old (prior to db version 2.02) attribute name */
+ if ((status = nc_get_att_float (exoid, NC_GLOBAL, ATT_API_VERSION_BLANK,ret_float)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get EXODUS API version for file id %d", exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ break;
+
+ case EX_INQ_DB_VERS:
+ /* returns the EXODUS II database version number */
+ if ((status = nc_get_att_float (exoid, NC_GLOBAL, ATT_VERSION, ret_float)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get EXODUS database version for file id %d", exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ break;
+
+ case EX_INQ_LIB_VERS:
+ /* returns the EXODUS II Library version number */
+ if (ret_float)
+ flt_cvt((float *)ret_float, EX_API_VERS);
+
+ if (ret_int)
+ *ret_int = EX_API_VERS_NODOT;
+ break;
+
+ case EX_INQ_TITLE:
+ /* returns the title of the database */
+ if ((status = nc_get_att_text (exoid, NC_GLOBAL, ATT_TITLE, tmp_title)) != NC_NOERR) {
+ *ret_char = '\0';
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get database title for file id %d", exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ } else {
+ strncpy(ret_char, tmp_title, MAX_LINE_LENGTH+1);
+ ret_char[MAX_LINE_LENGTH] = '\0';
+ }
+ break;
+
+ case EX_INQ_DIM:
+ /* returns the dimensionality (2 or 3, for 2-d or 3-d) of the database */
+ if (ex_get_dimension(exoid, DIM_NUM_DIM, "database dimensionality", &ldum, &dimid, "ex_inquire") != NC_NOERR)
+ return EX_FATAL;
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_NODES:
+ /* returns the number of nodes */
+ if (ex_get_dimension(exoid, DIM_NUM_NODES, "nodes", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_ELEM:
+ /* returns the number of elements */
+ if (ex_get_dimension(exoid, DIM_NUM_ELEM, "elements", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_ELEM_BLK:
+ /* returns the number of element blocks */
+ if (ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_NODE_SETS:
+ /* returns the number of node sets */
+ if (ex_get_dimension(exoid, DIM_NUM_NS, "node sets", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_NS_NODE_LEN:
+ /* returns the length of the concatenated node sets node list */
+ EX_GET_CONCAT_SET_LEN(ret_int,"node",EX_NODE_SET,DIM_NUM_NS,VAR_NS_STAT,DIM_NUM_NOD_NS,0);
+ break;
+
+ case EX_INQ_NS_DF_LEN:
+ /* returns the length of the concatenated node sets dist factor list */
+
+ /*
+ Determine the concatenated node sets distribution factor length:
1. Get the node set ids list.
2. Check see if the dist factor variable for a node set id exists.
3. If it exists, goto step 4, else the length is zero.
4. Get the dimension of the number of nodes in the node set -0
- use this value as the length as by definition they are the same.
+ use this value as the length as by definition they are the same.
5. Sum the individual lengths for the total list length.
-*/
-
- *ret_int = 0; /* default value if no node sets defined */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NS)) != -1)
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of node sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if (!(ids = malloc(num_sets*sizeof(int))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for node set ids for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_node_set_ids (exoid, ids) == EX_FATAL)
- {
- sprintf(errmsg,
- "Error: failed to get node sets in file id %d",
- exoid);
- /* pass back error code from ex_get_node_set_ids (in exerrval) */
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
-
- for (i=0; i<num_sets; i++)
- {
- if (ncvarid (exoid, VAR_FACT_NS(i+1)) == -1)
- {
- if (ncerr == NC_ENOTVAR)
- {
- ldum = 0; /* this dist factor doesn't exist */
- }
- else
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dist fact for node set %d in file id %d",
- ids[i], exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
- }
- else
- {
- if ((dimid = ncdimid (exoid, DIM_NUM_NOD_NS(i+1))) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes in node set %d in file id %d",
- ids[i], exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes in node set %d in file id %d",
- ids[i],exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free(ids);
- return (EX_FATAL);
- }
- }
- *ret_int += ldum;
- }
- free(ids);
- }
-
- break;
-
- case EX_INQ_SIDE_SETS:
-
-/* returns the number of side sets */
-
- *ret_int = 0; /* default return value */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_SS)) != -1)
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of side sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
-
- break;
-
- case EX_INQ_SS_NODE_LEN:
-
-/* returns the length of the concatenated side sets node list */
-
- *ret_int = 0; /* default return value */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_SS)) != -1)
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of side sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if (!(ids = malloc(num_sets*sizeof(int))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for side set ids for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_side_set_ids (exoid, ids) == EX_FATAL)
- {
- sprintf(errmsg,
- "Error: failed to get side set ids in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free(ids);
- return (EX_FATAL);
- }
-
- /* allocate space for stat array */
- if (!(stat_vals = malloc((int)num_sets*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- free (ids);
- sprintf(errmsg,
- "Error: failed to allocate memory for side set status array for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- /* get variable id of status array */
- if ((varid = ncvarid (exoid, VAR_SS_STAT)) != -1)
- {
- /* if status array exists, use it, otherwise assume, object exists
- to be backward compatible */
-
- start[0] = 0;
- start[1] = 0;
- count[0] = num_sets;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1)
- {
- exerrval = ncerr;
- free (ids);
- free(stat_vals);
- sprintf(errmsg,
- "Error: failed to get element block status array from file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else /* default: status is true */
- for(i=0;i<num_sets;i++)
- stat_vals[i]=1;
-
- /* walk id list, get each side set node length and sum for total */
-
- for (i=0; i<num_sets; i++)
- {
- if (stat_vals[i] == 0) /* is this object null? */
- continue;
-
- if (ex_get_side_set_node_list_len(exoid, ids[i], &tmp_num) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to side set %d node length in file id %d",
- ids[i],exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free(stat_vals);
- free(ids);
- return (EX_FATAL);
- }
- *ret_int += tmp_num;
- }
-
- free(stat_vals);
- free (ids);
- }
-
- break;
-
- case EX_INQ_SS_ELEM_LEN:
-/* returns the length of the concatenated side sets element list */
- EX_GET_CONCAT_SET_LEN(ret_int,"side",EX_SIDE_SET,DIM_NUM_SS,VAR_SS_STAT,DIM_NUM_SIDE_SS,0);
- break;
-
- case EX_INQ_SS_DF_LEN:
-
-/* returns the length of the concatenated side sets dist factor list */
-
-/*
- Determine the concatenated side sets distribution factor length:
+ */
+
+ *ret_int = 0; /* default value if no node sets defined */
+
+ if (nc_inq_dimid (exoid, DIM_NUM_NS, &dimid) == NC_NOERR) {
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_sets)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of node sets in file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ if (!(ids = malloc(num_sets*sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for node set ids for file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_node_set_ids (exoid, ids) == EX_FATAL)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node sets in file id %d",
+ exoid);
+ /* pass back error code from ex_get_node_set_ids (in exerrval) */
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+
+ for (i=0; i<num_sets; i++) {
+ if ((status = nc_inq_varid (exoid, VAR_FACT_NS(i+1), &varid)) != NC_NOERR) {
+ if (status == NC_ENOTVAR) {
+ idum = 0; /* this dist factor doesn't exist */
+ } else {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dist fact for node set %d in file id %d",
+ ids[i], exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+ } else {
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_NS(i+1), &dimid)) != NC_NOERR) {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of nodes in node set %d in file id %d",
+ ids[i], exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+ if ((status = nc_inq_dimlen (exoid, dimid, &idum)) != NC_NOERR) {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes in node set %d in file id %d",
+ ids[i],exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free(ids);
+ return (EX_FATAL);
+ }
+ }
+ *ret_int += idum;
+ }
+ free(ids);
+ }
+
+ break;
+
+ case EX_INQ_SIDE_SETS:
+ /* returns the number of side sets */
+ if (ex_get_dimension(exoid, DIM_NUM_SS, "side sets", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_SS_NODE_LEN:
+
+ /* returns the length of the concatenated side sets node list */
+
+ *ret_int = 0; /* default return value */
+
+ if (nc_inq_dimid (exoid, DIM_NUM_SS, &dimid) == NC_NOERR) {
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_sets)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of side sets in file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ if (!(ids = malloc(num_sets*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for side set ids for file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_side_set_ids (exoid, ids) == EX_FATAL) {
+ sprintf(errmsg,
+ "Error: failed to get side set ids in file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free(ids);
+ return (EX_FATAL);
+ }
+
+ /* allocate space for stat array */
+ if (!(stat_vals = malloc((int)num_sets*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
+ free (ids);
+ sprintf(errmsg,
+ "Error: failed to allocate memory for side set status array for file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ /* get variable id of status array */
+ if ((status = nc_inq_varid (exoid, VAR_SS_STAT, &varid)) == NC_NOERR) {
+ /* if status array exists, use it, otherwise assume, object exists
+ to be backward compatible */
+
+ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) {
+ exerrval = status;
+ free (ids);
+ free(stat_vals);
+ sprintf(errmsg,
+ "Error: failed to get element block status array from file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ else /* default: status is true */
+ for(i=0;i<num_sets;i++)
+ stat_vals[i]=1;
+
+ /* walk id list, get each side set node length and sum for total */
+
+ for (i=0; i<num_sets; i++) {
+ if (stat_vals[i] == 0) /* is this object null? */
+ continue;
+
+ if ((status = ex_get_side_set_node_list_len(exoid, ids[i], &tmp_num)) != NC_NOERR) {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to side set %d node length in file id %d",
+ ids[i],exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free(stat_vals);
+ free(ids);
+ return (EX_FATAL);
+ }
+ *ret_int += tmp_num;
+ }
+
+ free(stat_vals);
+ free (ids);
+ }
+
+ break;
+
+ case EX_INQ_SS_ELEM_LEN:
+ /* returns the length of the concatenated side sets element list */
+ EX_GET_CONCAT_SET_LEN(ret_int,"side",EX_SIDE_SET,DIM_NUM_SS,VAR_SS_STAT,DIM_NUM_SIDE_SS,0);
+ break;
+
+ case EX_INQ_SS_DF_LEN:
+
+ /* returns the length of the concatenated side sets dist factor list */
+
+ /*
+ Determine the concatenated side sets distribution factor length:
1. Get the side set ids list.
2. Check see if the dist factor dimension for a side set id exists.
3. If it exists, goto step 4, else set the individual length to zero.
4. Sum the dimension value into the running total length.
-*/
-
- *ret_int = 0;
-
- /* first check see if any side sets exist */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_SS)) != -1)
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of side sets in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- if (!(ids = malloc(num_sets*sizeof(int))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for side set ids for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ex_get_side_set_ids (exoid, ids) == EX_FATAL)
- {
- sprintf(errmsg,
- "Error: failed to get side sets in file id %d",
- exoid);
- /* pass back error code from ex_get_side_set_ids (in exerrval) */
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
-
- for (i=0; i<num_sets; i++)
- {
- if ((dimid = ncdimid (exoid, DIM_NUM_DF_SS(i+1))) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- ldum = 0; /* this dist factor doesn't exist */
- }
- else
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dist fact for side set %d in file id %d",
- ids[i], exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
- }
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dist factors in side set %d in file id %d",
- ids[i], exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- free (ids);
- return (EX_FATAL);
- }
- }
- *ret_int += ldum;
- }
- free (ids);
- }
-
- break;
-
- case EX_INQ_QA:
-
-/* returns the number of QA records */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_QA)) < 0)
- *ret_int = 0; /* no QA records stored */
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of QA records in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
-
- break;
-
- case EX_INQ_INFO:
-
-/* returns the number of information records */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_INFO)) < 0)
- *ret_int = 0; /* no information records stored */
- else
- {
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of info records in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
- }
- break;
-
- case EX_INQ_TIME:
-
-/* returns the number of time steps stored in the database; we find
- * this out by inquiring the maximum record number of the "unlimited"
- * dimension
- */
-
- if ((dimid = ncdimid (exoid, DIM_TIME)) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate time dimension in file id %d", exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get time dimension in file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
-
- break;
- case EX_INQ_EB_PROP:
-
-/* returns the number of element block properties */
-
- *ret_int = ex_get_num_props (exoid, EX_ELEM_BLOCK);
- break;
-
- case EX_INQ_NS_PROP:
-
-/* returns the number of node set properties */
-
- *ret_int = ex_get_num_props (exoid, EX_NODE_SET);
- break;
-
- case EX_INQ_SS_PROP:
-
-/* returns the number of side set properties */
-
- *ret_int = ex_get_num_props (exoid, EX_SIDE_SET);
- break;
-
- case EX_INQ_ELEM_MAP:
-
-/* returns the number of element maps */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_EM)) == -1)
- {
- /* no element maps so return 0 */
-
- *ret_int = 0;
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element maps for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
-
- break;
-
- case EX_INQ_EM_PROP:
-
-/* returns the number of element map properties */
-
- *ret_int = ex_get_num_props (exoid, EX_ELEM_MAP);
- break;
-
- case EX_INQ_NODE_MAP:
-
-/* returns the number of node maps */
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NM)) == -1)
- {
- /* no node maps so return 0 */
-
- *ret_int = 0;
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &ldum) == -1)
- {
- *ret_int = 0;
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of node maps for file id %d",
- exoid);
- ex_err("ex_inquire",errmsg,exerrval);
- return (EX_FATAL);
- }
- *ret_int = ldum;
-
- break;
-
- case EX_INQ_NM_PROP:
-/* returns the number of element map properties */
- *ret_int = ex_get_num_props (exoid, EX_NODE_MAP);
- break;
-
- case EX_INQ_EDGE:
-/* returns the number of edges (defined across all edge blocks). */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_EDGE, 1);
- break;
-
- case EX_INQ_EDGE_BLK:
-/* returns the number of edge blocks. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ED_BLK, 1);
- break;
-
- case EX_INQ_EDGE_SETS:
-/* returns the number of edge sets. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ES, 1);
- break;
-
- case EX_INQ_ES_LEN:
-/* returns the length of the concatenated edge set edge list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"edge",EX_EDGE_SET,DIM_NUM_ES,VAR_ES_STAT,DIM_NUM_EDGE_ES,0);
- break;
-
- case EX_INQ_ES_DF_LEN:
-/* returns the length of the concatenated edge set distribution factor list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"edge",EX_EDGE_SET,DIM_NUM_ES,VAR_ES_STAT,DIM_NUM_DF_ES,1);
- break;
-
- case EX_INQ_EDGE_PROP:
-/* returns the number of integer properties stored for each edge block. This includes the "ID" property. */
- *ret_int = ex_get_num_props( exoid, EX_EDGE_BLOCK );
- break;
-
- case EX_INQ_ES_PROP:
-/* returns the number of integer properties stored for each edge set.. This includes the "ID" property */
- *ret_int = ex_get_num_props( exoid, EX_EDGE_SET );
- break;
-
- case EX_INQ_FACE:
-/* returns the number of faces (defined across all face blocks). */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FACE, 1);
- break;
-
- case EX_INQ_FACE_BLK:
-/* returns the number of edge blocks. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FA_BLK, 1);
- break;
-
- case EX_INQ_FACE_SETS:
-/* returns the number of edge sets. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FS, 1);
- break;
-
- case EX_INQ_FS_LEN:
-/* returns the length of the concatenated edge set edge list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"face",EX_FACE_SET,DIM_NUM_FS,VAR_FS_STAT,DIM_NUM_FACE_FS,0);
- break;
-
- case EX_INQ_FS_DF_LEN:
-/* returns the length of the concatenated edge set distribution factor list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"face",EX_FACE_SET,DIM_NUM_FS,VAR_FS_STAT,DIM_NUM_DF_FS,1);
- break;
-
- case EX_INQ_FACE_PROP:
-/* returns the number of integer properties stored for each edge block. This includes the "ID" property. */
- *ret_int = ex_get_num_props( exoid, EX_FACE_BLOCK );
- break;
-
- case EX_INQ_FS_PROP:
-/* returns the number of integer properties stored for each edge set.. This includes the "ID" property */
- *ret_int = ex_get_num_props( exoid, EX_FACE_SET );
- break;
-
- case EX_INQ_ELEM_SETS:
-/* returns the number of element sets. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ELS, 1);
- break;
-
- case EX_INQ_ELS_LEN:
-/* returns the length of the concatenated element set element list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"element",EX_ELEM_SET,DIM_NUM_ELS,VAR_ELS_STAT,DIM_NUM_ELE_ELS,0);
- break;
-
- case EX_INQ_ELS_DF_LEN:
-/* returns the length of the concatenated element set distribution factor list. */
- EX_GET_CONCAT_SET_LEN(ret_int,"element",EX_ELEM_SET,DIM_NUM_ELS,VAR_ELS_STAT,DIM_NUM_DF_ELS,1);
- break;
+ */
+
+ *ret_int = 0;
+
+ /* first check see if any side sets exist */
+
+ if (nc_inq_dimid (exoid, DIM_NUM_SS, &dimid) == NC_NOERR) {
+ if ((status = nc_inq_dimlen (exoid, dimid, &num_sets)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of side sets in file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ if (!(ids = malloc(num_sets*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for side set ids for file id %d",
+ exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_side_set_ids (exoid, ids) == EX_FATAL) {
+ sprintf(errmsg,
+ "Error: failed to get side sets in file id %d",
+ exoid);
+ /* pass back error code from ex_get_side_set_ids (in exerrval) */
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+
+ for (i=0; i<num_sets; i++) {
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_DF_SS(i+1), &dimid)) != NC_NOERR) {
+ if (status == NC_EBADDIM) {
+ ldum = 0; /* this dist factor doesn't exist */
+ } else {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dist fact for side set %d in file id %d",
+ ids[i], exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+ } else {
+ if ((status = nc_inq_dimlen (exoid, dimid, &ldum)) != NC_NOERR) {
+ *ret_int = 0;
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of dist factors in side set %d in file id %d",
+ ids[i], exoid);
+ ex_err("ex_inquire",errmsg,exerrval);
+ free (ids);
+ return (EX_FATAL);
+ }
+ }
+ *ret_int += ldum;
+ }
+ free (ids);
+ }
+
+ break;
+
+ case EX_INQ_QA:
+ /* returns the number of QA records */
+ if (ex_get_dimension(exoid, DIM_NUM_QA, "QA records", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_INFO:
+ /* returns the number of information records */
+ if (ex_get_dimension(exoid, DIM_NUM_INFO, "info records", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_TIME:
+ /* returns the number of time steps stored in the database */
+ if (ex_get_dimension(exoid, DIM_TIME, "time dimension", &ldum, &dimid, "ex_inquire") != NC_NOERR)
+ return EX_FATAL;
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_EB_PROP:
+ /* returns the number of element block properties */
+ *ret_int = ex_get_num_props (exoid, EX_ELEM_BLOCK);
+ break;
+
+ case EX_INQ_NS_PROP:
+ /* returns the number of node set properties */
+ *ret_int = ex_get_num_props (exoid, EX_NODE_SET);
+ break;
+
+ case EX_INQ_SS_PROP:
+ /* returns the number of side set properties */
+ *ret_int = ex_get_num_props (exoid, EX_SIDE_SET);
+ break;
+
+ case EX_INQ_ELEM_MAP:
+ /* returns the number of element maps */
+ if (ex_get_dimension(exoid, DIM_NUM_EM, "element maps", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_EM_PROP:
+ /* returns the number of element map properties */
+ *ret_int = ex_get_num_props (exoid, EX_ELEM_MAP);
+ break;
+
+ case EX_INQ_NODE_MAP:
+ /* returns the number of node maps */
+ if (ex_get_dimension(exoid, DIM_NUM_NM, "node maps", &ldum, &dimid, NULL) != NC_NOERR)
+ *ret_int = 0;
+ else
+ *ret_int = ldum;
+ break;
+
+ case EX_INQ_NM_PROP:
+ /* returns the number of node map properties */
+ *ret_int = ex_get_num_props (exoid, EX_NODE_MAP);
+ break;
+
+ case EX_INQ_EDGE:
+ /* returns the number of edges (defined across all edge blocks). */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_EDGE, 1);
+ break;
+
+ case EX_INQ_EDGE_BLK:
+ /* returns the number of edge blocks. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ED_BLK, 1);
+ break;
+
+ case EX_INQ_EDGE_SETS:
+ /* returns the number of edge sets. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ES, 1);
+ break;
+
+ case EX_INQ_ES_LEN:
+ /* returns the length of the concatenated edge set edge list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"edge",EX_EDGE_SET,DIM_NUM_ES,VAR_ES_STAT,DIM_NUM_EDGE_ES,0);
+ break;
+
+ case EX_INQ_ES_DF_LEN:
+ /* returns the length of the concatenated edge set distribution factor list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"edge",EX_EDGE_SET,DIM_NUM_ES,VAR_ES_STAT,DIM_NUM_DF_ES,1);
+ break;
+
+ case EX_INQ_EDGE_PROP:
+ /* returns the number of integer properties stored for each edge block. This includes the "ID" property. */
+ *ret_int = ex_get_num_props( exoid, EX_EDGE_BLOCK );
+ break;
+
+ case EX_INQ_ES_PROP:
+ /* returns the number of integer properties stored for each edge set.. This includes the "ID" property */
+ *ret_int = ex_get_num_props( exoid, EX_EDGE_SET );
+ break;
+
+ case EX_INQ_FACE:
+ /* returns the number of faces (defined across all face blocks). */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FACE, 1);
+ break;
+
+ case EX_INQ_FACE_BLK:
+ /* returns the number of face blocks. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FA_BLK, 1);
+ break;
+
+ case EX_INQ_FACE_SETS:
+ /* returns the number of face sets. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FS, 1);
+ break;
+
+ case EX_INQ_FS_LEN:
+ /* returns the length of the concatenated edge set edge list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"face",EX_FACE_SET,DIM_NUM_FS,VAR_FS_STAT,DIM_NUM_FACE_FS,0);
+ break;
+
+ case EX_INQ_FS_DF_LEN:
+ /* returns the length of the concatenated edge set distribution factor list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"face",EX_FACE_SET,DIM_NUM_FS,VAR_FS_STAT,DIM_NUM_DF_FS,1);
+ break;
+
+ case EX_INQ_FACE_PROP:
+ /* returns the number of integer properties stored for each edge block. This includes the "ID" property. */
+ *ret_int = ex_get_num_props( exoid, EX_FACE_BLOCK );
+ break;
+
+ case EX_INQ_FS_PROP:
+ /* returns the number of integer properties stored for each edge set.. This includes the "ID" property */
+ *ret_int = ex_get_num_props( exoid, EX_FACE_SET );
+ break;
+
+ case EX_INQ_ELEM_SETS:
+ /* returns the number of element sets. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_ELS, 1);
+ break;
+
+ case EX_INQ_ELS_LEN:
+ /* returns the length of the concatenated element set element list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"element",EX_ELEM_SET,DIM_NUM_ELS,VAR_ELS_STAT,DIM_NUM_ELE_ELS,0);
+ break;
+
+ case EX_INQ_ELS_DF_LEN:
+ /* returns the length of the concatenated element set distribution factor list. */
+ EX_GET_CONCAT_SET_LEN(ret_int,"element",EX_ELEM_SET,DIM_NUM_ELS,VAR_ELS_STAT,DIM_NUM_DF_ELS,1);
+ break;
case EX_INQ_ELS_PROP:
-/* returns the number of integer properties stored for each element set. */
- *ret_int = ex_get_num_props( exoid, EX_ELEM_SET );
- break;
+ /* returns the number of integer properties stored for each element set. */
+ *ret_int = ex_get_num_props( exoid, EX_ELEM_SET );
+ break;
case EX_INQ_EDGE_MAP:
-/* returns the number of edge sets. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_EDM, 1);
- break;
+ /* returns the number of edge maps. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_EDM, 1);
+ break;
case EX_INQ_FACE_MAP:
-/* returns the number of edge sets. */
- EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FAM, 1);
- break;
-
-
- default:
- *ret_int = 0;
- exerrval = EX_FATAL;
- sprintf(errmsg, "Error: invalid inquiry %d", req_info);
- ex_err("ex_inquire",errmsg,exerrval);
- return(EX_FATAL);
- }
- return (EX_NOERR);
+ /* returns the number of face maps. */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_FAM, 1);
+ break;
+
+ case EX_INQ_COORD_FRAMES:
+ /* return the number of coordinate frames */
+ EX_GET_DIMENSION_VALUE(ret_int, 0, DIM_NUM_CFRAMES, 1);
+ break;
+
+ default:
+ *ret_int = 0;
+ exerrval = EX_FATAL;
+ sprintf(errmsg, "Error: invalid inquiry %d", req_info);
+ ex_err("ex_inquire",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/exopen.c b/cbind/src/exopen.c
index 69d9739..69f0f46 100644
--- a/cbind/src/exopen.c
+++ b/cbind/src/exopen.c
@@ -36,14 +36,6 @@
*
* exopen - ex_open
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* char* path exodus filename path
@@ -57,7 +49,6 @@
*
* revision history -
*
-* $Id: exopen.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -68,17 +59,27 @@
/*!
* opens an existing EXODUS II file (or EXODUS II history file) and returns
* an id that can subsequently be used to refer to the file. Multiple files
- * may be open simultaneously
+ * may be open simultaneously.
+ * \param path exodus filename path
+ * \param mode access mode w/r
+ * \param[out] comp_ws computer word size
+ * \param[out] io_ws storage word size
+ * \param[out] version EXODUSII interface version number
+ * \param run_version EXODUSII version number of linked library
+ * \return exoid exodus file id
*/
-int ex_open (const char *path,
- int mode,
- int *comp_ws,
- int *io_ws,
- float *version)
+int ex_open_int (const char *path,
+ int mode,
+ int *comp_ws,
+ int *io_ws,
+ float *version,
+ int run_version)
{
int exoid;
- nclong file_wordsize;
+ int status;
+ int old_fill;
+ int file_wordsize;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -86,20 +87,27 @@ int ex_open (const char *path,
/* set error handling mode to no messages, non-fatal errors */
ex_opts(exoptval); /* call required to set ncopts first time through */
-
- if (mode == EX_READ) /* READ ONLY */
- {
+ if (run_version != EX_API_VERS_NODOT) {
+ int run_version_major = run_version / 100;
+ int run_version_minor = run_version % 100;
+ int lib_version_major = EX_API_VERS_NODOT / 100;
+ int lib_version_minor = EX_API_VERS_NODOT % 100;
+ fprintf(stderr, "EXODUSII: Warning: This code was compiled with exodusII version %d.%02d,\n but was linked with exodusII library version %d.%02d\n This is probably an error in the build process of this code.\n",
+ run_version_major, run_version_minor, lib_version_major, lib_version_minor);
+ }
+
+ if (mode == EX_READ) { /* READ ONLY */
#if defined(__LIBCATAMOUNT__)
- if ((exoid = ncopen (path, NC_NOWRITE)) < 0)
+ if ((status = nc_open (path, NC_NOWRITE, &exoid)) != NC_NOERR)
#else
- if ((exoid = ncopen (path, NC_NOWRITE|NC_SHARE)) < 0)
+ if ((status = nc_open (path, NC_NOWRITE|NC_SHARE, &exoid)) != NC_NOERR)
#endif
{
/* NOTE: netCDF returns an id of -1 on an error - but no error code! */
- if (ncerr == 0)
+ if (status == 0)
exerrval = EX_FATAL;
else
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,"Error: failed to open %s read only",path);
ex_err("ex_open",errmsg,exerrval);
return(EX_FATAL);
@@ -109,16 +117,16 @@ int ex_open (const char *path,
else if (mode == EX_WRITE) /* READ/WRITE */
{
#if defined(__LIBCATAMOUNT__)
- if ((exoid = ncopen (path, NC_WRITE)) < 0)
+ if ((status = nc_open (path, NC_WRITE, &exoid)) != NC_NOERR)
#else
- if ((exoid = ncopen (path, NC_WRITE|NC_SHARE)) < 0)
+ if ((status = nc_open (path, NC_WRITE|NC_SHARE, &exoid)) != NC_NOERR)
#endif
{
/* NOTE: netCDF returns an id of -1 on an error - but no error code! */
- if (ncerr == 0)
+ if (status == 0)
exerrval = EX_FATAL;
else
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,"Error: failed to open %s write only",path);
ex_err("ex_open",errmsg,exerrval);
return(EX_FATAL);
@@ -126,9 +134,9 @@ int ex_open (const char *path,
/* turn off automatic filling of netCDF variables */
- if (ncsetfill (exoid, NC_NOFILL) == -1)
+ if ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to set nofill mode in file id %d",
exoid);
@@ -148,9 +156,8 @@ int ex_open (const char *path,
* floating point values stored in the file
*/
- if (ncattget (exoid, NC_GLOBAL, ATT_VERSION, version) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_get_att_float(exoid, NC_GLOBAL, ATT_VERSION, version)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to get database version for file id: %d",
exoid);
ex_err("ex_open",errmsg,exerrval);
@@ -167,9 +174,9 @@ int ex_open (const char *path,
return(EX_FATAL);
}
- if (ncattget (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) == -1)
+ if (nc_get_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) != NC_NOERR)
{ /* try old (prior to db version 2.02) attribute name */
- if (ncattget (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) == -1)
+ if (nc_get_att_int (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) != NC_NOERR)
{
exerrval = EX_FATAL;
sprintf(errmsg,"Error: failed to get file wordsize from file id: %d",
diff --git a/cbind/src/exopts.c b/cbind/src/exopts.c
index d24d3b5..3d1fe2d 100644
--- a/cbind/src/exopts.c
+++ b/cbind/src/exopts.c
@@ -36,12 +36,6 @@
*
* exopts - ex_opts
*
-* author - Sandia National Laboratories
-* Vic Yarberry - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int options error reporting options mask
@@ -52,7 +46,6 @@
*
* revision history -
*
-* $Id: exopts.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
@@ -65,27 +58,16 @@ int exoptval = EX_VERBOSE; /* loud mode: set EX_VERBOSE */
#if defined (DEBUG)
int exoptval = EX_VERBOSE | EX_DEBUG;/* debug mode: set EX_VERBOSE & EX_DEBUG */
#else
-int exoptval = 0; /* set default global options value to NOT print error msgs*/
+int exoptval = EX_DEFAULT; /* set default global options value to NOT print error msgs*/
#endif
#endif
/*!
* error reporting options mask
+ * \param options error reporting options mask \sa ex_options
*/
void ex_opts (int options)
{
- static int first_time = TRUE;
exerrval = 0; /* clear error code */
exoptval = options;
-
- if (first_time) /* set ncopts to quiet & no abort first time through */
- {
- ncopts = 0;
- first_time = FALSE;
- }
-
- if (exoptval & EX_DEBUG)
- ncopts = ncopts | NC_VERBOSE; /* debug mode: turn on netCDF verbose */
- else
- ncopts = ncopts & !NC_VERBOSE;
}
diff --git a/cbind/src/expatn.c b/cbind/src/expatn.c
index 35bccfa..4af82be 100644
--- a/cbind/src/expatn.c
+++ b/cbind/src/expatn.c
@@ -48,7 +48,6 @@
*
* revision history -
*
-* $Id: expatn.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -58,57 +57,38 @@
/*!
* writes the attribute names for a block
+ * \param exoid exodus file id
+ * \param blk_type block type (edge, face, elem)
+ * \param blk_id block id
+ * \param names ptr to array of attribute names
*/
int ex_put_attr_names(int exoid,
- int blk_type,
- int blk_id,
- char* names[])
+ ex_entity_type blk_type,
+ int blk_id,
+ char* names[])
{
- int varid, numattrdim, blk_id_ndx;
- long num_attr, start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- int i;
- const char* tname;
+ int status;
+ int varid, numattrdim, blk_id_ndx;
+ size_t num_attr, start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ size_t i;
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- tname = "edge";
- blk_id_ndx = ex_id_lkup(exoid,VAR_ID_ED_BLK,blk_id);
- break;
- case EX_FACE_BLOCK:
- tname = "face";
- blk_id_ndx = ex_id_lkup(exoid,VAR_ID_FA_BLK,blk_id);
- break;
- case EX_ELEM_BLOCK:
- tname = "element";
- blk_id_ndx = ex_id_lkup(exoid,VAR_ID_EL_BLK,blk_id);
- break;
- default:
- sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
- blk_type,exoid);
- ex_err("ex_put_attr_names",errmsg,EX_FATAL);
- return (EX_FATAL);
- break;
- }
+ blk_id_ndx = ex_id_lkup(exoid, blk_type, blk_id);
- /* Determine index of blk_id in VAR_ID_EL_BLK array */
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
+ /* Determine index of blk_id in blk_id_ndx array */
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
sprintf(errmsg,
- "Warning: no attributes allowed for NULL %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Warning: no attributes allowed for NULL %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr_names",errmsg,EX_MSG);
return (EX_WARN); /* no attributes for this block */
- }
- else
- {
+ } else {
sprintf(errmsg,
- "Error: no %s block id %d in %s array in file id %d",
- tname, blk_id, VAR_ID_EL_BLK, exoid);
+ "Error: no %s id %d in %s array in file id %d",
+ ex_name_of_object(blk_type), blk_id, VAR_ID_EL_BLK, exoid);
ex_err("ex_put_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
@@ -116,55 +96,105 @@ int ex_put_attr_names(int exoid,
/* inquire id's of previously defined dimensions */
switch (blk_type) {
+ case EX_SIDE_SET:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_SS(blk_id_ndx), &numattrdim);
+ break;
+ case EX_NODE_SET:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NS(blk_id_ndx), &numattrdim);
+ break;
+ case EX_EDGE_SET:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ES(blk_id_ndx), &numattrdim);
+ break;
+ case EX_FACE_SET:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FS(blk_id_ndx), &numattrdim);
+ break;
+ case EX_ELEM_SET:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ELS(blk_id_ndx), &numattrdim);
+ break;
+ case EX_NODAL:
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NBLK, &numattrdim);
+ break;
case EX_EDGE_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx));
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx), &numattrdim);
break;
case EX_FACE_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx));
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx), &numattrdim);
break;
case EX_ELEM_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx));
+ status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx), &numattrdim);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_put_attr_names",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
}
- if (numattrdim == -1)
- {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: number of attributes not defined for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: number of attributes not defined for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr_names",errmsg,EX_MSG);
return (EX_FATAL); /* number of attributes not defined */
}
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of attributes for block %d in file id %d",
- blk_id,exoid);
+ "Error: failed to get number of attributes for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
switch (blk_type) {
+ case EX_SIDE_SET:
+ status = nc_inq_varid (exoid, VAR_NAME_SSATTRIB(blk_id_ndx), &varid);
+ break;
+ case EX_NODE_SET:
+ status = nc_inq_varid (exoid, VAR_NAME_NSATTRIB(blk_id_ndx), &varid);
+ break;
+ case EX_EDGE_SET:
+ status = nc_inq_varid (exoid, VAR_NAME_ESATTRIB(blk_id_ndx), &varid);
+ break;
+ case EX_FACE_SET:
+ status = nc_inq_varid (exoid, VAR_NAME_FSATTRIB(blk_id_ndx), &varid);
+ break;
+ case EX_ELEM_SET:
+ status = nc_inq_varid (exoid, VAR_NAME_ELSATTRIB(blk_id_ndx), &varid);
+ break;
+ case EX_NODAL:
+ status = nc_inq_varid (exoid, VAR_NAME_NATTRIB, &varid);
+ break;
case EX_EDGE_BLOCK:
- varid = ncvarid (exoid, VAR_NAME_EATTRIB(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_NAME_EATTRIB(blk_id_ndx), &varid);
break;
case EX_FACE_BLOCK:
- varid = ncvarid (exoid, VAR_NAME_FATTRIB(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_NAME_FATTRIB(blk_id_ndx), &varid);
break;
case EX_ELEM_BLOCK:
- varid = ncvarid (exoid, VAR_NAME_ATTRIB(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_NAME_ATTRIB(blk_id_ndx), &varid);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_put_attr_names",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
}
- if (varid == -1) {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s attribute names for block %d in file id %d",
- tname,blk_id, exoid);
+ "Error: failed to locate %s attribute names for %s %d in file id %d",
+ ex_name_of_object(blk_type),ex_name_of_object(blk_type),blk_id, exoid);
ex_err("ex_put_attr_names",errmsg,exerrval);
return (EX_FATAL);
- }
+ }
/* write out the attributes */
for (i = 0; i < num_attr; i++) {
@@ -174,11 +204,11 @@ int ex_put_attr_names(int exoid,
count[0] = 1;
count[1] = strlen(names[i])+1;
- if (ncvarput (exoid, varid, start, count, (void*) names[i]) == -1) {
- exerrval = ncerr;
+ if ((status = nc_put_vara_text(exoid, varid, start, count, (void*) names[i])) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to put attribute namess for block %d in file id %d",
- blk_id,exoid);
+ "Error: failed to put attribute namess for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr_names",errmsg,exerrval);
return (EX_FATAL);
}
diff --git a/cbind/src/expatt.c b/cbind/src/expatt.c
index a3f8235..82cd55d 100644
--- a/cbind/src/expatt.c
+++ b/cbind/src/expatt.c
@@ -47,7 +47,6 @@
*
* revision history -
*
-* $Id: expatt.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -56,185 +55,103 @@
/*!
* writes the attributes for an edge/face/element block
+ * \param exoid exodus file id
+ * \param blk_type block type
+ * \param blk_id block id
+ * \param attrib array of attributes
*/
int ex_put_attr (int exoid,
- int blk_type,
- int blk_id,
- const void *attrib)
+ ex_entity_type blk_type,
+ int blk_id,
+ const void *attrib)
{
- int numentriesbdim, numattrdim, attrid, blk_id_ndx;
- long num_entries_this_blk, num_attr, start[2], count[2];
+ int status;
+ int attrid, blk_id_ndx;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* vobjids;
-
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- tname = "edge";
- vobjids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face";
- vobjids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element";
- vobjids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
- blk_type, exoid );
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
exerrval = 0; /* clear error code */
- /* Determine index of blk_id in VAR_ID_EL_BLK array */
- blk_id_ndx = ex_id_lkup(exoid,vobjids,blk_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no attributes allowed for NULL %s block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_put_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this block */
- }
- else
- {
- sprintf(errmsg,
- "Error: no %s block id %d in %s array in file id %d",
- tname, blk_id, vobjids, exoid);
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
+ if ( blk_type != EX_NODAL ) {
+ /* Determine index of blk_id in VAR_ID_EL_BLK array */
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes allowed for NULL %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_put_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this block */
+ } else {
+ sprintf(errmsg,
+ "Error: no %s id %d in in file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_put_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
}
}
-/* inquire id's of previously defined dimensions */
-
switch (blk_type) {
- case EX_EDGE_BLOCK:
- numentriesbdim = ncdimid (exoid, DIM_NUM_ED_IN_EBLK(blk_id_ndx));
+ case EX_SIDE_SET:
+ status = nc_inq_varid (exoid, VAR_SSATTRIB(blk_id_ndx), &attrid);
break;
- case EX_FACE_BLOCK:
- numentriesbdim = ncdimid (exoid, DIM_NUM_FA_IN_FBLK(blk_id_ndx));
+ case EX_NODE_SET:
+ status = nc_inq_varid (exoid, VAR_NSATTRIB(blk_id_ndx), &attrid);
break;
- case EX_ELEM_BLOCK:
- numentriesbdim = ncdimid (exoid, DIM_NUM_EL_IN_BLK(blk_id_ndx));
+ case EX_EDGE_SET:
+ status = nc_inq_varid (exoid, VAR_ESATTRIB(blk_id_ndx), &attrid);
+ break;
+ case EX_FACE_SET:
+ status = nc_inq_varid (exoid, VAR_FSATTRIB(blk_id_ndx), &attrid);
+ break;
+ case EX_ELEM_SET:
+ status = nc_inq_varid (exoid, VAR_ELSATTRIB(blk_id_ndx), &attrid);
+ break;
+ case EX_NODAL:
+ status = nc_inq_varid (exoid, VAR_NATTRIB, &attrid);
break;
- }
- if (numentriesbdim == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no %s block with id %d in file id %d",
- tname, blk_id, exoid);
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of %ss for block %d in file id %d",
- tname, blk_id, exoid);
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
- if (ncdiminq (exoid, numentriesbdim, (char *) 0, &num_entries_this_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %ss for block %d in file id %d",
- tname, blk_id,exoid);
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- switch (blk_type) {
case EX_EDGE_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_EATTRIB(blk_id_ndx), &attrid);
break;
case EX_FACE_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_FATTRIB(blk_id_ndx), &attrid);
break;
case EX_ELEM_BLOCK:
- numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx));
+ status = nc_inq_varid (exoid, VAR_ATTRIB(blk_id_ndx), &attrid);
break;
- }
- if (numattrdim == -1)
- {
- exerrval = ncerr;
+ default:
+ exerrval = 1005;
sprintf(errmsg,
- "Error: number of attributes not defined for %s block %d in file id %d",
- tname, blk_id,exoid);
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ blk_type,exoid);
ex_err("ex_put_attr",errmsg,EX_MSG);
return (EX_FATAL); /* number of attributes not defined */
}
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of attributes for %s block %d in file id %d",
- tname, blk_id,exoid);
+ "Error: failed to locate attribute variable for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr",errmsg,exerrval);
return (EX_FATAL);
}
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- attrid = ncvarid (exoid, VAR_EATTRIB(blk_id_ndx));
- break;
- case EX_FACE_BLOCK:
- attrid = ncvarid (exoid, VAR_FATTRIB(blk_id_ndx));
- break;
- case EX_ELEM_BLOCK:
- attrid = ncvarid (exoid, VAR_ATTRIB(blk_id_ndx));
- break;
+ /* write out the attributes */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_var_float(exoid, attrid, attrib);
+ } else {
+ status = nc_put_var_double(exoid, attrid, attrib);
}
- if (attrid == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate attribute variable for %s block %d in file id %d",
- tname,blk_id,exoid);
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* write out the attributes */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_entries_this_blk;
- count[1] = num_attr;
-
- if (ncvarput (exoid, attrid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,attrib,
- (int) num_attr * num_entries_this_blk)) == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to put attributes for %s block %d in file id %d",
- tname,blk_id,exoid);
+ "Error: failed to put attributes for %s %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_attr",errmsg,exerrval);
return (EX_FATAL);
}
-
-
return(EX_NOERR);
-
}
diff --git a/cbind/src/expattp.c b/cbind/src/expattp.c
new file mode 100644
index 0000000..3093742
--- /dev/null
+++ b/cbind/src/expattp.c
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expmp - ex_put_attr_param
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type block/set type (node, edge, face, elem)
+* int obj_id block/set id (ignored for NODAL)
+* int num_attrs number of attributes
+*
+* exit conditions -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * defines the number of attributes.
+ * \param exoid exodus file id
+ * \param obj_type block/set type (node, edge, face, elem)
+ * \param obj_id block/set id (ignored for NODAL)
+ * \param num_attrs number of attributes
+ */
+
+int ex_put_attr_param (int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int num_attrs)
+{
+ int status;
+ int dims[2];
+ int strdim, varid;
+
+ char errmsg[MAX_ERR_LENGTH];
+ const char *dnumobjent;
+ const char *dnumobjatt;
+ const char *vobjatt;
+ const char *vattnam;
+ int numobjentdim;
+ int obj_id_ndx;
+ int numattrdim;
+
+ /* Determine index of obj_id in obj_type id array */
+ if (obj_type == EX_NODAL)
+ obj_id_ndx = 0;
+ else {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes found for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_put_attr_param",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this object */
+ } else {
+ sprintf(errmsg,
+ "Warning: failed to locate %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type),obj_id, exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_WARN);
+ }
+ }
+ }
+
+ switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vobjatt = VAR_SSATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vobjatt = VAR_NSATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vobjatt = VAR_ESATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vobjatt = VAR_FSATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vobjatt = VAR_ELSATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjent = DIM_NUM_NODES;
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vobjatt = VAR_NATTRIB;
+ vattnam = VAR_NAME_NATTRIB;
+ break;
+ case EX_EDGE_BLOCK:
+ dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
+ vobjatt = VAR_EATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_EATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_BLOCK:
+ dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
+ vobjatt = VAR_FATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_FATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_BLOCK:
+ dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
+ vobjatt = VAR_ATTRIB(obj_id_ndx);
+ vattnam = VAR_NAME_ATTRIB(obj_id_ndx);
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
+ obj_type, exoid );
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ exerrval = 0; /* clear error code */
+
+ if ((status = nc_inq_dimid(exoid, dnumobjent, &numobjentdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of entries for %s %d in file id %d",
+ ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* put netcdf file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_def_dim(exoid, dnumobjatt, num_attrs, &numattrdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of attributes in %s %d in file id %d",
+ ex_name_of_object(obj_type), obj_id,exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ dims[0] = numobjentdim;
+ dims[1] = numattrdim;
+
+ if ((status = nc_def_var(exoid, vobjatt, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define attributes for %s %d in file id %d",
+ ex_name_of_object(obj_type), obj_id,exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get string length in file id %d",exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Attribute names... */
+ dims[0] = numattrdim;
+ dims[1] = strdim;
+
+ if ((status = nc_def_var(exoid, vattnam, NC_CHAR, 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define %s attribute name array in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete %s attribute parameter definition in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_attr_param",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expblk.c b/cbind/src/expblk.c
index 5daa6b2..316f16c 100644
--- a/cbind/src/expblk.c
+++ b/cbind/src/expblk.c
@@ -50,10 +50,6 @@
*
* exit conditions -
*
-* revision history -
-* 20061001 - David Thompson - Adapted from ex_put_elem_block
-*
-* $Id: expblk.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,10 +59,19 @@
/*!
* writes the parameters used to describe an element block
+ * \param exoid exodus file id
+ * \param blk_type type of block (edge, face, or element)
+ * \param blk_id block identifer
+ * \param entry_descrip string describing shape of entries in the block
+ * \param num_entries_this_blk number of entries(records) in the block
+ * \param num_nodes_per_entry number of nodes per block entry
+ * \param num_edges_per_entry number of edges per block entry
+ * \param num_faces_per_entry number of faces per block entry
+ * \param num_attr_per_entry number of attributes per block entry
*/
int ex_put_block( int exoid,
- int blk_type,
+ ex_entity_type blk_type,
int blk_id,
const char* entry_descrip,
int num_entries_this_blk,
@@ -75,429 +80,464 @@ int ex_put_block( int exoid,
int num_faces_per_entry,
int num_attr_per_entry )
{
- int varid, dimid, dims[2], blk_id_ndx, blk_stat, strdim;
- long start[2], num_blk;
- nclong ldum;
- int cur_num_blk, numblkdim, numattrdim;
- int nnodperentdim, nedgperentdim, nfacperentdim;
- int connid, econnid, fconnid;
- char *cdum;
- char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* dnumblk;
- const char* vblkids;
- const char* vblksta;
- const char* vnodcon;
- const char* vedgcon;
- const char* vfaccon;
- const char* vattnam;
- const char* vblkatt;
- const char* dneblk;
- const char* dnape;
- const char* dnnpe;
- const char* dnepe;
- const char* dnfpe;
- struct list_item** ctr_list;
-
- exerrval = 0; /* clear error code */
-
- cdum = 0;
-
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- tname = "edge";
- dnumblk = DIM_NUM_ED_BLK;
- vblkids = VAR_ID_ED_BLK;
- vblksta = VAR_STAT_ED_BLK;
- ctr_list = &ed_ctr_list;
- break;
- case EX_FACE_BLOCK:
- tname = "face";
- dnumblk = DIM_NUM_FA_BLK;
- vblkids = VAR_ID_FA_BLK;
- vblksta = VAR_STAT_FA_BLK;
- ctr_list = &fa_ctr_list;
- break;
- case EX_ELEM_BLOCK:
- tname = "element";
- dnumblk = DIM_NUM_EL_BLK;
- vblkids = VAR_ID_EL_BLK;
- vblksta = VAR_STAT_EL_BLK;
- ctr_list = &eb_ctr_list;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf( errmsg, "Error: Bad block type (%d) specified for file id %d",
- blk_type, exoid );
- ex_err( "ex_put_block", errmsg, exerrval );
- return (EX_FATAL);
- }
-
-/* first check if any element blocks are specified */
-
- if ((dimid = (ncdimid (exoid, dnumblk))) == -1 )
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no element blocks defined in file id %d",
- exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Get number of element blocks defined for this file */
- if ((ncdiminq (exoid,dimid,cdum,&num_blk)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element blocks in file id %d",
- exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Next: Make sure that this is not a duplicate element block id by
- searching the vblkids array.
- WARNING: This must be done outside of define mode because id_lkup accesses
- the database to determine the position
-*/
-
- if ((varid = ncvarid (exoid, vblkids)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element block ids in file id %d", exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
-
- }
-
- blk_id_ndx = ex_id_lkup(exoid,vblkids,blk_id);
- if (exerrval != EX_LOOKUPFAIL) /* found the element block id */
- {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: element block id %d already exists in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Keep track of the total number of element blocks defined using a counter
- stored in a linked list keyed by exoid.
- NOTE: ex_get_file_item is a function that finds the number of element
- blocks for a specific file and returns that value incremented.
-*/
- cur_num_blk=ex_get_file_item(exoid, ctr_list);
- if (cur_num_blk >= num_blk)
- {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: exceeded number of element blocks (%ld) defined in file id %d",
- num_blk,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* NOTE: ex_get_file_item is a function that finds the number of element
- blocks for a specific file and returns that value incremented. */
-
- cur_num_blk=ex_inc_file_item(exoid, ctr_list);
- start[0] = (long)cur_num_blk;
-
-/* write out element block id to previously defined id array variable*/
-
- ldum = (nclong)blk_id;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element block id to file id %d",
- exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- blk_id_ndx = start[0]+1; /* element id index into vblkids array*/
-
- if (num_entries_this_blk == 0) /* Is this a NULL element block? */
- blk_stat = 0; /* change element block status to NULL */
- else
- blk_stat = 1; /* change element block status to TRUE */
-
- if ((varid = ncvarid (exoid, vblksta)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element block status in file id %d", exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- ldum = (nclong)blk_stat;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element id %d status to file id %d",
- blk_id, exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (num_entries_this_blk == 0) /* Is this a NULL element block? */
- {
- return(EX_NOERR);
- }
-
-
- /*
- * Check that storage required for connectivity array is less
- * than 2GB which is maximum size permitted by netcdf
- * (in large file mode). 1<<29 == max number of integer items.
- */
- if (num_entries_this_blk * num_nodes_per_entry > (1<<29)) {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Size to store connectivity for element block %d exceeds 2GB in file id %d",
- blk_id, exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* put netcdf file into define mode */
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- switch (blk_type) {
- case EX_EDGE_BLOCK:
- dneblk = DIM_NUM_ED_IN_EBLK(blk_id_ndx);
- dnnpe = DIM_NUM_NOD_PER_ED(blk_id_ndx);
- dnepe = 0;
- dnfpe = 0;
- dnape = DIM_NUM_ATT_IN_EBLK(blk_id_ndx);
- vblkatt = VAR_EATTRIB(blk_id_ndx);
- vattnam = VAR_NAME_EATTRIB(blk_id_ndx);
- vnodcon = VAR_EBCONN(blk_id_ndx);
- vedgcon = 0;
- vfaccon = 0;
- break;
- case EX_FACE_BLOCK:
- dneblk = DIM_NUM_FA_IN_FBLK(blk_id_ndx);
- dnnpe = DIM_NUM_NOD_PER_FA(blk_id_ndx);
- dnepe = 0;
- dnfpe = 0;
- dnape = DIM_NUM_ATT_IN_FBLK(blk_id_ndx);
- vblkatt = VAR_FATTRIB(blk_id_ndx);
- vattnam = VAR_NAME_FATTRIB(blk_id_ndx);
- vnodcon = VAR_FBCONN(blk_id_ndx);
- vedgcon = 0;
- vfaccon = 0;
- break;
- case EX_ELEM_BLOCK:
- dneblk = DIM_NUM_EL_IN_BLK(blk_id_ndx);
- dnnpe = DIM_NUM_NOD_PER_EL(blk_id_ndx);
- dnepe = DIM_NUM_EDG_PER_EL(blk_id_ndx);
- dnfpe = DIM_NUM_FAC_PER_EL(blk_id_ndx);
- dnape = DIM_NUM_ATT_IN_BLK(blk_id_ndx);
- vblkatt = VAR_ATTRIB(blk_id_ndx);
- vattnam = VAR_NAME_ATTRIB(blk_id_ndx);
- vnodcon = VAR_CONN(blk_id_ndx);
- vedgcon = VAR_ECONN(blk_id_ndx);
- vfaccon = VAR_FCONN(blk_id_ndx);
- break;
- }
-/* define some dimensions and variables*/
-
- if ((numblkdim = ncdimdef (exoid,dneblk,(long)num_entries_this_blk)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE) /* duplicate entry */
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: element block %d already defined in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of elements/block for block %d file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
- if ((nnodperentdim = ncdimdef (exoid,dnnpe,(long)num_nodes_per_entry)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of nodes/element for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- if ( dnepe && num_edges_per_entry > 0 ) {
- if ((nedgperentdim = ncdimdef (exoid,dnepe,(long)num_edges_per_entry)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of edges/element for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
- if ( dnfpe && num_faces_per_entry > 0 ) {
- if ((nfacperentdim = ncdimdef (exoid,dnfpe,(long)num_faces_per_entry)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of faces/element for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
-/* element attribute array */
-
- if (num_attr_per_entry > 0)
- {
-
- if ((numattrdim = ncdimdef (exoid, dnape, (long)num_attr_per_entry)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of attributes in block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- dims[0] = numblkdim;
- dims[1] = numattrdim;
-
- if ((ncvardef (exoid, vblkatt, nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define attributes for element block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get string length in file id %d",exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
+ int status;
+ int arbitrary_polyhedra = 0; /* 1 if block is arbitrary 2d polyhedra type; 2 if 3d polyhedra */
+ int varid, dimid, dims[2], blk_id_ndx, blk_stat, strdim;
+ size_t start[2];
+ int num_blk;
+ size_t temp;
+ int cur_num_blk, numblkdim, numattrdim;
+ int nnodperentdim, nedgperentdim, nfacperentdim;
+ int connid;
+ int npeid;
+ char errmsg[MAX_ERR_LENGTH];
+ char entity_type1[5];
+ char entity_type2[5];
+ const char* dnumblk = NULL;
+ const char* vblkids = NULL;
+ const char* vblksta = NULL;
+ const char* vnodcon = NULL;
+ const char* vnpecnt = NULL;
+ const char* vedgcon = NULL;
+ const char* vfaccon = NULL;
+ const char* vconn = NULL;
+ const char* vattnam = NULL;
+ const char* vblkatt = NULL;
+ const char* dneblk = NULL;
+ const char* dnape = NULL;
+ const char* dnnpe = NULL;
+ const char* dnepe = NULL;
+ const char* dnfpe = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ dnumblk = DIM_NUM_ED_BLK;
+ vblkids = VAR_ID_ED_BLK;
+ vblksta = VAR_STAT_ED_BLK;
+ break;
+ case EX_FACE_BLOCK:
+ dnumblk = DIM_NUM_FA_BLK;
+ vblkids = VAR_ID_FA_BLK;
+ vblksta = VAR_STAT_FA_BLK;
+ break;
+ case EX_ELEM_BLOCK:
+ dnumblk = DIM_NUM_EL_BLK;
+ vblkids = VAR_ID_EL_BLK;
+ vblksta = VAR_STAT_EL_BLK;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Error: Bad block type (%d) specified for file id %d",
+ blk_type, exoid );
+ ex_err( "ex_put_block", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ /* first check if any element blocks are specified */
+
+ if ((status = ex_get_dimension(exoid, dnumblk, ex_name_of_object(blk_type),
+ &temp, &dimid, "ex_put_block")) != NC_NOERR) {
+ return EX_FATAL;
+ }
+ num_blk = temp;
+
+ /* Next: Make sure that this is not a duplicate element block id by
+ searching the vblkids array.
+ WARNING: This must be done outside of define mode because id_lkup accesses
+ the database to determine the position
+ */
+
+ if ((status = nc_inq_varid(exoid, vblkids, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s ids in file id %d",
+ ex_name_of_object(blk_type), exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ }
+
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != EX_LOOKUPFAIL) { /* found the element block id */
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: %s id %d already exists in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Keep track of the total number of element blocks defined using a counter
+ stored in a linked list keyed by exoid.
+ NOTE: ex_get_file_item is a function that finds the number of element
+ blocks for a specific file and returns that value incremented.
+ */
+ cur_num_blk=ex_get_file_item(exoid, ex_get_counter_list(blk_type));
+ if (cur_num_blk >= num_blk) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of %ss (%d) defined in file id %d",
+ ex_name_of_object(blk_type), num_blk,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* NOTE: ex_get_file_item is a function that finds the number of element
+ blocks for a specific file and returns that value incremented. */
+ cur_num_blk=ex_inc_file_item(exoid, ex_get_counter_list(blk_type));
+ start[0] = cur_num_blk;
+
+ /* write out element block id to previously defined id array variable*/
+ if ((status = nc_put_var1_int(exoid, varid, start, &blk_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s id to file id %d",
+ ex_name_of_object(blk_type), exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ blk_id_ndx = start[0]+1; /* element id index into vblkids array*/
+
+ if (num_entries_this_blk == 0) /* Is this a NULL element block? */
+ blk_stat = 0; /* change element block status to NULL */
+ else
+ blk_stat = 1; /* change element block status to TRUE */
+
+ if ((status = nc_inq_varid (exoid, vblksta, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s status in file id %d",
+ ex_name_of_object(blk_type), exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_put_var1_int(exoid, varid, start, &blk_stat)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s id %d status to file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_entries_this_blk == 0) {/* Is this a NULL element block? */
+ return(EX_NOERR);
+ }
+
+
+ /* put netcdf file into define mode */
+ if ((status=nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ dneblk = DIM_NUM_ED_IN_EBLK(blk_id_ndx);
+ dnnpe = DIM_NUM_NOD_PER_ED(blk_id_ndx);
+ dnepe = 0;
+ dnfpe = 0;
+ dnape = DIM_NUM_ATT_IN_EBLK(blk_id_ndx);
+ vblkatt = VAR_EATTRIB(blk_id_ndx);
+ vattnam = VAR_NAME_EATTRIB(blk_id_ndx);
+ vnodcon = VAR_EBCONN(blk_id_ndx);
+ vedgcon = 0;
+ vfaccon = 0;
+ break;
+ case EX_FACE_BLOCK:
+ dneblk = DIM_NUM_FA_IN_FBLK(blk_id_ndx);
+ dnnpe = DIM_NUM_NOD_PER_FA(blk_id_ndx);
+ dnepe = 0;
+ dnfpe = 0;
+ dnape = DIM_NUM_ATT_IN_FBLK(blk_id_ndx);
+ vblkatt = VAR_FATTRIB(blk_id_ndx);
+ vattnam = VAR_NAME_FATTRIB(blk_id_ndx);
+ vnodcon = VAR_FBCONN(blk_id_ndx);
+ vnpecnt = VAR_FBEPEC(blk_id_ndx);
+ vedgcon = 0;
+ vfaccon = 0;
+ break;
+ case EX_ELEM_BLOCK:
+ dneblk = DIM_NUM_EL_IN_BLK(blk_id_ndx);
+ dnnpe = DIM_NUM_NOD_PER_EL(blk_id_ndx);
+ dnepe = DIM_NUM_EDG_PER_EL(blk_id_ndx);
+ dnfpe = DIM_NUM_FAC_PER_EL(blk_id_ndx);
+ dnape = DIM_NUM_ATT_IN_BLK(blk_id_ndx);
+ vblkatt = VAR_ATTRIB(blk_id_ndx);
+ vattnam = VAR_NAME_ATTRIB(blk_id_ndx);
+ vnodcon = VAR_CONN(blk_id_ndx);
+ vnpecnt = VAR_EBEPEC(blk_id_ndx);
+ vedgcon = VAR_ECONN(blk_id_ndx);
+ vfaccon = VAR_FCONN(blk_id_ndx);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_put_block",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
+ }
+ /* define some dimensions and variables*/
+
+ if ((status = nc_def_dim(exoid,dneblk,num_entries_this_blk, &numblkdim )) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) { /* duplicate entry */
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: %s %d already defined in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of entities/block for %s %d file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if ( dnnpe && num_nodes_per_entry > 0) {
+ /* A nfaced block would not have any nodes defined... */
+ if ((status = nc_def_dim(exoid,dnnpe,num_nodes_per_entry, &nnodperentdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of nodes/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (dnepe && num_edges_per_entry > 0 ) {
+ if ((status = nc_def_dim (exoid,dnepe,num_edges_per_entry, &nedgperentdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of edges/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if ( dnfpe && num_faces_per_entry > 0 ) {
+ if ((status = nc_def_dim(exoid,dnfpe,num_faces_per_entry, &nfacperentdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of faces/entity for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ /* element attribute array */
+ if (num_attr_per_entry > 0) {
+
+ if ((status = nc_def_dim(exoid, dnape, num_attr_per_entry, &numattrdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of attributes in %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ dims[0] = numblkdim;
+ dims[1] = numattrdim;
+
+ if ((status = nc_def_var(exoid, vblkatt, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define attributes for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get string length in file id %d",exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- /* Attribute names... */
- dims[0] = numattrdim;
- dims[1] = strdim;
+ /* Attribute names... */
+ dims[0] = numattrdim;
+ dims[1] = strdim;
- if (ncvardef (exoid, vattnam, NC_CHAR, 2, dims) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define element attribute name array in file id %d",exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- }
-
-/* element connectivity array */
-
- dims[0] = numblkdim;
- dims[1] = nnodperentdim;
-
- if ((connid = ncvardef (exoid, vnodcon, NC_LONG, 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create connectivity array for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
-/* store element type as attribute of connectivity variable */
-
- if ((ncattput (exoid, connid, ATT_NAME_ELB, NC_CHAR, strlen(entry_descrip)+1,
- (void*) entry_descrip)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element type name %s in file id %d",
- entry_descrip,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- if ( vedgcon && num_edges_per_entry ) {
- dims[0] = numblkdim;
- dims[1] = nedgperentdim;
-
- if ((econnid = ncvardef (exoid, vedgcon, NC_LONG, 2, dims)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create edge connectivity array for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
- if ( vfaccon && num_faces_per_entry ) {
- dims[0] = numblkdim;
- dims[1] = nfacperentdim;
-
- if ((fconnid = ncvardef (exoid, vfaccon, NC_LONG, 2, dims)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create face connectivity array for block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete element block definition in file id %d",
- exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_elem_block",errmsg,exerrval);
- }
- return (EX_FATAL);
+ if ((status = nc_def_var(exoid, vattnam, NC_CHAR, 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define %s attribute name array in file id %d",
+ ex_name_of_object(blk_type), exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ /* See if storing an 'nsided' element block (arbitrary 2d polyhedra or super element) */
+ if (strlen(entry_descrip) >= 3) {
+ if ((entry_descrip[0] == 'n' || entry_descrip[0] == 'N') &&
+ (entry_descrip[1] == 's' || entry_descrip[1] == 'S') &&
+ (entry_descrip[2] == 'i' || entry_descrip[2] == 'I'))
+ arbitrary_polyhedra = 1;
+ else if ((entry_descrip[0] == 'n' || entry_descrip[0] == 'N') &&
+ (entry_descrip[1] == 'f' || entry_descrip[1] == 'F') &&
+ (entry_descrip[2] == 'a' || entry_descrip[2] == 'A'))
+ /* If a FACE_BLOCK, then we are dealing with the faces of the nfaced block. */
+ arbitrary_polyhedra = blk_type == EX_FACE_BLOCK ? 1 : 2;
+ }
+
+ /* element connectivity array */
+ if (arbitrary_polyhedra > 0) {
+ if (blk_type != EX_FACE_BLOCK && blk_type != EX_ELEM_BLOCK) {
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Error: Bad block type (%d) for nsided/nfaced block in file id %d",
+ blk_type, exoid );
+ ex_err( "ex_put_block", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ if (arbitrary_polyhedra == 1) {
+ dims[0] = nnodperentdim;
+ vconn = vnodcon;
+
+ /* store entity types as attribute of npeid variable -- node/elem, node/face, face/elem*/
+ strcpy(entity_type1, "NODE");
+ if (blk_type == EX_ELEM_BLOCK)
+ strcpy(entity_type2, "ELEM");
+ else
+ strcpy(entity_type2, "FACE");
+ } else if (arbitrary_polyhedra == 2) {
+ dims[0] = nfacperentdim;
+ vconn = vfaccon;
+
+ /* store entity types as attribute of npeid variable -- node/elem, node/face, face/elem*/
+ strcpy(entity_type1, "FACE");
+ strcpy(entity_type2, "ELEM");
+ }
+
+ if ((status = nc_def_var(exoid, vconn, NC_INT, 1, dims, &connid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* element face-per-element or node-per-element count array */
+ dims[0] = numblkdim;
+
+ if ((status = nc_def_var(exoid, vnpecnt, NC_INT, 1, dims, &npeid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create face- or node- per-entity count array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if ((status = nc_put_att_text(exoid, npeid, "entity_type1", strlen(entity_type1)+1,
+ entity_type1)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store entity type attribute text for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ if ((status = nc_put_att_text(exoid, npeid, "entity_type2", strlen(entity_type2)+1,
+ entity_type2)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store entity type attribute text for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id, exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ } else {
+ /* "Normal" (non-polyhedra) element block type */
+ dims[0] = numblkdim;
+ dims[1] = nnodperentdim;
+
+ if ((status = nc_def_var(exoid, vnodcon, NC_INT, 2, dims, &connid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+ /* store element type as attribute of connectivity variable */
+ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(entry_descrip)+1,
+ entry_descrip)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s type name %s in file id %d",
+ ex_name_of_object(blk_type), entry_descrip,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if (arbitrary_polyhedra == 0) {
+ if (vedgcon && num_edges_per_entry ) {
+ dims[0] = numblkdim;
+ dims[1] = nedgperentdim;
+
+ if ((status = nc_def_var(exoid, vedgcon, NC_INT, 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create edge connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if ( vfaccon && num_faces_per_entry ) {
+ dims[0] = numblkdim;
+ dims[1] = nfacperentdim;
+
+ if ((status = nc_def_var(exoid, vfaccon, NC_INT, 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create face connectivity array for %s %d in file id %d",
+ ex_name_of_object(blk_type), blk_id,exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+ }
+ /* leave define mode */
+
+ if ((exerrval=nc_enddef (exoid)) != NC_NOERR) {
+ sprintf(errmsg,
+ "Error: failed to complete %s definition in file id %d",
+ ex_name_of_object(blk_type), exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_block",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/expcab.c b/cbind/src/expcab.c
index 05681d0..129d29f 100644
--- a/cbind/src/expcab.c
+++ b/cbind/src/expcab.c
@@ -48,35 +48,27 @@
#include "exodusII_int.h"
#include <string.h>
-/* Define this macro to get old-style number maps (node_num_map &
- * elem_num_map) when define_maps is true. Leave it undefined to
- * get new-style number maps (node_map#, edge_map#, face_map#, and
- * elem_map#) when define_maps is true.
- */
-#undef EX_MAPSTYLE_OLD
/*!
* writes the parameters used to describe all element, edge, and face blocks
+ * \param exoid exodus file id
+ * \param param block parameters structure
*/
int ex_put_concat_all_blocks (int exoid,
const ex_block_params *param)
{
- int i, varid, dimid, dims[2], strdim, *eb_stat, *ed_stat, *fa_stat;
- int iblk;
- int iresult;
- long start[2], count[2], num_elem_blk, num_edge_blk, num_face_blk;
- nclong *lptr;
+ int varid, dimid, dims[2], strdim, *eb_stat, *ed_stat, *fa_stat;
+ int temp;
+ size_t iblk;
+ int status;
+ size_t num_elem_blk, num_edge_blk, num_face_blk, i;
int cur_num_elem_blk, nelnoddim, numelbdim, numattrdim, connid=-1;
int cur_num_edge_blk, numedbdim, nednoddim, cur_num_face_blk, numfabdim, nfanoddim;
int neledgdim=-1, nelfacdim=-1;
- char *cdum;
char errmsg[MAX_ERR_LENGTH];
int elem_work = 0; /* is DIM_NUM_EL_BLK defined? If so, there's work to do */
int edge_work = 0; /* is DIM_NUM_ED_BLK defined? If so, there's work to do */
int face_work = 0; /* is DIM_NUM_FA_BLK defined? If so, there's work to do */
-#ifdef EX_MAPSTYLE_OLD /* vv--old style number maps--vv */
- int numelemdim, numnodedim;
-#else /* ^^--old style number maps--^^ vv--new style number maps--vv */
static const char* dim_num_maps[] = {
DIM_NUM_NM,
DIM_NUM_EDM,
@@ -89,7 +81,7 @@ int ex_put_concat_all_blocks (int exoid,
DIM_NUM_FACE,
DIM_NUM_ELEM,
};
- static const int map_enums[] = {
+ static const ex_entity_type map_enums[] = {
EX_NODE_MAP,
EX_EDGE_MAP,
EX_FACE_MAP,
@@ -97,17 +89,14 @@ int ex_put_concat_all_blocks (int exoid,
};
/* If param->define_maps is true, we must fill these with values from ex_put_init_ext
before entering define mode */
- long num_maps[sizeof(dim_num_maps)/sizeof(dim_num_maps[0])];
- int num_map_dims = sizeof(dim_num_maps)/sizeof(dim_num_maps[0]);
-#endif /* ^^--new style number maps--^^ */
+ size_t num_maps[sizeof(dim_num_maps)/sizeof(dim_num_maps[0])];
+ size_t num_map_dims = sizeof(dim_num_maps)/sizeof(dim_num_maps[0]);
exerrval = 0; /* clear error code */
- cdum = 0;
-
/* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get string length in file id %d",exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
@@ -116,132 +105,108 @@ int ex_put_concat_all_blocks (int exoid,
if ( param->define_maps ) {
for ( i = 0; i < num_map_dims; ++i ) {
- if ( (dimid = ncdimid( exoid, dim_num_maps[i] )) == -1 ) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, dim_num_maps[i], &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf( errmsg, "Error: failed to find node map size of file id %d", exoid );
ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
return (EX_FATAL);
}
- if ( ncdiminq( exoid, dimid, cdum, num_maps + i ) == -1 ) {
- exerrval = ncerr;
- sprintf( errmsg, "Error: failed to retrieve node map size of file id %d", exoid );
- ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
- return (EX_FATAL);
+ if ((status = nc_inq_dimlen(exoid, dimid, num_maps+i)) != NC_NOERR) {
+ exerrval = status;
+ sprintf( errmsg, "Error: failed to retrieve node map size of file id %d", exoid );
+ ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
+ return (EX_FATAL);
}
}
}
#define EX_PREPARE_BLOCK(TNAME,WNAME,DNUMNAME,VSTATNAME,VIDNAME,LNUMNAME,SNUMNAME,SIDNAME,GSTAT) \
- /* first check if any TNAME blocks are specified \
- * OK if zero... \
- */ \
- if ((dimid = (ncdimid (exoid, DNUMNAME))) != -1 ) { \
- WNAME = 1; \
- \
- /* Get number of TNAME blocks defined for this file */ \
- if ((ncdiminq (exoid,dimid,cdum,&LNUMNAME)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get number of " TNAME " blocks in file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- /* Fill out the TNAME block status array */ \
- if (!(GSTAT = malloc(LNUMNAME*sizeof(int)))) { \
- exerrval = EX_MEMFAIL; \
- sprintf(errmsg, \
- "Error: failed to allocate space for " TNAME " block status array in file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- for (i=0;i<LNUMNAME;i++) { \
- if (SNUMNAME[i] == 0) /* Is this a NULL TNAME block? */ \
- GSTAT[i] = 0; /* change TNAME block status to NULL */ \
- else \
- GSTAT[i] = 1; /* change TNAME block status to TRUE */ \
- } \
- \
- /* Next, get variable id of status array */ \
- if ((varid = ncvarid (exoid, VSTATNAME)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate " TNAME " block status in file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- /* this contortion is necessary because netCDF is expecting nclongs; \
- fortunately it's necessary only when ints and nclongs aren't the \
- same size */ \
- start[0] = 0; \
- count[0] = LNUMNAME; \
- \
- if (sizeof(int) == sizeof(nclong)) { \
- iresult = ncvarput (exoid, varid, start, count, GSTAT); \
- } else { \
- lptr = itol (GSTAT, LNUMNAME); \
- iresult = ncvarput (exoid, varid, start, count, lptr); \
- free(lptr); \
- } \
- \
- if (iresult == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to store " TNAME " block status array to file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- free(GSTAT); \
- \
- /* Next, fill out ids array */ \
- /* first get id of ids array variable */ \
- if ((varid = ncvarid (exoid, VIDNAME)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate " TNAME " block ids array in file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- /* then, write out id list */ \
- /* this contortion is necessary because netCDF is expecting nclongs; \
- fortunately it's necessary only when ints and nclongs aren't the \
- same size */ \
- start[0] = 0; \
- count[0] = LNUMNAME; \
- \
- if (sizeof(int) == sizeof(nclong)) { \
- iresult = ncvarput (exoid, varid, start, count, SIDNAME); \
- } else { \
- lptr = itol (SIDNAME, LNUMNAME); \
- iresult = ncvarput (exoid, varid, start, count, lptr); \
- free(lptr); \
- } \
- \
- if (iresult == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to store " TNAME " block id array in file id %d", \
- exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- }
+ /* first check if any TNAME blocks are specified \
+ * OK if zero... \
+ */ \
+ if ((status = (nc_inq_dimid(exoid, DNUMNAME, &dimid))) == NC_NOERR) { \
+ WNAME = 1; \
+ \
+ /* Get number of TNAME blocks defined for this file */ \
+ if ((status = nc_inq_dimlen(exoid,dimid,&LNUMNAME)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to get number of " TNAME " blocks in file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* Fill out the TNAME block status array */ \
+ if (!(GSTAT = malloc(LNUMNAME*sizeof(int)))) { \
+ exerrval = EX_MEMFAIL; \
+ sprintf(errmsg, \
+ "Error: failed to allocate space for " TNAME " block status array in file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ for (i=0;i<LNUMNAME;i++) { \
+ if (SNUMNAME[i] == 0) /* Is this a NULL TNAME block? */ \
+ GSTAT[i] = 0; /* change TNAME block status to NULL */ \
+ else \
+ GSTAT[i] = 1; /* change TNAME block status to TRUE */ \
+ } \
+ \
+ /* Next, get variable id of status array */ \
+ if ((status = nc_inq_varid(exoid, VSTATNAME, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate " TNAME " block status in file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ status = nc_put_var_int(exoid, varid, GSTAT); \
+ \
+ if (status != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to store " TNAME " block status array to file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ free(GSTAT); \
+ \
+ /* Next, fill out ids array */ \
+ /* first get id of ids array variable */ \
+ if ((status = nc_inq_varid(exoid, VIDNAME, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate " TNAME " block ids array in file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* then, write out id list */ \
+ status = nc_put_var_int(exoid, varid, SIDNAME); \
+ \
+ if (status != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to store " TNAME " block id array in file id %d", \
+ exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ }
EX_PREPARE_BLOCK("element",elem_work,DIM_NUM_EL_BLK,VAR_STAT_EL_BLK,VAR_ID_EL_BLK,
- num_elem_blk,param->num_elem_this_blk,param->elem_blk_id,eb_stat);
+ num_elem_blk,param->num_elem_this_blk,param->elem_blk_id,eb_stat);
EX_PREPARE_BLOCK( "edge",edge_work,DIM_NUM_ED_BLK,VAR_STAT_ED_BLK,VAR_ID_ED_BLK,
- num_edge_blk,param->num_edge_this_blk,param->edge_blk_id,ed_stat);
+ num_edge_blk,param->num_edge_this_blk,param->edge_blk_id,ed_stat);
EX_PREPARE_BLOCK( "face",face_work,DIM_NUM_FA_BLK,VAR_STAT_FA_BLK,VAR_ID_FA_BLK,
- num_face_blk,param->num_face_this_blk,param->face_blk_id,fa_stat);
+ num_face_blk,param->num_face_this_blk,param->face_blk_id,fa_stat);
if ( elem_work == 0 && edge_work == 0 && face_work == 0 && param->define_maps == 0 ) {
/* Nothing to do. This is not an error, but we can save
@@ -250,131 +215,130 @@ int ex_put_concat_all_blocks (int exoid,
return (EX_NOERR);
}
/* put netcdf file into define mode */
- if (ncredef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_redef(exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
return (EX_FATAL);
}
#define EX_PREPARE_ATTRIB_ARRAY(TNAME,CURBLK,DNAME,DVAL,ID,VANAME,VADIM0,VADIM1,VANNAME) \
- if (DVAL[iblk] > 0) { \
- if ((VADIM1 = ncdimdef (exoid, \
- DNAME(CURBLK+1), \
- (long)DVAL[iblk])) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define number of attributes in " TNAME " block %d in file id %d", \
- ID[iblk],exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- dims[0] = VADIM0; \
- dims[1] = VADIM1; \
- \
- if ((ncvardef (exoid, VANAME(CURBLK+1), \
- nc_flt_code(exoid), 2, dims)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define attributes for " TNAME " block %d in file id %d", \
- ID[iblk],exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* Attribute names... */ \
- dims[0] = VADIM1; \
- dims[1] = strdim; \
- \
- if (ncvardef (exoid, VANNAME(CURBLK+1), NC_CHAR, 2, dims) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " attribute name array in file id %d",exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- }
+ if (DVAL[iblk] > 0) { \
+ if ((status = nc_def_dim (exoid, \
+ DNAME(CURBLK+1), \
+ DVAL[iblk], &VADIM1)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define number of attributes in " TNAME " block %d in file id %d", \
+ ID[iblk],exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ dims[0] = VADIM0; \
+ dims[1] = VADIM1; \
+ \
+ if ((status = nc_def_var (exoid, VANAME(CURBLK+1), \
+ nc_flt_code(exoid), 2, dims, &temp)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define attributes for " TNAME " block %d in file id %d", \
+ ID[iblk],exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ /* Attribute names... */ \
+ dims[0] = VADIM1; \
+ dims[1] = strdim; \
+ \
+ if ((status = nc_def_var(exoid, VANNAME(CURBLK+1), NC_CHAR, 2, dims, &temp)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define " TNAME " attribute name array in file id %d",exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ }
-#define EX_PREPARE_CONN(TNAME,BLK,BLKID,BLKSZ,VNAME,DNAME) \
- if ( DNAME > 0 ) { \
- dims[0] = BLKSZ; \
- dims[1] = DNAME; \
- \
- if ((connid = ncvardef (exoid, VNAME(BLK+1), \
- NC_LONG, 2, dims)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to create " TNAME " connectivity array for block %d in file id %d", \
- BLKID[iblk],exoid); \
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- }
+#define EX_PREPARE_CONN(TNAME,BLK,BLKID,BLKSZ,VNAME,DNAME) \
+ if ( DNAME > 0 ) { \
+ dims[0] = BLKSZ; \
+ dims[1] = DNAME; \
+ \
+ if ((status = nc_def_var(exoid, VNAME(BLK+1), \
+ NC_INT, 2, dims, &connid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to create " TNAME " connectivity array for block %d in file id %d", \
+ BLKID[iblk],exoid); \
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ }
/* Iterate over edge blocks ... */
for (iblk = 0; iblk < num_edge_blk; ++iblk) {
- cur_num_edge_blk=ex_get_file_item(exoid, &ed_ctr_list );
- if (cur_num_edge_blk >= num_edge_blk) {
+ cur_num_edge_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK));
+ if (cur_num_edge_blk >= (int)num_edge_blk) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of edge blocks (%ld) defined in file id %d",
- num_edge_blk,exoid);
+ "Error: exceeded number of edge blocks (%ld) defined in file id %d",
+ (long)num_edge_blk,exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret;
}
/* NOTE: ex_inc_file_item is used to find the number of edge blocks
for a specific file and returns that value incremented. */
- cur_num_edge_blk=ex_inc_file_item(exoid, &ed_ctr_list );
+ cur_num_edge_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK));
if (param->num_edge_this_blk[iblk] == 0) /* Is this a NULL edge block? */
continue;
/* define some dimensions and variables*/
- if ((numedbdim = ncdimdef (exoid,
- DIM_NUM_ED_IN_EBLK(cur_num_edge_blk+1),
- (long)param->num_edge_this_blk[iblk])) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) { /* duplicate entry */
- sprintf(errmsg,
- "Error: edge block %d already defined in file id %d",
- param->edge_blk_id[iblk],exoid);
+ if ((status = nc_def_dim(exoid,
+ DIM_NUM_ED_IN_EBLK(cur_num_edge_blk+1),
+ param->num_edge_this_blk[iblk],&numedbdim)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) { /* duplicate entry */
+ sprintf(errmsg,
+ "Error: edge block %d already defined in file id %d",
+ param->edge_blk_id[iblk],exoid);
} else {
- sprintf(errmsg,
- "Error: failed to define number of edges/block for block %d file id %d",
- param->edge_blk_id[iblk],exoid);
+ sprintf(errmsg,
+ "Error: failed to define number of edges/block for block %d file id %d",
+ param->edge_blk_id[iblk],exoid);
}
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
- if ((nednoddim = ncdimdef (exoid,
- DIM_NUM_NOD_PER_ED(cur_num_edge_blk+1),
- (long)param->num_nodes_per_edge[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid,
+ DIM_NUM_NOD_PER_ED(cur_num_edge_blk+1),
+ param->num_nodes_per_edge[iblk],&nednoddim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define number of nodes/edge for block %d in file id %d",
- param->edge_blk_id[iblk],exoid);
+ "Error: failed to define number of nodes/edge for block %d in file id %d",
+ param->edge_blk_id[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
/* edge attribute array */
-
EX_PREPARE_ATTRIB_ARRAY("edge",cur_num_edge_blk,DIM_NUM_ATT_IN_EBLK,param->num_attr_edge,param->edge_blk_id,VAR_EATTRIB,numedbdim,numattrdim,VAR_NAME_EATTRIB);
EX_PREPARE_CONN("edge block",cur_num_edge_blk,param->edge_blk_id,numedbdim,VAR_EBCONN,nednoddim);
/* store edge type as attribute of connectivity variable */
- if ((ncattput (exoid, connid, ATT_NAME_ELB, NC_CHAR, strlen(param->edge_type[iblk])+1,
- (void*)param->edge_type[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->edge_type[iblk])+1,
+ (void*)param->edge_type[iblk])) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store edge type name %s in file id %d",
- param->edge_type[iblk],exoid);
+ "Error: failed to store edge type name %s in file id %d",
+ param->edge_type[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
@@ -383,65 +347,64 @@ int ex_put_concat_all_blocks (int exoid,
/* Iterate over face blocks ... */
for (iblk = 0; iblk < num_face_blk; ++iblk) {
- cur_num_face_blk=ex_get_file_item(exoid, &fa_ctr_list );
- if (cur_num_face_blk >= num_face_blk) {
+ cur_num_face_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK));
+ if (cur_num_face_blk >= (int)num_face_blk) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of face blocks (%ld) defined in file id %d",
- num_face_blk,exoid);
+ "Error: exceeded number of face blocks (%ld) defined in file id %d",
+ (long)num_face_blk,exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret;
}
/* NOTE: ex_inc_file_item is used to find the number of edge blocks
for a specific file and returns that value incremented. */
- cur_num_face_blk=ex_inc_file_item(exoid, &fa_ctr_list );
+ cur_num_face_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK));
if (param->num_face_this_blk[iblk] == 0) /* Is this a NULL face block? */
continue;
/* define some dimensions and variables*/
- if ((numfabdim = ncdimdef (exoid,
- DIM_NUM_FA_IN_FBLK(cur_num_face_blk+1),
- (long)param->num_face_this_blk[iblk])) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) { /* duplicate entry */
- sprintf(errmsg,
- "Error: face block %d already defined in file id %d",
- param->face_blk_id[iblk],exoid);
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_FA_IN_FBLK(cur_num_face_blk+1),
+ param->num_face_this_blk[iblk],&numfabdim)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) { /* duplicate entry */
+ sprintf(errmsg,
+ "Error: face block %d already defined in file id %d",
+ param->face_blk_id[iblk],exoid);
} else {
- sprintf(errmsg,
- "Error: failed to define number of faces/block for block %d file id %d",
- param->face_blk_id[iblk],exoid);
+ sprintf(errmsg,
+ "Error: failed to define number of faces/block for block %d file id %d",
+ param->face_blk_id[iblk],exoid);
}
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
- if ((nfanoddim = ncdimdef (exoid,
- DIM_NUM_NOD_PER_FA(cur_num_face_blk+1),
- (long)param->num_nodes_per_face[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_NOD_PER_FA(cur_num_face_blk+1),
+ param->num_nodes_per_face[iblk],&nfanoddim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define number of nodes/face for block %d in file id %d",
- param->face_blk_id[iblk],exoid);
+ "Error: failed to define number of nodes/face for block %d in file id %d",
+ param->face_blk_id[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
/* edge attribute array */
-
EX_PREPARE_ATTRIB_ARRAY("face",cur_num_face_blk,DIM_NUM_ATT_IN_FBLK,param->num_attr_face,param->face_blk_id,VAR_FATTRIB,numfabdim,numattrdim,VAR_NAME_FATTRIB);
EX_PREPARE_CONN("face block",cur_num_face_blk,param->face_blk_id,numfabdim,VAR_FBCONN,nfanoddim);
/* store face type as attribute of connectivity variable */
- if ((ncattput (exoid, connid, ATT_NAME_ELB, NC_CHAR, strlen(param->face_type[iblk])+1,
- (void*)param->face_type[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->face_type[iblk])+1,
+ (void*)param->face_type[iblk])) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store face type name %s in file id %d",
- param->face_type[iblk],exoid);
+ "Error: failed to store face type name %s in file id %d",
+ param->face_type[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
@@ -450,36 +413,36 @@ int ex_put_concat_all_blocks (int exoid,
/* Iterate over element blocks ... */
for (iblk = 0; iblk < num_elem_blk; ++iblk) {
- cur_num_elem_blk=ex_get_file_item(exoid, &eb_ctr_list );
- if (cur_num_elem_blk >= num_elem_blk) {
+ cur_num_elem_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK));
+ if (cur_num_elem_blk >= (int)num_elem_blk) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of element blocks (%ld) defined in file id %d",
- num_elem_blk,exoid);
+ "Error: exceeded number of element blocks (%ld) defined in file id %d",
+ (long)num_elem_blk,exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret;
}
/* NOTE: ex_inc_file_item is used to find the number of element blocks
for a specific file and returns that value incremented. */
- cur_num_elem_blk=ex_inc_file_item(exoid, &eb_ctr_list );
+ cur_num_elem_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK));
if (param->num_elem_this_blk[iblk] == 0) /* Is this a NULL element block? */
continue;
/* define some dimensions and variables*/
- if ((numelbdim = ncdimdef (exoid,
- DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1),
- (long)param->num_elem_this_blk[iblk])) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) { /* duplicate entry */
- sprintf(errmsg,
- "Error: element block %d already defined in file id %d",
- param->elem_blk_id[iblk],exoid);
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1),
+ param->num_elem_this_blk[iblk], &numelbdim)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) { /* duplicate entry */
+ sprintf(errmsg,
+ "Error: element block %d already defined in file id %d",
+ param->elem_blk_id[iblk],exoid);
} else {
- sprintf(errmsg,
- "Error: failed to define number of elements/block for block %d file id %d",
- param->elem_blk_id[iblk],exoid);
+ sprintf(errmsg,
+ "Error: failed to define number of elements/block for block %d file id %d",
+ param->elem_blk_id[iblk],exoid);
}
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
@@ -488,58 +451,56 @@ int ex_put_concat_all_blocks (int exoid,
/* Always define DIM_NUM_NOD_PER_EL, even if zero.
* Do not define DIM_NUM_EDG_PER_EL or DIM_NUM_FAC_PER_EL unless > 0.
*/
- if ((nelnoddim = ncdimdef (exoid,
- DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1),
- (long)param->num_nodes_per_elem[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1),
+ param->num_nodes_per_elem[iblk], &nelnoddim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define number of nodes/element for block %d in file id %d",
- param->elem_blk_id[iblk],exoid);
+ "Error: failed to define number of nodes/element for block %d in file id %d",
+ param->elem_blk_id[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
if ( param->num_edges_per_elem[iblk] > 0 ) {
- if ((neledgdim = ncdimdef (exoid,
- DIM_NUM_EDG_PER_EL(cur_num_elem_blk+1),
- (long)param->num_edges_per_elem[iblk])) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of edges/element for block %d in file id %d",
- param->elem_blk_id[iblk],exoid);
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_EDG_PER_EL(cur_num_elem_blk+1),
+ param->num_edges_per_elem[iblk],&neledgdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of edges/element for block %d in file id %d",
+ param->elem_blk_id[iblk],exoid);
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
}
}
if ( param->num_faces_per_elem[iblk] > 0 ) {
- if ((nelfacdim = ncdimdef (exoid,
- DIM_NUM_FAC_PER_EL(cur_num_elem_blk+1),
- (long)param->num_faces_per_elem[iblk])) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of faces/element for block %d in file id %d",
- param->elem_blk_id[iblk],exoid);
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
+ if ((status = nc_def_dim(exoid,
+ DIM_NUM_FAC_PER_EL(cur_num_elem_blk+1),
+ param->num_faces_per_elem[iblk],&nelfacdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of faces/element for block %d in file id %d",
+ param->elem_blk_id[iblk],exoid);
+ ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
}
}
/* element attribute array */
-
EX_PREPARE_ATTRIB_ARRAY("element",cur_num_elem_blk,DIM_NUM_ATT_IN_BLK,param->num_attr_elem,param->elem_blk_id,VAR_ATTRIB,numelbdim,numattrdim,VAR_NAME_ATTRIB);
/* element connectivity array */
-
EX_PREPARE_CONN("nodal",cur_num_elem_blk,param->elem_blk_id,numelbdim,VAR_CONN,nelnoddim);
/* store element type as attribute of connectivity variable */
- if ((ncattput (exoid, connid, ATT_NAME_ELB, NC_CHAR, strlen(param->elem_type[iblk])+1,
- (void*)param->elem_type[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->elem_type[iblk])+1,
+ (void*)param->elem_type[iblk])) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store element type name %s in file id %d",
- param->elem_type[iblk],exoid);
+ "Error: failed to store element type name %s in file id %d",
+ param->elem_type[iblk],exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
@@ -550,85 +511,39 @@ int ex_put_concat_all_blocks (int exoid,
/* Define the element map here to avoid a later redefine call */
if ( param->define_maps != 0 ) {
-#ifdef EX_MAPSTYLE_OLD /* vv=old style num map */
- if (ncvarid(exoid, VAR_ELEM_NUM_MAP) == -1) { /* Map does not exist */
- /* Possible to have zero elements but >0 element blocks.
- * Only define map if there are nonzero elements
- */
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) != -1) {
- dims[0] = numelemdim;
-
- if ((ncvardef (exoid, VAR_ELEM_NUM_MAP, NC_LONG, 1, dims)) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) {
- sprintf(errmsg,
- "Error: element numbering map already exists in file id %d",
- exoid);
- } else {
- sprintf(errmsg,
- "Error: failed to create element numbering map in file id %d",
- exoid);
- }
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
- }
- /* Do the same for the node numbering map */
- if (ncvarid(exoid, VAR_NODE_NUM_MAP) == -1) { /* Map does not exist */
- if ((numnodedim = ncdimid (exoid, DIM_NUM_NODES)) != -1) {
- dims[0] = numnodedim;
- if ((ncvardef (exoid, VAR_NODE_NUM_MAP, NC_LONG, 1, dims)) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) {
- sprintf(errmsg,
- "Error: node numbering map already exists in file id %d",
- exoid);
- } else {
- sprintf(errmsg,
- "Error: failed to create node numbering map array in file id %d",
- exoid);
- }
- ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
- }
-#else /* ^^=old style num map vv=new style num map */
- int map_type;
+ size_t map_type;
for ( map_type = 0; map_type < num_map_dims; ++map_type ) {
- if ( (dims[0] = ncdimid( exoid, dim_size_maps[map_type] )) == -1 ) {
- exerrval = ncerr;
- sprintf( errmsg,
- "Error: could not find map size dimension %s in file id %d",
- dim_size_maps[map_type], exoid );
- ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
+ if ((status = nc_inq_dimid(exoid, dim_size_maps[map_type], &dims[0])) != NC_NOERR) {
+ exerrval = status;
+ sprintf( errmsg,
+ "Error: could not find map size dimension %s in file id %d",
+ dim_size_maps[map_type], exoid );
+ ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
}
for ( i = 1; i <= num_maps[map_type]; ++i ) {
- const char* mapname = ex_name_of_map( map_enums[map_type], i );
- if ( ncvarid( exoid, mapname ) == -1 ) {
- if ( ncvardef( exoid, mapname, NC_LONG, 1, dims ) == -1 ) {
- exerrval = ncerr;
- if ( ncerr == NC_ENAMEINUSE ) {
- sprintf( errmsg, "Error: number map %s already exists in file id %d", mapname, exoid );
- } else {
- sprintf( errmsg, "Error: failed to create number map array %s in file id %d", mapname, exoid );
- }
- ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
- goto error_ret; /* exit define mode and return */
- }
- }
+ const char* mapname = ex_name_of_map( map_enums[map_type], i );
+ if (nc_inq_varid(exoid, mapname, &temp) != NC_NOERR) {
+ if ((status = nc_def_var(exoid, mapname, NC_INT, 1, dims, &temp)) != NC_NOERR) {
+ exerrval = status;
+ if ( status == NC_ENAMEINUSE ) {
+ sprintf( errmsg, "Error: number map %s already exists in file id %d", mapname, exoid );
+ } else {
+ sprintf( errmsg, "Error: failed to create number map array %s in file id %d", mapname, exoid );
+ }
+ ex_err( "ex_put_concat_all_blocks", errmsg, exerrval );
+ goto error_ret; /* exit define mode and return */
+ }
+ }
}
}
-#endif /* ^^=new style num map */
}
/* leave define mode */
- if (ncendef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to complete element block definition in file id %d",
- exoid);
+ "Error: failed to complete element block definition in file id %d",
+ exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
return (EX_FATAL);
}
@@ -637,10 +552,10 @@ int ex_put_concat_all_blocks (int exoid,
/* Fatal error: exit definition mode and return */
error_ret:
- if (ncendef (exoid) == -1) { /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
+ "Error: failed to complete definition for file id %d",
+ exoid);
ex_err("ex_put_concat_all_blocks",errmsg,exerrval);
}
return (EX_FATAL);
diff --git a/cbind/src/expclb.c b/cbind/src/expclb.c
index 1c8e8e2..5e1ca5d 100644
--- a/cbind/src/expclb.c
+++ b/cbind/src/expclb.c
@@ -54,6 +54,13 @@
/*!
* writes the parameters used to describe an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id element block id
+ * \param elem_type element type string
+ * \param num_elem_this_blk number of elements in the element blk
+ * \param num_nodes_per_elem number of nodes per element block
+ * \param num_attr number of attributes
+ * \param define_maps if != 0, write maps, else don't
*/
int ex_put_concat_elem_block (int exoid,
const int* elem_blk_id,
@@ -63,38 +70,37 @@ int ex_put_concat_elem_block (int exoid,
const int* num_attr,
int define_maps)
{
- int i, varid, dimid, dims[2], strdim, *eb_stat;
+ int i, varid, dimid, dims[2], strdim, *eb_array;
+ int temp;
int iblk;
- int iresult;
- long start[2], count[2], num_elem_blk;
- nclong *lptr;
+ int status;
+ int num_elem_blk;
+ size_t length;
int cur_num_elem_blk, nelnoddim, numelbdim, numattrdim, connid, numelemdim, numnodedim;
- char *cdum;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
- cdum = 0;
-
/* first check if any element blocks are specified
* OK if zero...
*/
- if ((dimid = (ncdimid (exoid, DIM_NUM_EL_BLK))) == -1 ) {
+ if (nc_inq_dimid(exoid, DIM_NUM_EL_BLK, &dimid) != NC_NOERR) {
return (EX_NOERR);
}
/* Get number of element blocks defined for this file */
- if ((ncdiminq (exoid,dimid,cdum,&num_elem_blk)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimlen(exoid,dimid,&length)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of element blocks in file id %d",
exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
return (EX_FATAL);
}
+ num_elem_blk = length;
/* Fill out the element block status array */
- if (!(eb_stat = malloc(num_elem_blk*sizeof(int)))) {
+ if (!(eb_array = malloc(num_elem_blk*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
"Error: failed to allocate space for element block status array in file id %d",
@@ -105,14 +111,14 @@ int ex_put_concat_elem_block (int exoid,
for (i=0;i<num_elem_blk;i++) {
if (num_elem_this_blk[i] == 0) /* Is this a NULL element block? */
- eb_stat[i] = 0; /* change element block status to NULL */
+ eb_array[i] = 0; /* change element block status to NULL */
else
- eb_stat[i] = 1; /* change element block status to TRUE */
+ eb_array[i] = 1; /* change element block status to TRUE */
}
/* Next, get variable id of status array */
- if ((varid = ncvarid (exoid, VAR_STAT_EL_BLK)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_STAT_EL_BLK, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate element block status in file id %d",
exoid);
@@ -120,22 +126,10 @@ int ex_put_concat_elem_block (int exoid,
return (EX_FATAL);
}
- /* this contortion is necessary because netCDF is expecting nclongs;
- fortunately it's necessary only when ints and nclongs aren't the
- same size */
- start[0] = 0;
- count[0] = num_elem_blk;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, eb_stat);
- } else {
- lptr = itol (eb_stat, num_elem_blk);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
+ status = nc_put_var_int(exoid, varid, eb_array);
- if (iresult == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store element block status array to file id %d",
exoid);
@@ -143,12 +137,10 @@ int ex_put_concat_elem_block (int exoid,
return (EX_FATAL);
}
- free(eb_stat);
-
/* Next, fill out ids array */
/* first get id of ids array variable */
- if ((varid = ncvarid (exoid, VAR_ID_EL_BLK)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_ID_EL_BLK, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate element block ids array in file id %d",
exoid);
@@ -157,22 +149,10 @@ int ex_put_concat_elem_block (int exoid,
}
/* then, write out id list */
- /* this contortion is necessary because netCDF is expecting nclongs;
- fortunately it's necessary only when ints and nclongs aren't the
- same size */
- start[0] = 0;
- count[0] = num_elem_blk;
+ status = nc_put_var_int(exoid, varid, elem_blk_id);
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, elem_blk_id);
- } else {
- lptr = itol (elem_blk_id, num_elem_blk);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store element block id array in file id %d",
exoid);
@@ -181,8 +161,8 @@ int ex_put_concat_elem_block (int exoid,
}
/* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get string length in file id %d",exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
@@ -190,8 +170,8 @@ int ex_put_concat_elem_block (int exoid,
}
/* put netcdf file into define mode */
- if (ncredef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
return (EX_FATAL);
@@ -200,11 +180,11 @@ int ex_put_concat_elem_block (int exoid,
/* Iterate over element blocks ... */
for (iblk = 0; iblk < num_elem_blk; iblk++) {
- cur_num_elem_blk=ex_get_file_item(exoid, &eb_ctr_list );
+ cur_num_elem_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK));
if (cur_num_elem_blk >= num_elem_blk) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of element blocks (%ld) defined in file id %d",
+ "Error: exceeded number of element blocks (%d) defined in file id %d",
num_elem_blk,exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
goto error_ret;
@@ -212,17 +192,17 @@ int ex_put_concat_elem_block (int exoid,
/* NOTE: ex_inc_file_item is used to find the number of element blocks
for a specific file and returns that value incremented. */
- cur_num_elem_blk=ex_inc_file_item(exoid, &eb_ctr_list );
+ cur_num_elem_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK));
if (num_elem_this_blk[iblk] == 0) /* Is this a NULL element block? */
continue;
/* define some dimensions and variables*/
- if ((numelbdim = ncdimdef (exoid,
- DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1),
- (long)num_elem_this_blk[iblk])) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) { /* duplicate entry */
+ if ((status = nc_def_dim(exoid,
+ DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1),
+ num_elem_this_blk[iblk], &numelbdim)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) { /* duplicate entry */
sprintf(errmsg,
"Error: element block %d already defined in file id %d",
elem_blk_id[iblk],exoid);
@@ -235,10 +215,10 @@ int ex_put_concat_elem_block (int exoid,
goto error_ret; /* exit define mode and return */
}
- if ((nelnoddim = ncdimdef (exoid,
- DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1),
- (long)num_nodes_per_elem[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid,
+ DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1),
+ num_nodes_per_elem[iblk], &nelnoddim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of nodes/element for block %d in file id %d",
elem_blk_id[iblk],exoid);
@@ -246,13 +226,37 @@ int ex_put_concat_elem_block (int exoid,
goto error_ret; /* exit define mode and return */
}
- /* element attribute array */
+ /* element connectivity array */
+ dims[0] = numelbdim;
+ dims[1] = nelnoddim;
+ if ((status = nc_def_var (exoid, VAR_CONN(cur_num_elem_blk+1),
+ NC_INT, 2, dims, &connid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create connectivity array for block %d in file id %d",
+ elem_blk_id[iblk],exoid);
+ ex_err("ex_put_concat_elem_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* store element type as attribute of connectivity variable */
+ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(elem_type[iblk])+1,
+ (void*)elem_type[iblk])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store element type name %s in file id %d",
+ elem_type[iblk],exoid);
+ ex_err("ex_put_concat_elem_block",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* element attribute array */
if (num_attr[iblk] > 0) {
- if ((numattrdim = ncdimdef (exoid,
- DIM_NUM_ATT_IN_BLK(cur_num_elem_blk+1),
- (long)num_attr[iblk])) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_dim (exoid,
+ DIM_NUM_ATT_IN_BLK(cur_num_elem_blk+1),
+ num_attr[iblk], &numattrdim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of attributes in block %d in file id %d",
elem_blk_id[iblk],exoid);
@@ -260,71 +264,50 @@ int ex_put_concat_elem_block (int exoid,
goto error_ret; /* exit define mode and return */
}
- dims[0] = numelbdim;
- dims[1] = numattrdim;
+ /* Attribute names... */
+ dims[0] = numattrdim;
+ dims[1] = strdim;
- if ((ncvardef (exoid, VAR_ATTRIB(cur_num_elem_blk+1),
- nc_flt_code(exoid), 2, dims)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid, VAR_NAME_ATTRIB(cur_num_elem_blk+1),
+ NC_CHAR, 2, dims, &temp)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define attributes for element block %d in file id %d",
- elem_blk_id[iblk],exoid);
+ "Error: failed to define element attribute name array in file id %d",exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
+ eb_array[iblk] = temp;
- /* Attribute names... */
- dims[0] = numattrdim;
- dims[1] = strdim;
+ dims[0] = numelbdim;
+ dims[1] = numattrdim;
- if (ncvardef (exoid, VAR_NAME_ATTRIB(cur_num_elem_blk+1), NC_CHAR, 2, dims) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid, VAR_ATTRIB(cur_num_elem_blk+1),
+ nc_flt_code(exoid), 2, dims, &temp)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define element attribute name array in file id %d",exoid);
+ "Error: failed to define attributes for element block %d in file id %d",
+ elem_blk_id[iblk],exoid);
ex_err("ex_put_concat_elem_block",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
- }
-
- /* element connectivity array */
-
- dims[0] = numelbdim;
- dims[1] = nelnoddim;
-
- if ((connid = ncvardef (exoid, VAR_CONN(cur_num_elem_blk+1),
- NC_LONG, 2, dims)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create connectivity array for block %d in file id %d",
- elem_blk_id[iblk],exoid);
- ex_err("ex_put_concat_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- /* store element type as attribute of connectivity variable */
- if ((ncattput (exoid, connid, ATT_NAME_ELB, NC_CHAR, strlen(elem_type[iblk])+1,
- (void*)elem_type[iblk])) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element type name %s in file id %d",
- elem_type[iblk],exoid);
- ex_err("ex_put_concat_elem_block",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
}
+
}
/* Define the element map here to avoid a later redefine call */
if (define_maps != 0) {
- if (ncvarid(exoid, VAR_ELEM_NUM_MAP) == -1) { /* Map does not exist */
+ if (nc_inq_varid(exoid, VAR_ELEM_NUM_MAP, &temp) != NC_NOERR) {
+ /* Map does not exist */
/* Possible to have zero elements but >0 element blocks.
* Only define map if there are nonzero elements
*/
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) != -1) {
+ if (nc_inq_dimid(exoid, DIM_NUM_ELEM, &numelemdim) == NC_NOERR) {
dims[0] = numelemdim;
- if ((ncvardef (exoid, VAR_ELEM_NUM_MAP, NC_LONG, 1, dims)) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) {
+ if ((status = nc_def_var(exoid, VAR_ELEM_NUM_MAP, NC_INT, 1, dims, &temp)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
sprintf(errmsg,
"Error: element numbering map already exists in file id %d",
exoid);
@@ -338,13 +321,15 @@ int ex_put_concat_elem_block (int exoid,
}
}
}
+
/* Do the same for the node numbering map */
- if (ncvarid(exoid, VAR_NODE_NUM_MAP) == -1) { /* Map does not exist */
- if ((numnodedim = ncdimid (exoid, DIM_NUM_NODES)) != -1) {
+ if (nc_inq_varid(exoid, VAR_NODE_NUM_MAP, &temp) != NC_NOERR) {
+ /* Map does not exist */
+ if ((nc_inq_dimid(exoid, DIM_NUM_NODES, &numnodedim)) == NC_NOERR) {
dims[0] = numnodedim;
- if ((ncvardef (exoid, VAR_NODE_NUM_MAP, NC_LONG, 1, dims)) == -1) {
- exerrval = ncerr;
- if (ncerr == NC_ENAMEINUSE) {
+ if ((status = nc_def_var(exoid, VAR_NODE_NUM_MAP, NC_INT, 1, dims, &temp)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
sprintf(errmsg,
"Error: node numbering map already exists in file id %d",
exoid);
@@ -361,8 +346,8 @@ int ex_put_concat_elem_block (int exoid,
}
/* leave define mode */
- if (ncendef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to complete element block definition in file id %d",
exoid);
@@ -370,11 +355,32 @@ int ex_put_concat_elem_block (int exoid,
return (EX_FATAL);
}
+ {
+ /* Write dummy attribute name. Without this we get corruption in the
+ * attribute name.
+ */
+ size_t start[2], count[2];
+ char *text = "";
+ count[0] = 1;
+ start[1] = 0;
+ count[1] = strlen(text)+1;
+
+ for (iblk = 0; iblk < num_elem_blk; iblk++) {
+ if (num_elem_this_blk[iblk] == 0) /* Is this a NULL element block? */
+ continue;
+ for (i = 0; i < num_attr[iblk]; i++) {
+ start[0] = i;
+ nc_put_vara_text(exoid, eb_array[iblk], start, count, text);
+ }
+ }
+ }
+ free(eb_array);
+
return (EX_NOERR);
/* Fatal error: exit definition mode and return */
error_ret:
- if (ncendef (exoid) == -1) { /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
sprintf(errmsg,
"Error: failed to complete definition for file id %d",
exoid);
diff --git a/cbind/src/expcns.c b/cbind/src/expcns.c
index 6bfd91d..2f7416c 100644
--- a/cbind/src/expcns.c
+++ b/cbind/src/expcns.c
@@ -52,7 +52,6 @@
*
* revision history -
*
-* $Id: expcns.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +62,15 @@
/*!
* writes the node set ID's, node set count array, node set pointers array,
* and node set node list for all of the node sets
+ * \param exoid exodus file id
+ * \param node_set_ids array of node set ids
+ * \param num_nodes_per_set array of number of nodes per set
+ * \param num_dist_per_set array of number of dist fact per set
+ * \param node_sets_node_index array of set indices into node list
+ * \param node_sets_df_index array of set indices into dist fact list
+ * \param node_sets_node_list array of node list #'s for node set
+ * \param node_sets_dist_fact array of dist factors for node set
+ * \deprecated Use ex_put_concat_sets()(exoid, EX_NODE_SET, &set_specs)
*/
int ex_put_concat_node_sets (int exoid,
diff --git a/cbind/src/expcon.c b/cbind/src/expcon.c
index d548a11..4b5be25 100644
--- a/cbind/src/expcon.c
+++ b/cbind/src/expcon.c
@@ -36,14 +36,6 @@
*
* expcon - ex_put_coord_names
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: expcon.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,71 +53,67 @@
#include <string.h>
/*!
* writes the names of the coordinate arrays to the database
+ * \param exoid exodus file id
+ * \param coord_names ptr array of coordinate names
*/
int ex_put_coord_names (int exoid,
char *coord_names[])
{
- int i, ndimdim, varid;
- long num_dim, start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
+ int status;
+ size_t i;
+ int ndimdim, varid;
+ size_t num_dim, start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
-/* inquire previously defined dimensions */
+ exerrval = 0; /* clear error code */
- if ((ndimdim = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dimensions in file id %d",
- exoid);
- ex_err("ex_put_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_put_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if (ncdiminq (exoid, ndimdim, (char *) 0, &num_dim) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: inquire failed to get number of dimensions in file id %d",
- exoid);
- ex_err("ex_put_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
+ exoid);
+ ex_err("ex_put_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if ((varid = ncvarid (exoid, VAR_NAME_COOR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if ((status = nc_inq_varid(exoid, VAR_NAME_COOR, &varid)) == -1) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to locate coordinate names in file id %d",
- exoid);
- ex_err("ex_put_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* write out coordinate names */
+ exoid);
+ ex_err("ex_put_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- for (i=0; i<num_dim; i++)
- {
- start[0] = i;
- start[1] = 0;
- count[0] = 1;
- count[1] = strlen(coord_names[i]) + 1;
+ /* write out coordinate names */
- if (ncvarput (exoid, varid, start, count, (void*) coord_names[i]) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store coordinate name %d in file id %d",
- i,exoid);
- ex_err("ex_put_coord_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ for (i=0; i<num_dim; i++) {
+ start[0] = i;
+ start[1] = 0;
- return (EX_NOERR);
+ count[0] = 1;
+ count[1] = strlen(coord_names[i]) + 1;
+ if ((status = nc_put_vara_text(exoid, varid, start, count, coord_names[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store coordinate name %d in file id %d",
+ (int)i,exoid);
+ ex_err("ex_put_coord_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return (EX_NOERR);
}
diff --git a/cbind/src/expconn.c b/cbind/src/expconn.c
index c3491c4..5143c77 100644
--- a/cbind/src/expconn.c
+++ b/cbind/src/expconn.c
@@ -32,206 +32,110 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-/* $Id: expconn.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $ */
#include "exodusII.h"
#include "exodusII_int.h"
#include <stdlib.h> /* for free() */
+/*! write out the connectivity array */
+#define EX_WRITE_CONN(TNAME,VARCONN,VARCONNVAL) \
+ status = nc_put_var_int(exoid, VARCONN, VARCONNVAL); \
+ if (status != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to write connectivity array for %s block %d in file id %d", \
+ TNAME,blk_id,exoid); \
+ ex_err("ex_put_conn",errmsg, exerrval); \
+ return(EX_FATAL); \
+ }
+
/*!
* writes the connectivity array for a block
+ * \param exoid exodus file id
+ * \param blk_type type of block
+ * \param blk_id id of block
+ * \param node_conn node-element connectivity
+ * \param elem_edge_conn element-edge connectivity (NULL if none)
+ * \param elem_face_conn element-face connectivity (NULL if none)
*/
int ex_put_conn (int exoid,
- int blk_type,
+ ex_entity_type blk_type,
int blk_id,
const int *node_conn,
const int *elem_edge_conn,
const int *elem_face_conn)
{
- int numelbdim=-1, nelnoddim=-1, connid=-1, blk_id_ndx, iresult;
- char* var_id_blk;
- long num_entry_this_blk, num_id_per_entry, start[2], count[2];
- nclong *lptr;
+ int connid=-1, blk_id_ndx, status;
char errmsg[MAX_ERR_LENGTH];
- const char* blk_typename;
exerrval = 0; /* clear error code */
- switch (blk_type) {
- case EX_ELEM_BLOCK:
- /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */
- var_id_blk = VAR_ID_EL_BLK;
- blk_typename = "element";
- break;
- case EX_FACE_BLOCK:
- var_id_blk = VAR_ID_FA_BLK;
- blk_typename = "face";
- break;
- case EX_EDGE_BLOCK:
- var_id_blk = VAR_ID_ED_BLK;
- blk_typename = "edge";
- break;
- default:
- sprintf(errmsg,"Error: Invalid block type %d passed for file id %d",
- blk_type,exoid);
- ex_err("ex_put_conn",errmsg,EX_MSG);
- return (EX_FATAL);
- }
-
- blk_id_ndx = ex_id_lkup(exoid,var_id_blk,blk_id);
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
if (exerrval != 0)
{
if (exerrval == EX_NULLENTITY)
{
sprintf(errmsg,
"Warning: connectivity array not allowed for NULL %s block %d in file id %d",
- blk_typename,blk_id,exoid);
+ ex_name_of_object(blk_type),blk_id,exoid);
ex_err("ex_put_conn",errmsg,EX_MSG);
return (EX_WARN);
}
else
{
sprintf(errmsg,
- "Error: failed to locate %s block id %d in %s array in file id %d",
- blk_typename,blk_id,var_id_blk, exoid);
+ "Error: failed to locate %s block id %d in id array in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
ex_err("ex_put_conn",errmsg,exerrval);
return (EX_FATAL);
}
}
/* inquire id's of previously defined dimensions */
-
- switch (blk_type) {
- case EX_ELEM_BLOCK:
- /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */
- numelbdim = ncdimid (exoid, DIM_NUM_EL_IN_BLK(blk_id_ndx));
- break;
- case EX_FACE_BLOCK:
- numelbdim = ncdimid (exoid, DIM_NUM_FA_IN_FBLK(blk_id_ndx));
- break;
- case EX_EDGE_BLOCK:
- numelbdim = ncdimid (exoid, DIM_NUM_ED_IN_EBLK(blk_id_ndx));
- break;
- }
- if (numelbdim == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of %ss in block %d in file id %d",
- blk_typename,blk_id,exoid);
- ex_err("ex_put_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq(exoid, numelbdim, NULL, &num_entry_this_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
- switch (blk_type) {
- case EX_ELEM_BLOCK:
- nelnoddim = ncdimid (exoid, DIM_NUM_NOD_PER_EL(blk_id_ndx));
- break;
- case EX_FACE_BLOCK:
- nelnoddim = ncdimid (exoid, DIM_NUM_NOD_PER_FA(blk_id_ndx));
- break;
- case EX_EDGE_BLOCK:
- nelnoddim = ncdimid (exoid, DIM_NUM_NOD_PER_ED(blk_id_ndx));
- break;
- }
- if (nelnoddim == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes/%s in block %d in file id %d",
- blk_typename,blk_id,exoid);
- ex_err("ex_put_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq (exoid, nelnoddim, NULL, &num_id_per_entry) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes/elem in block %d in file id %d",
- blk_id,exoid);
- ex_err("ex_put_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
- switch (blk_type) {
- case EX_ELEM_BLOCK:
- connid = ncvarid (exoid, VAR_CONN(blk_id_ndx));
- break;
- case EX_FACE_BLOCK:
- connid = ncvarid (exoid, VAR_FBCONN(blk_id_ndx));
- break;
- case EX_EDGE_BLOCK:
- connid = ncvarid (exoid, VAR_EBCONN(blk_id_ndx));
- break;
- }
- if (connid == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
-"Error: failed to locate connectivity array for %s block %d in file id %d",
- blk_typename,blk_id,exoid);
- ex_err("ex_put_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
-
-/* write out the connectivity array */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-#define EX_WRITE_CONN(TNAME,ARRDIM0,ARRDIM1,VARCONN,VARCONNVAL) \
- start[0] = 0; \
- start[1] = 0; \
- \
- count[0] = (ARRDIM0); \
- count[1] = (ARRDIM1); \
- \
- if (sizeof(int) == sizeof(nclong)) { \
- iresult = ncvarput (exoid, VARCONN, start, count, VARCONNVAL); \
- } else { \
- lptr = itol (VARCONNVAL, (int)((ARRDIM0)*(ARRDIM1))); \
- iresult = ncvarput (exoid, VARCONN, start, count, lptr); \
- free(lptr); \
- } \
- \
- if (iresult == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to write connectivity array for %s block %d in file id %d", \
- TNAME,blk_id,exoid); \
- ex_err("ex_put_conn",errmsg, exerrval); \
- return(EX_FATAL); \
+ if (node_conn) {
+ switch (blk_type) {
+ case EX_ELEM_BLOCK:
+ status = nc_inq_varid (exoid, VAR_CONN(blk_id_ndx), &connid);
+ break;
+ case EX_FACE_BLOCK:
+ status = nc_inq_varid (exoid, VAR_FBCONN(blk_id_ndx), &connid);
+ break;
+ case EX_EDGE_BLOCK:
+ status = nc_inq_varid (exoid, VAR_EBCONN(blk_id_ndx), &connid);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_putt_conn",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_put_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ EX_WRITE_CONN(ex_name_of_object(blk_type),connid,node_conn);
}
- EX_WRITE_CONN(blk_typename,num_entry_this_blk,num_id_per_entry,connid,node_conn);
-
/* If there are edge and face connectivity arrays that belong with the element
* block, write them now. Warn if they are required but not specified or
* specified but not required.
*/
if ( blk_type == EX_ELEM_BLOCK ) {
int nedpereldim, nfapereldim;
- long num_ed_per_elem, num_fa_per_elem;
+ size_t num_ed_per_elem, num_fa_per_elem;
- nedpereldim = ncdimid (exoid, DIM_NUM_EDG_PER_EL(blk_id_ndx));
- if (nedpereldim == -1 && elem_edge_conn != 0)
+ status = nc_inq_dimid (exoid, DIM_NUM_EDG_PER_EL(blk_id_ndx), &nedpereldim);
+ if (status != NC_NOERR && elem_edge_conn != 0)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: edge connectivity specified but failed to "
"locate number of edges/element in block %d in file id %d",
@@ -240,10 +144,10 @@ int ex_put_conn (int exoid,
return(EX_FATAL);
}
- nfapereldim = ncdimid (exoid, DIM_NUM_FAC_PER_EL(blk_id_ndx));
- if (nfapereldim == -1 && elem_face_conn != 0)
+ status = nc_inq_dimid (exoid, DIM_NUM_FAC_PER_EL(blk_id_ndx), &nfapereldim);
+ if (status != NC_NOERR && elem_face_conn != 0)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: face connectivity specified but failed to "
"locate number of faces/element in block %d in file id %d",
@@ -252,9 +156,11 @@ int ex_put_conn (int exoid,
return(EX_FATAL);
}
- if (ncdiminq (exoid, nedpereldim, NULL, &num_ed_per_elem) == -1)
+ num_ed_per_elem = 0;
+ if ((elem_edge_conn != 0) &&
+ (status = nc_inq_dimlen(exoid, nedpereldim, &num_ed_per_elem) != NC_NOERR))
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get number of edges/elem in block %d in file id %d",
blk_id,exoid);
@@ -262,11 +168,13 @@ int ex_put_conn (int exoid,
return(EX_FATAL);
}
- if (ncdiminq (exoid, nfapereldim, NULL, &num_fa_per_elem) == -1)
+ num_fa_per_elem = 0;
+ if ((elem_face_conn != 0) &&
+ (status = nc_inq_dimlen(exoid, nfapereldim, &num_fa_per_elem) != NC_NOERR))
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of edges/elem in block %d in file id %d",
+ "Error: failed to get number of faces/elem in block %d in file id %d",
blk_id,exoid);
ex_err("ex_put_conn",errmsg,exerrval);
return(EX_FATAL);
@@ -279,7 +187,7 @@ int ex_put_conn (int exoid,
sprintf(errmsg,
"Error: number of edges per element (%ld) doesn't "
"agree with elem_edge_conn (0x%p)",
- num_ed_per_elem, elem_edge_conn );
+ (long)num_ed_per_elem, (void*)elem_edge_conn );
ex_err("ex_put_conn",errmsg,exerrval);
return (EX_FATAL);
}
@@ -291,16 +199,16 @@ int ex_put_conn (int exoid,
sprintf(errmsg,
"Error: number of faces per element (%ld) doesn't "
"agree with elem_face_conn (0x%p)",
- num_fa_per_elem, elem_face_conn );
+ (long)num_fa_per_elem, (void*)elem_face_conn );
ex_err("ex_put_conn",errmsg,exerrval);
return (EX_FATAL);
}
if ( num_ed_per_elem != 0 ) {
- connid = ncvarid (exoid, VAR_ECONN(blk_id_ndx));
- if (connid == -1)
+ status = nc_inq_varid(exoid, VAR_ECONN(blk_id_ndx), &connid);
+ if (status != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate connectivity array for "
"element edge block %d in file id %d",
@@ -308,14 +216,14 @@ int ex_put_conn (int exoid,
ex_err("ex_put_conn",errmsg, exerrval);
return(EX_FATAL);
}
- EX_WRITE_CONN("element edge",num_entry_this_blk,num_ed_per_elem,connid,elem_edge_conn);
+ EX_WRITE_CONN("element edge",connid,elem_edge_conn);
}
if ( num_fa_per_elem != 0 ) {
- connid = ncvarid (exoid, VAR_FCONN(blk_id_ndx));
- if (connid == -1)
+ status = nc_inq_varid (exoid, VAR_FCONN(blk_id_ndx), &connid);
+ if (status != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate connectivity array for "
"element face block %d in file id %d",
@@ -323,7 +231,7 @@ int ex_put_conn (int exoid,
ex_err("ex_put_conn",errmsg, exerrval);
return(EX_FATAL);
}
- EX_WRITE_CONN("element face",num_entry_this_blk,num_fa_per_elem,connid,elem_face_conn);
+ EX_WRITE_CONN("element face",connid,elem_face_conn);
}
}
diff --git a/cbind/src/expcor.c b/cbind/src/expcor.c
index 43bd1da..3006066 100644
--- a/cbind/src/expcor.c
+++ b/cbind/src/expcor.c
@@ -36,14 +36,6 @@
*
* expcor - ex_put_coord
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: expcor.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,6 +56,10 @@
/*!
* writes the coordinates of all the nodes in the model
* Only writes the 'non-null' arrays.
+ * \param exoid exodus file id
+ * \param x_coor X coord array
+ * \param y_coor y coord array
+ * \param z_coor z coord array
*/
int ex_put_coord (int exoid,
@@ -72,187 +67,169 @@ int ex_put_coord (int exoid,
const void *y_coor,
const void *z_coor)
{
+ int status;
int coordid;
int coordidx, coordidy, coordidz;
- int numnoddim, ndimdim, i;
- long num_nod, num_dim, start[2], count[2];
+ int numnoddim, ndimdim;
+ size_t num_nod, num_dim, start[2], count[2], i;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
/* inquire id's of previously defined dimensions */
- if ((numnoddim = ncdimid (exoid, DIM_NUM_NODES)) == -1)
- {
- /* If not found, then this file is storing 0 nodes.
- Return immediately */
- return (EX_NOERR);
- }
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_NODES, &numnoddim)) != NC_NOERR) {
+ /* If not found, then this file is storing 0 nodes.
+ Return immediately */
+ return (EX_NOERR);
+ }
- if (ncdiminq (exoid, numnoddim, NULL, &num_nod) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: inquire failed to return number of nodes in file id %d",
- exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: inquire failed to return number of nodes in file id %d",
+ exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if ((ndimdim = ncdimid (exoid, DIM_NUM_DIM)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dimensions in file id %d",
- exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if (ncdiminq (exoid, ndimdim, NULL, &num_dim) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dimensions in file id %d",
- exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* write out the coordinates */
if (ex_large_model(exoid) == 0) {
- if ((coordid = ncvarid (exoid, VAR_COORD)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_COORD, &coordid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate nodal coordinates in file id %d", exoid);
ex_err("ex_put_coord",errmsg,exerrval);
return (EX_FATAL);
}
- for (i=0; i<num_dim; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_nod;
-
- if (i == 0 && x_coor != NULL)
- {
- if (ncvarput (exoid, coordid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,x_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put X coord array in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- else if (i == 1 && y_coor != NULL)
- {
- if (ncvarput (exoid, coordid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,y_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put Y coord array in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- else if (i == 2 && z_coor != NULL)
- {
- if (ncvarput (exoid, coordid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,z_coor,(int)num_nod)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put Z coord array in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ for (i=0; i<num_dim; i++) {
+ char *which = 0;
+ start[0] = i;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = num_nod;
+
+ if (i == 0 && x_coor != NULL) {
+ which = "X";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, x_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, x_coor);
+ }
+ }
+ else if (i == 1 && y_coor != NULL) {
+ which = "Y";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, y_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, y_coor);
+ }
}
- } else {
- if ((coordidx = ncvarid (exoid, VAR_COORD_X)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate x nodal coordinates in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
+ else if (i == 2 && z_coor != NULL) {
+ which = "Z";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, z_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, z_coor);
+ }
}
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ } else {
+ if ((status = nc_inq_varid(exoid, VAR_COORD_X, &coordidx)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate x nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
if (num_dim > 1) {
- if ((coordidy = ncvarid (exoid, VAR_COORD_Y)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate y nodal coordinates in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_varid(exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate y nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
} else {
coordidy = 0;
}
if (num_dim > 2) {
- if ((coordidz = ncvarid (exoid, VAR_COORD_Z)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate z nodal coordinates in file id %d", exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_varid(exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate z nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
} else {
coordidz = 0;
}
+
/* write out the coordinates */
- for (i=0; i<num_dim; i++)
- {
- const void *coor;
- char *which;
- int status;
+ for (i=0; i<num_dim; i++) {
+ const void *coor = NULL;
+ char *which = NULL;
- if (i == 0) {
- coor = x_coor;
- which = "X";
- coordid = coordidx;
- } else if (i == 1) {
- coor = y_coor;
- which = "Y";
- coordid = coordidy;
- } else if (i == 2) {
- coor = z_coor;
- which = "Z";
- coordid = coordidz;
- }
-
- if (coor != NULL) {
- if (nc_flt_code(exoid) == NC_FLOAT) {
- status = nc_put_var_float(exoid, coordid,
- ex_conv_array(exoid,WRITE_CONVERT,
- coor,(int)num_nod));
- } else {
- status = nc_put_var_double(exoid, coordid,
- ex_conv_array(exoid,WRITE_CONVERT,
- coor,(int)num_nod));
- }
+ if (i == 0) {
+ coor = x_coor;
+ which = "X";
+ coordid = coordidx;
+ } else if (i == 1) {
+ coor = y_coor;
+ which = "Y";
+ coordid = coordidy;
+ } else if (i == 2) {
+ coor = z_coor;
+ which = "Z";
+ coordid = coordidz;
+ }
- if (status == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put %s coord array in file id %d", which, exoid);
- ex_err("ex_put_coord",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ if (coor != NULL && coordid != 0) {
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_var_float(exoid, coordid, coor);
+ } else {
+ status = nc_put_var_double(exoid, coordid, coor);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
}
+ }
}
return (EX_NOERR);
}
diff --git a/cbind/src/expcset.c b/cbind/src/expcset.c
index ba9de06..eef98c8 100644
--- a/cbind/src/expcset.c
+++ b/cbind/src/expcset.c
@@ -46,7 +46,6 @@
*
* revision history -
*
-* $Id: expcset.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -58,12 +57,17 @@
* writes the set ID's, set entry count array, set entry pointers array,
* set entry list, set extra list, and distribution factors list for
* all the sets of the specified type.
+ * \param exoid exodus file id
+ * \param set_type type of set
+ * \param set_specs set specs structure
*/
int ex_put_concat_sets (int exoid,
- int set_type,
+ ex_entity_type set_type,
const struct ex_set_specs* set_specs)
{
+ int status;
+ int temp;
const int *set_ids = set_specs->sets_ids;
const int *num_entries_per_set = set_specs->num_entries_per_set;
const int *num_dist_per_set = set_specs->num_dist_per_set;
@@ -72,112 +76,84 @@ int ex_put_concat_sets (int exoid,
const int *sets_entry_list = set_specs->sets_entry_list;
const int *sets_extra_list = set_specs->sets_extra_list;
const void *sets_dist_fact = set_specs->sets_dist_fact;
- char *cdum;
- int i, num_sets, cur_num_sets, dimid, varid, set_id_ndx, dims[1], *set_stat;
- int iresult;
- long start[1], count[1];
- nclong *lptr;
+ char *cdum = NULL;
+ int i, num_sets, cur_num_sets, dimid, varid, set_id_ndx, dims[1];
+ int *set_stat = NULL;
float fdum;
- const float *flt_dist_fact;
- const double *dbl_dist_fact;
+ const float *flt_dist_fact = NULL;
+ const double *dbl_dist_fact = NULL;
char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* statptr;
- char* numentryptr;
- char* numdfptr;
- char* factptr;
- char* elemptr;
- char* extraptr;
- struct list_item** ctr_list_ptr;
- int ex_inq_val;
- const int *extra_list;
+ char* idsptr = NULL;
+ char* statptr = NULL;
+ char* numdfptr = NULL;
+ char* factptr = NULL;
+ char* elemptr = NULL;
+ char* extraptr = NULL;
+ ex_inquiry ex_inq_val;
+ const int *extra_list = NULL;
exerrval = 0; /* clear error code */
cdum = 0; /* initialize even though it is not used */
/* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
-
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- ex_inq_val = EX_INQ_NODE_SETS;
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- statptr = VAR_NS_STAT;
- ctr_list_ptr = &ns_ctr_list;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- ex_inq_val = EX_INQ_EDGE_SETS;
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- statptr = VAR_ES_STAT;
- ctr_list_ptr = &es_ctr_list;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- ex_inq_val = EX_INQ_FACE_SETS;
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- statptr = VAR_FS_STAT;
- ctr_list_ptr = &fs_ctr_list;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- ex_inq_val = EX_INQ_SIDE_SETS;
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- statptr = VAR_SS_STAT;
- ctr_list_ptr = &ss_ctr_list;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- ex_inq_val = EX_INQ_ELEM_SETS;
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- statptr = VAR_ELS_STAT;
- ctr_list_ptr = &els_ctr_list;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if (ncdimid (exoid, dimptr) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
+ NOTE: there is another block that sets more stuff later ... */
+
+ if (set_type == EX_NODE_SET) {
+ ex_inq_val = EX_INQ_NODE_SETS;
+ idsptr = VAR_NS_IDS;
+ statptr = VAR_NS_STAT;
+ }
+ else if (set_type == EX_EDGE_SET) {
+ ex_inq_val = EX_INQ_EDGE_SETS;
+ idsptr = VAR_ES_IDS;
+ statptr = VAR_ES_STAT;
+ }
+ else if (set_type == EX_FACE_SET) {
+ ex_inq_val = EX_INQ_FACE_SETS;
+ idsptr = VAR_FS_IDS;
+ statptr = VAR_FS_STAT;
+ }
+ else if (set_type == EX_SIDE_SET) {
+ ex_inq_val = EX_INQ_SIDE_SETS;
+ idsptr = VAR_SS_IDS;
+ statptr = VAR_SS_STAT;
+ }
+ else if (set_type == EX_ELEM_SET) {
+ ex_inq_val = EX_INQ_ELEM_SETS;
+ idsptr = VAR_ELS_IDS;
+ statptr = VAR_ELS_STAT;
+ }
+ else {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: invalid set type (%d)", set_type);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &temp)) != NC_NOERR) {
+ if (status == NC_EBADDIM) {
+ exerrval = status;
sprintf(errmsg,
- "Error: no %s sets defined for file id %d", typeName, exoid);
+ "Error: no %ss defined for file id %d", ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
+ } else {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s sets defined in file id %d",
- typeName, exoid);
+ "Error: failed to locate %ss defined in file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
}
return (EX_FATAL);
}
-
-/* inquire how many sets are to be stored */
-
- if (ex_inquire(exoid, ex_inq_val, &num_sets, &fdum, cdum) == -1)
- {
+
+ /* inquire how many sets are to be stored */
+ if (ex_inquire(exoid, ex_inq_val, &num_sets, &fdum, cdum) != NC_NOERR) {
sprintf(errmsg,
- "Error: failed to get number of %s sets defined for file id %d",
- typeName, exoid);
+ "Error: failed to get number of %ss defined for file id %d",
+ ex_name_of_object(set_type), exoid);
/* use error val from inquire */
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
@@ -186,18 +162,16 @@ int ex_put_concat_sets (int exoid,
/* Fill out set status array */
/* First, allocate space for the status list */
- if (!(set_stat= malloc(num_sets*sizeof(int))))
- {
+ if (!(set_stat= malloc(num_sets*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
- "Error: failed to allocate space for %s set status array in file id %d",
- typeName, exoid);
+ "Error: failed to allocate space for %s status array in file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
- for (i=0;i<num_sets;i++)
- {
+ for (i=0;i<num_sets;i++) {
if (num_entries_per_set[i] == 0) /* Is this a NULL set? */
set_stat[i] = 0; /* change set status to NULL */
else
@@ -205,83 +179,63 @@ int ex_put_concat_sets (int exoid,
}
/* Next, get variable id of status array */
- if ((varid = ncvarid (exoid, statptr)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, statptr, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s set status in file id %d",
- typeName, exoid);
+ "Error: failed to locate %s status in file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
+ status = nc_put_var_int(exoid, varid, set_stat);
- start[0] = 0;
- count[0] = num_sets;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, set_stat);
- } else {
- lptr = itol (set_stat, num_sets);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store %s set status array to file id %d",
- typeName, exoid);
+ "Error: failed to store %s status array to file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_set",errmsg,exerrval);
return (EX_FATAL);
}
free(set_stat);
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
+ /* put netcdf file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
+ "Error: failed to put file id %d into define mode",
+ exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
/* create set definitions */
- for (i=0; i<num_sets; i++)
- {
-/* Keep track of the total number of sets defined using a counter stored
- in a linked list keyed by exoid.
- NOTE: ex_get_file_item is used to find the number of sets of type
- for a specific file and returns that value.
-*/
- cur_num_sets=ex_get_file_item(exoid, ctr_list_ptr );
- if (cur_num_sets >= num_sets)
- {
+ for (i=0; i<num_sets; i++) {
+ /* Keep track of the total number of sets defined using a counter stored
+ in a linked list keyed by exoid.
+ NOTE: ex_get_file_item is used to find the number of sets of type
+ for a specific file and returns that value.
+ */
+ cur_num_sets=ex_get_file_item(exoid, ex_get_counter_list(set_type));
+ if (cur_num_sets >= num_sets) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of %s sets (%d) defined in file id %d",
- typeName, num_sets,exoid);
+ "Error: exceeded number of %ss (%d) defined in file id %d",
+ ex_name_of_object(set_type), num_sets,exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
goto error_ret;
}
-/* NOTE: ex_inc_file_item is used to find the number of sets
- for a specific file and returns that value incremented. */
+ /* NOTE: ex_inc_file_item is used to find the number of sets
+ for a specific file and returns that value incremented. */
- cur_num_sets=ex_inc_file_item(exoid, ctr_list_ptr );
+ cur_num_sets=ex_inc_file_item(exoid, ex_get_counter_list(set_type));
set_id_ndx = cur_num_sets + 1;
/* setup more pointers based on set_type */
-
if (set_type == EX_NODE_SET) {
- numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
elemptr = VAR_NODE_NS(set_id_ndx);
extraptr = NULL;
/* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
@@ -289,58 +243,48 @@ int ex_put_concat_sets (int exoid,
factptr = VAR_FACT_NS(set_id_ndx);
}
else if (set_type == EX_EDGE_SET) {
- numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
elemptr = VAR_EDGE_ES(set_id_ndx);
extraptr = VAR_ORNT_ES(set_id_ndx);
numdfptr = DIM_NUM_DF_ES(set_id_ndx);
factptr = VAR_FACT_ES(set_id_ndx);
}
else if (set_type == EX_FACE_SET) {
- numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
elemptr = VAR_FACE_FS(set_id_ndx);
extraptr = VAR_ORNT_FS(set_id_ndx);
numdfptr = DIM_NUM_DF_FS(set_id_ndx);
factptr = VAR_FACT_FS(set_id_ndx);
}
else if (set_type == EX_SIDE_SET) {
- numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
elemptr = VAR_ELEM_SS(set_id_ndx);
extraptr = VAR_SIDE_SS(set_id_ndx);
numdfptr = DIM_NUM_DF_SS(set_id_ndx);
factptr = VAR_FACT_SS(set_id_ndx);
}
if (set_type == EX_ELEM_SET) {
- numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
elemptr = VAR_ELEM_ELS(set_id_ndx);
extraptr = NULL;
numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
factptr = VAR_FACT_ELS(set_id_ndx);
}
-/* define dimension for number of entries per set */
-
+ /* define dimension for number of entries per set */
if (num_entries_per_set[i] == 0) /* Is this a NULL set? */
continue; /* Do not create anything for NULL sets! */
-
- if ((dimid = ncdimdef (exoid, numentryptr,
- (long)num_entries_per_set[i])) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: %s set entry count %d already defined in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of entries for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
+ if ((status = nc_def_dim(exoid, ex_dim_num_entries_in_object(set_type, set_id_ndx),
+ num_entries_per_set[i], &dimid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: %s entry count %d already defined in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of entries for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
}
goto error_ret;
}
@@ -348,94 +292,72 @@ int ex_put_concat_sets (int exoid,
/* create element list variable for set */
dims[0] = dimid;
- if (ncvardef (exoid,elemptr,NC_LONG,1,dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: element list already exists for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create element list for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
+ if ((status = nc_def_var(exoid,elemptr,NC_INT,1,dims, &temp)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: element list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create element list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
}
goto error_ret; /* exit define mode and return */
}
/* create extra list variable for set (only for edge, face and side sets) */
-
- if (extraptr)
- {
- if (ncvardef (exoid,extraptr,NC_LONG,1,dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
+ if (extraptr) {
+ if ((status = nc_def_var(exoid,extraptr,NC_INT,1,dims, &temp)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
sprintf(errmsg,
- "Error: extra list already exists for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
+ "Error: extra list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
+ } else {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to create extra list for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
+ "Error: failed to create extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
}
goto error_ret; /* exit define mode and return */
}
}
-/* define dimension for number of dist factors per set */
-
-/* NOTE: only define df count if the dist factors exist! */
-
- if (num_dist_per_set[i] > 0)
- {
+ /* define dimension for number of dist factors per set */
+ /* NOTE: only define df count if the dist factors exist! */
+ if (num_dist_per_set[i] > 0) {
- if (set_type == EX_NODE_SET)
- {
- if (num_dist_per_set[i] != num_entries_per_set[i])
- {
+ if (set_type == EX_NODE_SET) {
+ if (num_dist_per_set[i] != num_entries_per_set[i]) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: # dist fact (%d) not equal to # nodes (%d) in node set %d file id %d",
- num_dist_per_set[i], num_entries_per_set[i], set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* resuse dimid from entry lists */
+ "Error: # dist fact (%d) not equal to # nodes (%d) in node set %d file id %d",
+ num_dist_per_set[i], num_entries_per_set[i], set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
- }
- else
- {
- if ((dimid = ncdimdef (exoid, numdfptr,
- (long)num_dist_per_set[i])) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
+ /* resuse dimid from entry lists */
+ } else {
+ if ((status = nc_def_dim(exoid, numdfptr,
+ num_dist_per_set[i], &dimid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
sprintf(errmsg,
- "Error: %s set df count %d already defined in file id %d",
- typeName, set_ids[i],exoid);
+ "Error: %s df count %d already defined in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
+ } else {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define %s set df count for set %d in file id %d",
- typeName, set_ids[i],exoid);
+ "Error: failed to define %s df count for set %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
}
goto error_ret;
@@ -443,80 +365,56 @@ int ex_put_concat_sets (int exoid,
}
/* create distribution factor list variable for set */
-
dims[0] = dimid;
- if (ncvardef (exoid, factptr,
- nc_flt_code(exoid), 1, dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: dist factor list already exists for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create dist factor list for %s set %d in file id %d",
- typeName, set_ids[i],exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
+ if ((status = nc_def_var(exoid, factptr, nc_flt_code(exoid), 1, dims, &temp)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: dist factor list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create dist factor list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
}
} /* end define dist factors */
}
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to complete definition in file id %d",
- exoid);
+ "Error: failed to complete definition in file id %d",
+ exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
-/* Next, fill out set ids array */
+ /* Next, fill out set ids array */
/* first get id of set ids array variable */
-
- if ((varid = ncvarid (exoid, idsptr)) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, idsptr, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s set ids array in file id %d",
- typeName, exoid);
+ "Error: failed to locate %s ids array in file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
/* then, write out set id list */
+ status = nc_put_var_int(exoid, varid, set_ids);
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_sets;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, set_ids);
- } else {
- lptr = itol (set_ids, num_sets);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store %s set id array in file id %d",
- typeName, exoid);
+ "Error: failed to store %s id array in file id %d",
+ ex_name_of_object(set_type), exoid);
ex_err("ex_put_concat_sets",errmsg,exerrval);
return (EX_FATAL);
}
@@ -529,85 +427,70 @@ int ex_put_concat_sets (int exoid,
return(EX_NOERR);
/* Now, use ExodusII call to store sets */
- for (i=0; i<num_sets; i++)
- {
+ for (i=0; i<num_sets; i++) {
- if (num_entries_per_set[i] == 0) /* Is this a NULL set? */
- continue; /* Do not create anything for NULL sets! */
+ if (num_entries_per_set[i] == 0) /* Is this a NULL set? */
+ continue; /* Do not create anything for NULL sets! */
- /* set extra list */
-
- if (set_type == EX_EDGE_SET || set_type == EX_FACE_SET ||
- set_type == EX_SIDE_SET)
- extra_list = &(sets_extra_list[sets_entry_index[i]]);
- else
- extra_list = NULL;
+ /* set extra list */
+ if (set_type == EX_EDGE_SET || set_type == EX_FACE_SET ||
+ set_type == EX_SIDE_SET)
+ extra_list = &(sets_extra_list[sets_entry_index[i]]);
+ else
+ extra_list = NULL;
- if (ex_comp_ws(exoid) == sizeof(float))
- {
- flt_dist_fact = sets_dist_fact;
- if (ex_put_set(exoid, set_type, set_ids[i],
- &(sets_entry_list[sets_entry_index[i]]),
- extra_list) == -1)
- return(EX_FATAL); /* error will be reported by subroutine */
- if (num_dist_per_set[i] > 0) /* store dist factors if required */
- {
- if (ex_put_set_dist_fact(exoid, set_type, set_ids[i],
- &(flt_dist_fact[sets_dist_index[i]])) == -1)
- {
- sprintf(errmsg,
- "Error: failed to store %s set %d dist factors for file id %d",
- typeName, set_ids[i],exoid);
- /* use error val from exodusII routine */
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- }
- else if (ex_comp_ws(exoid) == sizeof(double))
- {
- dbl_dist_fact = sets_dist_fact;
if (ex_put_set(exoid, set_type, set_ids[i],
&(sets_entry_list[sets_entry_index[i]]),
extra_list) == -1)
- return(EX_FATAL); /* error will be reported by subroutine */
- if (num_dist_per_set[i] > 0) /* only store if they exist */
- {
- if (ex_put_set_dist_fact(exoid, set_type, set_ids[i],
- &(dbl_dist_fact[sets_dist_index[i]])) == -1)
- {
- sprintf(errmsg,
- "Error: failed to store %s set %d dist factors for file id %d",
- typeName, set_ids[i],exoid);
- /* use error val from exodusII routine */
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- return (EX_FATAL);
- }
+ return(EX_FATAL); /* error will be reported by subroutine */
+
+ if (ex_comp_ws(exoid) == sizeof(float)) {
+ flt_dist_fact = sets_dist_fact;
+ if (num_dist_per_set[i] > 0) { /* store dist factors if required */
+ if (ex_put_set_dist_fact(exoid, set_type, set_ids[i],
+ &(flt_dist_fact[sets_dist_index[i]])) == -1) {
+ sprintf(errmsg,
+ "Error: failed to store %s %d dist factors for file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ /* use error val from exodusII routine */
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ } else if (ex_comp_ws(exoid) == sizeof(double)) {
+ dbl_dist_fact = sets_dist_fact;
+ if (num_dist_per_set[i] > 0) { /* only store if they exist */
+ if (ex_put_set_dist_fact(exoid, set_type, set_ids[i],
+ &(dbl_dist_fact[sets_dist_index[i]])) == -1) {
+ sprintf(errmsg,
+ "Error: failed to store %s %d dist factors for file id %d",
+ ex_name_of_object(set_type), set_ids[i],exoid);
+ /* use error val from exodusII routine */
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ } else {
+ /* unknown floating point word size */
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: unsupported floating point word size %d for file id %d",
+ ex_comp_ws(exoid), exoid);
+ ex_err("ex_put_concat_sets", errmsg, exerrval);
+ return (EX_FATAL);
}
- }
- else
- {
- /* unknown floating point word size */
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: unsupported floating point word size %d for file id %d",
- ex_comp_ws(exoid), exoid);
- ex_err("ex_put_concat_sets", errmsg, exerrval);
- return (EX_FATAL);
- }
}
-
return(EX_NOERR);
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_concat_sets",errmsg,exerrval);
- }
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ }
return (EX_FATAL);
}
diff --git a/cbind/src/expcss.c b/cbind/src/expcss.c
index fd4b51e..3bea752 100644
--- a/cbind/src/expcss.c
+++ b/cbind/src/expcss.c
@@ -53,7 +53,6 @@
*
* revision history -
*
-* $Id: expcss.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,6 +64,16 @@
* writes the side set ID's, side set element count array,
* side set element pointers array, side set element list,
* side set side list, and distribution factors list.
+ * \param exoid exodus file id
+ * \param side_set_ids array of side set ids
+ * \param num_elem_per_set number of elements/sides/faces per set
+ * \param num_dist_per_set number of distribution factors per set
+ * \param side_sets_elem_index index array of elements into elem list
+ * \param side_sets_dist_index index array of df into df list
+ * \param side_sets_elem_list array of elements
+ * \param side_sets_side_list array of sides/faces
+ * \param side_sets_dist_fact array of distribution factors
+ * \deprecated Use ex_put_concat_sets()(exoid, EX_SIDE_SET, set_specs)
*/
int ex_put_concat_side_sets (int exoid,
diff --git a/cbind/src/expean.c b/cbind/src/expean.c
index ad24adf..ebbecce 100644
--- a/cbind/src/expean.c
+++ b/cbind/src/expean.c
@@ -47,7 +47,6 @@
*
* revision history -
*
-* $Id: expean.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -57,6 +56,10 @@
/*!
* writes the attribute names for an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id element block id
+ * \param names[] ptr array of attribute names
+ * \deprecated Use ex_put_attr_names()(exoid, EX_ELEM_BLOCK, elem_blk_id, names)
*/
int ex_put_elem_attr_names(int exoid,
int elem_blk_id,
diff --git a/cbind/src/expeat.c b/cbind/src/expeat.c
index b21f408..00f12ac 100644
--- a/cbind/src/expeat.c
+++ b/cbind/src/expeat.c
@@ -46,7 +46,6 @@
*
* revision history -
*
-* $Id: expeat.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -55,6 +54,10 @@
/*!
* writes the attributes for an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id element block id
+ * \param attrib array of attributes
+ * \deprecated Use ex_put_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib)
*/
int ex_put_elem_attr (int exoid,
diff --git a/cbind/src/expecpp.c b/cbind/src/expecpp.c
new file mode 100644
index 0000000..4a627b9
--- /dev/null
+++ b/cbind/src/expecpp.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expecpp - ex_put_entity_count_per_polyhedra
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+#include <string.h>
+
+/*!
+ * writes out the number of entities (nodes/faces) per polyhedra
+ * (nsided/nfaced) in this element block to the database.
+ * \param exoid exodus file id
+ * \param blk_type type of block (face, or element)
+ * \param blk_id block identifer
+ * \param entity_counts entity_per_polyhedra count array
+ */
+
+int ex_put_entity_count_per_polyhedra (int exoid,
+ ex_entity_type blk_type,
+ int blk_id,
+ const int *entity_counts)
+{
+ int npeid=-1, blk_id_ndx, status;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id);
+ if (exerrval != 0)
+ {
+ if (exerrval == EX_NULLENTITY)
+ {
+ sprintf(errmsg,
+ "Warning: entity_counts array not allowed for NULL %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_put_entity_count_per_polyhedra",errmsg,EX_MSG);
+ return (EX_WARN);
+ }
+ else
+ {
+ sprintf(errmsg,
+ "Error: failed to locate %s block id %d in id array in file id %d",
+ ex_name_of_object(blk_type),blk_id, exoid);
+ ex_err("ex_put_entity_count_per_polyhedra",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* inquire id's of previously defined dimensions */
+ switch (blk_type) {
+ case EX_ELEM_BLOCK:
+ status = nc_inq_varid (exoid, VAR_EBEPEC(blk_id_ndx), &npeid);
+ break;
+ case EX_FACE_BLOCK:
+ status = nc_inq_varid (exoid, VAR_FBEPEC(blk_id_ndx), &npeid);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized block type in switch: %d in file id %d",
+ blk_type,exoid);
+ ex_err("ex_put_entity_count_per_polyhedra",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate entity_counts array for %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_put_entity_count_per_polyhedra",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ status = nc_put_var_int(exoid, npeid, entity_counts);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to write node counts array for %s block %d in file id %d",
+ ex_name_of_object(blk_type),blk_id,exoid);
+ ex_err("ex_put_entity_count_per_polyhedra",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expelb.c b/cbind/src/expelb.c
index 78e4468..676fbb2 100644
--- a/cbind/src/expelb.c
+++ b/cbind/src/expelb.c
@@ -47,10 +47,6 @@
*
* exit conditions -
*
-* revision history -
-* 20061001 - David Thompson - moved functionality to ex_put_block
-*
-* $Id: expelb.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -60,6 +56,13 @@
/*!
* writes the parameters used to describe an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id block identifier
+ * \param elem_type element type string
+ * \param num_elem_this_blk number of elements in the element blk
+ * \param num_nodes_per_elem number of nodes per element block
+ * \param num_attr_per_elem number of attributes per element
+ * \deprecated Use ex_put_block()(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type, num_elem_this_blk, num_nodes_per_elem, 0, 0, num_attr_per_elem)
*/
int ex_put_elem_block (int exoid,
diff --git a/cbind/src/expelc.c b/cbind/src/expelc.c
index b317577..0e07b41 100644
--- a/cbind/src/expelc.c
+++ b/cbind/src/expelc.c
@@ -32,7 +32,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-/* $Id: expelc.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $ */
#include "exodusII.h"
#include "exodusII_int.h"
@@ -40,127 +39,15 @@
/*!
* writes the connectivity array for an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id element block id
+ * \param *connect connectivity array
+ * \deprecated Use ex_put_conn()(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0)
*/
int ex_put_elem_conn (int exoid,
int elem_blk_id,
const int *connect)
{
- int numelbdim, nelnoddim, connid, elem_blk_id_ndx, iresult;
- long num_elem_this_blk, num_nod_per_elem, start[2], count[2];
- nclong *lptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */
- elem_blk_id_ndx = ex_id_lkup(exoid,VAR_ID_EL_BLK,elem_blk_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
-"Warning: connectivity array not allowed for NULL element block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
-
- sprintf(errmsg,
- "Error: failed to locate element block id %d in %s array in file id %d",
- elem_blk_id,VAR_ID_EL_BLK, exoid);
- ex_err("ex_put_elem_conn",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-/* inquire id's of previously defined dimensions */
-
- if ((numelbdim = ncdimid (exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of elements in block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq(exoid, numelbdim, NULL, &num_elem_this_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
- if ((nelnoddim = ncdimid (exoid, DIM_NUM_NOD_PER_EL(elem_blk_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes/elem in block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if (ncdiminq (exoid, nelnoddim, NULL, &num_nod_per_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes/elem in block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
- if ((connid = ncvarid (exoid, VAR_CONN(elem_blk_id_ndx))) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
-"Error: failed to locate connectivity array for element block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
-
-/* write out the connectivity array */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_elem_this_blk;
- count[1] = num_nod_per_elem;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, connid, start, count, connect);
- } else {
- lptr = itol (connect, (int)(num_elem_this_blk*num_nod_per_elem));
- iresult = ncvarput (exoid, connid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to write connectivity array for block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_conn",errmsg, exerrval);
- return(EX_FATAL);
- }
-
-
- return (EX_NOERR);
-
+ return ex_put_conn(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0);
}
diff --git a/cbind/src/expem.c b/cbind/src/expem.c
index 840058a..34a660a 100644
--- a/cbind/src/expem.c
+++ b/cbind/src/expem.c
@@ -36,11 +36,6 @@
*
* expem - ex_put_elem_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -60,6 +55,10 @@
/*!
* writes an element map; this is a vector of integers of length number
* of elements
+ * \param exoid exodus file id
+ * \param map_id element map id
+ * \param elem_map element map
+ * \deprecated Use ex_put_num_map()(exoid, EX_ELEM_MAP, map_id, elem_map)
*/
int ex_put_elem_map (int exoid,
diff --git a/cbind/src/expenm.c b/cbind/src/expenm.c
index 6f93561..6787adc 100644
--- a/cbind/src/expenm.c
+++ b/cbind/src/expenm.c
@@ -36,14 +36,6 @@
*
* expenm - ex_put_elem_num_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -63,128 +55,14 @@
/*!
* writes out the element numbering map to the database; this allows
* element numbers to be non-contiguous
+ * \param exoid exodus file id
+ * \param elem_map element numbering map array
+ * \deprecated Use ex_put_id_map()(exoid, EX_ELEM_MAP, elem_map)
*/
int ex_put_elem_num_map (int exoid,
const int *elem_map)
{
- int numelemdim, dims[1], mapid, iresult;
- long num_elem, start[1], count[1];
- nclong *lptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* inquire id's of previously defined dimensions */
-
- /* determine number of elements. Return if zero... */
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, numelemdim, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* put netcdf file into define mode */
-
- if ((mapid = ncvarid (exoid, VAR_ELEM_NUM_MAP)) == -1) {
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* create a variable array in which to store the element numbering map */
-
- dims[0] = numelemdim;
-
- if ((mapid = ncvardef (exoid, VAR_ELEM_NUM_MAP, NC_LONG, 1, dims)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: element numbering map already exists in file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create element numbering map in file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
-
- /* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- /* write out the element numbering map */
-
- /* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_elem;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, mapid, start, count, elem_map);
- } else {
- lptr = itol (elem_map, (int)num_elem);
- iresult = ncvarput (exoid, mapid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element numbering map in file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- return (EX_NOERR);
-
- /* Fatal error: exit definition mode and return */
- error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_elem_num_map",errmsg,exerrval);
- }
- return (EX_FATAL);
+ return ex_put_id_map(exoid, EX_ELEM_MAP, elem_map);
}
diff --git a/cbind/src/expev.c b/cbind/src/expev.c
index 1f102c6..59edbeb 100644
--- a/cbind/src/expev.c
+++ b/cbind/src/expev.c
@@ -51,7 +51,6 @@
*
* revision history -
*
-* $Id: expev.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +62,14 @@
* writes the values of a single element variable for one element block at
* one time step to the database; assume the first time step and
* element variable index are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param elem_var_index element variable index
+ * \param elem_blk_id element block id
+ * \param num_elem_this_blk number of elements in this block
+ * \param elem_var_vals the element bariables to be written
+ * \deprecated Use ex_put_var()(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, num_elem_this_blk, elem_var_vals)
+
*/
int ex_put_elem_var (int exoid,
@@ -72,239 +79,6 @@ int ex_put_elem_var (int exoid,
int num_elem_this_blk,
const void *elem_var_vals)
{
- int varid, dimid,time_dim, numelbdim, dims[2], elem_blk_id_ndx;
- long num_elem_blk, num_elem_var, start[2], count[2];
- nclong *elem_var_tab;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */
- elem_blk_id_ndx = ex_id_lkup(exoid,VAR_ID_EL_BLK,elem_blk_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no variables allowed for NULL block %d in file id %d",
- elem_blk_id,exoid);
- ex_err("ex_put_elem_var",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate element block id %d in %s array in file id %d",
- elem_blk_id, VAR_ID_EL_BLK, exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if ((varid = ncvarid (exoid,
- VAR_ELEM_VAR(elem_var_index,elem_blk_id_ndx))) == -1)
- {
- if (ncerr == NC_ENOTVAR) /* variable doesn't exist, create it! */
- {
-
-/* inquire previously defined dimensions */
-
- /* check for the existance of an element variable truth table */
- if ((varid = ncvarid (exoid, VAR_ELEM_TAB)) != -1)
- {
- /* find out number of element blocks and element variables */
- if ((dimid = ncdimid (exoid, DIM_NUM_EL_BLK)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of element blocks in file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_elem_blk) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element blocks in file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((dimid = ncdimid (exoid, DIM_NUM_ELE_VAR)) == -1)
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: no element variables stored in file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_elem_var) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element variables in file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (!(elem_var_tab = malloc(num_elem_blk*num_elem_var*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for element variable truth table in file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* read in the element variable truth table */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_elem_blk;
- count[1] = num_elem_var;
-
- if (ncvarget (exoid, varid, start, count, elem_var_tab) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get truth table from file id %d", exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if(elem_var_tab[num_elem_var*(elem_blk_id_ndx-1)+elem_var_index-1]
- == 0L)
- {
- free(elem_var_tab);
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid element variable %d, block %d in file id %d",
- elem_var_index, elem_blk_id, exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- free(elem_var_tab);
- }
-
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate time dimension in file id %d", exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- if ((numelbdim=ncdimid(exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx))) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: number of elements in element block %d not defined in file id %d",
- elem_blk_id, exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of elements in element block %d in file id %d",
- elem_blk_id, exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- }
- goto error_ret;
- }
-
-/* variable doesn't exist so put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define netCDF variable to store element variable values */
-
- dims[0] = time_dim;
- dims[1] = numelbdim;
- if ((varid = ncvardef(exoid,VAR_ELEM_VAR(elem_var_index,elem_blk_id_ndx),
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define element variable %d in file id %d",
- elem_var_index,exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- goto error_ret;
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete element variable %s definition to file id %d",
- VAR_ELEM_VAR(elem_var_index,elem_blk_id_ndx), exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element variable %s in file id %d",
- VAR_ELEM_VAR(elem_var_index,elem_blk_id_ndx),exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-/* store element variable values */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_elem_this_blk;
-
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,elem_var_vals,
- num_elem_this_blk)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element variable %d in file id %d",
- elem_var_index,exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_elem_var",errmsg,exerrval);
- }
- return (EX_FATAL);
+ return ex_put_var(exoid, time_step, EX_ELEM_BLOCK, elem_var_index,
+ elem_blk_id, num_elem_this_blk, elem_var_vals);
}
diff --git a/cbind/src/expfrm.c b/cbind/src/expfrm.c
index 4d8ecba..c02fc8c 100644
--- a/cbind/src/expfrm.c
+++ b/cbind/src/expfrm.c
@@ -32,26 +32,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+
/*!
*
* expfrm - ex_put_coordinate_frames: write coordinate frames
*
-* author - Sandia National Laboratories
-* Garth Reese - created this function. Nov 2002.
-*
-* environment - UNIX
-*
-* entry conditions -
-* input parameters:
-* int exoid exodus file id
-* int nframes number of coordinate frames in model
-* const int* cf_ids coordinate ids
-* void* pt_coordinates pointer to coordinates. 9 values per
-* coordinate frame
-* const char* tags character tag for each frame.
-* 'r' - rectangular
-* 'c' - cylindrical
-* 's' - spherical
+* \param exoid exodus file id
+* \param nframes number of coordinate frames in model
+* \param cf_ids coordinate ids
+* \param pt_coordinates pointer to coordinates. 9 values per coordinate frame
+* \param tags character tag for each frame. 'r' - rectangular, 'c' - cylindrical, 's' - spherical
*
* returns -
* EX_NOERR for no error
@@ -71,70 +61,66 @@
int ex_put_coordinate_frames( int exoid, int nframes, const int cf_ids[],
void* pt_coordinates, const char* tags)
{
+ int status;
int dim, dim9; /* dimension id for nframes, nframes*9 */
char errmsg[MAX_ERR_LENGTH]; /* buffer for error messages */
- int exerrval; /* returned error value */
int varcoords; /* variable id for the coordinates */
int varids; /* variable id for the frame ids */
int vartags; /* variable id for the frame tags */
- long int start=0; /* start value for varputs */
- long int count=nframes; /* number vars to put in varput */
- long int count9=nframes*9; /* ditto, but for coordinates */
int i; /* general indices */
- void* pt_c=0; /* pointer to size converted array */
-
-
if ( exoid < 0 )
return exoid;
+
if ( nframes == 0 ) /* write nothing */
return (EX_NOERR);
+
if ( nframes<0 )
return 1;
+
assert( cf_ids!=0 );
assert( pt_coordinates !=0 );
assert( tags != 0 );
/* make the definitions */
/* go into define mode. define num_frames, num_frames9 */
- if (ncredef (exoid) == -1){
- exerrval = ncerr;
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,"Error: failed to place file id %d into define mode",
exoid);
ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
- if ( (dim=ncdimdef (exoid, NUM_CFRAMES, nframes)) == -1 ||
- (dim9=ncdimdef (exoid, NUM_CFRAME9, nframes*9))== -1 ){
- exerrval = ncerr;
+ if ((status = nc_def_dim(exoid, DIM_NUM_CFRAMES, nframes, &dim)) != NC_NOERR ||
+ (nc_def_dim(exoid, DIM_NUM_CFRAME9, nframes*9, &dim9) != NC_NOERR)) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define number of coordinate frames in file id %d",
- exoid);
+ "Error: failed to define number of coordinate frames in file id %d",
+ exoid);
ex_err(PROCNAME,errmsg,exerrval);
goto error_ret;
}
-
/* define the variables. coordinates, tags and ids */
- if ((varcoords=ncvardef (exoid, FRAME_COORDS,
- nc_flt_code(exoid), 1, &dim9)) == -1 ||
- (varids=ncvardef (exoid, FRAME_IDS,NC_INT, 1, &dim)) == -1 ||
- (vartags=ncvardef(exoid, FRAME_TAGS,NC_CHAR,1,&dim)) == -1 ) {
- exerrval = ncerr;
+ if (nc_def_var (exoid, VAR_FRAME_COORDS,
+ nc_flt_code(exoid), 1, &dim9, &varcoords) != NC_NOERR ||
+ (nc_def_var(exoid, VAR_FRAME_IDS,NC_INT, 1, &dim, &varids) != NC_NOERR) ||
+ (nc_def_var(exoid, VAR_FRAME_TAGS,NC_CHAR,1,&dim, &vartags) != NC_NOERR) ) {
+ exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: failed to define coordinate frames in file id %d",
- exoid);
+ "Error: failed to define coordinate frames in file id %d",
+ exoid);
ex_err(PROCNAME,errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
/* leave define mode */
- if (ncendef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to complete coordinate frame definition in file id %d",
- exoid);
+ "Error: failed to complete coordinate frame definition in file id %d",
+ exoid);
ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
@@ -144,38 +130,44 @@ int ex_put_coordinate_frames( int exoid, int nframes, const int cf_ids[],
for (i=0;i<nframes;i++)
if ( strchr("RrCcSs",tags[i])==0 ){
sprintf(errmsg,"Warning: Unrecognized coordinate frame tag: '%c'.",
- tags[i]);
+ tags[i]);
exerrval=2;
ex_err(PROCNAME,errmsg,exerrval);
}
/* could also check vectors. Leave this up to the application */
/* put the variables into the file */
- pt_c = ex_conv_array(exoid,RTN_ADDRESS,pt_coordinates,count9);
- if ( ncvarput (exoid, vartags, &start, &count, tags) == -1 ||
- ncvarput (exoid, varids, &start, &count, cf_ids) == -1 ||
- ncvarput (exoid, varcoords, &start, &count9, pt_c )==-1 ){
- exerrval = ncerr;
+ if ( nc_put_var_text(exoid, vartags, tags) != NC_NOERR ||
+ nc_put_var_int(exoid, varids, cf_ids) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed writing frame data in file id %d",exoid);
+ "Error: failed writing frame data in file id %d",exoid);
ex_err(PROCNAME,errmsg,exerrval);
return (EX_FATAL);
}
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_var_float(exoid, varcoords, pt_coordinates);
+ } else {
+ status = nc_put_var_double(exoid, varcoords, pt_coordinates);
+ }
-
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed writing frame data in file id %d",exoid);
+ ex_err(PROCNAME,errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
-
-
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete frame definition for file id %d",
- exoid);
- ex_err(PROCNAME,errmsg,exerrval);
- }
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete frame definition for file id %d",
+ exoid);
+ ex_err(PROCNAME,errmsg,exerrval);
+ }
return (EX_FATAL);
diff --git a/cbind/src/expgv.c b/cbind/src/expgv.c
index 21e4a1c..c6bda24 100644
--- a/cbind/src/expgv.c
+++ b/cbind/src/expgv.c
@@ -36,14 +36,6 @@
*
* expgv - ex_put_glo_vars
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: expgv.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,6 +56,11 @@
/*!
* writes the values of all the global variables for a single time step to
* the database; time step numbers are assumed to start at 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param num_glob_vars number of global vars in file
+ * \param glob_var_vals array of global variable values
+ * \deprecated Use ex_put_var()(exoid, time_step, EX_GLOBAL, 1, 0, num_glob_vars, glob_var_vals)
*/
int ex_put_glob_vars (int exoid,
diff --git a/cbind/src/expidm.c b/cbind/src/expidm.c
new file mode 100644
index 0000000..74c5112
--- /dev/null
+++ b/cbind/src/expidm.c
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2007 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expenm - ex_put_id_map
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* ex_entity_type obj_type
+* int* elem_map element numbering map array
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes out the entity numbering map to the database; this allows
+ * the entity numbers to be non-contiguous. This map is used for
+ * mapping between local and global entity ids.
+ * \param exoid exodus file id
+ * \param map_type
+ * \param map element numbering map array
+ */
+
+int ex_put_id_map (int exoid,
+ ex_entity_type map_type,
+ const int *map)
+{
+ int dimid, mapid, status, dims[1];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* tname;
+ const char* dnumentries;
+ const char* vmap;
+
+ exerrval = 0; /* clear error code */
+
+ switch ( map_type ) {
+ case EX_NODE_MAP:
+ tname = "node";
+ dnumentries = DIM_NUM_NODES;
+ vmap = VAR_NODE_NUM_MAP;
+ break;
+ case EX_EDGE_MAP:
+ tname = "edge";
+ dnumentries = DIM_NUM_EDGE;
+ vmap = VAR_EDGE_NUM_MAP;
+ break;
+ case EX_FACE_MAP:
+ tname = "face";
+ dnumentries = DIM_NUM_FACE;
+ vmap = VAR_FACE_NUM_MAP;
+ break;
+ case EX_ELEM_MAP:
+ tname = "element";
+ dnumentries = DIM_NUM_ELEM;
+ vmap = VAR_ELEM_NUM_MAP;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg,
+ "Error: Bad map type (%d) specified for file id %d",
+ map_type, exoid );
+ ex_err( "ex_put_id_map", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ /* Make sure the file contains entries */
+ if (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR) {
+ return (EX_NOERR);
+ }
+
+ /* put netcdf file into define mode */
+ if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) {
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode",
+ exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* create a variable array in which to store the id map */
+ dims[0] = dimid;
+
+ if ((status = nc_def_var(exoid, vmap, NC_INT, 1, dims, &mapid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: %s numbering map already exists in file id %d",
+ tname, exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create %s id map in file id %d",
+ tname, exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d",
+ exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* write out the entity numbering map */
+ status = nc_put_var_int(exoid, mapid, map);
+
+ if (status!= NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s numbering map in file id %d",
+ tname, exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_id_map",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
+
diff --git a/cbind/src/expinf.c b/cbind/src/expinf.c
index 7c131c1..585e272 100644
--- a/cbind/src/expinf.c
+++ b/cbind/src/expinf.c
@@ -36,14 +36,6 @@
*
* expinf - ex_put_info
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: expinf.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,132 +54,115 @@
/*!
* writes information records to the database
+ * \param exoid exodus file id
+ * \param num_info count of info records to be written.
+ * \param info[] ptr array of info records
*/
int ex_put_info (int exoid,
int num_info,
char *info[])
{
- int i, lindim, num_info_dim, dims[2], varid;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
+ int status;
+ int i, lindim, num_info_dim, dims[2], varid;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
-/* only do this if there are records */
+ exerrval = 0; /* clear error code */
- if (num_info > 0)
- {
-/* inquire previously defined dimensions */
+ /* only do this if there are records */
+ if (num_info > 0) {
- if ((lindim = ncdimid (exoid, DIM_LIN)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid(exoid, DIM_LIN, &lindim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get line string length in file id %d", exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ ex_err("ex_put_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* put file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed put file id %d into define mode", exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define dimensions */
-
- if ((num_info_dim = ncdimdef (exoid, DIM_NUM_INFO, (long)num_info)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE) /* duplicate entry? */
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: info records already exist in file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of info records in file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- }
-
- goto error_ret; /* exit define mode and return */
- }
-
-
-/* define variable */
-
- dims[0] = num_info_dim;
- dims[1] = lindim;
-
- if ((varid = ncvardef (exoid, VAR_INFO, NC_CHAR, 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define info record in file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete info record definition in file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* write out information records */
-
- for (i=0; i<num_info; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = strlen(info[i]) + 1;
-
- if (ncvarput (exoid, varid, start, count, (void*) info[i]) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store info record in file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_info",errmsg,exerrval);
- }
- return (EX_FATAL);
+ ex_err("ex_put_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* define dimensions */
+ if ((status = nc_def_dim(exoid, DIM_NUM_INFO, num_info, &num_info_dim)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) { /* duplicate entry? */
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: info records already exist in file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of info records in file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ }
+
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* define variable */
+ dims[0] = num_info_dim;
+ dims[1] = lindim;
+
+ if ((status = nc_def_var(exoid, VAR_INFO, NC_CHAR, 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define info record in file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete info record definition in file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* write out information records */
+ for (i=0; i<num_info; i++) {
+ int length = strlen(info[i]);
+ start[0] = i;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = length < MAX_LINE_LENGTH ? length : MAX_LINE_LENGTH;
+
+ if ((status = nc_put_vara_text(exoid, varid, start, count, info[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store info record in file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_info",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/expini.c b/cbind/src/expini.c
index 611a166..eec715d 100644
--- a/cbind/src/expini.c
+++ b/cbind/src/expini.c
@@ -49,10 +49,6 @@
*
* exit conditions -
*
-* revision history -
-* David Thompson - Moved to expinix.c (expini.c now a special case)
-*
-* $Id: expini.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,6 +58,14 @@
/*!
* writes the initialization parameters to the EXODUS II file
+ * \param exoid exodus file id
+ * \param title title of file
+ * \param num_dim number of dimensions (per node)
+ * \param num_nodes number of nodes
+ * \param num_elem number of elements
+ * \param num_elem_blk number of element blocks
+ * \param num_node_sets number of node sets
+ * \param num_side_sets number of side sets
*/
int ex_put_init (int exoid,
diff --git a/cbind/src/expinix.c b/cbind/src/expinix.c
index 847244d..944ad68 100644
--- a/cbind/src/expinix.c
+++ b/cbind/src/expinix.c
@@ -46,23 +46,165 @@
* revision history -
* David Thompson - Added edge/face blocks/sets
*
-* $Id: expinix.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
#include "exodusII.h"
#include "exodusII_int.h"
+#include <stdlib.h>
#include <string.h>
+#include <assert.h>
+
+void write_dummy_names(int exoid, ex_entity_type obj_type)
+{
+ const char *routine = "write_dummy_names";
+ size_t start[2], count[2];
+ char *text = "";
+ int varid;
+ size_t num_entity;
+ size_t i;
+
+ ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type),
+ &num_entity, &varid, routine);
+
+ count[0] = 1;
+ start[1] = 0;
+ count[1] = strlen(text)+1;
+
+ for (i = 0; i < num_entity; i++) {
+ start[0] = i;
+ nc_put_vara_text(exoid, varid, start, count, text);
+ }
+}
+
+#define EX_WRITE_OBJECT_PARAMS(TNAME,DNAME,SNAME,INAME,NUM_BLK,DIMVAR) \
+ /* Can have nonzero model->num_elem_blk even if model->num_elem == 0 */ \
+ if ((NUM_BLK) > 0) { \
+ if ((status = nc_def_dim(exoid, DNAME, (size_t)(NUM_BLK), &DIMVAR)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define number of " TNAME "s in file id %d", \
+ exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ /* ...and some variables */ \
+ /* element block id status array */ \
+ dim[0] = DIMVAR; \
+ if ((status = nc_def_var (exoid, SNAME, NC_INT, 1, dim, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define " TNAME " status array in file id %d",exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ /* TNAME id array */ \
+ if ((status = nc_def_var (exoid, INAME, NC_INT, 1, dim, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define " TNAME " id array in file id %d",exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ /* store property name as attribute of property array variable */ \
+ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to store " TNAME " property name %s in file id %d", \
+ "ID",exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ }
+
+#define EX_WRITE_MAP_PARAMS(TNAME,DNUMMAP,VMAPIDS,NUMMAPS,MAPDIM) \
+ /* Can have nonzero model->num_XXXX_map even if model->num_XXXX == 0 */ \
+ if ((NUMMAPS) > 0) { \
+ if ((status = nc_def_dim(exoid, DNUMMAP, (size_t)(NUMMAPS), &MAPDIM)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define number of " TNAME "s in file id %d", \
+ exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ dim[0] = MAPDIM; \
+ \
+ /* TNAME id array */ \
+ if ((status = nc_def_var(exoid, VMAPIDS, NC_INT, 1, dim, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define " TNAME " id array in file id %d",exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ /* store property name as attribute of property array variable */ \
+ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to store " TNAME " property name %s in file id %d", \
+ "ID",exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ }
+
+#define EX_WRITE_OBJECT_NAMES(TNAME,DNAME,DIMVAR,DIMVAL) \
+ /* Element block names... */ \
+ if ((DIMVAL) > 0) { \
+ dim[0] = (DIMVAR); \
+ dim[1] = strdim; \
+ \
+ if ((status = nc_def_var (exoid, DNAME, NC_CHAR, 2, dim, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define %s name array in file id %d",TNAME,exoid); \
+ ex_err("ex_put_init_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ }
+
+static void zero_id_status(int exoid, const char *var_stat, const char *var_id,
+ int count, int *ids)
+{
+ int status;
+ int i;
+ int id_var, stat_var;
+
+ if (count > 0) {
+ for (i=0; i < count; i++) {
+ ids[i] = 0;
+ }
+
+ status = nc_inq_varid(exoid, var_id, &id_var);
+ assert(status == NC_NOERR);
+ status = nc_inq_varid(exoid, var_stat, &stat_var);
+ assert(status == NC_NOERR);
+
+ status = nc_put_var_int(exoid, id_var, ids);
+ assert(status == NC_NOERR);
+ status = nc_put_var_int(exoid, stat_var, ids);
+ assert(status == NC_NOERR);
+ }
+}
/*!
* writes the initialization parameters to the EXODUS II file
+ * \param exoid exodus file id
+ * \param model finite element model parameters
*/
int ex_put_init_ext (int exoid,
const ex_init_params *model)
{
- int numdimdim, numnoddim, elblkdim, edblkdim, fablkdim, esetdim, fsetdim, elsetdim, nsetdim, ssetdim, strdim, dim[2], varid;
+ int numdimdim, numnoddim, elblkdim, edblkdim, fablkdim, esetdim, fsetdim, elsetdim, nsetdim, ssetdim, strdim, dim[2], varid, temp;
+ int status;
int nmapdim,edmapdim,famapdim,emapdim;
+ int title_len;
#if 0
/* used for header size calculations which are turned off for now */
int header_size, fixed_var_size, iows;
@@ -71,7 +213,7 @@ int ex_put_init_ext (int exoid,
exerrval = 0; /* clear error code */
- if ((ncdimid (exoid, DIM_NUM_DIM)) != -1)
+ if (nc_inq_dimid (exoid, DIM_NUM_DIM, &temp) == NC_NOERR)
{
exerrval = EX_MSG;
sprintf(errmsg,
@@ -83,22 +225,22 @@ int ex_put_init_ext (int exoid,
/* put file into define mode */
- if (ncredef (exoid) == -1)
+ if ((status = nc_redef (exoid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to put file id %d into define mode", exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
return (EX_FATAL);
}
-
/* define some attributes... */
-
- if (ncattput (exoid, NC_GLOBAL, (const char*) ATT_TITLE,
- NC_CHAR, strlen(model->title)+1, (void *)model->title) == -1)
+ title_len = strlen(model->title) < MAX_LINE_LENGTH ?
+ strlen(model->title) : MAX_LINE_LENGTH;
+ if ((status = nc_put_att_text(exoid, NC_GLOBAL, (const char*)ATT_TITLE,
+ title_len+1, model->title)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define model->title attribute to file id %d", exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -107,9 +249,9 @@ int ex_put_init_ext (int exoid,
/* ...and some dimensions... */
- if ((numdimdim = ncdimdef (exoid, DIM_NUM_DIM, (long)model->num_dim)) == -1)
+ if ((status = nc_def_dim(exoid, DIM_NUM_DIM, model->num_dim, &numdimdim)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of dimensions in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -125,9 +267,9 @@ int ex_put_init_ext (int exoid,
*/
if (model->num_nodes > 0) {
- if ((numnoddim = ncdimdef (exoid, DIM_NUM_NODES, (long)model->num_nodes)) == -1)
+ if ((status = nc_def_dim(exoid, DIM_NUM_NODES, model->num_nodes, &numnoddim)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of nodes in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -144,9 +286,9 @@ int ex_put_init_ext (int exoid,
goto error_ret; /* exit define mode and return */
}
- if ((ncdimdef (exoid, DIM_NUM_ELEM, (long)model->num_elem)) == -1)
+ if ((status = nc_def_dim(exoid, DIM_NUM_ELEM, model->num_elem, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of elements in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -163,9 +305,9 @@ int ex_put_init_ext (int exoid,
goto error_ret; /* exit define mode and return */
}
- if ((ncdimdef (exoid, DIM_NUM_EDGE, (long)model->num_edge)) == -1)
+ if ((status = nc_def_dim(exoid, DIM_NUM_EDGE, model->num_edge, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of edges in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -182,9 +324,9 @@ int ex_put_init_ext (int exoid,
goto error_ret; /* exit define mode and return */
}
- if ((ncdimdef (exoid, DIM_NUM_FACE, (long)model->num_face)) == -1)
+ if ((status = nc_def_dim(exoid, DIM_NUM_FACE, model->num_face, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of faces in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -192,123 +334,20 @@ int ex_put_init_ext (int exoid,
}
}
-#define EX_WRITE_OBJECT_PARAMS(TNAME,DNAME,SNAME,INAME,NUM_BLK,DIMVAR) \
- /* Can have nonzero model->num_elem_blk even if model->num_elem == 0 */ \
- if ((NUM_BLK) > 0) { \
- if ((DIMVAR = ncdimdef (exoid, DNAME, (long)(NUM_BLK))) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define number of " TNAME "s in file id %d", \
- exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* ...and some variables */ \
- \
- /* element block id status array */ \
- \
- dim[0] = DIMVAR; \
- if ((varid = ncvardef (exoid, SNAME, NC_LONG, 1, dim)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " status array in file id %d",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* store property name as attribute of property array variable */ \
- /* \
- if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 7, "STATUS")) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to store " TNAME " property name %s in file id %d", \
- "STATUS",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- */ \
- \
- /* TNAME id array */ \
- \
- if ((varid = ncvardef (exoid, INAME, NC_LONG, 1, dim)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " id array in file id %d",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* store property name as attribute of property array variable */ \
- if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to store " TNAME " property name %s in file id %d", \
- "ID",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- }
-
- EX_WRITE_OBJECT_PARAMS( "element block", DIM_NUM_EL_BLK, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, model->num_elem_blk, elblkdim );
- EX_WRITE_OBJECT_PARAMS( "edge block", DIM_NUM_ED_BLK, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, model->num_edge_blk, edblkdim );
- EX_WRITE_OBJECT_PARAMS( "face block", DIM_NUM_FA_BLK, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, model->num_face_blk, fablkdim );
+ EX_WRITE_OBJECT_PARAMS("element block", DIM_NUM_EL_BLK, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, model->num_elem_blk, elblkdim);
+ EX_WRITE_OBJECT_PARAMS("edge block", DIM_NUM_ED_BLK, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, model->num_edge_blk, edblkdim);
+ EX_WRITE_OBJECT_PARAMS("face block", DIM_NUM_FA_BLK, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, model->num_face_blk, fablkdim);
- EX_WRITE_OBJECT_PARAMS( "node set", DIM_NUM_NS, VAR_NS_STAT, VAR_NS_IDS, model->num_node_sets, nsetdim );
- EX_WRITE_OBJECT_PARAMS( "edge set", DIM_NUM_ES, VAR_ES_STAT, VAR_ES_IDS, model->num_edge_sets, esetdim );
- EX_WRITE_OBJECT_PARAMS( "face set", DIM_NUM_FS, VAR_FS_STAT, VAR_FS_IDS, model->num_face_sets, fsetdim );
- EX_WRITE_OBJECT_PARAMS( "side set", DIM_NUM_SS, VAR_SS_STAT, VAR_SS_IDS, model->num_side_sets, ssetdim );
- EX_WRITE_OBJECT_PARAMS( "elem set", DIM_NUM_ELS, VAR_ELS_STAT, VAR_ELS_IDS, model->num_elem_sets, elsetdim );
+ EX_WRITE_OBJECT_PARAMS("node set", DIM_NUM_NS, VAR_NS_STAT, VAR_NS_IDS, model->num_node_sets, nsetdim);
+ EX_WRITE_OBJECT_PARAMS("edge set", DIM_NUM_ES, VAR_ES_STAT, VAR_ES_IDS, model->num_edge_sets, esetdim);
+ EX_WRITE_OBJECT_PARAMS("face set", DIM_NUM_FS, VAR_FS_STAT, VAR_FS_IDS, model->num_face_sets, fsetdim);
+ EX_WRITE_OBJECT_PARAMS("side set", DIM_NUM_SS, VAR_SS_STAT, VAR_SS_IDS, model->num_side_sets, ssetdim);
+ EX_WRITE_OBJECT_PARAMS("elem set", DIM_NUM_ELS, VAR_ELS_STAT, VAR_ELS_IDS, model->num_elem_sets, elsetdim);
-#define EX_WRITE_MAP_PARAMS(TNAME,DNUMMAP,VMAPIDS,NUMMAPS,MAPDIM) \
- /* Can have nonzero model->num_XXXX_map even if model->num_XXXX == 0 */ \
- if ((NUMMAPS) > 0) { \
- if ((MAPDIM = ncdimdef (exoid, DNUMMAP, (long)(NUMMAPS))) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define number of " TNAME "s in file id %d", \
- exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* ...and some variables */ \
- \
- dim[0] = MAPDIM; \
- \
- /* TNAME id array */ \
- \
- if ((varid = ncvardef (exoid, VMAPIDS, NC_LONG, 1, dim)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " id array in file id %d",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* store property name as attribute of property array variable */ \
- if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to store " TNAME " property name %s in file id %d", \
- "ID",exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- }
-
- EX_WRITE_MAP_PARAMS( "node map", DIM_NUM_NM, VAR_NM_PROP(1), model->num_node_maps, nmapdim );
- EX_WRITE_MAP_PARAMS( "edge map", DIM_NUM_EDM, VAR_EDM_PROP(1), model->num_edge_maps, edmapdim );
- EX_WRITE_MAP_PARAMS( "face map", DIM_NUM_FAM, VAR_FAM_PROP(1), model->num_face_maps, famapdim );
- EX_WRITE_MAP_PARAMS( "element map", DIM_NUM_EM, VAR_EM_PROP(1), model->num_elem_maps, emapdim );
+ EX_WRITE_MAP_PARAMS( "node map", DIM_NUM_NM, VAR_NM_PROP(1), model->num_node_maps, nmapdim);
+ EX_WRITE_MAP_PARAMS( "edge map", DIM_NUM_EDM, VAR_EDM_PROP(1), model->num_edge_maps, edmapdim);
+ EX_WRITE_MAP_PARAMS( "face map", DIM_NUM_FAM, VAR_FAM_PROP(1), model->num_face_maps, famapdim);
+ EX_WRITE_MAP_PARAMS("element map", DIM_NUM_EM, VAR_EM_PROP(1), model->num_elem_maps, emapdim);
/*
* To reduce the maximum dataset sizes, the storage of the nodal
@@ -329,26 +368,11 @@ int ex_put_init_ext (int exoid,
if (ex_large_model(exoid) == 1) {
/* node coordinate arrays -- separate storage... */
- /*
- * Check that storage required for coordinates is less
- * than 2GB which is maximum size permitted by netcdf
- * (in large file mode). 1<<29 == max number of integer items.
- */
- int shift = nc_flt_code(exoid) == NC_DOUBLE ? 28 : 29;
- if (model->num_nodes > (1<<shift)) {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Size to store nodal coordinates exceeds 2GB in file id %d",
- exoid);
- ex_err("ex_put_init_ext",errmsg,exerrval);
- return (EX_FATAL);
- }
-
dim[0] = numnoddim;
if (model->num_dim > 0) {
- if (ncvardef (exoid, VAR_COORD_X, nc_flt_code(exoid), 1, dim) == -1)
+ if ((status = nc_def_var (exoid, VAR_COORD_X, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define node x coordinate array in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -357,9 +381,9 @@ int ex_put_init_ext (int exoid,
}
if (model->num_dim > 1) {
- if (ncvardef (exoid, VAR_COORD_Y, nc_flt_code(exoid), 1, dim) == -1)
+ if ((status = nc_def_var(exoid, VAR_COORD_Y, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define node y coordinate array in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -368,9 +392,9 @@ int ex_put_init_ext (int exoid,
}
if (model->num_dim > 2) {
- if (ncvardef (exoid, VAR_COORD_Z, nc_flt_code(exoid), 1, dim) == -1)
+ if ((status = nc_def_var(exoid, VAR_COORD_Z, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define node z coordinate array in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -382,9 +406,9 @@ int ex_put_init_ext (int exoid,
dim[0] = numdimdim;
dim[1] = numnoddim;
- if (ncvardef (exoid, VAR_COORD, nc_flt_code(exoid), 2, dim) == -1)
+ if ((status = nc_def_var(exoid, VAR_COORD, nc_flt_code(exoid), 2, dim, &temp)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define node coordinate array in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
@@ -394,44 +418,14 @@ int ex_put_init_ext (int exoid,
}
/* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0)
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid (exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get string length in file id %d",exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
- /* coordinate names array */
-
- dim[0] = numdimdim;
- dim[1] = strdim;
-
- if (ncvardef (exoid, VAR_NAME_COOR, NC_CHAR, 2, dim) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define coordinate name array in file id %d",exoid);
- ex_err("ex_put_init_ext",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
-
-#define EX_WRITE_OBJECT_NAMES(TNAME,DNAME,DIMVAR,DIMVAL) \
- /* Element block names... */ \
- if ((DIMVAL) > 0) { \
- dim[0] = (DIMVAR); \
- dim[1] = strdim; \
- \
- if (ncvardef (exoid, DNAME, NC_CHAR, 2, dim) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define %s name array in file id %d",TNAME,exoid); \
- ex_err("ex_put_init_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- }
EX_WRITE_OBJECT_NAMES("element block",VAR_NAME_EL_BLK,elblkdim,model->num_elem_blk);
EX_WRITE_OBJECT_NAMES("edge block", VAR_NAME_ED_BLK,edblkdim,model->num_edge_blk);
@@ -445,70 +439,72 @@ int ex_put_init_ext (int exoid,
EX_WRITE_OBJECT_NAMES("edge map", VAR_NAME_EDM, edmapdim,model->num_edge_maps);
EX_WRITE_OBJECT_NAMES("face map", VAR_NAME_FAM, famapdim,model->num_face_maps);
EX_WRITE_OBJECT_NAMES("element map", VAR_NAME_EM, emapdim, model->num_elem_maps);
-
+ EX_WRITE_OBJECT_NAMES("coordinate", VAR_NAME_COOR, numdimdim,model->num_dim);
+
/* leave define mode */
-#if 1
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete variable definitions in file id %d",exoid);
- ex_err("ex_put_init_ext",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete variable definitions in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ return (EX_FATAL);
+ }
-#else
- /* estimate (guess) size of header of netCDF file */
- header_size = 1200 +
- model->num_elem_blk * 800 +
- model->num_node_sets * 220 +
- model->num_side_sets * 300;
-
- if (header_size > MAX_HEADER_SIZE) header_size = MAX_HEADER_SIZE;
-
- /* estimate (guess) size of fixed size variable section of netCDF file */
-
- if (nc_flt_code(exoid) == NC_DOUBLE)
- iows = 8;
- else
- iows = 4;
-
- fixed_var_size = model->num_dim * model->num_nodes * iows +
- model->num_nodes * sizeof(int) +
- model->num_elem * 16 * sizeof(int) +
- model->num_elem_blk * sizeof(int) +
- model->num_node_sets * model->num_nodes/100 * sizeof(int) +
- model->num_node_sets * model->num_nodes/100 * iows +
- model->num_node_sets * sizeof(int) +
- model->num_side_sets * model->num_elem/100 * 2 * sizeof(int) +
- model->num_side_sets * model->num_elem/100 * iows +
- model->num_side_sets * sizeof(int);
-
-
-
- /* With netcdf-3.4, this produces very large files on the
- * SGI. Also with netcdf-3.5beta3
- */
- /*
- * This is also causing other problems on other systems .. disable for now
- */
- if (nc__enddef (exoid,
- header_size, NC_ALIGN_CHUNK,
- fixed_var_size, NC_ALIGN_CHUNK) == -1)
- {
- exerrval = ncerr;
+ /* Fill the id and status arrays with zeros */
+ {
+ int *zeros = NULL;
+ int maxset = model->num_elem_blk;
+ if (maxset < model->num_edge_blk) maxset = model->num_edge_blk;
+ if (maxset < model->num_face_blk) maxset = model->num_face_blk;
+ if (maxset < model->num_node_sets) maxset = model->num_node_sets;
+ if (maxset < model->num_edge_sets) maxset = model->num_edge_sets;
+ if (maxset < model->num_face_sets) maxset = model->num_face_sets;
+ if (maxset < model->num_side_sets) maxset = model->num_side_sets;
+ if (maxset < model->num_elem_sets) maxset = model->num_elem_sets;
+
+ /* allocate space for id/status array */
+ if (!(zeros = malloc(maxset*sizeof(int)))) {
+ exerrval = EX_MEMFAIL;
sprintf(errmsg,
- "Error: failed to complete variable definitions in file id %d",exoid);
+ "Error: failed to allocate memory for id/status array for file id %d", exoid);
ex_err("ex_put_init_ext",errmsg,exerrval);
return (EX_FATAL);
}
-
-#endif
+
+ zero_id_status(exoid, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, model->num_elem_blk, zeros);
+ zero_id_status(exoid, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, model->num_edge_blk, zeros);
+ zero_id_status(exoid, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, model->num_face_blk, zeros);
+
+ zero_id_status(exoid, VAR_NS_STAT, VAR_NS_IDS, model->num_node_sets, zeros);
+ zero_id_status(exoid, VAR_ES_STAT, VAR_ES_IDS, model->num_edge_sets, zeros);
+ zero_id_status(exoid, VAR_FS_STAT, VAR_FS_IDS, model->num_face_sets, zeros);
+ zero_id_status(exoid, VAR_SS_STAT, VAR_SS_IDS, model->num_side_sets, zeros);
+ zero_id_status(exoid, VAR_ELS_STAT, VAR_ELS_IDS, model->num_elem_sets, zeros);
+ if (zeros != NULL) {
+ free(zeros);
+ zeros = NULL;
+ }
+ }
+ {
+ /* Write dummy values to the names arrays to avoid corruption issues on some platforms */
+ if (model->num_elem_blk > 0) write_dummy_names(exoid, EX_ELEM_BLOCK);
+ if (model->num_edge_blk > 0) write_dummy_names(exoid, EX_EDGE_BLOCK);
+ if (model->num_face_blk > 0) write_dummy_names(exoid, EX_FACE_BLOCK);
+ if (model->num_node_sets> 0) write_dummy_names(exoid, EX_NODE_SET);
+ if (model->num_edge_sets> 0) write_dummy_names(exoid, EX_EDGE_SET);
+ if (model->num_face_sets> 0) write_dummy_names(exoid, EX_FACE_SET);
+ if (model->num_side_sets> 0) write_dummy_names(exoid, EX_SIDE_SET);
+ if (model->num_elem_sets> 0) write_dummy_names(exoid, EX_ELEM_SET);
+ if (model->num_node_maps> 0) write_dummy_names(exoid, EX_NODE_MAP);
+ if (model->num_edge_maps> 0) write_dummy_names(exoid, EX_EDGE_MAP);
+ if (model->num_face_maps> 0) write_dummy_names(exoid, EX_FACE_MAP);
+ if (model->num_elem_maps> 0) write_dummy_names(exoid, EX_ELEM_MAP);
+ }
return (EX_NOERR);
-
+
/* Fatal error: exit definition mode and return */
error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
{
sprintf(errmsg,
"Error: failed to complete definition for file id %d",
@@ -517,3 +513,4 @@ int ex_put_init_ext (int exoid,
}
return (EX_FATAL);
}
+
diff --git a/cbind/src/expmap.c b/cbind/src/expmap.c
index e9018e0..98f62cd 100644
--- a/cbind/src/expmap.c
+++ b/cbind/src/expmap.c
@@ -36,14 +36,6 @@
*
* expmap - ex_put_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +45,6 @@
*
* revision history -
*
-* $Id: expmap.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,127 +53,103 @@
#include <stdlib.h> /* for free() */
/*!
- * writes out the element order map to the database
+ * writes out the element order map to the database.
+ * \param exoid exodus file id
+ * \param elem_map element order map array
+ * \deprecated Use ex_put_num_map() instead.
*/
int ex_put_map (int exoid,
const int *elem_map)
{
- int numelemdim, dims[1], mapid, iresult;
- long num_elem, start[1], count[1];
- nclong *lptr;
- char errmsg[MAX_ERR_LENGTH];
+ int numelemdim, dims[1], mapid, status;
+ char errmsg[MAX_ERR_LENGTH];
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
-/* inquire id's of previously defined dimensions */
+ /* inquire id's of previously defined dimensions */
/* determine number of elements. Return if zero... */
- if ((numelemdim = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
- {
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, numelemdim, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* create a variable array in which to store the element map */
-
- dims[0] = numelemdim;
-
- if ((mapid = ncvardef (exoid, VAR_MAP, NC_LONG, 1, dims)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: element map already exists in file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create element map array in file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* write out the element order map */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_elem;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, mapid, start, count, elem_map);
- } else {
- lptr = itol (elem_map, (int)num_elem);
- iresult = ncvarput (exoid, mapid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element map in file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_map",errmsg,exerrval);
- }
- return (EX_FATAL);
+ if (nc_inq_dimid(exoid, DIM_NUM_ELEM, &numelemdim) != NC_NOERR)
+ {
+ return (EX_NOERR);
+ }
+
+ /* put netcdf file into define mode */
+
+ if ((status = nc_redef (exoid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* create a variable array in which to store the element map */
+
+ dims[0] = numelemdim;
+
+ if ((status = nc_def_var(exoid, VAR_MAP, NC_INT, 1, dims, &mapid)) != NC_NOERR)
+ {
+ if (status == NC_ENAMEINUSE)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: element map already exists in file id %d",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ }
+ else
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create element map array in file id %d",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* write out the element order map */
+ status = nc_put_var_int(exoid, mapid, elem_map);
+
+ if (status != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store element map in file id %d",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_map",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/expmp.c b/cbind/src/expmp.c
index 6268799..8b7cab2 100644
--- a/cbind/src/expmp.c
+++ b/cbind/src/expmp.c
@@ -36,11 +36,6 @@
*
* expmp - ex_put_map_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,23 +51,29 @@
#include "exodusII_int.h"
/*!
- * defines the number of node and element maps
+ * defines the number of node and element maps. It is more efficient
+ * to define both of these at the same time; however, they can be
+ * defined in separate calls by setting only one of the counts to a
+ * non-zero value. It is an error to redefine the number of node or
+ * element maps.
+ * \param exoid exodus file id
+ * \param num_node_maps number of node maps
+ * \param num_elem_maps number of element maps
*/
int ex_put_map_param (int exoid,
int num_node_maps,
int num_elem_maps)
{
- int dim[2], dimid, strdim, varid;
- long num_nodes, num_elem;
+ int dim[2], dimid, strdim, varid, status;
int i;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
/* return if these have been defined before */
- if ( ((ncdimid (exoid, DIM_NUM_NM)) != -1) ||
- ((ncdimid (exoid, DIM_NUM_EM)) != -1) )
+ if ( (num_node_maps > 0 && ((nc_inq_dimid (exoid, DIM_NUM_NM, &dimid)) == NC_NOERR)) ||
+ (num_elem_maps > 0 && ((nc_inq_dimid (exoid, DIM_NUM_EM, &dimid)) == NC_NOERR)) )
{
exerrval = EX_MSG;
sprintf(errmsg,
@@ -81,13 +82,12 @@ int ex_put_map_param (int exoid,
return (EX_FATAL);
}
- if ( (num_node_maps > 0) || (num_elem_maps > 0) )
- {
+ if ( (num_node_maps > 0) || (num_elem_maps > 0) ) {
/* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0)
+ if ((status = nc_inq_dimid (exoid, DIM_STR, &strdim)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get string length in file id %d",exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
@@ -95,23 +95,22 @@ int ex_put_map_param (int exoid,
}
/* put file into define mode */
- if (ncredef (exoid) == -1)
+ if ((status = nc_redef (exoid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to put file id %d into define mode", exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
return (EX_FATAL);
}
-
-
+
+
/* node maps: */
- if (num_node_maps > 0)
- {
-
- if ((dimid = ncdimdef (exoid, DIM_NUM_NM, (long)num_node_maps)) == -1)
- {
- exerrval = ncerr;
+ if (num_node_maps > 0) {
+
+ if ((status = nc_def_dim(exoid, DIM_NUM_NM, num_node_maps, &dimid)) != NC_NOERR)
+ {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of node maps in file id %d",exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
@@ -120,9 +119,9 @@ int ex_put_map_param (int exoid,
/* node maps id array: */
dim[0] = dimid;
- if ((varid = ncvardef (exoid, VAR_NM_PROP(1), NC_LONG, 1, dim)) == -1)
+ if ((status = nc_def_var(exoid, VAR_NM_PROP(1), NC_INT, 1, dim, &varid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to create node maps property array in file id %d",
exoid);
@@ -131,9 +130,9 @@ int ex_put_map_param (int exoid,
}
/* store property name as attribute of property array variable */
- if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1)
+ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store node map property name %s in file id %d",
"ID",exoid);
@@ -145,8 +144,8 @@ int ex_put_map_param (int exoid,
dim[0] = dimid;
dim[1] = strdim;
- if (ncvardef (exoid, VAR_NAME_NM, NC_CHAR, 2, dim) == -1) {
- exerrval = ncerr;
+ if (nc_def_var(exoid, VAR_NAME_NM, NC_CHAR, 2, dim, &varid) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define node map name array in file id %d",exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
@@ -154,43 +153,28 @@ int ex_put_map_param (int exoid,
}
/* determine number of nodes */
- if ((dimid = (ncdimid (exoid, DIM_NUM_NODES))) == -1 )
- {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &dimid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: couldn't determine number of nodes in file id %d",
exoid);
ex_err("ex_put_node_map",errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_nodes) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes in file id %d",
- exoid);
- ex_err("ex_put_node_map",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
+
dim[0] = dimid;
/* create variable array in which to store the node maps */
for (i=0; i < num_node_maps; i++) {
- if ((varid =
- ncvardef(exoid,VAR_NODE_MAP(i+1),NC_LONG,1,dim)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid,VAR_NODE_MAP(i+1),NC_INT,1,dim,&varid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
sprintf(errmsg,
"Error: node map %d already defined in file id %d",
i,exoid);
ex_err("ex_put_node_map",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
+ } else {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to create node map %d in file id %d",
i,exoid);
@@ -202,11 +186,10 @@ int ex_put_map_param (int exoid,
}
/* element maps: */
- if (num_elem_maps > 0)
- {
- if ((dimid = ncdimdef (exoid, DIM_NUM_EM, (long)num_elem_maps)) == -1)
+ if (num_elem_maps > 0) {
+ if ((status = nc_def_dim (exoid, DIM_NUM_EM, num_elem_maps,&dimid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define number of element maps in file id %d",
exoid);
@@ -216,9 +199,9 @@ int ex_put_map_param (int exoid,
/* element maps id array: */
dim[0] = dimid;
- if ((varid = ncvardef (exoid, VAR_EM_PROP(1), NC_LONG, 1, dim)) == -1)
+ if ((status = nc_def_var(exoid, VAR_EM_PROP(1), NC_INT, 1, dim, &varid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to create element maps property array in file id %d",
exoid);
@@ -227,9 +210,9 @@ int ex_put_map_param (int exoid,
}
/* store property name as attribute of property array variable */
- if ((ncattput (exoid, varid, ATT_PROP_NAME, NC_CHAR, 3, "ID")) == -1)
+ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store element map property name %s in file id %d",
"ID",exoid);
@@ -241,8 +224,8 @@ int ex_put_map_param (int exoid,
dim[0] = dimid;
dim[1] = strdim;
- if (ncvardef (exoid, VAR_NAME_EM, NC_CHAR, 2, dim) == -1) {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid, VAR_NAME_EM, NC_CHAR, 2, dim, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define element map name array in file id %d",exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
@@ -250,10 +233,9 @@ int ex_put_map_param (int exoid,
}
/* determine number of elements */
-
- if ((dimid = (ncdimid (exoid, DIM_NUM_ELEM))) == -1 )
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_ELEM, &dimid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: couldn't determine number of elements in file id %d",
exoid);
@@ -261,25 +243,14 @@ int ex_put_map_param (int exoid,
goto error_ret; /* exit define mode and return */
}
- if (ncdiminq (exoid, dimid, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in file id %d",
- exoid);
- ex_err("ex_put_elem_map",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
/* create variable array in which to store the element maps */
dim[0] = dimid;
for (i = 0; i < num_elem_maps; i++) {
- if ((varid =
- ncvardef(exoid,VAR_ELEM_MAP(i+1),NC_LONG,1,dim)) == -1)
+ if ((status = nc_def_var(exoid,VAR_ELEM_MAP(i+1),NC_INT,1,dim, &varid)) != NC_NOERR)
{
- if (ncerr == NC_ENAMEINUSE)
+ if (status == NC_ENAMEINUSE)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: element map %d already defined in file id %d",
i,exoid);
@@ -287,7 +258,7 @@ int ex_put_map_param (int exoid,
}
else
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to create element map %d in file id %d",
i,exoid);
@@ -299,9 +270,9 @@ int ex_put_map_param (int exoid,
}
/* leave define mode */
- if (ncendef (exoid) == -1)
+ if ((status = nc_enddef (exoid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to complete variable definitions in file id %d",exoid);
ex_err("ex_put_map_param",errmsg,exerrval);
@@ -314,7 +285,7 @@ int ex_put_map_param (int exoid,
/* Fatal error: exit definition mode and return */
error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
{
sprintf(errmsg,
"Error: failed to complete definition for file id %d",
diff --git a/cbind/src/expnam.c b/cbind/src/expnam.c
index 182fefd..aaf6c92 100644
--- a/cbind/src/expnam.c
+++ b/cbind/src/expnam.c
@@ -49,7 +49,6 @@
*
* revision history -
*
-* $Id: expnam.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,103 +58,101 @@
/*!
* writes the name of the specified entity to the database.
+ * \param exoid exodus file id
+ * \param obj_type object type
+ * \param entity_id id of entity name to write
+ * \param name ptr to entity name
*/
int ex_put_name (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int entity_id,
const char *name)
{
- int varid, ent_ndx;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- const char *routine = "ex_put_name";
+ int status;
+ int varid, ent_ndx;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char *routine = "ex_put_name";
+ const char *vobj;
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
- if (obj_type == EX_ELEM_BLOCK) {
- if ((varid = ncvarid (exoid, VAR_NAME_EL_BLK)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element block names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- ent_ndx = ex_id_lkup(exoid, VAR_ID_EL_BLK, entity_id);
- }
- else if (obj_type == EX_NODE_SET) {
- if ((varid = ncvarid (exoid, VAR_NAME_NS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodeset names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- ent_ndx = ex_id_lkup(exoid, VAR_NS_IDS, entity_id);
- }
- else if (obj_type == EX_SIDE_SET) {
- if ((varid = ncvarid (exoid, VAR_NAME_SS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate sideset names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- ent_ndx = ex_id_lkup(exoid, VAR_SS_IDS, entity_id);
- }
-
- else if (obj_type == EX_NODE_MAP) {
- if ((varid = ncvarid (exoid, VAR_NAME_NM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate node map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- ent_ndx = ex_id_lkup(exoid, VAR_NM_PROP(1), entity_id);
- }
+ switch(obj_type) {
+ case EX_EDGE_BLOCK:
+ vobj = VAR_NAME_ED_BLK;
+ break;
+ case EX_FACE_BLOCK:
+ vobj = VAR_NAME_FA_BLK;
+ break;
+ case EX_ELEM_BLOCK:
+ vobj = VAR_NAME_EL_BLK;
+ break;
+ case EX_NODE_SET:
+ vobj = VAR_NAME_NS;
+ break;
+ case EX_SIDE_SET:
+ vobj = VAR_NAME_SS;
+ break;
+ case EX_EDGE_SET:
+ vobj = VAR_NAME_ES;
+ break;
+ case EX_FACE_SET:
+ vobj = VAR_NAME_FS;
+ break;
+ case EX_ELEM_SET:
+ vobj = VAR_NAME_ELS;
+ break;
+ case EX_NODE_MAP:
+ vobj = VAR_NAME_NM;
+ break;
+ case EX_EDGE_MAP:
+ vobj = VAR_NAME_EDM;
+ break;
+ case EX_FACE_MAP:
+ vobj = VAR_NAME_FAM;
+ break;
+ case EX_ELEM_MAP:
+ vobj = VAR_NAME_EM;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid type specified in file id %d", exoid);
+ ex_err(routine,errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, vobj, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s names in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
- else if (obj_type == EX_ELEM_MAP) {
- if ((varid = ncvarid (exoid, VAR_NAME_EM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- ent_ndx = ex_id_lkup(exoid, VAR_EM_PROP(1), entity_id);
- }
+ ent_ndx = ex_id_lkup(exoid, obj_type, entity_id);
- else {/* invalid type */
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid type specified in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return(EX_FATAL);
- }
-
- /* If this is a null entity, then 'ent_ndx' will be negative.
- * We don't care in this routine, so make it positive and continue...
- */
- if (ent_ndx < 0) ent_ndx = -ent_ndx;
+ /* If this is a null entity, then 'ent_ndx' will be negative.
+ * We don't care in this routine, so make it positive and continue...
+ */
+ if (ent_ndx < 0) ent_ndx = -ent_ndx;
- /* write EXODUS entityname */
- start[0] = ent_ndx-1;
- start[1] = 0;
+ /* write EXODUS entityname */
+ start[0] = ent_ndx-1;
+ start[1] = 0;
- count[0] = 1;
- count[1] = strlen(name) + 1;
+ count[0] = 1;
+ count[1] = strlen(name) + 1;
- if (ncvarput (exoid, varid, start, count, (void*)name) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store entity name for id %d in file id %d",
- ent_ndx, exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- return(EX_NOERR);
+ if ((status = nc_put_vara_text(exoid, varid, start, count, name)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s name for id %d in file id %d",
+ ex_name_of_object(obj_type), entity_id, exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return(EX_NOERR);
}
diff --git a/cbind/src/expnams.c b/cbind/src/expnams.c
index e405e44..38d3bfa 100644
--- a/cbind/src/expnams.c
+++ b/cbind/src/expnams.c
@@ -48,7 +48,6 @@
*
* revision history -
*
-* $Id: expnams.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -58,191 +57,108 @@
/*!
* writes the names of the results variables to the database
+ * \param exoid exodus file id
+ * \param obj_type object type
+ * \param names ptr array of entity names
*/
int ex_put_names (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
char* names[])
{
- int i, varid;
- long num_entity;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- const char *routine = "ex_put_names";
+ int status;
+ int varid;
+ size_t num_entity, i;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char *vname = NULL;
- exerrval = 0; /* clear error code */
-
- switch (obj_type) {
- /* ======== BLOCKS ========= */
- case EX_EDGE_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_ED_BLK, "edge block", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_ED_BLK)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate edge block names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_FACE_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face block", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_FA_BLK)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate face block names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_ELEM_BLOCK:
- ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element block", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_EL_BLK)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element block names in file id %d",
- exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
-
- /* ======== SETS ========= */
- case EX_NODE_SET:
- ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_NS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodeset names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_EDGE_SET:
- ex_get_dimension(exoid, DIM_NUM_ES, "edgeset", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_ES)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate edgeset names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_FACE_SET:
- ex_get_dimension(exoid, DIM_NUM_FS, "faceset", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_FS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate faceset names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_SIDE_SET:
- ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_SS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate sideset names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_ELEM_SET:
- ex_get_dimension(exoid, DIM_NUM_ELS, "elemset", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_ELS)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate elemset names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
-
- /* ======== MAPS ========= */
- case EX_NODE_MAP:
- ex_get_dimension(exoid, DIM_NUM_NM, "node map", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_NM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate node map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_EDGE_MAP:
- ex_get_dimension(exoid, DIM_NUM_EDM, "edge map", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_EDM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate edge map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_FACE_MAP:
- ex_get_dimension(exoid, DIM_NUM_FAM, "face map", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_FAM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate face map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
- case EX_ELEM_MAP:
- ex_get_dimension(exoid, DIM_NUM_EM, "element map", &num_entity, routine);
-
- if ((varid = ncvarid (exoid, VAR_NAME_EM)) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate element map names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- break;
-
- /* ======== ERROR (Invalid type) ========= */
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid type specified in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return(EX_FATAL);
- }
+ const char *routine = "ex_put_names";
-
- /* write EXODUS entitynames */
-
- for (i=0; i<num_entity; i++)
- {
- if (names[i] != '\0') {
- start[0] = i;
- start[1] = 0;
+ exerrval = 0; /* clear error code */
+
+ switch (obj_type) {
+ /* ======== BLOCKS ========= */
+ case EX_EDGE_BLOCK:
+ vname = VAR_NAME_ED_BLK;
+ break;
+ case EX_FACE_BLOCK:
+ vname = VAR_NAME_FA_BLK;
+ break;
+ case EX_ELEM_BLOCK:
+ vname = VAR_NAME_EL_BLK;
+ break;
+
+ /* ======== SETS ========= */
+ case EX_NODE_SET:
+ vname = VAR_NAME_NS;
+ break;
+ case EX_EDGE_SET:
+ vname = VAR_NAME_ES;
+ break;
+ case EX_FACE_SET:
+ vname = VAR_NAME_FS;
+ break;
+ case EX_SIDE_SET:
+ vname = VAR_NAME_SS;
+ break;
+ case EX_ELEM_SET:
+ vname = VAR_NAME_ELS;
+ break;
+
+ /* ======== MAPS ========= */
+ case EX_NODE_MAP:
+ vname = VAR_NAME_NM;
+ break;
+ case EX_EDGE_MAP:
+ vname = VAR_NAME_EDM;
+ break;
+ case EX_FACE_MAP:
+ vname = VAR_NAME_FAM;
+ break;
+ case EX_ELEM_MAP:
+ vname = VAR_NAME_EM;
+ break;
+
+ /* ======== ERROR (Invalid type) ========= */
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid type specified in file id %d", exoid);
+ ex_err(routine,errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type),
+ &num_entity, &varid, routine);
+
+ if ((status = nc_inq_varid(exoid, vname, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s names in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* write EXODUS entitynames */
+ for (i=0; i<num_entity; i++) {
+ if (names[i] != '\0') {
+ start[0] = i;
+ start[1] = 0;
- count[0] = 1;
- count[1] = strlen(names[i]) + 1;
+ count[0] = 1;
+ count[1] = strlen(names[i]) + 1;
- if (ncvarput (exoid, varid, start, count, (void*) names[i]) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store entity names in file id %d", exoid);
- ex_err(routine,errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- }
- return(EX_NOERR);
+ if ((status = nc_put_vara_text(exoid, varid, start, count, names[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s names in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+ return(EX_NOERR);
}
diff --git a/cbind/src/expncor.c b/cbind/src/expncor.c
new file mode 100644
index 0000000..5b7a603
--- /dev/null
+++ b/cbind/src/expncor.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expcor - ex_put_n_coord
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int start_node_num starting index (1-based) of coordinates to be written.
+* int num_nodes number of nodes to write coordinates for.
+* float* x_coord X coord array
+* float* y_coord y coord array
+* float* z_coord z coord array
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the coordinates of some of the nodes in the model
+ * Only writes the 'non-null' arrays.
+ * \param exoid exodus file id
+ * \param start_node_num the starting index (1-based) of the coordinates to be written
+ * \param num_nodes the number of nodes to write coordinates for.
+ * \param x_coor x coord array
+ * \param y_coor y coord array
+ * \param z_coor z coord array
+ */
+
+int ex_put_n_coord (int exoid,
+ int start_node_num,
+ int num_nodes,
+ const void *x_coor,
+ const void *y_coor,
+ const void *z_coor)
+{
+ int status;
+ int coordid;
+ int coordidx, coordidy, coordidz;
+
+ int numnoddim, ndimdim;
+ size_t i, num_nod, num_dim, start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire id's of previously defined dimensions */
+
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_NODES, &numnoddim)) != NC_NOERR) {
+ /* If not found, then this file is storing 0 nodes.
+ Return immediately */
+ return (EX_NOERR);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: inquire failed to return number of nodes in file id %d",
+ exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of dimensions in file id %d",
+ exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (start_node_num + num_nodes -1 > (int)num_nod) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: start index (%d) + node count (%d) is larger than total number of nodes (%d) in file id %d",
+ start_node_num, num_nodes, (int)num_nod, exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ --start_node_num;
+
+ /* write out the coordinates */
+ if (ex_large_model(exoid) == 0) {
+ if ((status = nc_inq_varid(exoid, VAR_COORD, &coordid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ for (i=0; i<num_dim; i++) {
+ char *which = 0;
+ start[0] = i;
+ start[1] = start_node_num;
+
+ count[0] = 1;
+ count[1] = num_nodes;
+
+ if (i == 0 && x_coor != NULL) {
+ which = "X";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, x_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, x_coor);
+ }
+ }
+ else if (i == 1 && y_coor != NULL) {
+ which = "Y";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, y_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, y_coor);
+ }
+ }
+ else if (i == 2 && z_coor != NULL) {
+ which = "Z";
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, z_coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, z_coor);
+ }
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ } else {
+ if ((status = nc_inq_varid(exoid, VAR_COORD_X, &coordidx)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate x nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_dim > 1) {
+ if ((status = nc_inq_varid(exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate y nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ } else {
+ coordidy = 0;
+ }
+ if (num_dim > 2) {
+ if ((status = nc_inq_varid(exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate z nodal coordinates in file id %d", exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ } else {
+ coordidz = 0;
+ }
+
+ /* write out the coordinates */
+ for (i=0; i<num_dim; i++) {
+ const void *coor = NULL;
+ char *which = NULL;
+
+ start[0] = start_node_num;
+ count[0] = num_nodes;
+
+ if (i == 0) {
+ coor = x_coor;
+ which = "X";
+ coordid = coordidx;
+ } else if (i == 1) {
+ coor = y_coor;
+ which = "Y";
+ coordid = coordidy;
+ } else if (i == 2) {
+ coor = z_coor;
+ which = "Z";
+ coordid = coordidz;
+ }
+
+ if (coor != NULL && coordid != 0) {
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, coordid, start, count, coor);
+ } else {
+ status = nc_put_vara_double(exoid, coordid, start, count, coor);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put %s coord array in file id %d", which, exoid);
+ ex_err("ex_put_n_coord",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expnm.c b/cbind/src/expnm.c
index 4b3e082..4915097 100644
--- a/cbind/src/expnm.c
+++ b/cbind/src/expnm.c
@@ -36,11 +36,6 @@
*
* expnm - ex_put_node_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,6 +51,10 @@
/*!
* writes an node map; this is a vector of integers of length number
* of nodes
+ * \param exoid exodus file id
+ * \param map_id node map id
+ * \param node_map node map
+ * \deprecated Use ex_put_num_map()(exoid, EX_NODE_MAP, map_id, node_map)
*/
int ex_put_node_map (int exoid,
diff --git a/cbind/src/expnmap.c b/cbind/src/expnmap.c
index 6931c53..737c1e9 100644
--- a/cbind/src/expnmap.c
+++ b/cbind/src/expnmap.c
@@ -36,11 +36,6 @@
*
* expem - ex_put_num_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -51,8 +46,6 @@
* exit conditions -
*
* revision history -
-* 20060928 David Thompson - Adapted from ex_put_elem_map
-*
*
*****************************************************************************/
@@ -64,59 +57,52 @@
* writes a map; this is a vector of integers of the same length as the
* number of entries in the source object (nodes, edges, faces, or elements
* in the file).
+ * \param exoid exodus file id
+ * \param map_type type of map (node,edge,face,elem)
+ * \param map_id id to associate with new map
+ * \param map map set value array
*/
int ex_put_num_map ( int exoid,
- int map_type,
+ ex_entity_type map_type,
int map_id,
const int *map )
{
- int dimid, varid, iresult;
- long start[1];
- nclong ldum, *lptr;
- long num_maps, num_entries, count[1];
+ int dimid, varid;
+ size_t start[1];
+ int ldum;
+ int num_maps;
+ size_t num_entries;
int cur_num_maps;
- char *cdum;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
const char* dnumentries;
const char* dnummaps;
const char* vmapids;
const char* vmap;
- struct list_item** map_ctr_list;
-
+ int status;
+
exerrval = 0; /* clear error code */
- cdum = 0;
-
switch ( map_type ) {
case EX_NODE_MAP:
- tname = "node";
dnumentries = DIM_NUM_NODES;
dnummaps = DIM_NUM_NM;
vmapids = VAR_NM_PROP(1);
- map_ctr_list = &nm_ctr_list;
break;
case EX_EDGE_MAP:
- tname = "edge";
dnumentries = DIM_NUM_EDGE;
dnummaps = DIM_NUM_EDM;
vmapids = VAR_EDM_PROP(1);
- map_ctr_list = &edm_ctr_list;
break;
case EX_FACE_MAP:
- tname = "face";
dnumentries = DIM_NUM_FACE;
dnummaps = DIM_NUM_FAM;
vmapids = VAR_FAM_PROP(1);
- map_ctr_list = &fam_ctr_list;
break;
case EX_ELEM_MAP:
- tname = "element";
dnumentries = DIM_NUM_ELEM;
dnummaps = DIM_NUM_EM;
vmapids = VAR_EM_PROP(1);
- map_ctr_list = &em_ctr_list;
break;
default:
exerrval = EX_BADPARAM;
@@ -127,115 +113,88 @@ int ex_put_num_map ( int exoid,
return (EX_FATAL);
}
-/* Make sure the file contains entries */
- if ((dimid = (ncdimid (exoid, dnumentries))) == -1 )
+ /* Make sure the file contains entries */
+ if (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR )
{
return (EX_NOERR);
}
-/* first check if any maps are specified */
-
- if ((dimid = (ncdimid (exoid, dnummaps))) == -1 )
+ /* first check if any maps are specified */
+ if ((status = nc_inq_dimid (exoid, dnummaps, &dimid)) != NC_NOERR )
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: no %s maps specified in file id %d",
- tname,exoid);
+ "Error: no %ss specified in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
-/* Check for duplicate map id entry */
- ex_id_lkup(exoid,vmapids,map_id);
+ /* Check for duplicate map id entry */
+ ex_id_lkup(exoid,map_type,map_id);
if (exerrval != EX_LOOKUPFAIL) /* found the map id */
{
- exerrval = ncerr;
sprintf(errmsg,
- "Error: %s map %d already defined in file id %d",
- tname,map_id,exoid);
+ "Error: %s %d already defined in file id %d",
+ ex_name_of_object(map_type),map_id,exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return(EX_FATAL);
}
-/* Get number of maps initialized for this file */
- if ((ncdiminq (exoid,dimid,cdum,&num_maps)) == -1)
+ /* Get number of maps initialized for this file */
+ if ((status = nc_inq_dimlen(exoid,dimid,&num_entries)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of %s maps in file id %d",
- tname,exoid);
+ "Error: failed to get number of %ss in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
-
-/* Keep track of the total number of maps defined using a counter stored
- in a linked list keyed by exoid.
- NOTE: ex_get_file_item is used to find the number of maps
- for a specific file and returns that value.
-*/
- cur_num_maps = ex_get_file_item(exoid, map_ctr_list );
- if (cur_num_maps >= num_maps)
- {
+ num_maps = num_entries;
+
+ /* Keep track of the total number of maps defined using a counter stored
+ in a linked list keyed by exoid.
+ NOTE: ex_get_file_item is used to find the number of maps
+ for a specific file and returns that value.
+ */
+ cur_num_maps = ex_get_file_item(exoid, ex_get_counter_list(map_type));
+ if (cur_num_maps >= num_maps) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: exceeded number of %s maps (%ld) specified in file id %d",
- tname,num_maps,exoid);
+ "Error: exceeded number of %ss (%d) specified in file id %d",
+ ex_name_of_object(map_type),num_maps,exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
-/* NOTE: ex_inc_file_item is used to find the number of maps
- for a specific file and returns that value incremented. */
+ /* NOTE: ex_inc_file_item is used to find the number of maps
+ for a specific file and returns that value incremented. */
+ cur_num_maps = ex_inc_file_item(exoid, ex_get_counter_list(map_type));
- cur_num_maps = ex_inc_file_item(exoid, map_ctr_list );
-
-/* write out information to previously defined variable */
+ /* write out information to previously defined variable */
/* first get id of variable */
-
- if ((varid = ncvarid (exoid, vmapids)) == -1)
+ if ((status = nc_inq_varid (exoid, vmapids, &varid)) == -1)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate %s map ids in file id %d",
- tname,exoid);
+ "Error: failed to locate %s ids in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
/* then, write out map id */
-
start[0] = cur_num_maps;
- ldum = (nclong)map_id;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store %s map id %d in file id %d",
- tname,map_id,exoid);
- ex_err("ex_put_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* determine number of entries */
-
- if ((dimid = (ncdimid (exoid, dnumentries))) == -1 )
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: couldn't determine number of %s entries in file id %d",
- tname,exoid);
- ex_err("ex_put_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entries) == -1)
+ ldum = (int)map_id;
+ if ((status = nc_put_var1_int(exoid, varid, start, &ldum)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get number of %s entries in file id %d",
- tname,exoid);
+ "Error: failed to store %s id %d in file id %d",
+ ex_name_of_object(map_type),map_id,exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
@@ -253,37 +212,48 @@ int ex_put_num_map ( int exoid,
case EX_ELEM_MAP:
vmap = VAR_ELEM_MAP(cur_num_maps+1);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized map type in switch: %d in file id %d",
+ map_type,exoid);
+ ex_err("ex_putt_n_one_attr",errmsg,EX_MSG);
+ return (EX_FATAL);
}
-/* locate variable array in which to store the map */
- if ((varid = ncvarid(exoid,vmap)) == -1)
+ /* locate variable array in which to store the map */
+ if ((status = nc_inq_varid(exoid,vmap,&varid)) != NC_NOERR)
{
-#if 0
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s map %d in file id %d",
- vmap,map_id,exoid);
- ex_err("ex_put_num_map",errmsg,exerrval);
- return (EX_FATAL);
-#endif
int dims[2];
- ncerr = 0;
- if ( ncredef( exoid ) == -1 ) {
- exerrval = ncerr;
+ /* determine number of entries */
+ if ((status = nc_inq_dimid (exoid, dnumentries, &dimid)) == -1 )
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: couldn't determine number of %s entries in file id %d",
+ ex_name_of_object(map_type),exoid);
+ ex_err("ex_put_num_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ status = 0;
+
+ if ((status = nc_redef( exoid )) != NC_NOERR ) {
+ exerrval = status;
sprintf(errmsg, "Error: failed to place file id %d into define mode", exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
dims[0] = dimid;
- if ( (varid = ncvardef( exoid, vmap, NC_LONG, 1, dims )) == -1 ) {
- exerrval = ncerr;
+ if ((status = nc_def_var( exoid, vmap, NC_INT, 1, dims, &varid )) == -1 ) {
+ exerrval = status;
sprintf(errmsg, "Error: failed to define map %s in file id %d", vmap, exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
}
- if ( ncendef( exoid ) == -1 ) { /* exit define mode */
+ if ((status = nc_enddef(exoid)) != NC_NOERR ) { /* exit define mode */
sprintf( errmsg, "Error: failed to complete definition for file id %d", exoid );
ex_err( "ex_put_num_map", errmsg, exerrval );
varid = -1; /* force early exit */
@@ -293,28 +263,13 @@ int ex_put_num_map ( int exoid,
return (EX_FATAL);
}
-/* write out the map */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_entries;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, map);
- } else {
- lptr = itol (map, (int)num_entries);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
+ /* write out the map */
+ if ((status = nc_put_var_int(exoid, varid, map)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store %s map in file id %d",
- tname,exoid);
+ "Error: failed to store %s in file id %d",
+ ex_name_of_object(map_type),exoid);
ex_err("ex_put_num_map",errmsg,exerrval);
return (EX_FATAL);
}
diff --git a/cbind/src/expnnm.c b/cbind/src/expnnm.c
index 5587ffc..794b897 100644
--- a/cbind/src/expnnm.c
+++ b/cbind/src/expnnm.c
@@ -36,14 +36,6 @@
*
* expnnm - ex_put_node_num_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -63,128 +55,13 @@
/*!
* writes out the node numbering map to the database; allows node numbers
* to be non-contiguous
+ * \param exoid exodus file id
+ * \param node_map node numbering map
+ * \deprecated Use ex_put_id_map()(exoid, EX_NODE_MAP, node_map)
*/
int ex_put_node_num_map (int exoid,
const int *node_map)
{
- int numnodedim, dims[1], mapid, iresult;
- long num_nodes, start[1], count[1];
- nclong *lptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* inquire id's of previously defined dimensions */
-
- /* determine number of nodes, return immediately if 0 */
- if ((numnodedim = ncdimid (exoid, DIM_NUM_NODES)) == -1)
- {
- return (EX_NOERR);
- }
-
- if (ncdiminq (exoid, numnodedim, (char *) 0, &num_nodes) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodes in file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* put netcdf file into define mode */
-
- if ((mapid = ncvarid (exoid, VAR_NODE_NUM_MAP)) == -1) {
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* create a variable array in which to store the node numbering map */
-
- dims[0] = numnodedim;
-
- if ((mapid = ncvardef (exoid, VAR_NODE_NUM_MAP, NC_LONG, 1, dims)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: node numbering map already exists in file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create node numbering map array in file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
-
- /* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- /* write out the node numbering map */
-
- /* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_nodes;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, mapid, start, count, node_map);
- } else {
- lptr = itol (node_map, (int)num_nodes);
- iresult = ncvarput (exoid, mapid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store node numbering map in file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- return (EX_NOERR);
-
- /* Fatal error: exit definition mode and return */
- error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_node_num_map",errmsg,exerrval);
- }
- return (EX_FATAL);
+ return ex_put_id_map(exoid, EX_NODE_MAP, node_map);
}
-
diff --git a/cbind/src/expnv.c b/cbind/src/expnnv.c
similarity index 65%
copy from cbind/src/expnv.c
copy to cbind/src/expnnv.c
index 38b1010..347be4b 100644
--- a/cbind/src/expnv.c
+++ b/cbind/src/expnnv.c
@@ -34,13 +34,14 @@
*/
/*****************************************************************************
*
-* expnv - ex_put_nodal_var
+* expnv - ex_put_n_nodal_var
*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int time_step whole time step number
-* int nodeal_var_index index of desired nodal variable
+* int nodel_var_index index of desired nodal variable
+* int start_node index (1-based) of first node to put
* int num_nodes number of nodal points
* float* nodal_var_vals array of nodal variable values
*
@@ -48,7 +49,6 @@
*
* revision history -
*
-* $Id: expnv.c,v 1.4 2006/11/28 14:02:05 gdsjaar Exp $
*
*****************************************************************************/
@@ -56,37 +56,45 @@
#include "exodusII_int.h"
/*!
- * writes the values of a single nodal variable for a single time step to
- * the database; assume the first time step and nodal variable index
- * is 1
+ * writes the values of a single nodal variable for a partial block at
+ * one single time step to the database; assume the first time step
+ * and nodal variable index is 1
+ * \param exoid exodus file id
+ * \param time_step whole time step number
+ * \param nodal_var_index index of desired nodal variable
+ * \param start_node index of first node to write data for (1-based)
+ * \param num_nodes number of nodal points
+ * \param nodal_var_vals array of nodal variable values
*/
-int ex_put_nodal_var (int exoid,
- int time_step,
- int nodal_var_index,
- int num_nodes,
- const void *nodal_var_vals)
+int ex_put_n_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int start_node,
+ int num_nodes,
+ const void *nodal_var_vals)
{
+ int status;
int varid;
- long start[3], count[3];
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
if (ex_large_model(exoid) == 0) {
/* write values of the nodal variable */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variables in file id %d",
exoid);
- ex_err("ex_put_nodal_var",errmsg,exerrval);
+ ex_err("ex_put_n_nodal_var",errmsg,exerrval);
return (EX_WARN);
}
start[0] = --time_step;
start[1] = --nodal_var_index;
- start[2] = 0;
+ start[2] = --start_node;
count[0] = 1;
count[1] = 1;
@@ -94,32 +102,35 @@ int ex_put_nodal_var (int exoid,
} else {
/* nodal variables stored separately, find variable for this variable
index */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR_NEW(nodal_var_index))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
- ex_err("ex_put_nodal_var",errmsg,exerrval);
+ ex_err("ex_put_n_nodal_var",errmsg,exerrval);
return (EX_WARN);
}
start[0] = --time_step;
- start[1] = 0;
+ start[1] = --start_node;
count[0] = 1;
count[1] = num_nodes;
}
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,nodal_var_vals,num_nodes)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store nodal variables in file id %d",
- exoid);
- ex_err("ex_put_nodal_var",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals);
+ }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_n_nodal_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
}
diff --git a/cbind/src/expnoatt.c b/cbind/src/expnoatt.c
new file mode 100644
index 0000000..ee19507
--- /dev/null
+++ b/cbind/src/expnoatt.c
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expoea - ex_put_n_one_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type object type (edge, face, elem block)
+* int obj_id object id (edge, face, elem block ID)
+* int attrib_index index of attribute to write
+* float* attrib array of attributes
+*
+* exit conditions -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the specified attribute for a block
+ * \param exoid exodus file id
+ * \param obj_type object type (edge, face, elem block)
+ * \param obj_id object id (edge, face, elem block ID)
+ * \param start_num the starting index of the attributes to be written
+ * \param num_ent the number of entities to write attributes for.
+ * \param attrib_index index of attribute to write
+ * \param attrib array of attributes
+ */
+
+int ex_put_n_one_attr( int exoid,
+ ex_entity_type obj_type,
+ int obj_id,
+ int start_num,
+ int num_ent,
+ int attrib_index,
+ const void *attrib )
+{
+ int status;
+ int attrid, obj_id_ndx, temp;
+ size_t num_entries_this_obj, num_attr;
+ size_t start[2], count[2];
+ ptrdiff_t stride[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* dnumobjent;
+ const char* dnumobjatt;
+ const char* vattrbname;
+
+ exerrval = 0; /* clear error code */
+
+ /* Determine index of obj_id in id array */
+ if (obj_type != EX_NODAL) {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes allowed for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_put_n_one_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this element block */
+ } else {
+ sprintf(errmsg,
+ "Error: no %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_put_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+
+ switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vattrbname = VAR_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vattrbname = VAR_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vattrbname = VAR_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vattrbname = VAR_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vattrbname = VAR_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjent = DIM_NUM_NODES;
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vattrbname = VAR_NATTRIB;
+ break;
+ case EX_EDGE_BLOCK:
+ dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
+ vattrbname = VAR_EATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_BLOCK:
+ dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
+ vattrbname = VAR_FATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_BLOCK:
+ dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
+ vattrbname = VAR_ATTRIB(obj_id_ndx);
+ break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
+ ex_err("ex_putt_n_one_attr",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+
+ /* inquire id's of previously defined dimensions */
+ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_put_n_one_attr") != NC_NOERR)
+ return EX_FATAL;
+
+ if (start_num + num_ent -1 > (int)num_entries_this_obj) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: start index (%d) + count (%d) is larger than total number of entities (%d) in file id %d",
+ start_num, num_ent, (int)num_entries_this_obj, exoid);
+ ex_err("ex_put_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_put_n_one_attr") != NC_NOERR)
+ return EX_FATAL;
+
+ if (attrib_index < 1 || attrib_index > (int)num_attr) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %d in file id %d",
+ attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_put_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate attribute variable for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_put_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* write out the attributes */
+
+ start[0] = start_num-1;
+ start[1] = attrib_index-1;
+
+ count[0] = num_ent;
+ count[1] = 1;
+
+ stride[0] = 1;
+ stride[1] = num_attr;
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vars_float(exoid, attrid, start, count, stride, attrib);
+ } else {
+ status = nc_put_vars_double(exoid, attrid, start, count, stride, attrib);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put attribute %d for %s %d in file id %d",
+ attrib_index, ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_put_n_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/expnp.c b/cbind/src/expnp.c
index 77fb323..b51bc42 100644
--- a/cbind/src/expnp.c
+++ b/cbind/src/expnp.c
@@ -36,14 +36,6 @@
*
* expnp - ex_put_node_set_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: expnp.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -64,6 +55,11 @@
/*!
* writes the information which describes a single node set
+ * \param exoid exodus file id
+ * \param node_set_id node set id
+ * \param num_nodes_in_set number of nodes in set
+ * \param num_dist_in_set number of distribution factors in set
+ * \deprecated Use ex_put_set_param()(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_dist_in_set)
*/
int ex_put_node_set_param (int exoid,
@@ -71,6 +67,5 @@ int ex_put_node_set_param (int exoid,
int num_nodes_in_set,
int num_dist_in_set)
{
- return ex_put_set_param(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set,
- num_dist_in_set);
+ return ex_put_set_param(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_dist_in_set);
}
diff --git a/cbind/src/expns.c b/cbind/src/expns.c
index 272395b..af0b97d 100644
--- a/cbind/src/expns.c
+++ b/cbind/src/expns.c
@@ -36,14 +36,6 @@
*
* expns - ex_put_node_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: expns.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +54,10 @@
/*!
* writes the node list for a single node set
+ * \param exoid exodus file id
+ * \param node_set_id node set id
+ * \param node_set_node_list node list array for the node set
+ * \deprecated Use ex_put_set()(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL)
*/
int ex_put_node_set (int exoid,
diff --git a/cbind/src/expnsd.c b/cbind/src/expnsd.c
index 5e3f027..d63766c 100644
--- a/cbind/src/expnsd.c
+++ b/cbind/src/expnsd.c
@@ -36,14 +36,6 @@
*
* expnsd - ex_put_node_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: expnsd.c,v 1.4 2006/11/28 14:02:05 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +54,10 @@
/*!
* writes the node set distribution factors for a single node set
+ * \param exoid exodus file id
+ * \param node_set_id node set id
+ * \param node_set_dist_fact node distribution factors for node set
+ * \deprecated Use ex_put_set_dist_fact()(exoid, EX_NODE_SET, node_set_id, node_set_dist_fact)
*/
int ex_put_node_set_dist_fact (int exoid,
diff --git a/cbind/src/expnstt.c b/cbind/src/expnstt.c
index 796d1f6..2d85f37 100644
--- a/cbind/src/expnstt.c
+++ b/cbind/src/expnstt.c
@@ -45,7 +45,6 @@
*
* exit conditions -
*
-* $Id: expnstt.c,v 1.3 2006/11/28 14:02:05 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,6 +61,11 @@
* of define mode (causing the entire file to be copied over and over)
* which is what occurs when the nodeset variable values variables are
* defined in ex_put_nset_var
+ * \param exoid exodus file id
+ * \param num_nset number of nodesets
+ * \param num_nset_var number of nodeset variables
+ * \param nset_var_tab nodeset variable truth table array
+ * \deprecated Use ex_put_truth_table()(exoid, EX_NODE_SET, num_nset, num_nset_var, nset_var_tab)
*/
int ex_put_nset_var_tab (int exoid,
@@ -69,5 +73,5 @@ int ex_put_nset_var_tab (int exoid,
int num_nset_var,
int *nset_var_tab)
{
- return ex_put_var_tab(exoid, "M", num_nset, num_nset_var, nset_var_tab);
+ return ex_put_truth_table(exoid, EX_NODE_SET, num_nset, num_nset_var, nset_var_tab);
}
diff --git a/cbind/src/expnsv.c b/cbind/src/expnsv.c
index f5dada6..d8f6f92 100644
--- a/cbind/src/expnsv.c
+++ b/cbind/src/expnsv.c
@@ -51,7 +51,6 @@
*
* revision history -
*
-* $Id: expnsv.c,v 1.3 2006/11/28 14:02:05 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +62,14 @@
* writes the values of a single nodeset variable for one nodeset at
* one time step to the database; assume the first time step and
* nodeset variable index are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param nset_var_index nodeset variable index
+ * \param nset_id nodeset id
+ * \param num_nodes_this_nset number of nodes in this nodeset
+ * \param nset_var_vals the values to be written
+ * \deprecated Use ex_put_var()(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_nodes_this_nset, nset_var_vals)
+
*/
int ex_put_nset_var (int exoid,
@@ -72,239 +79,6 @@ int ex_put_nset_var (int exoid,
int num_nodes_this_nset,
const void *nset_var_vals)
{
- int varid, dimid,time_dim, numelbdim, dims[2], nset_id_ndx;
- long num_nsets, num_nset_var, start[2], count[2];
- nclong *nset_var_tab;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of nset_id in VAR_NS_ID array */
- nset_id_ndx = ex_id_lkup(exoid,VAR_NS_IDS,nset_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no variables allowed for NULL nodeset %d in file id %d",
- nset_id,exoid);
- ex_err("ex_put_nset_var",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate nodeset id %d in %s array in file id %d",
- nset_id, VAR_NS_IDS, exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if ((varid = ncvarid (exoid,
- VAR_NS_VAR(nset_var_index,nset_id_ndx))) == -1)
- {
- if (ncerr == NC_ENOTVAR) /* variable doesn't exist, create it! */
- {
-
-/* inquire previously defined dimensions */
-
- /* check for the existance of an nodeset variable truth table */
- if ((varid = ncvarid (exoid, VAR_NSET_TAB)) != -1)
- {
- /* find out number of nodesets and nodeset variables */
- if ((dimid = ncdimid (exoid, DIM_NUM_NS)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodesets in file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_nsets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodesets in file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((dimid = ncdimid (exoid, DIM_NUM_NSET_VAR)) == -1)
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: no nodeset variables stored in file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_nset_var) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of nodeset variables in file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (!(nset_var_tab = malloc(num_nsets*num_nset_var*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for nodeset variable truth table in file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* read in the nodeset variable truth table */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_nsets;
- count[1] = num_nset_var;
-
- if (ncvarget (exoid, varid, start, count, nset_var_tab) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get truth table from file id %d", exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if(nset_var_tab[num_nset_var*(nset_id_ndx-1)+nset_var_index-1]
- == 0L)
- {
- free(nset_var_tab);
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid nodeset variable %d, nodeset %d in file id %d",
- nset_var_index, nset_id, exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- free(nset_var_tab);
- }
-
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate time dimension in file id %d", exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- if ((numelbdim=ncdimid(exoid, DIM_NUM_NOD_NS(nset_id_ndx))) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: number of nodes in nodeset %d not defined in file id %d",
- nset_id, exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of sides in nodeset %d in file id %d",
- nset_id, exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- }
- goto error_ret;
- }
-
-/* variable doesn't exist so put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define netCDF variable to store nodeset variable values */
-
- dims[0] = time_dim;
- dims[1] = numelbdim;
- if ((varid = ncvardef(exoid,VAR_NS_VAR(nset_var_index,nset_id_ndx),
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodeset variable %d in file id %d",
- nset_var_index,exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- goto error_ret;
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete nodeset variable %s definition to file id %d",
- VAR_NS_VAR(nset_var_index,nset_id_ndx), exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate nodeset variable %s in file id %d",
- VAR_NS_VAR(nset_var_index,nset_id_ndx),exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-/* store nodeset variable values */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_nodes_this_nset;
-
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,nset_var_vals,
- num_nodes_this_nset)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store nodeset variable %d in file id %d",
- nset_var_index,exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_nset_var",errmsg,exerrval);
- }
- return (EX_FATAL);
+ return ex_put_var(exoid, time_step, EX_NODE_SET, nset_var_index,
+ nset_id, num_nodes_this_nset, nset_var_vals);
}
diff --git a/cbind/src/expnv.c b/cbind/src/expnv.c
index 38b1010..f9d405a 100644
--- a/cbind/src/expnv.c
+++ b/cbind/src/expnv.c
@@ -48,7 +48,6 @@
*
* revision history -
*
-* $Id: expnv.c,v 1.4 2006/11/28 14:02:05 gdsjaar Exp $
*
*****************************************************************************/
@@ -59,6 +58,11 @@
* writes the values of a single nodal variable for a single time step to
* the database; assume the first time step and nodal variable index
* is 1
+ * \param exoid exodus file id
+ * \param time_step whole time step number
+ * \param nodal_var_index index of desired nodal variable
+ * \param num_nodes number of nodal points
+ * \param nodal_var_vals array of nodal variable values
*/
int ex_put_nodal_var (int exoid,
@@ -68,16 +72,17 @@ int ex_put_nodal_var (int exoid,
const void *nodal_var_vals)
{
+ int status;
int varid;
- long start[3], count[3];
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
if (ex_large_model(exoid) == 0) {
/* write values of the nodal variable */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variables in file id %d",
exoid);
@@ -94,8 +99,8 @@ int ex_put_nodal_var (int exoid,
} else {
/* nodal variables stored separately, find variable for this variable
index */
- if ((varid = ncvarid (exoid, VAR_NOD_VAR_NEW(nodal_var_index))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Warning: could not find nodal variable %d in file id %d",
nodal_var_index, exoid);
@@ -110,16 +115,19 @@ int ex_put_nodal_var (int exoid,
count[1] = num_nodes;
}
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,nodal_var_vals,num_nodes)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store nodal variables in file id %d",
- exoid);
- ex_err("ex_put_nodal_var",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals);
+ }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_nodal_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
}
diff --git a/cbind/src/expnvar.c b/cbind/src/expnvar.c
new file mode 100644
index 0000000..e47ab78
--- /dev/null
+++ b/cbind/src/expnvar.c
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvar - ex_put_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* int var_type type (edge block, face block, edge set, ... )
+* int var_index element variable index
+* int obj_id element block id
+* int start_num starting index of the variables to be written
+* int num_ent number of entities to write variables for.
+*
+* exit conditions -
+*
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the values of a single variable for a partial block at one time
+ * step to the database; assume the first time step and variable index
+ * are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param var_type type (edge block, face block, edge set, ... )
+ * \param var_index element variable index
+ * \param obj_id element block id
+ * \param start_index index of first entity in block to write (1-based)
+ * \param num_entities number of entries in this block/set
+ * \param var_vals the values to be written
+ */
+
+int ex_put_n_var (int exoid,
+ int time_step,
+ ex_entity_type var_type,
+ int var_index,
+ int obj_id,
+ int start_index,
+ int num_entities,
+ const void *var_vals)
+{
+ int varid, dimid,time_dim, numobjdim, dims[2], obj_id_ndx;
+ size_t num_obj;
+ size_t num_obj_var;
+ size_t num_entity;
+ size_t start[2], count[2];
+ int *obj_var_truth_tab;
+ int status;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+#define EX_LOOK_UP_VAR(VOBJID,VVAR,VOBJTAB,DNUMOBJ,DNUMOBJVAR) \
+ /* Determine index of obj_id in VOBJID array */ \
+ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id); \
+ if (exerrval != 0) \
+ { \
+ if (exerrval == EX_NULLENTITY) \
+ { \
+ sprintf(errmsg, \
+ "Warning: no variables allowed for NULL block %d in file id %d", \
+ obj_id,exoid); \
+ ex_err("ex_put_n_var",errmsg,EX_MSG); \
+ return (EX_WARN); \
+ } \
+ else \
+ { \
+ sprintf(errmsg, \
+ "Error: failed to locate %s id %d in %s array in file id %d", \
+ ex_name_of_object(var_type), obj_id, VOBJID, exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } \
+ \
+ if ((status = nc_inq_varid (exoid, VVAR(var_index,obj_id_ndx), &varid)) != NC_NOERR) \
+ { \
+ if (status == NC_ENOTVAR) /* variable doesn't exist, create it! */ \
+ { \
+ /* check for the existance of an TNAME variable truth table */ \
+ if (nc_inq_varid(exoid, VOBJTAB, &varid) == NC_NOERR) { \
+ /* find out number of TNAMEs and TNAME variables */ \
+ status = ex_get_dimension(exoid, DNUMOBJ, ex_name_of_object(var_type), &num_obj, &dimid, "ex_put_n_var"); \
+ if (status != NC_NOERR) return status; \
+ \
+ status = ex_get_dimension(exoid, DNUMOBJVAR, ex_name_of_object(var_type), &num_obj_var, &dimid, "ex_put_n_var"); \
+ if (status != NC_NOERR) return status; \
+ \
+ if (!(obj_var_truth_tab = malloc(num_obj*num_obj_var*sizeof(int)))) \
+ { \
+ exerrval = EX_MEMFAIL; \
+ sprintf(errmsg, \
+ "Error: failed to allocate memory for %s variable truth table in file id %d", \
+ ex_name_of_object(var_type), exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* read in the TNAME variable truth table */ \
+ if ((status = nc_get_var_int (exoid, varid, obj_var_truth_tab)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to get truth table from file id %d", exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ if(obj_var_truth_tab[num_obj_var*(obj_id_ndx-1)+var_index-1] \
+ == 0L) \
+ { \
+ free(obj_var_truth_tab); \
+ exerrval = EX_BADPARAM; \
+ sprintf(errmsg, \
+ "Error: Invalid %s variable %d, %s %d in file id %d", \
+ ex_name_of_object(var_type), var_index, ex_name_of_object(var_type), obj_id, exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ free(obj_var_truth_tab); \
+ } \
+ \
+ if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate time dimension in file id %d", exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ ex_get_dimension(exoid, ex_dim_num_entries_in_object(var_type, obj_id_ndx), \
+ ex_name_of_object(var_type), &num_entity, &numobjdim, "ex_put_n_var"); \
+ \
+ /* variable doesn't exist so put file into define mode */ \
+ if ((status = nc_redef (exoid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to put file id %d into define mode", exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* define netCDF variable to store TNAME variable values */ \
+ dims[0] = time_dim; \
+ dims[1] = numobjdim; \
+ if ((status = nc_def_var(exoid, VVAR(var_index,obj_id_ndx), \
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define %s variable %d in file id %d", \
+ ex_name_of_object(var_type), var_index,exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ goto error_ret; \
+ } \
+ \
+ /* leave define mode */ \
+ \
+ if ((status = nc_enddef (exoid)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to complete %s variable %s definition to file id %d", \
+ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx), exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } \
+ else \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate %s variable %s in file id %d", \
+ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx),exoid); \
+ ex_err("ex_put_n_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ }
+
+ switch (var_type) {
+ case EX_GLOBAL:
+ if ( num_entities <= 0 ) {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Warning: no global variables specified for file id %d",
+ exoid);
+ ex_err("ex_put_glob_vars",errmsg,exerrval);
+
+ return (EX_WARN);
+ }
+ /* inquire previously defined variable */
+
+ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) {
+ if (status == NC_ENOTVAR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no global variables defined in file id %d",
+ exoid);
+ ex_err("ex_put_glob_vars",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get global variables parameters in file id %d",
+ exoid);
+ ex_err("ex_put_glob_vars",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+ }
+ break;
+ case EX_NODAL:
+ return ex_put_n_nodal_var(exoid, time_step, var_index, start_index, num_entities, var_vals);
+ break;
+ case EX_EDGE_BLOCK:
+ EX_LOOK_UP_VAR(VAR_ID_ED_BLK,VAR_EDGE_VAR,VAR_EBLK_TAB,DIM_NUM_ED_BLK,DIM_NUM_EDG_VAR);
+ break;
+ case EX_FACE_BLOCK:
+ EX_LOOK_UP_VAR(VAR_ID_FA_BLK,VAR_FACE_VAR,VAR_FBLK_TAB,DIM_NUM_FA_BLK,DIM_NUM_FAC_VAR);
+ break;
+ case EX_ELEM_BLOCK:
+ EX_LOOK_UP_VAR(VAR_ID_EL_BLK,VAR_ELEM_VAR,VAR_ELEM_TAB,DIM_NUM_EL_BLK,DIM_NUM_ELE_VAR);
+ break;
+ case EX_NODE_SET:
+ EX_LOOK_UP_VAR(VAR_NS_IDS,VAR_NS_VAR,VAR_NSET_TAB,DIM_NUM_NS,DIM_NUM_NSET_VAR);
+ break;
+ case EX_EDGE_SET:
+ EX_LOOK_UP_VAR(VAR_ES_IDS,VAR_ES_VAR,VAR_ESET_TAB,DIM_NUM_ES,DIM_NUM_ESET_VAR);
+ break;
+ case EX_FACE_SET:
+ EX_LOOK_UP_VAR(VAR_FS_IDS,VAR_FS_VAR,VAR_FSET_TAB,DIM_NUM_FS,DIM_NUM_FSET_VAR);
+ break;
+ case EX_SIDE_SET:
+ EX_LOOK_UP_VAR(VAR_SS_IDS,VAR_SS_VAR,VAR_SSET_TAB,DIM_NUM_SS,DIM_NUM_SSET_VAR);
+ break;
+ case EX_ELEM_SET:
+ EX_LOOK_UP_VAR(VAR_ELS_IDS,VAR_ELS_VAR,VAR_ELSET_TAB,DIM_NUM_ELS,DIM_NUM_ELSET_VAR);
+ break;
+ default:
+ exerrval = EX_MSG;
+ sprintf( errmsg, "Error: invalid variable type (%d) specified for file id %d",
+ var_type, exoid );
+ ex_err( "ex_put_n_var", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+ /* store element variable values */
+
+ start[0] = --time_step;
+ start[1] = start_index-1;
+ if ( var_type == EX_GLOBAL ) {
+ /* global variables may be written
+ * - all at once (by setting var_index to 1 and num_entries_this_obj to num_glob, or
+ * - one at a time (by setting var_index to the desired index and num_entries_this_obj to 1.
+ */
+ count[0] = var_index;
+ } else {
+ count[0] = 1;
+ }
+ count[1] = num_entities;
+
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s %d variable %d in file id %d",
+ ex_name_of_object(var_type), obj_id, var_index,exoid);
+ ex_err("ex_put_n_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_n_var",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expnvv.c b/cbind/src/expnvv.c
index 4fc4f9e..c0ad711 100644
--- a/cbind/src/expnvv.c
+++ b/cbind/src/expnvv.c
@@ -49,7 +49,6 @@
*
* revision history -
*
-* $Id: expnvv.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -60,6 +59,12 @@
* writes the values of a single nodal variable for a single time step to
* the database; assume the first time step and nodal variable index
* is 1
+ * \param exoid exodus file id
+ * \param time_step whole time step number
+ * \param nodal_var_index index of desired nodal variable
+ * \param num_nodes number of nodal points
+ * \param varid id of variable on exodus database
+ * \param nodal_var_vals array of nodal variable values
*/
int ex_put_nodal_varid_var(int exoid,
@@ -69,7 +74,8 @@ int ex_put_nodal_varid_var(int exoid,
int varid,
const void *nodal_var_vals)
{
- long start[3], count[3];
+ int status;
+ size_t start[3], count[3];
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -90,16 +96,20 @@ int ex_put_nodal_varid_var(int exoid,
count[1] = num_nodes;
}
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,nodal_var_vals,num_nodes)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store nodal variables in file id %d",
- exoid);
- ex_err("ex_put_nodal_varid_var",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_nodal_varid_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
}
diff --git a/cbind/src/expoatt.c b/cbind/src/expoatt.c
index d9b2c91..11383b1 100644
--- a/cbind/src/expoatt.c
+++ b/cbind/src/expoatt.c
@@ -46,10 +46,6 @@
*
* exit conditions -
*
-* revision history -
-* 20061003 - David Thompson - Adapted from ex_put_one_attr
-*
-* $Id: expoatt.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -58,72 +54,82 @@
/*!
* writes the specified attribute for a block
+ * \param exoid exodus file id
+ * \param obj_type object type (edge, face, elem block)
+ * \param obj_id object id (edge, face, elem block ID)
+ * \param attrib_index index of attribute to write
+ * \param attrib array of attributes
*/
int ex_put_one_attr( int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
int attrib_index,
const void *attrib )
{
- int numobjentdim, numattrdim, attrid, obj_id_ndx;
- long num_entries_this_obj, num_attr;
+ int status;
+ int attrid, obj_id_ndx, temp;
+ size_t num_entries_this_obj, num_attr;
size_t start[2], count[2];
ptrdiff_t stride[2];
- int error;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
- const char* vobjids;
const char* dnumobjent;
const char* dnumobjatt;
const char* vattrbname;
- switch (obj_type) {
- case EX_EDGE_BLOCK:
- tname = "edge block";
- vobjids = VAR_ID_ED_BLK;
- break;
- case EX_FACE_BLOCK:
- tname = "face block";
- vobjids = VAR_ID_FA_BLK;
- break;
- case EX_ELEM_BLOCK:
- tname = "element block";
- vobjids = VAR_ID_EL_BLK;
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d",
- obj_type, exoid );
- ex_err("ex_put_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
exerrval = 0; /* clear error code */
- /* Determine index of obj_id in vobjids array */
- obj_id_ndx = ex_id_lkup(exoid,vobjids,obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no attributes allowed for NULL %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_put_one_attr",errmsg,EX_MSG);
- return (EX_WARN); /* no attributes for this element block */
- }
- else
- {
- sprintf(errmsg,
- "Error: no %s id %d in %s array in file id %d",
- tname, obj_id, vobjids, exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* Determine index of obj_id in id array */
+ if (obj_type != EX_NODAL) {
+ obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no attributes allowed for NULL %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_put_one_attr",errmsg,EX_MSG);
+ return (EX_WARN); /* no attributes for this element block */
+ } else {
+ sprintf(errmsg,
+ "Error: no %s id %d in id array in file id %d",
+ ex_name_of_object(obj_type), obj_id, exoid);
+ ex_err("ex_put_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
}
-
+ }
+
switch (obj_type) {
+ case EX_SIDE_SET:
+ dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx);
+ vattrbname = VAR_SSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODE_SET:
+ dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx);
+ vattrbname = VAR_NSATTRIB(obj_id_ndx);
+ break;
+ case EX_EDGE_SET:
+ dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx);
+ vattrbname = VAR_ESATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_SET:
+ dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx);
+ vattrbname = VAR_FSATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_SET:
+ dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx);
+ dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx);
+ vattrbname = VAR_ELSATTRIB(obj_id_ndx);
+ break;
+ case EX_NODAL:
+ dnumobjent = DIM_NUM_NODES;
+ dnumobjatt = DIM_NUM_ATT_IN_NBLK;
+ vattrbname = VAR_NATTRIB;
+ break;
case EX_EDGE_BLOCK:
dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx);
dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
@@ -139,82 +145,39 @@ int ex_put_one_attr( int exoid,
dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
vattrbname = VAR_ATTRIB(obj_id_ndx);
break;
+ default:
+ exerrval = 1005;
+ sprintf(errmsg,
+ "Internal Error: unrecognized object type in switch: %d in file id %d",
+ obj_type,exoid);
+ ex_err("ex_put_one_attr",errmsg,EX_MSG);
+ return (EX_FATAL); /* number of attributes not defined */
}
/* inquire id's of previously defined dimensions */
- if ((numobjentdim = ncdimid (exoid, dnumobjent)) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no %s with id %d in file id %d",
- tname, obj_id, exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entries for %s %d in file id %d",
- tname, obj_id, exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
- if (ncdiminq (exoid, numobjentdim, (char *) 0, &num_entries_this_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entries for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
+ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_put_one_attr") != NC_NOERR)
+ return EX_FATAL;
- if ((numattrdim = ncdimid(exoid, dnumobjatt)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: number of attributes not defined for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_put_one_attr",errmsg,EX_MSG);
- return (EX_FATAL); /* number of attributes not defined */
- }
-
- if (ncdiminq (exoid, numattrdim, (char *) 0, &num_attr) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of attributes for block %d in file id %d",
- obj_id,exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_put_one_attr") != NC_NOERR)
+ return EX_FATAL;
- if (attrib_index < 1 || attrib_index > num_attr) {
+ if (attrib_index < 1 || attrib_index > (int)num_attr) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: Invalid attribute index specified: %d. Valid range is 1 to %ld for %s %d in file id %d",
- attrib_index, num_attr, tname, obj_id, exoid);
+ "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %d in file id %d",
+ attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_put_one_attr",errmsg,exerrval);
return (EX_FATAL);
}
- if ((attrid = ncvarid (exoid, vattrbname)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate attribute variable for %s %d in file id %d",
- tname,obj_id,exoid);
- ex_err("ex_put_one_attr",errmsg,exerrval);
- return (EX_FATAL);
- }
-
+ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate attribute variable for %s %d in file id %d",
+ ex_name_of_object(obj_type),obj_id,exoid);
+ ex_err("ex_put_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* write out the attributes */
@@ -227,25 +190,19 @@ int ex_put_one_attr( int exoid,
stride[0] = 1;
stride[1] = num_attr;
- if (nc_flt_code(exoid) == NC_FLOAT) {
- error = nc_put_vars_float(exoid, attrid, start, count, stride,
- ex_conv_array(exoid,WRITE_CONVERT,attrib,
- (int)num_attr*num_entries_this_obj));
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vars_float(exoid, attrid, start, count, stride, attrib);
} else {
- error = nc_put_vars_double(exoid, attrid, start, count, stride,
- ex_conv_array(exoid,WRITE_CONVERT,attrib,
- (int)num_attr*num_entries_this_obj));
+ status = nc_put_vars_double(exoid, attrid, start, count, stride, attrib);
}
- if (error == -1) {
- exerrval = ncerr;
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to put attribute %d for %s %d in file id %d",
- attrib_index, tname, obj_id, exoid);
+ attrib_index, ex_name_of_object(obj_type), obj_id, exoid);
ex_err("ex_put_one_attr",errmsg,exerrval);
return (EX_FATAL);
}
-
-
return(EX_NOERR);
-
}
diff --git a/cbind/src/expoea.c b/cbind/src/expoea.c
index ce0d590..ddc1113 100644
--- a/cbind/src/expoea.c
+++ b/cbind/src/expoea.c
@@ -48,7 +48,6 @@
* revision history -
* 20061003 - David Thompson - moved to ex_put_one_attr
*
-* $Id: expoea.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -57,6 +56,12 @@
/*!
* writes the specified attribute for an element block
+ * \param exoid exodus file id
+ * \param elem_blk_id element block id
+ * \param attrib_index index of attribute to write
+ * \param attrib array of attributes
+ * \deprecated Use ex_put_one_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib)
+
*/
int ex_put_one_elem_attr (int exoid,
diff --git a/cbind/src/expp.c b/cbind/src/expp.c
index 6097d09..c8f9ee1 100644
--- a/cbind/src/expp.c
+++ b/cbind/src/expp.c
@@ -51,7 +51,6 @@
*
* revision history -
*
-* $Id: expp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,300 +60,297 @@
/*!
* writes an object property
+ * \param exoid exodus file id
+ * \param obj_type type of object
+ * \param obj_id id of object to which property will be assigned
+ * \param prop_name name of the property for which the value will be stored
+ * \param value value of the property
*/
int ex_put_prop (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int obj_id,
const char *prop_name,
int value)
{
- int found = FALSE;
- int num_props, i, dimid, propid, dims[1];
- long start[1];
- nclong ldum;
- char name[MAX_VAR_NAME_LENGTH+1];
- char obj_stype[MAX_VAR_NAME_LENGTH+1];
- char obj_vtype[MAX_VAR_NAME_LENGTH+1];
- char tmpstr[MAX_STR_LENGTH+1];
- char dim_name[MAX_VAR_NAME_LENGTH+1];
- long vals[1];
-
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* check if property has already been created */
-
- num_props = ex_get_num_props(exoid, obj_type);
-
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (obj_vtype, VAR_ID_EL_BLK);
- strcpy (obj_stype, "element block");
- break;
- case EX_NODE_SET:
- strcpy (obj_vtype, VAR_NS_IDS);
- strcpy (obj_stype, "node set");
- break;
- case EX_SIDE_SET:
- strcpy (obj_vtype, VAR_SS_IDS);
- strcpy (obj_stype, "side set");
- break;
- case EX_ELEM_MAP:
- strcpy (obj_vtype, VAR_EM_PROP(1));
- strcpy (obj_stype, "element map");
- break;
- case EX_NODE_MAP:
- strcpy (obj_vtype, VAR_NM_PROP(1));
- strcpy (obj_stype, "node map");
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if (num_props > 1) /* any properties other than the default 1? */
- {
-
- for (i=1; i<=num_props; i++)
- {
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (name, VAR_EB_PROP(i));
- break;
- case EX_NODE_SET:
- strcpy (name, VAR_NS_PROP(i));
- break;
- case EX_SIDE_SET:
- strcpy (name, VAR_SS_PROP(i));
- break;
- case EX_ELEM_MAP:
- strcpy (name, VAR_EM_PROP(i));
- break;
- case EX_NODE_MAP:
- strcpy (name, VAR_NM_PROP(i));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if ((propid = ncvarid (exoid, name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get property array id in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* compare stored attribute name with passed property name */
-
- memset(tmpstr, 0, MAX_STR_LENGTH+1);
- if ((ncattget (exoid, propid, ATT_PROP_NAME, tmpstr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get property name in file id %d", exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (strcmp(tmpstr, prop_name) == 0)
- {
- found = TRUE;
- break;
- }
- }
- }
-
-/* if property array has not been created, create it */
-
- if (!found)
- {
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* create a variable with a name xx_prop#, where # is the new number */
-/* of the property */
-
- switch (obj_type){
- case EX_ELEM_BLOCK:
- strcpy (name, VAR_EB_PROP(num_props+1));
- strcpy (dim_name, DIM_NUM_EL_BLK);
- break;
- case EX_NODE_SET:
- strcpy (name, VAR_NS_PROP(num_props+1));
- strcpy (dim_name, DIM_NUM_NS);
- break;
- case EX_SIDE_SET:
- strcpy (name, VAR_SS_PROP(num_props+1));
- strcpy (dim_name, DIM_NUM_SS);
- break;
- case EX_ELEM_MAP:
- strcpy (name, VAR_EM_PROP(num_props+1));
- strcpy (dim_name, DIM_NUM_EM);
- break;
- case EX_NODE_MAP:
- strcpy (name, VAR_NM_PROP(num_props+1));
- strcpy (dim_name, DIM_NUM_NM);
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
-/* inquire id of previously defined dimension (number of objects) */
-
- if ((dimid = ncdimid (exoid, dim_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of objects in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg, exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- dims[0] = dimid;
- ncsetfill(exoid, NC_FILL); /* fill with zeros per routine spec */
-
- if ((propid = ncvardef (exoid, name, NC_LONG, 1, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create property array variable in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- vals[0] = 0; /* fill value */
- /* create attribute to cause variable to fill with zeros per routine spec */
- if ((ncattput (exoid, propid, _FillValue, NC_LONG, 1, vals)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create property name fill attribute in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
-/* store property name as attribute of property array variable */
-
- if ((ncattput (exoid, propid, ATT_PROP_NAME, NC_CHAR,
- strlen(prop_name)+1, (void*)prop_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store property name %s in file id %d",
- prop_name,exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to leave define mode in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
- ncsetfill(exoid, NC_NOFILL); /* default: nofill */
-
- }
-
-/* find index into property array using obj_id; put value in property */
-/* array at proper index; ex_id_lkup returns an index that is 1-based,*/
-/* but netcdf expects 0-based arrays so subtract 1 */
+ int status;
+ int oldfill, temp;
+ int found = FALSE;
+ int num_props, i, dimid, propid, dims[1];
+ size_t start[1];
+ int ldum;
+ char name[MAX_VAR_NAME_LENGTH+1];
+ char tmpstr[MAX_STR_LENGTH+1];
+ char dim_name[MAX_VAR_NAME_LENGTH+1];
+ int vals[1];
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* check if property has already been created */
+
+ num_props = ex_get_num_props(exoid, obj_type);
+
+ if (num_props > 1) { /* any properties other than the default 1? */
+
+ for (i=1; i<=num_props; i++) {
+ switch (obj_type) {
+ case EX_ELEM_BLOCK:
+ strcpy (name, VAR_EB_PROP(i));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(i));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(i));
+ break;
+ case EX_NODE_SET:
+ strcpy (name, VAR_NS_PROP(i));
+ break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(i));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(i));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(i));
+ break;
+ case EX_SIDE_SET:
+ strcpy (name, VAR_SS_PROP(i));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (name, VAR_EM_PROP(i));
+ break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(i));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(i));
+ break;
+ case EX_NODE_MAP:
+ strcpy (name, VAR_NM_PROP(i));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get property array id in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* compare stored attribute name with passed property name */
+ memset(tmpstr, 0, MAX_STR_LENGTH+1);
+ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get property name in file id %d", exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (strcmp(tmpstr, prop_name) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+ }
- /* special case: property name ID - check for duplicate ID assignment */
- if (strcmp("ID",prop_name) == 0)
- {
- start[0] = ex_id_lkup (exoid, obj_vtype, value);
- if (exerrval != EX_LOOKUPFAIL) /* found the id */
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: attempt to assign duplicate %s ID %d in file id %d",
- obj_stype, value, exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_WARN);
- }
- }
+ /* if property array has not been created, create it */
+ if (!found) {
+ /* put netcdf file into define mode */
+
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* create a variable with a name xx_prop#, where # is the new number */
+ /* of the property */
+
+ switch (obj_type){
+ case EX_ELEM_BLOCK:
+ strcpy (name, VAR_EB_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_EL_BLK);
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_FA_BLK);
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_ED_BLK);
+ break;
+ case EX_NODE_SET:
+ strcpy (name, VAR_NS_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_NS);
+ break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_ES);
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_FS);
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_ELS);
+ break;
+ case EX_SIDE_SET:
+ strcpy (name, VAR_SS_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_SS);
+ break;
+ case EX_ELEM_MAP:
+ strcpy (name, VAR_EM_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_EM);
+ break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_FAM);
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_EDM);
+ break;
+ case EX_NODE_MAP:
+ strcpy (name, VAR_NM_PROP(num_props+1));
+ strcpy (dim_name, DIM_NUM_NM);
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ /* inquire id of previously defined dimension (number of objects) */
+ if ((status = nc_inq_dimid(exoid, dim_name, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of objects in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg, exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ dims[0] = dimid;
+ nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */
+
+ if ((status = nc_def_var(exoid, name, NC_INT, 1, dims, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create property array variable in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ vals[0] = 0; /* fill value */
+ /* create attribute to cause variable to fill with zeros per routine spec */
+ if ((status = nc_put_att_int(exoid, propid, _FillValue, NC_INT, 1, vals)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create property name fill attribute in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ /* store property name as attribute of property array variable */
+ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME,
+ strlen(prop_name)+1, (void*)prop_name)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store property name %s in file id %d",
+ prop_name,exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to leave define mode in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ nc_set_fill(exoid, oldfill, &temp); /* default: nofill */
+ }
- start[0] = ex_id_lkup (exoid, obj_vtype, obj_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no properties allowed for NULL %s id %d in file id %d",
- obj_stype, obj_id,exoid);
- ex_err("ex_put_prop",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
+ /* find index into property array using obj_id; put value in property */
+ /* array at proper index; ex_id_lkup returns an index that is 1-based,*/
+ /* but netcdf expects 0-based arrays so subtract 1 */
+
+ /* special case: property name ID - check for duplicate ID assignment */
+ if (strcmp("ID",prop_name) == 0) {
+ start[0] = ex_id_lkup (exoid, obj_type, value);
+ if (exerrval != EX_LOOKUPFAIL) /* found the id */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: attempt to assign duplicate %s ID %d in file id %d",
+ ex_name_of_object(obj_type), value, exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_WARN);
+ }
+ }
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to find value %d in %s property array in file id %d",
- obj_id, obj_stype, exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ start[0] = ex_id_lkup (exoid, obj_type, obj_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no properties allowed for NULL %s id %d in file id %d",
+ ex_name_of_object(obj_type), obj_id,exoid);
+ ex_err("ex_put_prop",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to find value %d in %s property array in file id %d",
+ obj_id, ex_name_of_object(obj_type), exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
- start[0] = start[0] - 1;
+ start[0] = start[0] - 1;
- ldum = (nclong)value;
- if (ncvarput1 (exoid, propid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store property value in file id %d",
- exoid);
- ex_err("ex_put_prop",errmsg,exerrval);
- return (EX_FATAL);
- }
+ ldum = (int)value;
+ if ((status = nc_put_var1_int(exoid, propid, start, &ldum)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store property value in file id %d",
+ exoid);
+ ex_err("ex_put_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- return (EX_NOERR);
+ return (EX_NOERR);
-/* Fatal error: exit definition mode and return */
-error_ret:
- ncsetfill(exoid, NC_NOFILL); /* default: nofill */
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ nc_set_fill(exoid, oldfill, &temp); /* default: nofill */
- if (ncendef (exoid) == -1) /* exit define mode */
- {
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
+ "Error: failed to complete definition for file id %d",
+ exoid);
ex_err("ex_put_prop",errmsg,exerrval);
}
return (EX_FATAL);
diff --git a/cbind/src/exppa.c b/cbind/src/exppa.c
index d180310..cef3b92 100644
--- a/cbind/src/exppa.c
+++ b/cbind/src/exppa.c
@@ -36,11 +36,6 @@
*
* exppa - ex_put_prop_array: write object property array
*
-* author - Larry A. Schoof, Sandia National Laboratories
-* Victor R. Yarberry, Sandia National Laboratories
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +49,6 @@
*
* revision history -
*
-* $Id: exppa.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,260 +59,224 @@
/*!
* writes an array of object properties
+ * \param exoid exodus file id
+ * \param obj_type type of object (element block, node set or side set)
+ * \param prop_name name of the property for which the values will be stored
+ * \param values array of property values
*/
int ex_put_prop_array (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
const char *prop_name,
const int *values)
{
- int num_props, i, propid, dimid, dims[1], iresult;
- int found = FALSE;
- long start[1], count[1], num_obj;
- nclong *lptr;
- char name[MAX_VAR_NAME_LENGTH+1];
- char tmpstr[MAX_STR_LENGTH+1];
- char obj_stype[MAX_VAR_NAME_LENGTH+1];
- char dim_name[MAX_VAR_NAME_LENGTH+1];
-
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* check if property has already been created */
-
- num_props = ex_get_num_props(exoid, obj_type);
-
- switch (obj_type)
- {
- case EX_ELEM_BLOCK:
- strcpy (obj_stype, VAR_ID_EL_BLK);
- strcpy (dim_name, DIM_NUM_EL_BLK);
- break;
- case EX_NODE_SET:
- strcpy (obj_stype, VAR_NS_IDS);
- strcpy (dim_name, DIM_NUM_NS);
- break;
- case EX_SIDE_SET:
- strcpy (obj_stype, VAR_SS_IDS);
- strcpy (dim_name, DIM_NUM_SS);
- break;
- case EX_ELEM_MAP:
- strcpy (obj_stype, VAR_EM_PROP(1));
- strcpy (dim_name, DIM_NUM_EM);
- break;
- case EX_NODE_MAP:
- strcpy (obj_stype, VAR_NM_PROP(1));
- strcpy (dim_name, DIM_NUM_NM);
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-/* inquire id of previously defined dimension (number of objects) */
-
- if ((dimid = ncdimid (exoid, dim_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of %s objects in file id %d",
- obj_stype, exoid);
- ex_err("ex_put_prop_array",errmsg, exerrval);
- return (EX_FATAL);
- }
-
-/* get number of objects */
-
- if (ncdiminq (exoid, dimid, dim_name, &num_obj) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %s objects in file id %d",
- obj_stype, exoid);
- ex_err("ex_put_prop_array",errmsg, exerrval);
- return (EX_FATAL);
- }
-
-
-
- for (i=1; i<=num_props; i++)
- {
- switch (obj_type){
- case EX_ELEM_BLOCK:
- strcpy (name, VAR_EB_PROP(i));
- break;
- case EX_NODE_SET:
- strcpy (name, VAR_NS_PROP(i));
- break;
- case EX_SIDE_SET:
- strcpy (name, VAR_SS_PROP(i));
- break;
- case EX_ELEM_MAP:
- strcpy (name, VAR_EM_PROP(i));
- break;
- case EX_NODE_MAP:
- strcpy (name, VAR_NM_PROP(i));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return(EX_FATAL);
- }
-
- if ((propid = ncvarid (exoid, name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get property array id in file id %d",
- exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* compare stored attribute name with passed property name */
-
- memset(tmpstr, 0, MAX_STR_LENGTH+1);
- if ((ncattget (exoid, propid, ATT_PROP_NAME, tmpstr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ int oldfill, temp;
+ int num_props, i, propid, dimid, dims[1], status;
+ int found = FALSE;
+ size_t num_obj;
+ char name[MAX_VAR_NAME_LENGTH+1];
+ char tmpstr[MAX_STR_LENGTH+1];
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* check if property has already been created */
+
+ num_props = ex_get_num_props(exoid, obj_type);
+
+ /* inquire id of previously defined dimension (number of objects) */
+ status = ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type),
+ &num_obj, &dimid, "ex_put_prop_array");
+ if (status != NC_NOERR) return status;
+
+ for (i=1; i<=num_props; i++) {
+ switch (obj_type){
+ case EX_ELEM_BLOCK:
+ strcpy (name, VAR_EB_PROP(i));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(i));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(i));
+ break;
+ case EX_NODE_SET:
+ strcpy (name, VAR_NS_PROP(i));
+ break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(i));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(i));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(i));
+ break;
+ case EX_SIDE_SET:
+ strcpy (name, VAR_SS_PROP(i));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (name, VAR_EM_PROP(i));
+ break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(i));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(i));
+ break;
+ case EX_NODE_MAP:
+ strcpy (name, VAR_NM_PROP(i));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get property array id in file id %d",
+ exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* compare stored attribute name with passed property name */
+ memset(tmpstr, 0, MAX_STR_LENGTH+1);
+ if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to get property name in file id %d", exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (strcmp(tmpstr, prop_name) == 0)
- {
- found = TRUE;
- break;
- }
- }
-
-/* if property array has not been created, create it */
-
- if (!found)
- {
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* create a variable with a name xx_prop#, where # is the new number */
-/* of properties */
-
- switch (obj_type){
- case EX_ELEM_BLOCK:
- strcpy (name, VAR_EB_PROP(num_props+1));
- break;
- case EX_NODE_SET:
- strcpy (name, VAR_NS_PROP(num_props+1));
- break;
- case EX_SIDE_SET:
- strcpy (name, VAR_SS_PROP(num_props+1));
- break;
- case EX_ELEM_MAP:
- strcpy (name, VAR_EM_PROP(num_props+1));
- break;
- case EX_NODE_MAP:
- strcpy (name, VAR_NM_PROP(num_props+1));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- dims[0] = dimid;
- ncsetfill(exoid, NC_FILL); /* fill with zeros per routine spec */
-
- if ((propid = ncvardef (exoid, name, NC_LONG, 1, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create property array variable in file id %d",
- exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
- ncsetfill(exoid, NC_NOFILL); /* default: nofill */
-
-
-/* store property name as attribute of property array variable */
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (strcmp(tmpstr, prop_name) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
- if ((ncattput (exoid, propid, ATT_PROP_NAME, NC_CHAR,
- strlen(prop_name)+1, prop_name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* if property array has not been created, create it */
+ if (!found) {
+
+ /* put netcdf file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* create a variable with a name xx_prop#, where # is the new number */
+ /* of properties */
+ switch (obj_type){
+ case EX_ELEM_BLOCK:
+ strcpy (name, VAR_EB_PROP(num_props+1));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(num_props+1));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(num_props+1));
+ break;
+ case EX_NODE_SET:
+ strcpy (name, VAR_NS_PROP(num_props+1));
+ break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(num_props+1));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(num_props+1));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(num_props+1));
+ break;
+ case EX_SIDE_SET:
+ strcpy (name, VAR_SS_PROP(num_props+1));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (name, VAR_EM_PROP(num_props+1));
+ break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(num_props+1));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(num_props+1));
+ break;
+ case EX_NODE_MAP:
+ strcpy (name, VAR_NM_PROP(num_props+1));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ dims[0] = dimid;
+ nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */
+
+ if ((status = nc_def_var(exoid, name, NC_INT, 1, dims, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create property array variable in file id %d",
+ exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+ nc_set_fill(exoid, oldfill, &temp); /* default: nofill */
+
+
+ /* store property name as attribute of property array variable */
+ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME,
+ strlen(prop_name)+1, prop_name)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to store property name %s in file id %d",
- prop_name,exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to leave define mode in file id %d",
- exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- }
-
-/* put num_obj values in property array */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_obj;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, propid, start, count, values);
- } else {
- lptr = itol (values, (int)num_obj);
- iresult = ncvarput (exoid, propid, start, count, lptr);
- free(lptr);
- }
+ prop_name,exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ /* leave define mode */
+
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to leave define mode in file id %d",
+ exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store property values in file id %d",
- exoid);
- ex_err("ex_put_prop_array",errmsg,exerrval);
- return (EX_FATAL);
- }
+ /* put num_obj values in property array */
+ status = nc_put_var_int(exoid, propid, values);
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store property values in file id %d",
+ exoid);
+ ex_err("ex_put_prop_array",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- return (EX_NOERR);
+ return (EX_NOERR);
-/* Fatal error: exit definition mode and return */
-error_ret:
- ncsetfill(exoid, NC_NOFILL); /* default: nofill */
- if (ncendef (exoid) == -1) /* exit define mode */
- {
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ nc_set_fill(exoid, oldfill, &temp); /* default: nofill */
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
+ "Error: failed to complete definition for file id %d",
+ exoid);
ex_err("ex_put_prop_array",errmsg,exerrval);
}
return (EX_FATAL);
diff --git a/cbind/src/exppem.c b/cbind/src/exppem.c
index d4608f0..302bf57 100644
--- a/cbind/src/exppem.c
+++ b/cbind/src/exppem.c
@@ -36,11 +36,6 @@
*
* exppem - ex_put_partial_elem_map
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -70,39 +65,33 @@ int ex_put_partial_elem_map (int exoid,
int ent_count,
const int *elem_map)
{
- int dimid, varid, iresult, map_ndx, map_exists;
- long start[1];
- nclong ldum, *lptr;
- long num_elem_maps, num_elem, count[1];
+ int status;
+ int dimid, varid, map_ndx, map_exists;
+ size_t start[1];
+ size_t num_elem_maps, num_elem, count[1];
int cur_num_elem_maps;
- char *cdum;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
map_exists = 0;
- cdum = 0;
-
/* Make sure the file contains elements */
- if ((dimid = (ncdimid (exoid, DIM_NUM_ELEM))) == -1 )
- {
- return (EX_NOERR);
- }
+ if (nc_inq_dimid (exoid, DIM_NUM_ELEM, &dimid) != NC_NOERR ) {
+ return (EX_NOERR);
+ }
/* first check if any element maps are specified */
-
- if ((dimid = (ncdimid (exoid, DIM_NUM_EM))) == -1 )
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no element maps specified in file id %d",
- exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
-
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_EM, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no element maps specified in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
/* Check for duplicate element map id entry */
- map_ndx = ex_id_lkup(exoid,VAR_EM_PROP(1),map_id);
+ map_ndx = ex_id_lkup(exoid,EX_ELEM_MAP,map_id);
if (exerrval == EX_LOOKUPFAIL) { /* did not find the element map id */
map_exists = 0; /* Map is being defined */
map_ndx = -1;
@@ -112,63 +101,58 @@ int ex_put_partial_elem_map (int exoid,
if (!map_exists) {
/* Get number of element maps initialized for this file */
- if ((ncdiminq (exoid,dimid,cdum,&num_elem_maps)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of element maps in file id %d",
- exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimlen(exoid,dimid,&num_elem_maps)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of element maps in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* Keep track of the total number of element maps defined using a
counter stored in a linked list keyed by exoid. NOTE:
ex_get_file_item is used to find the number of element maps for a
specific file and returns that value.
*/
- cur_num_elem_maps = ex_get_file_item(exoid, &em_ctr_list );
- if (cur_num_elem_maps >= num_elem_maps)
- {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: exceeded number of element maps (%ld) specified in file id %d",
- num_elem_maps,exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ cur_num_elem_maps = ex_get_file_item(exoid, ex_get_counter_list(EX_ELEM_MAP));
+ if (cur_num_elem_maps >= (int)num_elem_maps) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of element maps (%ld) specified in file id %d",
+ (long)num_elem_maps,exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* NOTE: ex_inc_file_item is used to find the number of element maps
for a specific file and returns that value incremented. */
-
- cur_num_elem_maps = ex_inc_file_item(exoid, &em_ctr_list );
+ cur_num_elem_maps = ex_inc_file_item(exoid, ex_get_counter_list(EX_ELEM_MAP));
} else {
cur_num_elem_maps = map_ndx-1;
}
/* determine number of elements */
- if ((dimid = (ncdimid (exoid, DIM_NUM_ELEM))) == -1 )
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: couldn't determine number of elements in file id %d",
- exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimid(exoid, DIM_NUM_ELEM, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: couldn't determine number of elements in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- if (ncdiminq (exoid, dimid, (char *) 0, &num_elem) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of elements in file id %d",
- exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if ((status = nc_inq_dimlen(exoid, dimid, &num_elem)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of elements in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* Check input parameters for a valid range of numbers */
- if (ent_start <= 0 || ent_start > num_elem) {
+ if (ent_start <= 0 || ent_start > (int)num_elem) {
exerrval = EX_FATAL;
sprintf(errmsg,
"Error: start count is invalid in file id %d",
@@ -184,7 +168,7 @@ int ex_put_partial_elem_map (int exoid,
ex_err("ex_put_partial_elem_map",errmsg,exerrval);
return (EX_FATAL);
}
- if (ent_start+ent_count-1 > num_elem) {
+ if (ent_start+ent_count-1 > (int)num_elem) {
exerrval = EX_FATAL;
sprintf(errmsg,
"Error: start+count-1 is larger than element count in file id %d",
@@ -197,8 +181,8 @@ int ex_put_partial_elem_map (int exoid,
/* write out information to previously defined variable */
/* first get id of variable */
- if ((varid = ncvarid (exoid, VAR_EM_PROP(1))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid(exoid, VAR_EM_PROP(1), &varid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate element map ids in file id %d",
exoid);
@@ -210,56 +194,41 @@ int ex_put_partial_elem_map (int exoid,
if (!map_exists) {
start[0] = cur_num_elem_maps;
- ldum = (nclong)map_id;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element map id %d in file id %d",
- map_id,exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- /* locate variable array in which to store the element map */
- if ((varid =
- ncvarid(exoid,VAR_ELEM_MAP(cur_num_elem_maps+1))) == -1)
- {
- exerrval = ncerr;
+ if ((status = nc_put_var1_int(exoid, varid, start, &map_id)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to locate element map %d in file id %d",
+ "Error: failed to store element map id %d in file id %d",
map_id,exoid);
ex_err("ex_put_partial_elem_map",errmsg,exerrval);
return (EX_FATAL);
}
+ }
+
+ /* locate variable array in which to store the element map */
+ if ((status = nc_inq_varid(exoid,VAR_ELEM_MAP(cur_num_elem_maps+1),
+ &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate element map %d in file id %d",
+ map_id,exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
/* write out the element map */
-
- /* this contortion is necessary because netCDF is expecting nclongs;
- fortunately it's necessary only when ints and nclongs aren't the
- same size */
-
start[0] = ent_start-1;
count[0] = ent_count;
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, elem_map);
- } else {
- lptr = itol (elem_map, (int)ent_count);
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
+ status = nc_put_vara_int(exoid, varid, start, count, elem_map);
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store element map in file id %d",
- exoid);
- ex_err("ex_put_partial_elem_map",errmsg,exerrval);
- return (EX_FATAL);
- }
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store element map in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
return (EX_NOERR);
}
diff --git a/cbind/src/exppn.c b/cbind/src/exppn.c
index 24b9bdc..b8a86f4 100644
--- a/cbind/src/exppn.c
+++ b/cbind/src/exppn.c
@@ -48,7 +48,6 @@
*
* revision history -
*
-* $Id: exppn.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -56,163 +55,152 @@
#include "exodusII_int.h"
#include <string.h>
-/*
+/*!
* writes the parameters to set up property name arrays
+ * \param exoid exodus file id
+ * \param obj_type type of object
+ * \param num_props number of properties to be assigned
+ * \param **prop_names array of num_props names
*/
int ex_put_prop_names (int exoid,
- int obj_type,
+ ex_entity_type obj_type,
int num_props,
char **prop_names)
{
- int i, propid, dimid, dims[1];
- char name[MAX_VAR_NAME_LENGTH+1];
- long vals[1];
-
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* determine what type of object (element block, node set, or side set) */
-
- switch (obj_type){
- case EX_ELEM_BLOCK:
- strcpy (name, DIM_NUM_EL_BLK);
- break;
- case EX_NODE_SET:
- strcpy (name, DIM_NUM_NS);
- break;
- case EX_SIDE_SET:
- strcpy (name, DIM_NUM_SS);
- break;
- case EX_ELEM_MAP:
- strcpy (name, DIM_NUM_EM);
- break;
- case EX_NODE_MAP:
- strcpy (name, DIM_NUM_NM);
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-/* inquire id of previously defined dimension (number of objects) */
-
- if ((dimid = ncdimid (exoid, name)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of objects in file id %d",
- exoid);
- ex_err("ex_put_prop_names",errmsg, exerrval);
- return(EX_FATAL);
- }
-
- ncsetfill(exoid, NC_FILL); /* fill with zeros per routine spec */
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* define num_props variables; we postpend the netcdf variable name with */
-/* a counter starting at 2 because "xx_prop1" is reserved for the id array*/
-
- dims[0] = dimid;
-
- for (i=0; i<num_props; i++)
- {
- switch (obj_type){
- case EX_ELEM_BLOCK:
- strcpy (name, VAR_EB_PROP(i+2));
- break;
- case EX_NODE_SET:
- strcpy (name, VAR_NS_PROP(i+2));
- break;
- case EX_SIDE_SET:
- strcpy (name, VAR_SS_PROP(i+2));
- break;
- case EX_ELEM_MAP:
- strcpy (name, VAR_EM_PROP(i+2));
- break;
- case EX_NODE_MAP:
- strcpy (name, VAR_NM_PROP(i+2));
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg, "Error: object type %d not supported; file id %d",
- obj_type, exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- if ((propid = ncvardef (exoid, name, NC_LONG, 1, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create property array variable in file id %d",
- exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- vals[0] = 0; /* fill value */
- /* create attribute to cause variable to fill with zeros per routine spec */
- if ((ncattput (exoid, propid, _FillValue, NC_LONG, 1, vals)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create property name fill attribute in file id %d",
- exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
-/* store property name as attribute of property array variable */
-
- if ((ncattput (exoid, propid, ATT_PROP_NAME, NC_CHAR,
- strlen(prop_names[i])+1, prop_names[i])) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ int status;
+ int oldfill, temp;
+ int i, propid, dimid, dims[1];
+ char name[MAX_VAR_NAME_LENGTH+1];
+ int vals[1];
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire id of previously defined dimension (number of objects) */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(obj_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of %s in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err("ex_put_prop_names",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */
+
+ /* put netcdf file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* define num_props variables; we postpend the netcdf variable name with */
+ /* a counter starting at 2 because "xx_prop1" is reserved for the id array*/
+ dims[0] = dimid;
+
+ for (i=0; i<num_props; i++) {
+ switch (obj_type) {
+ case EX_ELEM_BLOCK:
+ strcpy (name, VAR_EB_PROP(i+2));
+ break;
+ case EX_FACE_BLOCK:
+ strcpy (name, VAR_FA_PROP(i+2));
+ break;
+ case EX_EDGE_BLOCK:
+ strcpy (name, VAR_ED_PROP(i+2));
+ break;
+ case EX_NODE_SET:
+ strcpy (name, VAR_NS_PROP(i+2));
+ break;
+ case EX_SIDE_SET:
+ strcpy (name, VAR_SS_PROP(i+2));
+ break;
+ case EX_EDGE_SET:
+ strcpy (name, VAR_ES_PROP(i+2));
+ break;
+ case EX_FACE_SET:
+ strcpy (name, VAR_FS_PROP(i+2));
+ break;
+ case EX_ELEM_SET:
+ strcpy (name, VAR_ELS_PROP(i+2));
+ break;
+ case EX_ELEM_MAP:
+ strcpy (name, VAR_EM_PROP(i+2));
+ break;
+ case EX_FACE_MAP:
+ strcpy (name, VAR_FAM_PROP(i+2));
+ break;
+ case EX_EDGE_MAP:
+ strcpy (name, VAR_EDM_PROP(i+2));
+ break;
+ case EX_NODE_MAP:
+ strcpy (name, VAR_NM_PROP(i+2));
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ if ((status = nc_def_var(exoid, name, NC_INT, 1, dims, &propid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create property array variable in file id %d",
+ exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ vals[0] = 0; /* fill value */
+
+ /* create attribute to cause variable to fill with zeros per routine spec */
+ if ((status = nc_put_att_int(exoid, propid, _FillValue, NC_INT, 1, vals)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to create property name fill attribute in file id %d",
+ exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+
+ /* store property name as attribute of property array variable */
+ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME,
+ strlen(prop_names[i])+1, prop_names[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to store property name %s in file id %d",
- prop_names[i],exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- goto error_ret; /* Exit define mode and return */
- }
-
- }
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to leave define mode in file id %d",
- exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- ncsetfill(exoid, NC_NOFILL); /* default: turn off fill */
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_prop_names",errmsg,exerrval);
- }
- return (EX_FATAL);
+ prop_names[i],exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ goto error_ret; /* Exit define mode and return */
+ }
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef(exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to leave define mode in file id %d",
+ exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ nc_set_fill(exoid, oldfill, &temp); /* default: turn off fill */
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_prop_names",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/exppsetd.c b/cbind/src/exppsetd.c
new file mode 100644
index 0000000..7fd9b40
--- /dev/null
+++ b/cbind/src/exppsetd.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expssd - ex_put_partial_set_dist_fact
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int set_type set type
+* int set_id set id
+* int offset index (1-based) of first dist factor to write
+* int num_to_put number of dist factors to write.
+* void* set_dist_fact array of dist factors for set
+
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the partial distribution factors for a single set
+ * \param exoid exodus file id
+ * \param set_type set type
+ * \param set_id set id
+ * \param offset index (1-based) of first dist factor to write
+ * \param num_to_put number of dist factors to write.
+ * \param *set_dist_fact array of dist factors for set
+ */
+
+int ex_put_partial_set_dist_fact (int exoid,
+ ex_entity_type set_type,
+ int set_id,
+ int offset,
+ int num_to_put,
+ const void *set_dist_fact)
+{
+ int status;
+ int dimid, set_id_ndx;
+ int dist_id;
+ size_t start[1], count[1];
+ char errmsg[MAX_ERR_LENGTH];
+ char* factptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no %ss specified in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid,set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no data allowed for NULL %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_fact",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in VAR_*S_IDS array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* setup more pointers based on set_type */
+ if (set_type == EX_NODE_SET) {
+ /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
+ factptr = VAR_FACT_NS(set_id_ndx);
+ }
+ else if (set_type == EX_EDGE_SET) {
+ factptr = VAR_FACT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ factptr = VAR_FACT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ factptr = VAR_FACT_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ factptr = VAR_FACT_ELS(set_id_ndx);
+ }
+
+ /* find id of distribution factors variable
+ */
+
+ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) {
+ /* this test is only needed for node set because we're using
+ DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/
+ if (status == NC_ENOTVAR) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: no dist factors defined for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_WARN);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate dist factors list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ start[0] = offset-1;
+ count[0] = num_to_put;
+ /* write out the distribution factors array */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, dist_id, start, count, set_dist_fact);
+ } else {
+ status = nc_put_vara_double(exoid, dist_id, start, count, set_dist_fact);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store dist factors for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_partial_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expqa.c b/cbind/src/expqa.c
index b6acf1b..d9347ca 100644
--- a/cbind/src/expqa.c
+++ b/cbind/src/expqa.c
@@ -36,14 +36,6 @@
*
* expqa = ex_put_qa
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: expqa.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -64,146 +55,125 @@
/*!
* writes the QA records to the database
+ * \param exoid exodus file id
+ * \param num_qa_records number of qa records to be written
+ * \param *qa_record qa record array
*/
int ex_put_qa (int exoid,
int num_qa_records,
char* qa_record[][4])
{
- int i, j, strdim, num_qa_dim, varid, n4dim;
- int dims[3];
- long start[3], count[3];
- char errmsg[MAX_ERR_LENGTH];
+ int status;
+ int i, j, strdim, num_qa_dim, varid, n4dim;
+ int dims[3];
+ size_t start[3], count[3];
+ char errmsg[MAX_ERR_LENGTH];
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
-/* only do this if there are records */
+ /* only do this if there are records */
- if (num_qa_records > 0)
- {
-/* inquire previously defined dimensions */
+ if (num_qa_records > 0) {
+ /* inquire previously defined dimensions */
- if ((strdim = ncdimid (exoid, DIM_STR)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &strdim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to locate string length in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((n4dim = ncdimid (exoid, DIM_N4)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate record length in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define dimensions */
-
- if ((num_qa_dim = ncdimdef (exoid,DIM_NUM_QA,(long)num_qa_records)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE) /* duplicate entry? */
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: qa records already exist in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define qa record array size in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- }
-
- goto error_ret; /* exit define mode and return */
- }
-
-
-
-/* define variable */
-
- dims[0] = num_qa_dim;
- dims[1] = n4dim;
- dims[2] = strdim;
-
- if ((varid = ncvardef (exoid, VAR_QA_TITLE, NC_CHAR, 3, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define qa record array in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* write out QA records */
-
- for (i=0; i<num_qa_records; i++)
- {
- for (j=0; j<4; j++)
- {
- start[0] = i;
- start[1] = j;
- start[2] = 0;
-
- count[0] = 1;
- count[1] = 1;
- count[2] = strlen(qa_record[i][j]) + 1;
-
- if (ncvarput (exoid, varid, start, count,
- (void*) qa_record[i][j]) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store qa record in file id %d", exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- }
- }
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_qa",errmsg,exerrval);
- }
- return (EX_FATAL);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_dimid(exoid, DIM_N4, &n4dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate record length in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* put file into define mode */
+ if ((status = nc_redef(exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* define dimensions */
+ if ((status = nc_def_dim(exoid,DIM_NUM_QA,num_qa_records, &num_qa_dim)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) { /* duplicate entry? */
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: qa records already exist in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define qa record array size in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ }
+
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* define variable */
+ dims[0] = num_qa_dim;
+ dims[1] = n4dim;
+ dims[2] = strdim;
+
+ if ((status = nc_def_var(exoid, VAR_QA_TITLE, NC_CHAR, 3, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define qa record array in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* write out QA records */
+
+ for (i=0; i<num_qa_records; i++) {
+ for (j=0; j<4; j++) {
+ start[0] = i;
+ start[1] = j;
+ start[2] = 0;
+
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = strlen(qa_record[i][j]) + 1;
+
+ if ((status = nc_put_vara_text(exoid, varid, start, count, qa_record[i][j])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store qa record in file id %d", exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ }
+ }
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_qa",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/expset.c b/cbind/src/expset.c
index 99f09d9..0ec5e02 100644
--- a/cbind/src/expset.c
+++ b/cbind/src/expset.c
@@ -36,27 +36,18 @@
*
* expss - ex_put_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int set_type set type
* int set_id set id
-* int* set_entry_list array of entries in set
+* int* set_entry_list array of entries in set
* int* set_extra_list array of extras in set
* exit conditions -
*
* revision history -
*
-* $Id: expset.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -66,237 +57,144 @@
/*!
* writes the set entry list and set extra list for a single set
+ * \param exoid exodus file id
+ * \param set_type set type
+ * \param set_id set id
+ * \param *set_entry_list array of entries in set
+ * \param *set_extra_list array of extras in set
*/
int ex_put_set (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
const int *set_entry_list,
const int *set_extra_list)
{
- int dimid, iresult;
- int entry_list_id, extra_list_id, set_id_ndx;
- long num_entries_in_set, start[1], count[1];
- nclong *lptr;
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* numentryptr;
- char* entryptr;
- char* extraptr;
-
- exerrval = 0; /* clear error code */
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) < 0)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no %s sets defined in file id %d",
- typeName, exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Lookup index of set id in VAR_*S_IDS array */
-
- set_id_ndx = ex_id_lkup(exoid,idsptr,set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no data allowed for NULL %s set %d in file id %d",
- typeName,set_id,exoid);
- ex_err("ex_put_set",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate %s set id %d in VAR_*S_IDS array in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ int dimid, status;
+ int entry_list_id, extra_list_id, set_id_ndx;
+ char errmsg[MAX_ERR_LENGTH];
+ char* entryptr = NULL;
+ char* extraptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no %ss defined in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid, set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no data allowed for NULL %s %d in file id %d",
+ ex_name_of_object(set_type),set_id,exoid);
+ ex_err("ex_put_set",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to locate %s id %d in VAR_*S_IDS array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
/* setup more pointers based on set_type */
- if (set_type == EX_NODE_SET) {
- numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
- entryptr = VAR_NODE_NS(set_id_ndx);
- extraptr = NULL;
- }
- else if (set_type == EX_EDGE_SET) {
- numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
- entryptr = VAR_EDGE_ES(set_id_ndx);
- extraptr = VAR_ORNT_ES(set_id_ndx);
- }
- else if (set_type == EX_FACE_SET) {
- numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
- entryptr = VAR_FACE_FS(set_id_ndx);
- extraptr = VAR_ORNT_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
- entryptr = VAR_ELEM_SS(set_id_ndx);
- extraptr = VAR_SIDE_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
- entryptr = VAR_ELEM_ELS(set_id_ndx);
- extraptr = NULL;
- }
-
-/* inquire id's of previously defined dimensions */
-
- if ((dimid = ncdimid (exoid, numentryptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of entities in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_entries_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of entities in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* inquire id's of previously defined variables */
-
- if ((entry_list_id = ncvarid (exoid, entryptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate entry list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* only do for edge, face and side sets */
- if (extraptr)
- {
- if ((extra_list_id = ncvarid (exoid, extraptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate extra list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* write out the entry list and extra list arrays */
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- count[0] = num_entries_in_set;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput(exoid, entry_list_id, start, count, set_entry_list);
- } else {
- lptr = itol (set_entry_list, (int)num_entries_in_set);
- iresult = ncvarput (exoid, entry_list_id, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store entry list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- /* only do for edge, face and side sets */
- if (extraptr)
- {
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput(exoid, extra_list_id, start, count, set_extra_list);
- } else {
- lptr = itol (set_extra_list, (int)num_entries_in_set);
- iresult = ncvarput (exoid, extra_list_id, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store extra list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- /* warn if extra data was sent in for node sets and elem sets */
- if ((set_type == EX_NODE_SET || set_type == EX_ELEM_SET) &&
- set_extra_list != NULL)
- {
- sprintf(errmsg,
- "Warning: extra list was ignored for %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_put_set",errmsg,EX_MSG);
- return(EX_WARN);
- }
-
- return (EX_NOERR);
+ if (set_type == EX_NODE_SET) {
+ entryptr = VAR_NODE_NS(set_id_ndx);
+ extraptr = NULL;
+ }
+ else if (set_type == EX_EDGE_SET) {
+ entryptr = VAR_EDGE_ES(set_id_ndx);
+ extraptr = VAR_ORNT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ entryptr = VAR_FACE_FS(set_id_ndx);
+ extraptr = VAR_ORNT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ entryptr = VAR_ELEM_SS(set_id_ndx);
+ extraptr = VAR_SIDE_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ entryptr = VAR_ELEM_ELS(set_id_ndx);
+ extraptr = NULL;
+ }
+
+ /* inquire id's of previously defined variables */
+ if ((status = nc_inq_varid(exoid, entryptr, &entry_list_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate entry list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* only do for edge, face and side sets */
+ if (extraptr) {
+ if ((status = nc_inq_varid(exoid, extraptr, &extra_list_id)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* write out the entry list and extra list arrays */
+
+ status = nc_put_var_int(exoid, entry_list_id, set_entry_list);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store entry list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* only do for edge, face and side sets */
+ if (extraptr) {
+ if ( set_extra_list == NULL ) {
+ sprintf(errmsg, "Error: extra list NULL for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid );
+ ex_err("ex_put_set",errmsg,EX_BADPARAM);
+ return (EX_FATAL);
+ }
+
+ status = nc_put_var_int(exoid, extra_list_id, set_extra_list);
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* warn if extra data was sent in for node sets and elem sets */
+ if ((set_type == EX_NODE_SET || set_type == EX_ELEM_SET) &&
+ set_extra_list != NULL) {
+ sprintf(errmsg,
+ "Warning: extra list was ignored for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_put_set",errmsg,EX_MSG);
+ return(EX_WARN);
+ }
+
+ return (EX_NOERR);
}
diff --git a/cbind/src/expsetd.c b/cbind/src/expsetd.c
index 1baeebf..6c4c3e3 100644
--- a/cbind/src/expsetd.c
+++ b/cbind/src/expsetd.c
@@ -36,12 +36,6 @@
*
* expssd - ex_put_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -53,7 +47,6 @@
*
* revision history -
*
-* $Id: expsetd.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,199 +55,110 @@
/*!
* writes the distribution factors for a single set
+ * \param exoid exodus file id
+ * \param set_type set type
+ * \param set_id set id
+ * \param *set_dist_fact array of dist factors for set
*/
int ex_put_set_dist_fact (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
const void *set_dist_fact)
{
- int dimid, set_id_ndx;
- int dist_id;
- long num_df_in_set, start[1], count[1];
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* numdfptr;
- char* factptr;
-
- exerrval = 0; /* clear error code */
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any sets are specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) < 0)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no %s sets specified in file id %d",
- typeName, exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Lookup index of set id in VAR_*S_IDS array */
-
- set_id_ndx = ex_id_lkup(exoid,idsptr,set_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no data allowed for NULL %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_fact",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
+ int status;
+ int dimid, set_id_ndx;
+ int dist_id;
+ char errmsg[MAX_ERR_LENGTH];
+ char* factptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* first check if any sets are specified */
+ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no %ss specified in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Lookup index of set id in VAR_*S_IDS array */
+ set_id_ndx = ex_id_lkup(exoid,set_type,set_id);
+ if (exerrval != 0) {
+ if (exerrval == EX_NULLENTITY) {
+ sprintf(errmsg,
+ "Warning: no data allowed for NULL %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_fact",errmsg,EX_MSG);
+ return (EX_WARN);
+ } else {
sprintf(errmsg,
- "Error: failed to locate %s set id %d in VAR_*S_IDS array in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
+ "Error: failed to locate %s id %d in VAR_*S_IDS array in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
/* setup more pointers based on set_type */
- if (set_type == EX_NODE_SET) {
- /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
- numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
- factptr = VAR_FACT_NS(set_id_ndx);
- }
- else if (set_type == EX_EDGE_SET) {
- numdfptr = DIM_NUM_DF_ES(set_id_ndx);
- factptr = VAR_FACT_ES(set_id_ndx);
- }
- else if (set_type == EX_FACE_SET) {
- numdfptr = DIM_NUM_DF_FS(set_id_ndx);
- factptr = VAR_FACT_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numdfptr = DIM_NUM_DF_SS(set_id_ndx);
- factptr = VAR_FACT_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
- factptr = VAR_FACT_ELS(set_id_ndx);
- }
-
-/* inquire id's of previously defined dimension and variable */
-
- if ((dimid = ncdimid (exoid, numdfptr)) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: no dist factors defined for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_WARN);
-
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of dist factors in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_df_in_set) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of dist factors in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* find id of distribution factors variable
- */
-
- if ((dist_id = ncvarid (exoid, factptr)) == -1)
- {
- /* this test is only needed for node set because we're using
- DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/
- if (ncerr == NC_ENOTVAR)
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Warning: no dist factors defined for %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_WARN);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate dist factors list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
-/* write out the distribution factors array */
-
- start[0] = 0;
-
- count[0] = num_df_in_set;
-
- if (ncvarput (exoid, dist_id, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,set_dist_fact,
- (int)num_df_in_set)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store dist factors for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_dist_fact",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
+ if (set_type == EX_NODE_SET) {
+ /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
+ factptr = VAR_FACT_NS(set_id_ndx);
+ }
+ else if (set_type == EX_EDGE_SET) {
+ factptr = VAR_FACT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ factptr = VAR_FACT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ factptr = VAR_FACT_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ factptr = VAR_FACT_ELS(set_id_ndx);
+ }
+
+ /* find id of distribution factors variable
+ */
+
+ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) {
+ /* this test is only needed for node set because we're using
+ DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/
+ if (status == NC_ENOTVAR) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: no dist factors defined for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_WARN);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate dist factors list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* write out the distribution factors array */
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_var_float(exoid, dist_id, set_dist_fact);
+ } else {
+ status = nc_put_var_double(exoid, dist_id, set_dist_fact);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store dist factors for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_dist_fact",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
}
diff --git a/cbind/src/expsetp.c b/cbind/src/expsetp.c
index 7defcc7..2e5faa9 100644
--- a/cbind/src/expsetp.c
+++ b/cbind/src/expsetp.c
@@ -36,14 +36,6 @@
*
* expsetp - ex_put_set_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -57,7 +49,6 @@
*
* revision history -
*
-* $Id: expsetp.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,409 +56,355 @@
#include "exodusII_int.h"
/*!
- * writes the set id and the number of entries
- * which describe a single set
+ * writes the set id and the number of entries which describe a single set
+ * \param exoid exodus file id
+ * \param set_type the type of set
+ * \param set_id set id
+ * \param num_entries_in_set number of entries in the set
+ * \param num_dist_fact_in_set number of distribution factors in the set
*/
int ex_put_set_param (int exoid,
- int set_type,
+ ex_entity_type set_type,
int set_id,
int num_entries_in_set,
int num_dist_fact_in_set)
{
- int dimid, varid, set_id_ndx, dims[1];
- long start[1], num_sets;
- nclong ldum;
- int cur_num_sets, set_stat;
- char *cdum;
- char errmsg[MAX_ERR_LENGTH];
- char* typeName;
- char* dimptr;
- char* idsptr;
- char* statptr;
- char* numentryptr;
- char* numdfptr;
- char* factptr;
- char* entryptr;
- char* extraptr;
- struct list_item** ctr_list_ptr;
-
- exerrval = 0; /* clear error code */
-
- cdum = 0;
-
- /* setup pointers based on set_type
- NOTE: there is another block that sets more stuff later ... */
- if (set_type == EX_NODE_SET) {
- typeName = "node";
- dimptr = DIM_NUM_NS;
- idsptr = VAR_NS_IDS;
- statptr = VAR_NS_STAT;
- ctr_list_ptr = &ns_ctr_list;
- }
- else if (set_type == EX_EDGE_SET) {
- typeName = "edge";
- dimptr = DIM_NUM_ES;
- idsptr = VAR_ES_IDS;
- statptr = VAR_ES_STAT;
- ctr_list_ptr = &es_ctr_list;
- }
- else if (set_type == EX_FACE_SET) {
- typeName = "face";
- dimptr = DIM_NUM_FS;
- idsptr = VAR_FS_IDS;
- statptr = VAR_FS_STAT;
- ctr_list_ptr = &fs_ctr_list;
- }
- else if (set_type == EX_SIDE_SET) {
- typeName = "side";
- dimptr = DIM_NUM_SS;
- idsptr = VAR_SS_IDS;
- statptr = VAR_SS_STAT;
- ctr_list_ptr = &ss_ctr_list;
- }
- else if (set_type == EX_ELEM_SET) {
- typeName = "elem";
- dimptr = DIM_NUM_ELS;
- idsptr = VAR_ELS_IDS;
- statptr = VAR_ELS_STAT;
- ctr_list_ptr = &els_ctr_list;
- }
- else {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: invalid set type (%d)", set_type);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* first check if any of that set type is specified */
-
- if ((dimid = ncdimid (exoid, dimptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: no %s sets specified in file id %d", typeName,
- exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* Check for duplicate set id entry */
- ex_id_lkup(exoid, idsptr, set_id);
- if (exerrval != EX_LOOKUPFAIL) /* found the side set id */
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: %s set %d already defined in file id %d", typeName,
- set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-/* Get number of sets specified for this file */
- if ((ncdiminq (exoid,dimid,cdum,&num_sets)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of %s sets in file id %d",
- typeName, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* Keep track of the total number of sets defined using a counter stored
- in a linked list keyed by exoid.
- NOTE: ex_get_file_item finds the maximum number of sets defined
- for a specific file and returns that value.
-*/
- cur_num_sets=ex_get_file_item(exoid, ctr_list_ptr);
- if (cur_num_sets >= num_sets)
- {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: exceeded number of %s sets (%ld) defined in file id %d",
- typeName, num_sets,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* NOTE: ex_inc_file_item finds the current number of sets defined
- for a specific file and returns that value incremented. */
-
- cur_num_sets=ex_inc_file_item(exoid, ctr_list_ptr);
- set_id_ndx = cur_num_sets + 1;
+ int status;
+ size_t temp;
+ int dimid, varid, set_id_ndx, dims[1];
+ size_t start[1];
+ int num_sets;
+ int ldum;
+ int cur_num_sets, set_stat;
+ char errmsg[MAX_ERR_LENGTH];
+ char* dimptr = NULL;
+ char* idsptr = NULL;
+ char* statptr = NULL;
+ char* numentryptr = NULL;
+ char* numdfptr = NULL;
+ char* factptr = NULL;
+ char* entryptr = NULL;
+ char* extraptr = NULL;
+
+ exerrval = 0; /* clear error code */
+
+ /* setup pointers based on set_type
+ NOTE: there is another block that sets more stuff later ... */
+ if (set_type == EX_NODE_SET) {
+ dimptr = DIM_NUM_NS;
+ idsptr = VAR_NS_IDS;
+ statptr = VAR_NS_STAT;
+ }
+ else if (set_type == EX_EDGE_SET) {
+ dimptr = DIM_NUM_ES;
+ idsptr = VAR_ES_IDS;
+ statptr = VAR_ES_STAT;
+ }
+ else if (set_type == EX_FACE_SET) {
+ dimptr = DIM_NUM_FS;
+ idsptr = VAR_FS_IDS;
+ statptr = VAR_FS_STAT;
+ }
+ else if (set_type == EX_SIDE_SET) {
+ dimptr = DIM_NUM_SS;
+ idsptr = VAR_SS_IDS;
+ statptr = VAR_SS_STAT;
+ }
+ else if (set_type == EX_ELEM_SET) {
+ dimptr = DIM_NUM_ELS;
+ idsptr = VAR_ELS_IDS;
+ statptr = VAR_ELS_STAT;
+ }
+ else {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: invalid set type (%d)", set_type);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* first check if any of that set type is specified */
+
+ if ((status = nc_inq_dimid(exoid, dimptr, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: no %ss specified in file id %d", ex_name_of_object(set_type),
+ exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Check for duplicate set id entry */
+ ex_id_lkup(exoid, set_type, set_id);
+ if (exerrval != EX_LOOKUPFAIL) { /* found the side set id */
+ sprintf(errmsg,
+ "Error: %s %d already defined in file id %d", ex_name_of_object(set_type),
+ set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ /* Get number of sets specified for this file */
+ if ((status = nc_inq_dimlen(exoid,dimid,&temp)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get number of %ss in file id %d",
+ ex_name_of_object(set_type), exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ num_sets = temp;
+
+
+ /* Keep track of the total number of sets defined using a counter stored
+ in a linked list keyed by exoid.
+ NOTE: ex_get_file_item finds the maximum number of sets defined
+ for a specific file and returns that value.
+ */
+ cur_num_sets=ex_get_file_item(exoid, ex_get_counter_list(set_type));
+ if (cur_num_sets >= num_sets) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of %ss (%d) defined in file id %d",
+ ex_name_of_object(set_type), num_sets,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* NOTE: ex_inc_file_item finds the current number of sets defined
+ for a specific file and returns that value incremented. */
+
+ cur_num_sets=ex_inc_file_item(exoid, ex_get_counter_list(set_type));
+ set_id_ndx = cur_num_sets + 1;
/* setup more pointers based on set_type */
- if (set_type == EX_NODE_SET) {
- numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
- entryptr = VAR_NODE_NS(set_id_ndx);
- extraptr = NULL;
- /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
- numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
- factptr = VAR_FACT_NS(set_id_ndx);
- }
- else if (set_type == EX_EDGE_SET) {
- numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
- entryptr = VAR_EDGE_ES(set_id_ndx);
- extraptr = VAR_ORNT_ES(set_id_ndx);
- numdfptr = DIM_NUM_DF_ES(set_id_ndx);
- factptr = VAR_FACT_ES(set_id_ndx);
- }
- else if (set_type == EX_FACE_SET) {
- numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
- entryptr = VAR_FACE_FS(set_id_ndx);
- extraptr = VAR_ORNT_FS(set_id_ndx);
- numdfptr = DIM_NUM_DF_FS(set_id_ndx);
- factptr = VAR_FACT_FS(set_id_ndx);
- }
- else if (set_type == EX_SIDE_SET) {
- numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
- entryptr = VAR_ELEM_SS(set_id_ndx);
- extraptr = VAR_SIDE_SS(set_id_ndx);
- numdfptr = DIM_NUM_DF_SS(set_id_ndx);
- factptr = VAR_FACT_SS(set_id_ndx);
- }
- if (set_type == EX_ELEM_SET) {
- numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
- entryptr = VAR_ELEM_ELS(set_id_ndx);
- extraptr = NULL;
- numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
- factptr = VAR_FACT_ELS(set_id_ndx);
- }
-
-/* write out information to previously defined variable */
-
- /* first: get id of set id variable */
-
- if ((varid = ncvarid (exoid, idsptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s set %d in file id %d", typeName,
- set_id, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* write out set id */
-
- start[0] = cur_num_sets;
-
- ldum = (nclong)set_id;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store %s set id %d in file id %d", typeName,
- set_id, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (num_entries_in_set == 0) /* Is this a NULL set? */
- set_stat = 0; /* change set status to NULL */
- else
- set_stat = 1; /* change set status to TRUE */
-
- if ((varid = ncvarid (exoid, statptr)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate %s set status in file id %d", typeName,
- exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- ldum = (nclong)set_stat;
- if (ncvarput1 (exoid, varid, start, &ldum) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store %s set %d status to file id %d", typeName,
- set_id, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (num_entries_in_set == 0) /* Is this a NULL set? */
- {
- return(EX_NOERR);
- }
-
-/* put netcdf file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define dimensions and variables */
-
- if ((dimid = ncdimdef(exoid, numentryptr,
- (long)num_entries_in_set)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: %s set %d size already defined in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- else {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of entries in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- goto error_ret;
- }
-
-/* create variable array in which to store the entry lists */
-
- dims[0] = dimid;
-
- if (ncvardef (exoid, entryptr, NC_LONG, 1, dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: entry list already exists for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create entry list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
- if (extraptr)
- {
- if (ncvardef (exoid, extraptr, NC_LONG, 1, dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: extra list already exists for %s set %d in file id %d",
- typeName, set_id, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create extra list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
+ if (set_type == EX_NODE_SET) {
+ numentryptr = DIM_NUM_NOD_NS(set_id_ndx);
+ entryptr = VAR_NODE_NS(set_id_ndx);
+ extraptr = NULL;
+ /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */
+ numdfptr = DIM_NUM_NOD_NS(set_id_ndx);
+ factptr = VAR_FACT_NS(set_id_ndx);
+ }
+ else if (set_type == EX_EDGE_SET) {
+ numentryptr = DIM_NUM_EDGE_ES(set_id_ndx);
+ entryptr = VAR_EDGE_ES(set_id_ndx);
+ extraptr = VAR_ORNT_ES(set_id_ndx);
+ numdfptr = DIM_NUM_DF_ES(set_id_ndx);
+ factptr = VAR_FACT_ES(set_id_ndx);
+ }
+ else if (set_type == EX_FACE_SET) {
+ numentryptr = DIM_NUM_FACE_FS(set_id_ndx);
+ entryptr = VAR_FACE_FS(set_id_ndx);
+ extraptr = VAR_ORNT_FS(set_id_ndx);
+ numdfptr = DIM_NUM_DF_FS(set_id_ndx);
+ factptr = VAR_FACT_FS(set_id_ndx);
+ }
+ else if (set_type == EX_SIDE_SET) {
+ numentryptr = DIM_NUM_SIDE_SS(set_id_ndx);
+ entryptr = VAR_ELEM_SS(set_id_ndx);
+ extraptr = VAR_SIDE_SS(set_id_ndx);
+ numdfptr = DIM_NUM_DF_SS(set_id_ndx);
+ factptr = VAR_FACT_SS(set_id_ndx);
+ }
+ if (set_type == EX_ELEM_SET) {
+ numentryptr = DIM_NUM_ELE_ELS(set_id_ndx);
+ entryptr = VAR_ELEM_ELS(set_id_ndx);
+ extraptr = NULL;
+ numdfptr = DIM_NUM_DF_ELS(set_id_ndx);
+ factptr = VAR_FACT_ELS(set_id_ndx);
+ }
+
+ /* write out information to previously defined variable */
+
+ /* first: get id of set id variable */
+ if ((status = nc_inq_varid(exoid, idsptr, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s %d in file id %d", ex_name_of_object(set_type),
+ set_id, exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* write out set id */
+ start[0] = cur_num_sets;
+
+ ldum = (int)set_id;
+ if ((status = nc_put_var1_int(exoid, varid, start, &ldum)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s id %d in file id %d", ex_name_of_object(set_type),
+ set_id, exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_entries_in_set == 0) /* Is this a NULL set? */
+ set_stat = 0; /* change set status to NULL */
+ else
+ set_stat = 1; /* change set status to TRUE */
+
+ if ((status = nc_inq_varid(exoid, statptr, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate %s status in file id %d", ex_name_of_object(set_type),
+ exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ ldum = (int)set_stat;
+ if ((status = nc_put_var1_int(exoid, varid, start, &ldum)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s %d status to file id %d", ex_name_of_object(set_type),
+ set_id, exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (num_entries_in_set == 0) {/* Is this a NULL set? */
+ return(EX_NOERR);
+ }
+
+ /* put netcdf file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode",
+ exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* define dimensions and variables */
+ if ((status = nc_def_dim(exoid, numentryptr,
+ num_entries_in_set, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE)
+ {
+ sprintf(errmsg,
+ "Error: %s %d size already defined in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ else {
+ sprintf(errmsg,
+ "Error: failed to define number of entries in %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ goto error_ret;
+ }
+
+ /* create variable array in which to store the entry lists */
+
+ dims[0] = dimid;
+ if ((status = nc_def_var(exoid, entryptr, NC_INT, 1, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
+ sprintf(errmsg,
+ "Error: entry list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to create entry list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if (extraptr) {
+ if ((status = nc_def_var(exoid, extraptr, NC_INT, 1, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
+ sprintf(errmsg,
+ "Error: extra list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id, exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to create extra list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
- }
- }
-
-/* Create distribution factors variable if required */
-
- if (num_dist_fact_in_set > 0)
- {
-
- if (set_type == EX_NODE_SET)
- {
- /* but num_dist_fact_in_set must equal number of nodes */
- if (num_dist_fact_in_set != num_entries_in_set)
- {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # dist fact (%d) not equal to # nodes (%d) in node set %d file id %d",
- num_dist_fact_in_set, num_entries_in_set, set_id, exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* resuse dimid from entry lists */
-
- }
- else
- {
- if ((dimid = ncdimdef (exoid, numdfptr,
- (long)num_dist_fact_in_set)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of dist factors in %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
-/* create variable array in which to store the set distribution factors
- */
-
- dims[0] = dimid;
-
- if (ncvardef (exoid, factptr,
- nc_flt_code(exoid), 1, dims) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: dist factors list already exists for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to create dist factors list for %s set %d in file id %d",
- typeName, set_id,exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
- }
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d", exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_set_param",errmsg,exerrval);
- }
- return (EX_FATAL);
+ }
+ }
+
+ /* Create distribution factors variable if required */
+
+ if (num_dist_fact_in_set > 0) {
+
+ if (set_type == EX_NODE_SET) {
+ /* but num_dist_fact_in_set must equal number of nodes */
+ if (num_dist_fact_in_set != num_entries_in_set) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: # dist fact (%d) not equal to # nodes (%d) in node set %d file id %d",
+ num_dist_fact_in_set, num_entries_in_set, set_id, exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* resuse dimid from entry lists */
+
+ } else {
+ if ((status = nc_def_dim(exoid, numdfptr,
+ num_dist_fact_in_set, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of dist factors in %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ /* create variable array in which to store the set distribution factors
+ */
+ dims[0] = dimid;
+ if ((status = nc_def_var(exoid, factptr, nc_flt_code(exoid), 1, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
+ sprintf(errmsg,
+ "Error: dist factors list already exists for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to create dist factors list for %s %d in file id %d",
+ ex_name_of_object(set_type), set_id,exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d", exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_set_param",errmsg,exerrval);
+ }
+ return (EX_FATAL);
}
diff --git a/cbind/src/expsp.c b/cbind/src/expsp.c
index 70a9c5f..3e36d87 100644
--- a/cbind/src/expsp.c
+++ b/cbind/src/expsp.c
@@ -36,14 +36,6 @@
*
* expsp - ex_put_side_set_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,7 +48,6 @@
*
* revision history -
*
-* $Id: expsp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -66,6 +57,11 @@
/*!
* writes the side set id and the number of sides (edges or faces)
* which describe a single side set
+ * \param exoid exodus file id
+ * \param side_set_id side set id
+ * \param num_side_in_set number of sides in the side set
+ * \param num_dist_fact_in_set number of distribution factors in the side set
+ * \deprecated Use ex_put_set_param()(exoid, EX_SIDE_SET, side_set_id, num_side_in_set, num_dist_fact_in_set)
*/
int ex_put_side_set_param (int exoid,
diff --git a/cbind/src/expss.c b/cbind/src/expss.c
index b168609..5c717c2 100644
--- a/cbind/src/expss.c
+++ b/cbind/src/expss.c
@@ -36,14 +36,6 @@
*
* expss - ex_put_side_set
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: expss.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -64,6 +55,11 @@
/*!
* writes the side set element list and side set side list for a single side set
+ * \param exoid exodus file id
+ * \param side_set_id side set id
+ * \param *side_set_elem_list array of elements in side set
+ * \param *side_set_side_list array of sides in side set
+ * \deprecated Use ex_put_set()(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list)
*/
int ex_put_side_set (int exoid,
diff --git a/cbind/src/expssd.c b/cbind/src/expssd.c
index b587358..63b20f9 100644
--- a/cbind/src/expssd.c
+++ b/cbind/src/expssd.c
@@ -36,12 +36,6 @@
*
* expssd - ex_put_side_set_dist_fact
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -52,7 +46,6 @@
*
* revision history -
*
-* $Id: expssd.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,6 +54,10 @@
/*!
* writes the distribution factors for a single side set
+ * \param exoid exodus file id
+ * \param side_set_id side set id
+ * \param *side_set_dist_fact array of dist factors for side set
+ * \deprecated Use ex_put_set_dist_fact()(exoid, EX_SIDE_SET, side_set_id, side_set_dist_fact)
*/
int ex_put_side_set_dist_fact (int exoid,
diff --git a/cbind/src/expsstt.c b/cbind/src/expsstt.c
index 363495d..c713e87 100644
--- a/cbind/src/expsstt.c
+++ b/cbind/src/expsstt.c
@@ -45,7 +45,6 @@
*
* exit conditions -
*
-* $Id: expsstt.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,6 +62,11 @@
* of define mode (causing the entire file to be copied over and over)
* which is what occurs when the sideset variable values variables are
* defined in ex_put_sset_var
+ * \param exoid exodus file id
+ * \param num_sset number of sidesets
+ * \param num_sset_var number of sideset variables
+ * \param *sset_var_tab sideset variable truth table array
+ * \deprecated Use ex_put_truth_table()(exoid, EX_SIDE_SET, num_sset, num_sset_var, sset_var_tab)
*/
int ex_put_sset_var_tab (int exoid,
@@ -70,6 +74,6 @@ int ex_put_sset_var_tab (int exoid,
int num_sset_var,
int *sset_var_tab)
{
- return ex_put_var_tab(exoid, "S", num_sset, num_sset_var, sset_var_tab);
+ return ex_put_truth_table(exoid, EX_SIDE_SET, num_sset, num_sset_var, sset_var_tab);
}
diff --git a/cbind/src/expssv.c b/cbind/src/expssv.c
index 393f53f..817132f 100644
--- a/cbind/src/expssv.c
+++ b/cbind/src/expssv.c
@@ -36,14 +36,6 @@
*
* expev - ex_put_sset_var
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -59,7 +51,6 @@
*
* revision history -
*
-* $Id: expssv.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -71,6 +62,13 @@
* writes the values of a single sideset variable for one sideset at
* one time step to the database; assume the first time step and
* sideset variable index are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param sset_var_index sideset variable index
+ * \param sset_id sideset id
+ * \param num_faces_this_sset number of faces in this sideset
+ * \param sset_var_vals the variable values to be written
+ * \deprecated Use ex_put_var()(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_faces_this_sset, sset_var_vals)
*/
int ex_put_sset_var (int exoid,
@@ -80,239 +78,5 @@ int ex_put_sset_var (int exoid,
int num_faces_this_sset,
const void *sset_var_vals)
{
- int varid, dimid,time_dim, numelbdim, dims[2], sset_id_ndx;
- long num_ssets, num_sset_var, start[2], count[2];
- nclong *sset_var_tab;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* Determine index of sset_id in VAR_SS_ID array */
- sset_id_ndx = ex_id_lkup(exoid,VAR_SS_IDS,sset_id);
- if (exerrval != 0)
- {
- if (exerrval == EX_NULLENTITY)
- {
- sprintf(errmsg,
- "Warning: no variables allowed for NULL sideset %d in file id %d",
- sset_id,exoid);
- ex_err("ex_put_sset_var",errmsg,EX_MSG);
- return (EX_WARN);
- }
- else
- {
- sprintf(errmsg,
- "Error: failed to locate sideset id %d in %s array in file id %d",
- sset_id, VAR_SS_IDS, exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- if ((varid = ncvarid (exoid,
- VAR_SS_VAR(sset_var_index,sset_id_ndx))) == -1)
- {
- if (ncerr == NC_ENOTVAR) /* variable doesn't exist, create it! */
- {
-
-/* inquire previously defined dimensions */
-
- /* check for the existance of an sideset variable truth table */
- if ((varid = ncvarid (exoid, VAR_SSET_TAB)) != -1)
- {
- /* find out number of sidesets and sideset variables */
- if ((dimid = ncdimid (exoid, DIM_NUM_SS)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of sidesets in file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_ssets) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of sidesets in file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((dimid = ncdimid (exoid, DIM_NUM_SSET_VAR)) == -1)
- {
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: no sideset variables stored in file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (ncdiminq (exoid, dimid, (char *) 0, &num_sset_var) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get number of sideset variables in file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (!(sset_var_tab = malloc(num_ssets*num_sset_var*sizeof(nclong))))
- {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for sideset variable truth table in file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* read in the sideset variable truth table */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_ssets;
- count[1] = num_sset_var;
-
- if (ncvarget (exoid, varid, start, count, sset_var_tab) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get truth table from file id %d", exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if(sset_var_tab[num_sset_var*(sset_id_ndx-1)+sset_var_index-1]
- == 0L)
- {
- free(sset_var_tab);
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid sideset variable %d, sideset %d in file id %d",
- sset_var_index, sset_id, exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- free(sset_var_tab);
- }
-
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate time dimension in file id %d", exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- if ((numelbdim=ncdimid(exoid, DIM_NUM_SIDE_SS(sset_id_ndx))) == -1)
- {
- if (ncerr == NC_EBADDIM)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: number of faces in sideset %d not defined in file id %d",
- sset_id, exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of sides in sideset %d in file id %d",
- sset_id, exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- }
- goto error_ret;
- }
-
-/* variable doesn't exist so put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
-/* define netCDF variable to store sideset variable values */
-
- dims[0] = time_dim;
- dims[1] = numelbdim;
- if ((varid = ncvardef(exoid,VAR_SS_VAR(sset_var_index,sset_id_ndx),
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define sideset variable %d in file id %d",
- sset_var_index,exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- goto error_ret;
- }
-
-
-/* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete sideset variable %s definition to file id %d",
- VAR_SS_VAR(sset_var_index,sset_id_ndx), exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate sideset variable %s in file id %d",
- VAR_SS_VAR(sset_var_index,sset_id_ndx),exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-/* store sideset variable values */
-
- start[0] = --time_step;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = num_faces_this_sset;
-
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,sset_var_vals,
- num_faces_this_sset)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store sideset variable %d in file id %d",
- sset_var_index,exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return (EX_NOERR);
-
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_sset_var",errmsg,exerrval);
- }
- return (EX_FATAL);
+ return ex_put_var(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_faces_this_sset, sset_var_vals);
}
diff --git a/cbind/src/exptim.c b/cbind/src/exptim.c
index fade82a..606a95c 100644
--- a/cbind/src/exptim.c
+++ b/cbind/src/exptim.c
@@ -36,14 +36,6 @@
*
* exptim - ex_put_time
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: exptim.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -65,48 +56,48 @@
/*!
* writes the time value for a whole time step;
* assume the first time step is 1
+ * \param exoid exodus file id
+ * \param time_step time step number (1...)
+ * \param time_value simulation time at specified step
*/
int ex_put_time (int exoid,
int time_step,
const void *time_value)
{
- int varid;
- long start[1];
- char var_name[MAX_VAR_NAME_LENGTH+1];
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
-/* inquire previously defined dimensions */
-
- strcpy (var_name, VAR_WHOLE_TIME);
+ int status;
+ int varid;
+ size_t start[1];
+ char errmsg[MAX_ERR_LENGTH];
-/* inquire previously defined variable */
+ exerrval = 0; /* clear error code */
- if ((varid = ncvarid (exoid, var_name)) < 0)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ /* inquire previously defined variable */
+ if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to locate time variable in file id %d", exoid);
- ex_err("ex_put_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ ex_err("ex_put_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
-/* store time value */
+ /* store time value */
+ start[0] = --time_step;
- start[0] = --time_step;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_var1_float(exoid, varid, start, time_value);
+ } else {
+ status = nc_put_var1_double(exoid, varid, start, time_value);
+ }
- if (ncvarput1 (exoid, varid, start,
- ex_conv_array(exoid,WRITE_CONVERT,time_value,1)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if (status != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to store time value in file id %d", exoid);
- ex_err("ex_put_time",errmsg,exerrval);
- return (EX_FATAL);
- }
+ ex_err("ex_put_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
- return (EX_NOERR);
+ return (EX_NOERR);
}
diff --git a/cbind/src/exptt.c b/cbind/src/exptt.c
index faea8c0..5cafcf6 100644
--- a/cbind/src/exptt.c
+++ b/cbind/src/exptt.c
@@ -36,8 +36,6 @@
*
* expvtt - ex_put_var_tab
*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -50,7 +48,6 @@
*
* revision history -
*
-* $Id: exptt.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,11 +59,17 @@
* writes the EXODUS II variable truth table to the database; also,
* creates netCDF variables in which to store EXODUS II variable
* values; although this table isn't required (because the netCDF
- * variables can also be created in ex_put_*_var), this call will save
+ * variables can also be created in ex_put_var), this call will save
* tremendous time because all of the variables are defined at once
* while the file is in define mode, rather than going in and out of
* define mode (causing the entire file to be copied over and over)
- * which is what occurs when the variables are defined in ex_put_*_var
+ * which is what occurs when the variables are defined in ex_put_var
+ * \param exoid exodus file id
+ * \param *var_type 'e', 'm', 's' element, nodeset, sideset
+ * \param num_blk number of blocks
+ * \param num_var number of variables
+ * \param *var_tab variable truth table array
+ * \deprecated Use ex_put_truth_table()(exoid, obj_type, num_blk, num_var, var_tab)
*/
int ex_put_var_tab (int exoid,
@@ -75,297 +78,7 @@ int ex_put_var_tab (int exoid,
int num_var,
int *var_tab)
{
- int numelblkdim, numelvardim, timedim, dims[2], varid, iresult;
- int obj_type;
- char *sta_type, *tab_type;
- long num_entity = -1;
- long num_var_db = -1;
- long start[2], count[2];
- nclong *stat_vals, *lptr;
- int i, j, k, id, *ids;
- char errmsg[MAX_ERR_LENGTH];
- const char* routine = "ex_get_var_tab";
-
- /*
- * The ent_type and the var_name are used to build the netcdf
- * variables name. Normally this is done via a macro defined in
- * exodusII_int.h
- */
- const char* ent_type = NULL;
- const char* var_name = NULL;
- const char* ent_size = NULL;
- exerrval = 0; /* clear error code */
-
- if (*var_type == 'e' || *var_type == 'E') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_ELEM_TAB);
- var_name = "vals_elem_var";
- ent_type = "eb";
- ent_size = "num_el_in_blk";
- obj_type = EX_ELEM_BLOCK;
- sta_type = VAR_STAT_EL_BLK;
- tab_type = VAR_ELEM_TAB;
- }
- else if (*var_type == 'm' || *var_type == 'M') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_NS, "nodesets",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_NSET_TAB);
- var_name = "vals_nset_var";
- ent_type = "ns";
- ent_size = "num_nod_ns";
- obj_type = EX_NODE_SET;
- sta_type = VAR_NS_STAT;
- tab_type = VAR_NSET_TAB;
- }
- else if (*var_type == 's' || *var_type == 'S') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_SS, "sidesets",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_SSET_TAB);
- var_name = "vals_sset_var";
- ent_type = "ss";
- ent_size = "num_side_ss";
- obj_type = EX_SIDE_SET;
- sta_type = VAR_SS_STAT;
- tab_type = VAR_SSET_TAB;
- }
- else { /* invalid variable type */
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
- ex_err("ex_get_varid",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if (num_entity == -1 || num_var_db == -1)
- return (EX_FATAL);
-
- if (num_entity != num_blk) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # of blocks doesn't match those defined in file id %d", exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if (num_var_db != num_var) {
- exerrval = EX_FATAL;
- sprintf(errmsg,
- "Error: # of variables doesn't match those defined in file id %d", exoid);
- ex_err("ex_get_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* get block IDs */
- if (!(ids = malloc(num_blk*sizeof(int)))) {
- exerrval = EX_MEMFAIL;
- sprintf(errmsg,
- "Error: failed to allocate memory for id array for file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* Get status array for later use */
- if (!(stat_vals = malloc(num_blk*sizeof(nclong)))) {
- exerrval = EX_MEMFAIL;
- free(ids);
- sprintf(errmsg,
- "Error: failed to allocate memory for status array for file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- ex_get_ids (exoid, obj_type, ids);
- varid = ncvarid (exoid, sta_type);
-
- /* get variable id of status array */
- if (varid != -1) {
- /* if status array exists (V 2.01+), use it, otherwise assume
- object exists to be backward compatible */
-
- start[0] = 0;
- start[1] = 0;
- count[0] = num_blk;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1) {
- exerrval = ncerr;
- free(stat_vals);
- sprintf(errmsg,
- "Error: failed to get status array from file id %d",
- exoid);
- ex_err("put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
- } else {
- /* status array doesn't exist (V2.00), dummy one up for later checking */
- for(i=0;i<num_blk;i++)
- stat_vals[i] = 1;
- }
-
- /* put netcdf file into define mode */
- if (ncredef (exoid) == -1) {
- free(stat_vals);
- free (ids);
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* inquire previously defined dimensions */
- if ((timedim = ncdimid (exoid, DIM_TIME)) == -1) {
- exerrval = ncerr;
- free(stat_vals);
- free (ids);
- sprintf(errmsg,
- "Error: failed to locate time variable in file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* define netCDF variables in which to store EXODUS II element
- * variable values
- */
-
- k = 0;
- for (i=0; i<num_blk; i++) {
- for (j=1; j<=num_var; j++) {
-
- /* check if variables are to be put out for this entity */
- if (var_tab[k] != 0) {
- if (stat_vals[i] != 0) {/* check for NULL entity */
- /* NOTE: This code used to zero out the var_tab entry
- if the stat_vals[i] value was zero. However, in some
- cases it is good to know that a variable was assigned to
- an entity even if that entity is empty. The code was
- changed to not modify the truth table.
- */
- dims[0] = timedim;
-
- /* Determine number of entities in block */
- if ((dims[1] = ncdimid (exoid, ex_catstr(ent_size, (i+1)))) == -1) {
- exerrval = ncerr;
- id=ids[i];
- free(stat_vals);
- free (ids);
- sprintf(errmsg,
- "Error: failed to locate number of entities in block %d in file id %d",
- id,exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
-
- /* define netCDF variable to store variable values; the j
- * index cycles from 1 through the number of variables so
- * that the index of the EXODUS II variable (which is part
- * of the name of the netCDF variable) will begin at 1
- * instead of 0
- */
-
- if ((varid = ncvardef (exoid, ex_catstr2(var_name, j, ent_type, i+1),
- nc_flt_code(exoid), 2, dims)) == -1) {
- if (ncerr != NC_ENAMEINUSE) {
- exerrval = ncerr;
- id=ids[i];
- free(stat_vals);
- free (ids);
- sprintf(errmsg,
- "Error: failed to define variable for block %d in file id %d",
- id,exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
- }
- } /* if */
- k++; /* increment element truth table pointer */
- } /* for j */
- } /* for i */
-
- free (stat_vals);
- free (ids);
-
- /* create a variable array in which to store the truth table
- */
-
- dims[0] = numelblkdim;
- dims[1] = numelvardim;
- varid = ncvardef (exoid, tab_type, NC_LONG, 2, dims);
-
- if (varid == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define variable truth table in file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* leave define mode */
- if (ncendef (exoid) == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definitions in file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* write out the element variable truth table */
-
- /* this contortion is necessary because netCDF is expecting nclongs;
- fortunately it's necessary only when ints and nclongs aren't the
- same size */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_blk;
- count[1] = num_var;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, var_tab);
- } else {
- lptr = itol (var_tab, (int)(num_blk*num_var));
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1) {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store variable truth table in file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- return (EX_NOERR);
-
- /* Fatal error: exit definition mode and return */
- error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
- }
- return (EX_FATAL);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_put_truth_table(exoid, obj_type, num_blk, num_var, var_tab);
}
diff --git a/cbind/src/expvan.c b/cbind/src/expvan.c
index 7bf3880..a1cb132 100644
--- a/cbind/src/expvan.c
+++ b/cbind/src/expvan.c
@@ -36,14 +36,6 @@
*
* expvan - ex_put_var_names
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -55,7 +47,6 @@
*
* revision history -
*
-* $Id: expvan.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -64,51 +55,13 @@
#include <string.h>
#include <ctype.h>
-#define EX_PUT_NAMES(TNAME,DNUMVAR,VNAMES) \
- if ((ncdimid (exoid, DNUMVAR)) == -1) \
- { \
- if (ncerr == NC_EBADDIM) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: no " TNAME " variables defined in file id %d", \
- exoid); \
- ex_err("ex_put_var_names",errmsg,exerrval); \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate number of " TNAME " variables in file id %d", \
- exoid); \
- ex_err("ex_put_var_names",errmsg,exerrval); \
- } \
- return(EX_FATAL); \
- } \
- \
- if ((varid = ncvarid (exoid, VNAMES)) == -1) \
- { \
- if (ncerr == NC_ENOTVAR) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: no " TNAME " variable names defined in file id %d", \
- exoid); \
- ex_err("ex_put_var_names",errmsg,exerrval); \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: " TNAME " name variable names not found in file id %d", \
- exoid); \
- ex_err("ex_put_var_names",errmsg,exerrval); \
- } \
- return(EX_FATAL); \
- }
-
/*!
* writes the names of the results variables to the database
+ * \param exoid exodus file id
+ * \param *var_type variable type: G,N, or E
+ * \param num_vars # of variables to read
+ * \param *var_names ptr array of variable names
+ * \deprecated Use ex_put_variable_names()(exoid, obj_type, num_vars, var_names)
*/
int ex_put_var_names (int exoid,
@@ -116,77 +69,7 @@ int ex_put_var_names (int exoid,
int num_vars,
char* var_names[])
{
- int i, varid;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- int vartyp;
-
- exerrval = 0; /* clear error code */
-
- vartyp = tolower( *var_type );
- switch (vartyp) {
- case 'g':
- EX_PUT_NAMES( "global",DIM_NUM_GLO_VAR, VAR_NAME_GLO_VAR);
- break;
- case 'n':
- EX_PUT_NAMES( "nodal",DIM_NUM_NOD_VAR, VAR_NAME_NOD_VAR);
- break;
- case 'l':
- EX_PUT_NAMES( "edge",DIM_NUM_EDG_VAR, VAR_NAME_EDG_VAR);
- break;
- case 'f':
- EX_PUT_NAMES( "face",DIM_NUM_FAC_VAR, VAR_NAME_FAC_VAR);
- break;
- case 'e':
- EX_PUT_NAMES( "element",DIM_NUM_ELE_VAR, VAR_NAME_ELE_VAR);
- break;
- case 'm':
- EX_PUT_NAMES( "node set",DIM_NUM_NSET_VAR, VAR_NAME_NSET_VAR);
- break;
- case 'd':
- EX_PUT_NAMES( "edge set",DIM_NUM_ESET_VAR, VAR_NAME_ESET_VAR);
- break;
- case 'a':
- EX_PUT_NAMES( "face set",DIM_NUM_FSET_VAR, VAR_NAME_FSET_VAR);
- break;
- case 's':
- EX_PUT_NAMES( "side set",DIM_NUM_SSET_VAR, VAR_NAME_SSET_VAR);
- break;
- case 't':
- EX_PUT_NAMES("element set",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR);
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
- ex_err("ex_put_var_names",errmsg,exerrval);
- return(EX_FATAL);
- }
-
-
-
-/* write EXODUS variable names */
-
- for (i=0; i<num_vars; i++)
- {
- start[0] = i;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = strlen(var_names[i]) + 1;
-
- if (ncvarput (exoid, varid, start, count, (void*) var_names[i]) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store variable names in file id %d",
- exoid);
- ex_err("ex_put_var_names",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
- return(EX_NOERR);
-
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_put_variable_names(exoid, obj_type, num_vars, var_names);
}
diff --git a/cbind/src/expvar.c b/cbind/src/expvar.c
index b951265..783a191 100644
--- a/cbind/src/expvar.c
+++ b/cbind/src/expvar.c
@@ -52,7 +52,6 @@
*
* revision history -
*
-* $Id: expvar.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,287 +60,229 @@
#include "exodusII_int.h"
/*!
- * writes the values of a single element variable for one element block at
- * one time step to the database; assume the first time step and
- * element variable index are 1
+ * writes the values of a single variable for one block at one time
+ * step to the database; assume the first time step and variable index
+ * are 1
+ * \param exoid exodus file id
+ * \param time_step time step number
+ * \param var_type type (edge block, face block, edge set, ... )
+ * \param var_index element variable index
+ * \param obj_id element block id
+ * \param num_entries_this_obj number of entries in this block/set
+ * \param var_vals the values to be written
*/
int ex_put_var (int exoid,
int time_step,
- int var_type,
+ ex_entity_type var_type,
int var_index,
int obj_id,
int num_entries_this_obj,
const void *var_vals)
{
int varid, dimid,time_dim, numobjdim, dims[2], obj_id_ndx;
- long num_obj, num_obj_var, start[2], count[2];
- nclong *obj_var_truth_tab;
+ size_t num_obj;
+ size_t num_obj_var;
+ size_t num_entity;
+ size_t start[2], count[2];
+ int *obj_var_truth_tab;
+ int status;
char errmsg[MAX_ERR_LENGTH];
- const char* tname;
exerrval = 0; /* clear error code */
-#define EX_LOOK_UP_VAR(TNAME,VOBJID,VVAR,VOBJTAB,DNUMOBJ,DNUMOBJENT,DNUMOBJVAR) \
- /* Determine index of obj_id in VOBJID array */ \
- tname = TNAME; \
- obj_id_ndx = ex_id_lkup(exoid,VOBJID,obj_id); \
- if (exerrval != 0) \
- { \
- if (exerrval == EX_NULLENTITY) \
- { \
- sprintf(errmsg, \
- "Warning: no variables allowed for NULL block %d in file id %d", \
- obj_id,exoid); \
- ex_err("ex_put_var",errmsg,EX_MSG); \
- return (EX_WARN); \
- } \
- else \
- { \
- sprintf(errmsg, \
- "Error: failed to locate " TNAME " id %d in %s array in file id %d", \
- obj_id, VOBJID, exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- } \
- \
- if ((varid = ncvarid (exoid, \
- VVAR(var_index,obj_id_ndx))) == -1) \
- { \
- if (ncerr == NC_ENOTVAR) /* variable doesn't exist, create it! */ \
- { \
- \
-/* inquire previously defined dimensions */ \
- \
- /* check for the existance of an TNAME variable truth table */ \
- if ((varid = ncvarid (exoid, VOBJTAB)) != -1) \
- { \
- /* find out number of TNAMEs and TNAME variables */ \
- if ((dimid = ncdimid (exoid, DNUMOBJ)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate number of " TNAME "s in file id %d", \
- exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if (ncdiminq (exoid, dimid, (char *) 0, &num_obj) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get number of " TNAME "s in file id %d", \
- exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if ((dimid = ncdimid (exoid, DNUMOBJVAR)) == -1) \
- { \
- exerrval = EX_BADPARAM; \
- sprintf(errmsg, \
- "Error: no " TNAME " variables stored in file id %d", \
- exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if (ncdiminq (exoid, dimid, (char *) 0, &num_obj_var) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get number of " TNAME " variables in file id %d", \
- exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if (!(obj_var_truth_tab = malloc(num_obj*num_obj_var*sizeof(nclong)))) \
- { \
- exerrval = EX_MEMFAIL; \
- sprintf(errmsg, \
- "Error: failed to allocate memory for " TNAME " variable truth table in file id %d", \
- exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- /* read in the TNAME variable truth table */ \
- \
- start[0] = 0; \
- start[1] = 0; \
- \
- count[0] = num_obj; \
- count[1] = num_obj_var; \
- \
- if (ncvarget (exoid, varid, start, count, obj_var_truth_tab) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to get truth table from file id %d", exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- if(obj_var_truth_tab[num_obj_var*(obj_id_ndx-1)+var_index-1] \
- == 0L) \
- { \
- free(obj_var_truth_tab); \
- exerrval = EX_BADPARAM; \
- sprintf(errmsg, \
- "Error: Invalid " TNAME " variable %d, " TNAME " %d in file id %d", \
- var_index, obj_id, exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- free(obj_var_truth_tab); \
- } \
- \
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate time dimension in file id %d", exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- if ((numobjdim=ncdimid(exoid, DNUMOBJENT(obj_id_ndx))) == -1) \
- { \
- if (ncerr == NC_EBADDIM) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: number of entries in " TNAME " %d not defined in file id %d", \
- obj_id, exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate number of entries in " TNAME " %d in file id %d", \
- obj_id, exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- } \
- goto error_ret; \
- } \
- \
-/* variable doesn't exist so put file into define mode */ \
- \
- if (ncredef (exoid) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to put file id %d into define mode", exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- \
- \
-/* define netCDF variable to store TNAME variable values */ \
- \
- dims[0] = time_dim; \
- dims[1] = numobjdim; \
- if ((varid = ncvardef(exoid,VVAR(var_index,obj_id_ndx), \
- nc_flt_code(exoid), 2, dims)) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " variable %d in file id %d", \
- var_index,exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- goto error_ret; \
- } \
- \
- \
-/* leave define mode */ \
- \
- if (ncendef (exoid) == -1) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to complete " TNAME " variable %s definition to file id %d", \
- VVAR(var_index,obj_id_ndx), exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to locate " TNAME " variable %s in file id %d", \
- VVAR(var_index,obj_id_ndx),exoid); \
- ex_err("ex_put_var",errmsg,exerrval); \
- return (EX_FATAL); \
- } \
- }
+#define EX_LOOK_UP_VAR(VOBJID,VVAR,VOBJTAB,DNUMOBJ,DNUMOBJVAR) \
+ /* Determine index of obj_id in VOBJID array */ \
+ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id); \
+ if (exerrval != 0) \
+ { \
+ if (exerrval == EX_NULLENTITY) \
+ { \
+ sprintf(errmsg, \
+ "Warning: no variables allowed for NULL block %d in file id %d", \
+ obj_id,exoid); \
+ ex_err("ex_put_var",errmsg,EX_MSG); \
+ return (EX_WARN); \
+ } \
+ else \
+ { \
+ sprintf(errmsg, \
+ "Error: failed to locate %s id %d in %s array in file id %d", \
+ ex_name_of_object(var_type), obj_id, VOBJID, exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } \
+ \
+ if ((status = nc_inq_varid (exoid, VVAR(var_index,obj_id_ndx), &varid)) != NC_NOERR) \
+ { \
+ if (status == NC_ENOTVAR) /* variable doesn't exist, create it! */ \
+ { \
+ /* check for the existance of an TNAME variable truth table */ \
+ if (nc_inq_varid(exoid, VOBJTAB, &varid) == NC_NOERR) { \
+ /* find out number of TNAMEs and TNAME variables */ \
+ status = ex_get_dimension(exoid, DNUMOBJ, ex_name_of_object(var_type), &num_obj, &dimid, "ex_put_var"); \
+ if (status != NC_NOERR) return status; \
+ \
+ status = ex_get_dimension(exoid, DNUMOBJVAR, ex_name_of_object(var_type), &num_obj_var, &dimid, "ex_put_var"); \
+ if (status != NC_NOERR) return status; \
+ \
+ if (!(obj_var_truth_tab = malloc(num_obj*num_obj_var*sizeof(int)))) \
+ { \
+ exerrval = EX_MEMFAIL; \
+ sprintf(errmsg, \
+ "Error: failed to allocate memory for %s variable truth table in file id %d", \
+ ex_name_of_object(var_type), exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* read in the TNAME variable truth table */ \
+ if ((status = nc_get_var_int (exoid, varid, obj_var_truth_tab)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to get truth table from file id %d", exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ if(obj_var_truth_tab[num_obj_var*(obj_id_ndx-1)+var_index-1] \
+ == 0L) \
+ { \
+ free(obj_var_truth_tab); \
+ exerrval = EX_BADPARAM; \
+ sprintf(errmsg, \
+ "Error: Invalid %s variable %d, %s %d in file id %d", \
+ ex_name_of_object(var_type), var_index, ex_name_of_object(var_type), obj_id, exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ free(obj_var_truth_tab); \
+ } \
+ \
+ if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate time dimension in file id %d", exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ \
+ ex_get_dimension(exoid, ex_dim_num_entries_in_object(var_type, obj_id_ndx), \
+ ex_name_of_object(var_type), &num_entity, &numobjdim, "ex_put_var"); \
+ \
+ /* variable doesn't exist so put file into define mode */ \
+ if ((status = nc_redef (exoid)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to put file id %d into define mode", exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ \
+ /* define netCDF variable to store TNAME variable values */ \
+ dims[0] = time_dim; \
+ dims[1] = numobjdim; \
+ if ((status = nc_def_var(exoid, VVAR(var_index,obj_id_ndx), \
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define %s variable %d in file id %d", \
+ ex_name_of_object(var_type), var_index,exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ goto error_ret; \
+ } \
+ \
+ /* leave define mode */ \
+ \
+ if ((status = nc_enddef (exoid)) != NC_NOERR) \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to complete %s variable %s definition to file id %d", \
+ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx), exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ } \
+ else \
+ { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to locate %s variable %s in file id %d", \
+ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx),exoid); \
+ ex_err("ex_put_var",errmsg,exerrval); \
+ return (EX_FATAL); \
+ } \
+ }
switch (var_type) {
case EX_GLOBAL:
if ( num_entries_this_obj <= 0 ) {
- exerrval = EX_MSG;
- sprintf(errmsg,
- "Warning: no global variables specified for file id %d",
- exoid);
- ex_err("ex_put_glob_vars",errmsg,exerrval);
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Warning: no global variables specified for file id %d",
+ exoid);
+ ex_err("ex_put_glob_vars",errmsg,exerrval);
- return (EX_WARN);
+ return (EX_WARN);
}
/* inquire previously defined variable */
- if ((varid = ncvarid (exoid, VAR_GLO_VAR)) == -1) {
- if (ncerr == NC_ENOTVAR) {
- exerrval = ncerr;
+ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) {
+ if (status == NC_ENOTVAR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: no global variables defined in file id %d",
- exoid);
+ "Error: no global variables defined in file id %d",
+ exoid);
ex_err("ex_put_glob_vars",errmsg,exerrval);
} else {
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to get global variables parameters in file id %d",
- exoid);
+ "Error: failed to get global variables parameters in file id %d",
+ exoid);
ex_err("ex_put_glob_vars",errmsg,exerrval);
}
return (EX_FATAL);
}
break;
+ case EX_NODAL:
+ return ex_put_nodal_var(exoid, time_step, var_index, num_entries_this_obj, var_vals);
+ break;
case EX_EDGE_BLOCK:
- EX_LOOK_UP_VAR("edge block",VAR_ID_ED_BLK,VAR_EDGE_VAR,VAR_EBLK_TAB,DIM_NUM_ED_BLK,DIM_NUM_ED_IN_EBLK,DIM_NUM_EDG_VAR);
+ EX_LOOK_UP_VAR(VAR_ID_ED_BLK,VAR_EDGE_VAR,VAR_EBLK_TAB,DIM_NUM_ED_BLK,DIM_NUM_EDG_VAR);
break;
case EX_FACE_BLOCK:
- EX_LOOK_UP_VAR("face block",VAR_ID_FA_BLK,VAR_FACE_VAR,VAR_FBLK_TAB,DIM_NUM_FA_BLK,DIM_NUM_FA_IN_FBLK,DIM_NUM_FAC_VAR);
+ EX_LOOK_UP_VAR(VAR_ID_FA_BLK,VAR_FACE_VAR,VAR_FBLK_TAB,DIM_NUM_FA_BLK,DIM_NUM_FAC_VAR);
break;
case EX_ELEM_BLOCK:
- EX_LOOK_UP_VAR("element block",VAR_ID_EL_BLK,VAR_ELEM_VAR,VAR_ELEM_TAB,DIM_NUM_EL_BLK,DIM_NUM_EL_IN_BLK,DIM_NUM_ELE_VAR);
+ EX_LOOK_UP_VAR(VAR_ID_EL_BLK,VAR_ELEM_VAR,VAR_ELEM_TAB,DIM_NUM_EL_BLK,DIM_NUM_ELE_VAR);
break;
case EX_NODE_SET:
- EX_LOOK_UP_VAR("node set",VAR_NS_IDS,VAR_NS_VAR,VAR_NSET_TAB,DIM_NUM_NS,DIM_NUM_NOD_NS,DIM_NUM_NSET_VAR);
+ EX_LOOK_UP_VAR(VAR_NS_IDS,VAR_NS_VAR,VAR_NSET_TAB,DIM_NUM_NS,DIM_NUM_NSET_VAR);
break;
case EX_EDGE_SET:
- EX_LOOK_UP_VAR("edge set",VAR_ES_IDS,VAR_ES_VAR,VAR_ESET_TAB,DIM_NUM_ES,DIM_NUM_EDGE_ES,DIM_NUM_ESET_VAR);
+ EX_LOOK_UP_VAR(VAR_ES_IDS,VAR_ES_VAR,VAR_ESET_TAB,DIM_NUM_ES,DIM_NUM_ESET_VAR);
break;
case EX_FACE_SET:
- EX_LOOK_UP_VAR("face set",VAR_FS_IDS,VAR_FS_VAR,VAR_FSET_TAB,DIM_NUM_FS,DIM_NUM_FACE_FS,DIM_NUM_FSET_VAR);
+ EX_LOOK_UP_VAR(VAR_FS_IDS,VAR_FS_VAR,VAR_FSET_TAB,DIM_NUM_FS,DIM_NUM_FSET_VAR);
break;
case EX_SIDE_SET:
- EX_LOOK_UP_VAR("side set",VAR_SS_IDS,VAR_SS_VAR,VAR_SSET_TAB,DIM_NUM_SS,DIM_NUM_SIDE_SS,DIM_NUM_SSET_VAR);
+ EX_LOOK_UP_VAR(VAR_SS_IDS,VAR_SS_VAR,VAR_SSET_TAB,DIM_NUM_SS,DIM_NUM_SSET_VAR);
break;
case EX_ELEM_SET:
- EX_LOOK_UP_VAR("element set",VAR_ELS_IDS,VAR_ELS_VAR,VAR_ELSET_TAB,DIM_NUM_ELS,DIM_NUM_ELE_ELS,DIM_NUM_ELSET_VAR);
+ EX_LOOK_UP_VAR(VAR_ELS_IDS,VAR_ELS_VAR,VAR_ELSET_TAB,DIM_NUM_ELS,DIM_NUM_ELSET_VAR);
break;
default:
exerrval = EX_MSG;
sprintf( errmsg, "Error: invalid variable type (%d) specified for file id %d",
- var_type, exoid );
+ var_type, exoid );
ex_err( "ex_put_var", errmsg, exerrval );
return (EX_FATAL);
}
-/* store element variable values */
+ /* store element variable values */
start[0] = --time_step;
start[1] = 0;
@@ -357,28 +298,31 @@ int ex_put_var (int exoid,
}
count[1] = num_entries_this_obj;
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,var_vals,
- num_entries_this_obj)) == -1)
- {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to store %s variable %d in file id %d",
- tname,var_index,exoid);
+ "Error: failed to store %s %d variable %d in file id %d",
+ ex_name_of_object(var_type), obj_id, var_index,exoid);
ex_err("ex_put_var",errmsg,exerrval);
return (EX_FATAL);
}
return (EX_NOERR);
-/* Fatal error: exit definition mode and return */
-error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_var",errmsg,exerrval);
- }
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_var",errmsg,exerrval);
+ }
return (EX_FATAL);
}
diff --git a/cbind/src/expvarnam.c b/cbind/src/expvarnam.c
new file mode 100644
index 0000000..6bbf5e1
--- /dev/null
+++ b/cbind/src/expvarnam.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvnm - ex_put_variable_name
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type variable type: G,N, or E
+* int var_num variable number name to write 1..num_var
+* char* var_name ptr of variable name
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+#include <ctype.h>
+
+/*!
+ * writes the name of a particular results variable to the database
+ * \param exoid exodus file id
+ * \param obj_type variable type
+ * \param var_num variable number name to write 1..num_var
+ * \param *var_name ptr of variable name
+ */
+
+int ex_put_variable_name (int exoid,
+ ex_entity_type obj_type,
+ int var_num,
+ const char *var_name)
+{
+ int status;
+ int varid, dimid;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* vname;
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &dimid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get string length in file id %d",exoid);
+ ex_err("ex_put_var_name",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* inquire previously defined variables */
+ switch (obj_type) {
+ case EX_GLOBAL:
+ vname = VAR_NAME_GLO_VAR;
+ break;
+ case EX_NODAL:
+ vname = VAR_NAME_NOD_VAR;
+ break;
+ case EX_EDGE_BLOCK:
+ vname = VAR_NAME_EDG_VAR;
+ break;
+ case EX_FACE_BLOCK:
+ vname = VAR_NAME_FAC_VAR;
+ break;
+ case EX_ELEM_BLOCK:
+ vname = VAR_NAME_ELE_VAR;
+ break;
+ case EX_NODE_SET:
+ vname = VAR_NAME_NSET_VAR;
+ break;
+ case EX_EDGE_SET:
+ vname = VAR_NAME_ESET_VAR;
+ break;
+ case EX_FACE_SET:
+ vname = VAR_NAME_FSET_VAR;
+ break;
+ case EX_SIDE_SET:
+ vname = VAR_NAME_SSET_VAR;
+ break;
+ case EX_ELEM_SET:
+ vname = VAR_NAME_ELSET_VAR;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Error: Invalid variable type (%d) given for file id %d", obj_type, exoid );
+ ex_err( "ex_put_variable_name", errmsg, exerrval );
+ return (EX_WARN);
+ }
+
+ if ((status = nc_inq_varid(exoid, vname, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf( errmsg,
+ "Warning: no %s variables names stored in file id %d",
+ ex_name_of_object(obj_type), exoid );
+ ex_err("ex_put_variable_name",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ /* write EXODUS variable name */
+ start[0] = var_num-1;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = strlen(var_name) + 1;
+
+ if ((status = nc_put_vara_text(exoid, varid, start, count, var_name)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store %s variable name %d in file id %d",
+ ex_name_of_object(obj_type), var_num, exoid);
+ ex_err("ex_put_variable_name",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return(EX_NOERR);
+}
diff --git a/cbind/src/expvarnams.c b/cbind/src/expvarnams.c
new file mode 100644
index 0000000..3415dad
--- /dev/null
+++ b/cbind/src/expvarnams.c
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvan - ex_put_variable_names
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type variable type: G,N, or E
+* int num_vars # of variables to read
+* char* var_names ptr array of variable names
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+#include <ctype.h>
+
+#define EX_PUT_NAMES(TNAME,DNUMVAR,VNAMES) \
+ if ((status = nc_inq_dimid(exoid, DNUMVAR, &dimid)) != NC_NOERR) { \
+ exerrval = status; \
+ if (status == NC_EBADDIM) { \
+ sprintf(errmsg, \
+ "Error: no " TNAME " variables defined in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_names",errmsg,exerrval); \
+ } else { \
+ sprintf(errmsg, \
+ "Error: failed to locate number of " TNAME " variables in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_names",errmsg,exerrval); \
+ } \
+ return(EX_FATAL); \
+ } \
+ \
+ if ((status = nc_inq_varid(exoid, VNAMES, &varid)) != NC_NOERR) { \
+ exerrval = status; \
+ if (status == NC_ENOTVAR) \
+ { \
+ sprintf(errmsg, \
+ "Error: no " TNAME " variable names defined in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_names",errmsg,exerrval); \
+ } else { \
+ sprintf(errmsg, \
+ "Error: " TNAME " name variable names not found in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_names",errmsg,exerrval); \
+ } \
+ return(EX_FATAL); \
+ }
+
+/*!
+ * writes the names of the results variables to the database
+ * \param exoid exodus file id
+ * \param obj_type variable type
+ * \param num_vars # of variables to read
+ * \param *var_names ptr array of variable names
+ */
+
+int ex_put_variable_names (int exoid,
+ ex_entity_type obj_type,
+ int num_vars,
+ char* var_names[])
+{
+ int i, varid, dimid, status;
+ size_t start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ switch (obj_type) {
+ case EX_GLOBAL:
+ EX_PUT_NAMES( "global",DIM_NUM_GLO_VAR, VAR_NAME_GLO_VAR);
+ break;
+ case EX_NODAL:
+ EX_PUT_NAMES( "nodal",DIM_NUM_NOD_VAR, VAR_NAME_NOD_VAR);
+ break;
+ case EX_EDGE_BLOCK:
+ EX_PUT_NAMES( "edge",DIM_NUM_EDG_VAR, VAR_NAME_EDG_VAR);
+ break;
+ case EX_FACE_BLOCK:
+ EX_PUT_NAMES( "face",DIM_NUM_FAC_VAR, VAR_NAME_FAC_VAR);
+ break;
+ case EX_ELEM_BLOCK:
+ EX_PUT_NAMES( "element",DIM_NUM_ELE_VAR, VAR_NAME_ELE_VAR);
+ break;
+ case EX_NODE_SET:
+ EX_PUT_NAMES( "node set",DIM_NUM_NSET_VAR, VAR_NAME_NSET_VAR);
+ break;
+ case EX_EDGE_SET:
+ EX_PUT_NAMES( "edge set",DIM_NUM_ESET_VAR, VAR_NAME_ESET_VAR);
+ break;
+ case EX_FACE_SET:
+ EX_PUT_NAMES( "face set",DIM_NUM_FSET_VAR, VAR_NAME_FSET_VAR);
+ break;
+ case EX_SIDE_SET:
+ EX_PUT_NAMES( "side set",DIM_NUM_SSET_VAR, VAR_NAME_SSET_VAR);
+ break;
+ case EX_ELEM_SET:
+ EX_PUT_NAMES("element set",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR);
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid variable type %d specified in file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_var_names",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ /* write EXODUS variable names */
+ for (i=0; i<num_vars; i++) {
+ start[0] = i;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = strlen(var_names[i]) + 1;
+
+ if ((status = nc_put_vara_text(exoid, varid, start, count, var_names[i])) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to store variable names in file id %d",
+ exoid);
+ ex_err("ex_put_var_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/expvarparam.c b/cbind/src/expvarparam.c
new file mode 100644
index 0000000..58f8c83
--- /dev/null
+++ b/cbind/src/expvarparam.c
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvp - ex_put_var_param
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type
+* int* num_vars number of variables in database
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#include <ctype.h>
+
+#define EX_PREPARE_RESULT_VAR(TNAME,DIMNAME,VARNAMEVAR) \
+ if ((status = nc_def_dim(exoid, DIMNAME, num_vars, &dimid)) != NC_NOERR) { \
+ if (status == NC_ENAMEINUSE) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: " TNAME " variable name parameters are already defined in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_param",errmsg,exerrval); \
+ } else { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define number of " TNAME " variables in file id %d", \
+ exoid); \
+ ex_err("ex_put_var_param",errmsg,exerrval); \
+ } \
+ goto error_ret; /* exit define mode and return */ \
+ } \
+ /* Now define TNAME variable name variable */ \
+ dims[0] = dimid; \
+ dims[1] = strdim; \
+ if ((status = nc_def_var (exoid, VARNAMEVAR, NC_CHAR, 2, dims, &varid)) != NC_NOERR) { \
+ if (status == NC_ENAMEINUSE) { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: " TNAME " variable names are already defined in file id %d", \
+ exoid); \
+ ex_err("ex_put_variable_param",errmsg,exerrval); \
+ } else { \
+ exerrval = status; \
+ sprintf(errmsg, \
+ "Error: failed to define " TNAME " variable names in file id %d", \
+ exoid); \
+ ex_err("ex_put_variable_param",errmsg,exerrval); \
+ } \
+ goto error_ret; /* exit define mode and return */ \
+ }
+
+/*!
+ * writes the number and names of global, nodal, or element variables
+ * that will be written to the database
+ * \param exoid exodus file id
+ * \param obj_type object type
+ * \param *num_vars number of variables in database
+ */
+
+int ex_put_variable_param (int exoid,
+ ex_entity_type obj_type,
+ int num_vars)
+{
+ int time_dim, num_nod_dim, dimid, strdim, varid;
+ int dims[3];
+ char errmsg[MAX_ERR_LENGTH];
+ int status;
+
+ exerrval = 0; /* clear error code */
+
+ /* if no variables are to be stored, return with warning */
+ if (num_vars == 0) {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Warning: zero %s variables specified for file id %d",
+ ex_name_of_object(obj_type),exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+
+ return (EX_WARN);
+ }
+
+ if ( obj_type != EX_NODAL &&
+ obj_type != EX_NODE_SET &&
+ obj_type != EX_EDGE_BLOCK &&
+ obj_type != EX_EDGE_SET &&
+ obj_type != EX_FACE_BLOCK &&
+ obj_type != EX_FACE_SET &&
+ obj_type != EX_ELEM_BLOCK &&
+ obj_type != EX_ELEM_SET &&
+ obj_type != EX_SIDE_SET &&
+ obj_type != EX_GLOBAL) {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid variable type %d specified in file id %d",
+ obj_type, exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ /* inquire previously defined dimensions */
+ if ((status = nc_inq_dimid (exoid, DIM_TIME, &time_dim)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate time dimension in file id %d", exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &num_nod_dim)) != NC_NOERR) {
+ if (obj_type == EX_NODAL) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to locate number of nodes in file id %d", exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ if ((status = nc_inq_dimid (exoid, DIM_STR, &strdim)) < 0) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to get string length in file id %d",exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* put file into define mode */
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode", exoid);
+ ex_err("ex_get_var_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* define dimensions and variables */
+ if (obj_type == EX_GLOBAL) {
+ EX_PREPARE_RESULT_VAR("global",DIM_NUM_GLO_VAR,VAR_NAME_GLO_VAR);
+
+ dims[0] = time_dim;
+ dims[1] = dimid;
+ if ((status = nc_def_var (exoid, VAR_GLO_VAR,
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define global variables in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ else if (obj_type == EX_NODAL) {
+ /*
+ * There are two ways to store the nodal variables. The old way *
+ * was a blob (#times,#vars,#nodes), but that was exceeding the
+ * netcdf maximum dataset size for large models. The new way is
+ * to store #vars separate datasets each of size (#times,#nodes)
+ *
+ * We want this routine to be capable of storing both formats
+ * based on some external flag. Since the storage format of the
+ * coordinates have also been changed, we key off of their
+ * storage type to decide which method to use for nodal
+ * variables. If the variable 'coord' is defined, then store old
+ * way; otherwise store new.
+ */
+ if ((status = nc_def_dim(exoid, DIM_NUM_NOD_VAR, num_vars, &dimid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: nodal variable name parameters are already defined in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define number of nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if (ex_large_model(exoid) == 0) { /* Old way */
+ dims[0] = time_dim;
+ dims[1] = dimid;
+ dims[2] = num_nod_dim;
+ if ((status = nc_def_var(exoid, VAR_NOD_VAR,
+ nc_flt_code(exoid), 3, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ } else { /* New way */
+ int i;
+ for (i = 1; i <= num_vars; i++) {
+ dims[0] = time_dim;
+ dims[1] = num_nod_dim;
+ if ((status = nc_def_var (exoid, VAR_NOD_VAR_NEW(i),
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define nodal variable %d in file id %d",
+ i, exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+ }
+
+ /* Now define nodal variable name variable */
+ dims[0] = dimid;
+ dims[1] = strdim;
+ if ((status = nc_def_var(exoid, VAR_NAME_NOD_VAR, NC_CHAR, 2, dims, &varid)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: nodal variable names are already defined in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ } else {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define nodal variable names in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ /* netCDF variables in which to store the EXODUS obj_type variable values will
+ * be defined in ex_put_*_var_tab or ex_put_*_var; at this point, we
+ * don't know what obj_type variables are valid for which obj_type blocks
+ * (the info that is stored in the obj_type variable truth table)
+ */
+ else if (obj_type == EX_ELEM_BLOCK) {
+ EX_PREPARE_RESULT_VAR("element",DIM_NUM_ELE_VAR,VAR_NAME_ELE_VAR);
+ }
+ else if (obj_type == EX_NODE_SET) {
+ EX_PREPARE_RESULT_VAR("nodeset",DIM_NUM_NSET_VAR,VAR_NAME_NSET_VAR);
+ }
+ else if (obj_type == EX_SIDE_SET) {
+ EX_PREPARE_RESULT_VAR("sideset",DIM_NUM_SSET_VAR,VAR_NAME_SSET_VAR);
+ }
+ else if (obj_type == EX_EDGE_BLOCK) {
+ EX_PREPARE_RESULT_VAR("edge",DIM_NUM_EDG_VAR,VAR_NAME_EDG_VAR);
+ }
+ else if (obj_type == EX_FACE_BLOCK) {
+ EX_PREPARE_RESULT_VAR("face",DIM_NUM_FAC_VAR,VAR_NAME_FAC_VAR);
+ }
+ else if (obj_type == EX_EDGE_SET) {
+ EX_PREPARE_RESULT_VAR("edgeset",DIM_NUM_ESET_VAR,VAR_NAME_ESET_VAR);
+ }
+ else if (obj_type == EX_FACE_SET) {
+ EX_PREPARE_RESULT_VAR("faceset",DIM_NUM_FSET_VAR,VAR_NAME_FSET_VAR);
+ }
+ else if (obj_type == EX_ELEM_SET) {
+ EX_PREPARE_RESULT_VAR("elementset",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR);
+ }
+
+ /* leave define mode */
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return(EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if ((status = nc_enddef(exoid)) != NC_NOERR) { /* exit define mode */
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_variable_param",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/exptt.c b/cbind/src/expvartab.c
similarity index 55%
copy from cbind/src/exptt.c
copy to cbind/src/expvartab.c
index faea8c0..578bec2 100644
--- a/cbind/src/exptt.c
+++ b/cbind/src/expvartab.c
@@ -34,23 +34,20 @@
*/
/*****************************************************************************
*
-* expvtt - ex_put_var_tab
-*
-* environment - UNIX
+* expvtt - ex_put_truth_table
*
* entry conditions -
* input parameters:
-* int exoid exodus file id
-* char* type 'e', 'm', 's' element, nodeset, sideset
+* int exoid exodus file id
+* int obj_type object type
* int num_blk number of blocks
* int num_var number of variables
-* int* var_tab variable truth table array
+* int* variable_table variable truth table array
*
* exit conditions -
*
* revision history -
*
-* $Id: exptt.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -62,29 +59,33 @@
* writes the EXODUS II variable truth table to the database; also,
* creates netCDF variables in which to store EXODUS II variable
* values; although this table isn't required (because the netCDF
- * variables can also be created in ex_put_*_var), this call will save
+ * variables can also be created in ex_put_var), this call will save
* tremendous time because all of the variables are defined at once
* while the file is in define mode, rather than going in and out of
* define mode (causing the entire file to be copied over and over)
- * which is what occurs when the variables are defined in ex_put_*_var
+ * which is what occurs when the variables are defined in ex_put_var
+ * \param exoid exodus file id
+ * \param obj_type object type
+ * \param num_blk number of blocks
+ * \param num_var number of variables
+ * \param *var_tab variable truth table array
*/
-int ex_put_var_tab (int exoid,
- const char *var_type,
- int num_blk,
- int num_var,
- int *var_tab)
+int ex_put_truth_table (int exoid,
+ ex_entity_type obj_type,
+ int num_blk,
+ int num_var,
+ int *var_tab)
{
- int numelblkdim, numelvardim, timedim, dims[2], varid, iresult;
- int obj_type;
+ int numelblkdim, numelvardim, timedim, dims[2], varid;
char *sta_type, *tab_type;
- long num_entity = -1;
- long num_var_db = -1;
- long start[2], count[2];
- nclong *stat_vals, *lptr;
+ size_t num_entity = 0;
+ size_t num_var_db = 0;
+ int *stat_vals;
int i, j, k, id, *ids;
+ int status;
char errmsg[MAX_ERR_LENGTH];
- const char* routine = "ex_get_var_tab";
+ const char* routine = "ex_put_truth_table";
/*
* The ent_type and the var_name are used to build the netcdf
@@ -96,69 +97,113 @@ int ex_put_var_tab (int exoid,
const char* ent_size = NULL;
exerrval = 0; /* clear error code */
- if (*var_type == 'e' || *var_type == 'E') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_ELEM_TAB);
+ ex_get_dimension(exoid, ex_dim_num_objects(obj_type),
+ ex_name_of_object(obj_type), &num_entity, &numelblkdim, routine);
+
+ if (obj_type == EX_ELEM_BLOCK) {
+ ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_ELEM_TAB, &varid);
var_name = "vals_elem_var";
ent_type = "eb";
ent_size = "num_el_in_blk";
- obj_type = EX_ELEM_BLOCK;
sta_type = VAR_STAT_EL_BLK;
tab_type = VAR_ELEM_TAB;
}
- else if (*var_type == 'm' || *var_type == 'M') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_NS, "nodesets",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_NSET_TAB);
- var_name = "vals_nset_var";
- ent_type = "ns";
- ent_size = "num_nod_ns";
- obj_type = EX_NODE_SET;
- sta_type = VAR_NS_STAT;
- tab_type = VAR_NSET_TAB;
+ else if (obj_type == EX_EDGE_BLOCK) {
+ ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge block variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_EBLK_TAB, &varid);
+ var_name = "vals_edge_var";
+ ent_type = "eb";
+ ent_size = "num_ed_in_blk";
+ sta_type = VAR_STAT_ED_BLK;
+ tab_type = VAR_EBLK_TAB;
}
- else if (*var_type == 's' || *var_type == 'S') {
- numelblkdim = ex_get_dimension(exoid, DIM_NUM_SS, "sidesets",
- &num_entity, routine);
- numelvardim = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables",
- &num_var_db, routine);
- varid = ncvarid (exoid, VAR_SSET_TAB);
+ else if (obj_type == EX_FACE_BLOCK) {
+ ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face block variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_FBLK_TAB, &varid);
+ var_name = "vals_face_var";
+ ent_type = "fb";
+ ent_size = "num_fa_in_blk";
+ sta_type = VAR_STAT_FA_BLK;
+ tab_type = VAR_FBLK_TAB;
+ }
+ else if (obj_type == EX_SIDE_SET) {
+ ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_SSET_TAB, &varid);
var_name = "vals_sset_var";
ent_type = "ss";
ent_size = "num_side_ss";
- obj_type = EX_SIDE_SET;
sta_type = VAR_SS_STAT;
tab_type = VAR_SSET_TAB;
}
+ else if (obj_type == EX_NODE_SET) {
+ ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_NSET_TAB, &varid);
+ var_name = "vals_nset_var";
+ ent_type = "ns";
+ ent_size = "num_nod_ns";
+ sta_type = VAR_NS_STAT;
+ tab_type = VAR_NSET_TAB;
+ }
+ else if (obj_type == EX_EDGE_SET) {
+ ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edge set variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_ESET_TAB, &varid);
+ var_name = "vals_eset_var";
+ ent_type = "es";
+ ent_size = "num_edge_es";
+ sta_type = VAR_ES_STAT;
+ tab_type = VAR_ESET_TAB;
+ }
+ else if (obj_type == EX_FACE_SET) {
+ ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "face set variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_FSET_TAB, &varid);
+ var_name = "vals_fset_var";
+ ent_type = "fs";
+ ent_size = "num_face_fs";
+ sta_type = VAR_FS_STAT;
+ tab_type = VAR_FSET_TAB;
+ }
+ else if (obj_type == EX_ELEM_SET) {
+ ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "element set variables",
+ &num_var_db, &numelvardim, routine);
+ status = nc_inq_varid (exoid, VAR_ELSET_TAB, &varid);
+ var_name = "vals_elset_var";
+ ent_type = "es";
+ ent_size = "num_ele_els";
+ sta_type = VAR_ELS_STAT;
+ tab_type = VAR_ELSET_TAB;
+ }
+
else { /* invalid variable type */
exerrval = EX_BADPARAM;
sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
+ "Error: Invalid variable type %d specified in file id %d",
+ obj_type, exoid);
ex_err("ex_get_varid",errmsg,exerrval);
return (EX_WARN);
}
- if (num_entity == -1 || num_var_db == -1)
- return (EX_FATAL);
-
- if (num_entity != num_blk) {
+ if ((int)num_entity != num_blk) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: # of blocks doesn't match those defined in file id %d", exoid);
+ "Error: # of %s doesn't match those defined in file id %d",
+ ex_name_of_object(obj_type), exoid);
ex_err("ex_get_var_tab",errmsg,exerrval);
return (EX_FATAL);
}
- if (num_var_db != num_var) {
+ if ((int)num_var_db != num_var) {
exerrval = EX_FATAL;
sprintf(errmsg,
- "Error: # of variables doesn't match those defined in file id %d", exoid);
+ "Error: # of %s variables doesn't match those defined in file id %d",
+ ex_name_of_object(obj_type), exoid);
ex_err("ex_get_var_tab",errmsg,exerrval);
return (EX_FATAL);
}
@@ -167,42 +212,37 @@ int ex_put_var_tab (int exoid,
if (!(ids = malloc(num_blk*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
- "Error: failed to allocate memory for id array for file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ "Error: failed to allocate memory for %s id array for file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
return (EX_FATAL);
}
/* Get status array for later use */
- if (!(stat_vals = malloc(num_blk*sizeof(nclong)))) {
+ if (!(stat_vals = malloc(num_blk*sizeof(int)))) {
exerrval = EX_MEMFAIL;
free(ids);
sprintf(errmsg,
- "Error: failed to allocate memory for status array for file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ "Error: failed to allocate memory for %s status array for file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
return (EX_FATAL);
}
ex_get_ids (exoid, obj_type, ids);
- varid = ncvarid (exoid, sta_type);
+ status = nc_inq_varid (exoid, sta_type, &varid);
/* get variable id of status array */
- if (varid != -1) {
+ if (status == NC_NOERR) {
/* if status array exists (V 2.01+), use it, otherwise assume
object exists to be backward compatible */
- start[0] = 0;
- start[1] = 0;
- count[0] = num_blk;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var_int (exoid, varid, stat_vals)) != NC_NOERR) {
+ exerrval = status;
free(stat_vals);
sprintf(errmsg,
- "Error: failed to get status array from file id %d",
- exoid);
+ "Error: failed to get %s status array from file id %d",
+ ex_name_of_object(obj_type), exoid);
ex_err("put_var_tab",errmsg,exerrval);
return (EX_FATAL);
}
@@ -213,26 +253,26 @@ int ex_put_var_tab (int exoid,
}
/* put netcdf file into define mode */
- if (ncredef (exoid) == -1) {
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
free(stat_vals);
free (ids);
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to put file id %d into define mode",
exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ ex_err(routine,errmsg,exerrval);
return (EX_FATAL);
}
/* inquire previously defined dimensions */
- if ((timedim = ncdimid (exoid, DIM_TIME)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid (exoid, DIM_TIME, &timedim)) != NC_NOERR) {
+ exerrval = status;
free(stat_vals);
free (ids);
sprintf(errmsg,
"Error: failed to locate time variable in file id %d",
exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ ex_err(routine,errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
@@ -256,15 +296,15 @@ int ex_put_var_tab (int exoid,
dims[0] = timedim;
/* Determine number of entities in block */
- if ((dims[1] = ncdimid (exoid, ex_catstr(ent_size, (i+1)))) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, ex_catstr(ent_size, (i+1)), &dims[1])) != NC_NOERR) {
+ exerrval = status;
id=ids[i];
free(stat_vals);
free (ids);
sprintf(errmsg,
- "Error: failed to locate number of entities in block %d in file id %d",
- id,exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ "Error: failed to locate number of entities in %s %d in file id %d",
+ ex_name_of_object(obj_type), id,exoid);
+ ex_err(routine,errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
@@ -276,17 +316,17 @@ int ex_put_var_tab (int exoid,
* instead of 0
*/
- if ((varid = ncvardef (exoid, ex_catstr2(var_name, j, ent_type, i+1),
- nc_flt_code(exoid), 2, dims)) == -1) {
- if (ncerr != NC_ENAMEINUSE) {
- exerrval = ncerr;
+ if ((status = nc_def_var(exoid, ex_catstr2(var_name, j, ent_type, i+1),
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) {
+ if (status != NC_ENAMEINUSE) {
+ exerrval = status;
id=ids[i];
free(stat_vals);
free (ids);
sprintf(errmsg,
- "Error: failed to define variable for block %d in file id %d",
- id,exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ "Error: failed to define variable for %s %d in file id %d",
+ ex_name_of_object(obj_type), id,exoid);
+ ex_err(routine,errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
}
@@ -304,54 +344,36 @@ int ex_put_var_tab (int exoid,
dims[0] = numelblkdim;
dims[1] = numelvardim;
- varid = ncvardef (exoid, tab_type, NC_LONG, 2, dims);
+ status = nc_def_var (exoid, tab_type, NC_INT, 2, dims, &varid);
- if (varid == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
- "Error: failed to define variable truth table in file id %d",
- exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ "Error: failed to define %s variable truth table in file id %d",
+ ex_name_of_object(obj_type), exoid);
+ ex_err(routine,errmsg,exerrval);
goto error_ret; /* exit define mode and return */
}
/* leave define mode */
- if (ncendef (exoid) == -1) {
- exerrval = ncerr;
+ if ((status = nc_enddef (exoid)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to complete definitions in file id %d",
exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ ex_err(routine,errmsg,exerrval);
return (EX_FATAL);
}
-
/* write out the element variable truth table */
+ status = nc_put_var_int(exoid, varid, var_tab);
- /* this contortion is necessary because netCDF is expecting nclongs;
- fortunately it's necessary only when ints and nclongs aren't the
- same size */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_blk;
- count[1] = num_var;
-
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, var_tab);
- } else {
- lptr = itol (var_tab, (int)(num_blk*num_var));
- iresult = ncvarput (exoid, varid, start, count, lptr);
- free(lptr);
- }
-
- if (iresult == -1) {
- exerrval = ncerr;
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store variable truth table in file id %d",
exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ ex_err(routine,errmsg,exerrval);
return (EX_FATAL);
}
@@ -360,12 +382,12 @@ int ex_put_var_tab (int exoid,
/* Fatal error: exit definition mode and return */
error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
{
sprintf(errmsg,
"Error: failed to complete definition for file id %d",
exoid);
- ex_err("ex_put_var_tab",errmsg,exerrval);
+ ex_err(routine,errmsg,exerrval);
}
return (EX_FATAL);
}
diff --git a/cbind/src/expvnm.c b/cbind/src/expvnm.c
index 8aea166..86cc0f9 100644
--- a/cbind/src/expvnm.c
+++ b/cbind/src/expvnm.c
@@ -36,15 +36,6 @@
*
* expvnm - ex_put_var_name
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-* David Thompson - Support for edge/face elements and element sets
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -56,7 +47,6 @@
*
* revision history -
*
-* $Id: expvnm.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -67,6 +57,11 @@
/*!
* writes the name of a particular results variable to the database
+ * \param exoid exodus file id
+ * \param *var_type variable type: G,N, or E
+ * \param var_num variable number name to write 1..num_var
+ * \param *var_name ptr of variable name
+ * \deprecated use ex_put_variable_name()(exoid, obj_type, var_num, *var_name)
*/
int ex_put_var_name (int exoid,
@@ -74,104 +69,7 @@ int ex_put_var_name (int exoid,
int var_num,
const char *var_name)
{
- int varid;
- long start[2], count[2];
- char errmsg[MAX_ERR_LENGTH];
- int otype;
- const char* vname;
- const char* tname;
-
- exerrval = 0; /* clear error code */
-
-/* inquire previously defined dimensions */
-
- if ((ncdimid (exoid, DIM_STR)) < 0)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get string length in file id %d",exoid);
- ex_err("ex_put_var_name",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-/* inquire previously defined variables */
-
- otype = tolower( *var_type );
- switch (otype) {
- case 'g': /* global var */
- vname = VAR_NAME_GLO_VAR;
- tname = "global";
- break;
- case 'n': /* node var */
- vname = VAR_NAME_NOD_VAR;
- tname = "nodal";
- break;
- case 'e': /* elem var */
- vname = VAR_NAME_ELE_VAR;
- tname = "element";
- break;
- case 'l': /* edge var */
- vname = VAR_NAME_EDG_VAR;
- tname = "edge";
- break;
- case 'f': /* face var */
- vname = VAR_NAME_FAC_VAR;
- tname = "face";
- break;
- case 'm': /* node set var */
- vname = VAR_NAME_NSET_VAR;
- tname = "node set";
- break;
- case 'd': /* edge set var */
- vname = VAR_NAME_ESET_VAR;
- tname = "edge set";
- break;
- case 'a': /* face set var */
- vname = VAR_NAME_FSET_VAR;
- tname = "face set";
- break;
- case 's': /* side set var */
- vname = VAR_NAME_SSET_VAR;
- tname = "side set";
- break;
- case 't': /* elem set var */
- vname = VAR_NAME_ELSET_VAR;
- tname = "element set";
- break;
- default:
- exerrval = EX_BADPARAM;
- sprintf(errmsg,
- "Error: Invalid variable type %c specified in file id %d",
- *var_type, exoid);
- ex_err("ex_put_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
-
- if ((varid = ncvarid (exoid, vname)) == -1) {
- exerrval = ncerr;
- sprintf( errmsg,
- "Warning: no %s variables names stored in file id %d", tname, exoid );
- ex_err("ex_put_var_name",errmsg,exerrval);
- return (EX_WARN);
- }
-
-/* write EXODUS variable name */
-
- start[0] = var_num-1;
- start[1] = 0;
-
- count[0] = 1;
- count[1] = strlen(var_name) + 1;
-
- if (ncvarput (exoid, varid, start, count, (void*)var_name) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to store %c variable name %d in file id %d",
- *var_type, var_num, exoid);
- ex_err("ex_put_var_name",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return(EX_NOERR);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return ex_put_variable_name(exoid, obj_type, var_num, var_name);
}
diff --git a/cbind/src/expvp.c b/cbind/src/expvp.c
index 8f31439..e16ffc4 100644
--- a/cbind/src/expvp.c
+++ b/cbind/src/expvp.c
@@ -36,14 +36,6 @@
*
* expvp - ex_put_var_param
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
@@ -54,7 +46,6 @@
*
* revision history -
*
-* $Id: expvp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -63,322 +54,20 @@
#include <ctype.h>
-#define EX_PREPARE_RESULT_VAR(TNAME,DIMNAME,VARNAMEVAR) \
- if ((dimid = ncdimdef (exoid, DIMNAME, (long)num_vars)) == -1) \
- { \
- if (ncerr == NC_ENAMEINUSE) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: " TNAME " variable name parameters are already defined in file id %d", \
- exoid); \
- ex_err("ex_put_var_param",errmsg,exerrval); \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define number of " TNAME " variables in file id %d", \
- exoid); \
- ex_err("ex_put_var_param",errmsg,exerrval); \
- } \
- goto error_ret; /* exit define mode and return */ \
- } \
- \
- /* Now define TNAME variable name variable */ \
- dims[0] = dimid; \
- dims[1] = strdim; \
- if ((ncvardef (exoid, VARNAMEVAR, NC_CHAR, 2, dims)) == -1) \
- { \
- if (ncerr == NC_ENAMEINUSE) \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: " TNAME " variable names are already defined in file id %d", \
- exoid); \
- ex_err("ex_put_var_param",errmsg,exerrval); \
- } \
- else \
- { \
- exerrval = ncerr; \
- sprintf(errmsg, \
- "Error: failed to define " TNAME " variable names in file id %d", \
- exoid); \
- ex_err("ex_put_var_param",errmsg,exerrval); \
- } \
- goto error_ret; /* exit define mode and return */ \
- }
-
/*!
* writes the number and names of global, nodal, or element variables
* that will be written to the database
+ * \param exoid exodus file id
+ * \param var_type variable type G,N, or E
+ * \param num_vars number of variables in database
+ * \deprecated Use ex_put_variable_param()(exoid, obj_type, num_vars)
*/
int ex_put_var_param (int exoid,
const char *var_type,
int num_vars)
{
- int time_dim, num_nod_dim, dimid, strdim;
- int dims[3];
- char *vptr;
- char errmsg[MAX_ERR_LENGTH];
-
- exerrval = 0; /* clear error code */
-
- /* if no variables are to be stored, return with warning */
- if (num_vars == 0)
- {
- exerrval = EX_MSG;
- if (tolower(*var_type) == 'e')
- vptr="element";
- else if (tolower(*var_type) == 'g')
- vptr="global";
- else if (tolower(*var_type) == 'n')
- vptr="nodal";
- else if (tolower(*var_type) == 'm')
- vptr="nodeset";
- else
- vptr="invalid type";
-
- sprintf(errmsg,
- "Warning: zero %s variables specified for file id %d",
- vptr,exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
-
- return (EX_WARN);
- }
-
- /* inquire previously defined dimensions */
-
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate time dimension in file id %d", exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- if ((num_nod_dim = ncdimid (exoid, DIM_NUM_NODES)) == -1) {
- if (tolower(*var_type) == 'n') {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to locate number of nodes in file id %d", exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
- }
-
-
- if ((strdim = ncdimid (exoid, DIM_STR)) < 0)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to get string length in file id %d",exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- /* put file into define mode */
-
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_get_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
-
- /* define dimensions and variables */
-
- if (tolower(*var_type) == 'g')
- {
- EX_PREPARE_RESULT_VAR("global",DIM_NUM_GLO_VAR,VAR_NAME_GLO_VAR);
-
- dims[0] = time_dim;
- dims[1] = dimid;
- if ((ncvardef (exoid, VAR_GLO_VAR,
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define global variables in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
-
- else if (tolower(*var_type) == 'n')
- {
- /*
- * There are two ways to store the nodal variables. The old way *
- * was a blob (#times,#vars,#nodes), but that was exceeding the
- * netcdf maximum dataset size for large models. The new way is
- * to store #vars separate datasets each of size (#times,#nodes)
- *
- * We want this routine to be capable of storing both formats
- * based on some external flag. Since the storage format of the
- * coordinates have also been changed, we key off of their
- * storage type to decide which method to use for nodal
- * variables. If the variable 'coord' is defined, then store old
- * way; otherwise store new.
- */
- if ((dimid = ncdimdef (exoid, DIM_NUM_NOD_VAR, (long)num_vars)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: nodal variable name parameters are already defined in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define number of nodal variables in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
- if (ex_large_model(exoid) == 0) { /* Old way */
- dims[0] = time_dim;
- dims[1] = dimid;
- dims[2] = num_nod_dim;
- if ((ncvardef (exoid, VAR_NOD_VAR,
- nc_flt_code(exoid), 3, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodal variables in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- } else { /* New way */
- int i;
- for (i = 1; i <= num_vars; i++) {
- dims[0] = time_dim;
- dims[1] = num_nod_dim;
- if ((ncvardef (exoid, VAR_NOD_VAR_NEW(i),
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodal variable %d in file id %d",
- i, exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
- }
-
- /* Now define nodal variable name variable */
- dims[0] = dimid;
- dims[1] = strdim;
- if ((ncvardef (exoid, VAR_NAME_NOD_VAR, NC_CHAR, 2, dims)) == -1)
- {
- if (ncerr == NC_ENAMEINUSE)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: nodal variable names are already defined in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- }
- else
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodal variable names in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- }
- goto error_ret; /* exit define mode and return */
- }
-
- }
-
- else if (tolower(*var_type) == 'e')
- {
- EX_PREPARE_RESULT_VAR("element",DIM_NUM_ELE_VAR,VAR_NAME_ELE_VAR);
-
- /* netCDF variables in which to store the EXODUS element variable values will
- * be defined in ex_put_elem_var_tab or ex_put_elem_var; at this point, we
- * don't know what element variables are valid for which element blocks
- * (the info that is stored in the element variable truth table)
- */
- }
-
- else if (tolower(*var_type) == 'm')
- {
- EX_PREPARE_RESULT_VAR("nodeset",DIM_NUM_NSET_VAR,VAR_NAME_NSET_VAR);
-
- /* netCDF variables in which to store the EXODUS nodeset variable values will
- * be defined in ex_put_nset_var_tab or ex_put_nset_var; at this point, we
- * don't know what nodeset variables are valid for which nodesets
- * (the info that is stored in the nodeset variable truth table)
- */
- }
- else if (tolower(*var_type) == 's')
- {
- EX_PREPARE_RESULT_VAR("sideset",DIM_NUM_SSET_VAR,VAR_NAME_SSET_VAR);
-
- /* netCDF variables in which to store the EXODUS sideset variable values will
- * be defined in ex_put_nset_var_tab or ex_put_nset_var; at this point, we
- * don't know what sideset variables are valid for which sidesets
- * (the info that is stored in the sideset variable truth table)
- */
- }
- else if (tolower(*var_type) == 'l')
- {
- EX_PREPARE_RESULT_VAR("edge",DIM_NUM_EDG_VAR,VAR_NAME_EDG_VAR);
- }
- else if (tolower(*var_type) == 'f')
- {
- EX_PREPARE_RESULT_VAR("face",DIM_NUM_FAC_VAR,VAR_NAME_FAC_VAR);
- }
- else if (tolower(*var_type) == 'd')
- {
- EX_PREPARE_RESULT_VAR("edgeset",DIM_NUM_ESET_VAR,VAR_NAME_ESET_VAR);
- }
- else if (tolower(*var_type) == 'a')
- {
- EX_PREPARE_RESULT_VAR("faceset",DIM_NUM_FSET_VAR,VAR_NAME_FSET_VAR);
- }
- else if (tolower(*var_type) == 'i')
- {
- EX_PREPARE_RESULT_VAR("elementset",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR);
- }
-
- /* leave define mode */
-
- if (ncendef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to complete definition in file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return(EX_NOERR);
-
- /* Fatal error: exit definition mode and return */
- error_ret:
- if (ncendef (exoid) == -1) /* exit define mode */
- {
- sprintf(errmsg,
- "Error: failed to complete definition for file id %d",
- exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- }
- return (EX_FATAL);
+ ex_entity_type obj_type;
+ obj_type = ex_var_type_to_ex_entity_type(*var_type);
+ return (ex_put_variable_param(exoid, obj_type, num_vars));
}
diff --git a/cbind/src/expvpa.c b/cbind/src/expvpa.c
index be15554..9cb4e63 100644
--- a/cbind/src/expvpa.c
+++ b/cbind/src/expvpa.c
@@ -50,7 +50,6 @@
*
* exit conditions -
*
-* $Id: expvpa.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
*****************************************************************************/
#include <stdlib.h>
@@ -58,8 +57,17 @@
#include "exodusII_int.h"
/*!
- * writes the number of global, nodal, element, nodeset, and sideset variables
+ * defines the number of global, nodal, element, nodeset, and sideset variables
* that will be written to the database
+* \param exoid exodus file id
+* \param num_g global variable count
+* \param num_n nodal variable count
+* \param num_e element variable count
+* \param *elem_var_tab element variable truth table array
+* \param num_m nodeset variable count
+* \param *nset_var_tab nodeset variable truth table array
+* \param num_s sideset variable count
+* \param *sset_var_tab sideset variable truth table array
*/
int ex_put_all_var_param (int exoid,
diff --git a/cbind/src/expvpax.c b/cbind/src/expvpax.c
index e823339..04bd7e3 100644
--- a/cbind/src/expvpax.c
+++ b/cbind/src/expvpax.c
@@ -43,7 +43,6 @@
*
* exit conditions -
*
-* $Id: expvpax.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
*****************************************************************************/
#include <stdlib.h>
@@ -52,34 +51,62 @@
#include <ctype.h>
static void *safe_free(void *array);
-static int define_dimension(int exoid, const char *DIMENSION, int count, const char *label);
-static int define_variable_name_variable(int exoid, const char *VARIABLE, long dimension,
+static int define_dimension(int exoid, const char *DIMENSION, int count, const char *label, int *dimid);
+static int define_variable_name_variable(int exoid, const char *VARIABLE, int dimension,
const char *label);
-static nclong *get_status_array(int exoid, long count, const char *VARIABLE, const char *label);
-static int put_truth_table(int exoid, int num_blk, int num_var, int varid, int *table, const char *label);
-static int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
+static int *get_status_array(int exoid, int count, const char *VARIABLE, const char *label);
+static int put_truth_table(int exoid, int varid, int *table, const char *label);
+static int define_truth_table(ex_entity_type obj_type, int exoid, int num_ent, int num_var,
int *var_tab, int *status, int *ids, const char *label);
+#define EX_GET_IDS_STATUS(TNAME,NUMVAR,DNAME,DID,DVAL,VIDS,EIDS,VSTAT,VSTATVAL) \
+ if (NUMVAR > 0) { \
+ status = ex_get_dimension(exoid, DNAME, TNAME "s", &DVAL, &DID, routine); \
+ if (status != NC_NOERR) \
+ goto error_ret; \
+ \
+ /* get element block IDs */ \
+ if (!(VIDS = malloc(DVAL*sizeof(int)))) { \
+ exerrval = EX_MEMFAIL; \
+ sprintf(errmsg, \
+ "Error: failed to allocate memory for " TNAME " id array for file id %d", \
+ exoid); \
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \
+ goto error_ret; \
+ } \
+ ex_get_ids (exoid, EIDS, VIDS); \
+ \
+ /* Get element block status array for later use (allocates memory) */ \
+ VSTATVAL = get_status_array(exoid, DVAL, VSTAT, TNAME); \
+ if (VSTATVAL == NULL) { \
+ goto error_ret; \
+ } \
+ }
+
/*!
* writes the number of global, nodal, element, nodeset, and sideset variables
* that will be written to the database
+ * \param exoid exodus file id
+ * \param *vp pointer to variable parameter info
*/
int ex_put_all_var_param_ext ( int exoid,
const ex_var_params* vp )
{
int in_define = 0;
- int time_dim, num_nod_dim, dimid, iresult;
- long num_elem_blk, num_edge_blk, num_face_blk,
- num_nset, num_eset, num_fset, num_sset, num_elset;
+ int status;
+ int temp;
+ int time_dim, num_nod_dim, dimid;
+ size_t num_elem_blk, num_edge_blk, num_face_blk;
+ size_t num_nset, num_eset, num_fset, num_sset, num_elset;
int numelblkdim, numelvardim, numedvardim, numedblkdim,
- numfavardim, numfablkdim, numnsetdim, nsetvardim,
- numesetdim, esetvardim, numfsetdim, fsetvardim,
- numssetdim, ssetvardim, numelsetdim, elsetvardim;
+ numfavardim, numfablkdim, numnsetdim, nsetvardim,
+ numesetdim, esetvardim, numfsetdim, fsetvardim,
+ numssetdim, ssetvardim, numelsetdim, elsetvardim;
int i;
int edblk_varid, fablk_varid, eblk_varid, nset_varid,
- eset_varid, fset_varid, sset_varid, elset_varid;
+ eset_varid, fset_varid, sset_varid, elset_varid, varid;
int* eblk_ids = 0;
int* edblk_ids = 0;
@@ -90,14 +117,14 @@ int ex_put_all_var_param_ext ( int exoid,
int* sset_ids = 0;
int* elset_ids = 0;
- nclong* eblk_stat = 0;
- nclong* edblk_stat = 0;
- nclong* fablk_stat = 0;
- nclong* nset_stat = 0;
- nclong* eset_stat = 0;
- nclong* fset_stat = 0;
- nclong* sset_stat = 0;
- nclong* elset_stat = 0;
+ int* eblk_stat = 0;
+ int* edblk_stat = 0;
+ int* fablk_stat = 0;
+ int* nset_stat = 0;
+ int* eset_stat = 0;
+ int* fset_stat = 0;
+ int* sset_stat = 0;
+ int* elset_stat = 0;
int dims[3];
char errmsg[MAX_ERR_LENGTH];
@@ -107,17 +134,17 @@ int ex_put_all_var_param_ext ( int exoid,
/* inquire previously defined dimensions */
- if ((time_dim = ncdimid (exoid, DIM_TIME)) == -1) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate time dimension in file id %d", exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
goto error_ret;
}
- if ((num_nod_dim = ncdimid (exoid, DIM_NUM_NODES)) == -1) {
+ if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &num_nod_dim)) != NC_NOERR) {
if (vp->num_node > 0) {
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate number of nodes in file id %d",
exoid);
@@ -127,38 +154,14 @@ int ex_put_all_var_param_ext ( int exoid,
}
/* Check this now so we can use it later without checking for errors */
- if (ncdimid (exoid, DIM_STR) < 0) {
- exerrval = ncerr;
+ if ((status = nc_inq_dimid(exoid, DIM_STR, &temp)) != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to get string length in file id %d",exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
goto error_ret;
}
-#define EX_GET_IDS_STATUS(TNAME,NUMVAR,DNAME,DID,DVAL,VIDS,EIDS,VSTAT,VSTATVAL) \
- if (NUMVAR > 0) { \
- DID = ex_get_dimension(exoid, DNAME, TNAME "s", &DVAL, routine); \
- if (DID == -1) \
- goto error_ret; \
- \
- /* get element block IDs */ \
- if (!(VIDS = malloc(DVAL*sizeof(int)))) { \
- exerrval = EX_MEMFAIL; \
- sprintf(errmsg, \
- "Error: failed to allocate memory for " TNAME " id array for file id %d", \
- exoid); \
- ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \
- goto error_ret; \
- } \
- ex_get_ids (exoid, EIDS, VIDS); \
- \
- /* Get element block status array for later use (allocates memory) */ \
- VSTATVAL = get_status_array(exoid, DVAL, VSTAT, TNAME); \
- if (VSTATVAL == NULL) { \
- goto error_ret; \
- } \
- }
-
EX_GET_IDS_STATUS( "edge block",vp->num_edge, DIM_NUM_ED_BLK,numedblkdim,num_edge_blk,edblk_ids,EX_EDGE_BLOCK,VAR_STAT_ED_BLK,edblk_stat);
EX_GET_IDS_STATUS( "face block",vp->num_face, DIM_NUM_FA_BLK,numfablkdim,num_face_blk,fablk_ids,EX_FACE_BLOCK,VAR_STAT_FA_BLK,fablk_stat);
EX_GET_IDS_STATUS("element block",vp->num_elem, DIM_NUM_EL_BLK,numelblkdim,num_elem_blk, eblk_ids,EX_ELEM_BLOCK,VAR_STAT_EL_BLK, eblk_stat);
@@ -169,126 +172,119 @@ int ex_put_all_var_param_ext ( int exoid,
EX_GET_IDS_STATUS( "element set",vp->num_elset,DIM_NUM_ELS, numelsetdim,num_elset, elset_ids,EX_ELEM_SET, VAR_ELS_STAT, elset_stat);
/* put file into define mode */
- if (ncredef (exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to put file id %d into define mode", exoid);
- ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
- goto error_ret;
- }
+ if ((status = nc_redef (exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to put file id %d into define mode", exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ goto error_ret;
+ }
in_define = 1;
/* define dimensions and variables */
+ if (vp->num_glob > 0) {
+ if (define_dimension(exoid, DIM_NUM_GLO_VAR, vp->num_glob, "global", &dimid) != NC_NOERR)
+ goto error_ret;
+
+ dims[0] = time_dim;
+ dims[1] = dimid;
+ if ((status = nc_def_var (exoid, VAR_GLO_VAR, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define global variables in file id %d",
+ exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
- if (vp->num_glob > 0)
- {
- dimid = define_dimension(exoid, DIM_NUM_GLO_VAR, vp->num_glob, "global");
- if (dimid == -1) goto error_ret;
+ /* Now define global variable name variable */
+ if (define_variable_name_variable(exoid, VAR_NAME_GLO_VAR, dimid, "global") != NC_NOERR)
+ goto error_ret;
+ }
-
+ if (vp->num_node > 0) {
+ /*
+ * There are two ways to store the nodal variables. The old way *
+ * was a blob (#times,#vars,#nodes), but that was exceeding the
+ * netcdf maximum dataset size for large models. The new way is
+ * to store #vars separate datasets each of size (#times,#nodes)
+ *
+ * We want this routine to be capable of storing both formats
+ * based on some external flag. Since the storage format of the
+ * coordinates have also been changed, we key off of their
+ * storage type to decide which method to use for nodal
+ * variables. If the variable 'coord' is defined, then store old
+ * way; otherwise store new.
+ */
+ if (define_dimension(exoid, DIM_NUM_NOD_VAR, vp->num_node, "nodal", &dimid) != NC_NOERR)
+ goto error_ret;
+
+ if (ex_large_model(exoid) == 0) { /* Old way */
dims[0] = time_dim;
dims[1] = dimid;
- if ((ncvardef (exoid, VAR_GLO_VAR,
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define global variables in file id %d",
- exoid);
- ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
-
- /* Now define global variable name variable */
- if (define_variable_name_variable(exoid, VAR_NAME_GLO_VAR, dimid, "global") == -1)
- goto error_ret;
- }
-
- if (vp->num_node > 0)
- {
- /*
- * There are two ways to store the nodal variables. The old way *
- * was a blob (#times,#vars,#nodes), but that was exceeding the
- * netcdf maximum dataset size for large models. The new way is
- * to store #vars separate datasets each of size (#times,#nodes)
- *
- * We want this routine to be capable of storing both formats
- * based on some external flag. Since the storage format of the
- * coordinates have also been changed, we key off of their
- * storage type to decide which method to use for nodal
- * variables. If the variable 'coord' is defined, then store old
- * way; otherwise store new.
- */
- dimid = define_dimension(exoid, DIM_NUM_NOD_VAR, vp->num_node, "nodal");
- if (dimid == -1) goto error_ret;
-
- if (ex_large_model(exoid) == 0) { /* Old way */
- dims[0] = time_dim;
- dims[1] = dimid;
- dims[2] = num_nod_dim;
- if ((ncvardef (exoid, VAR_NOD_VAR,
- nc_flt_code(exoid), 3, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodal variables in file id %d",
- exoid);
- ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- } else { /* Store new way */
- for (i = 1; i <= vp->num_node; i++) {
- dims[0] = time_dim;
- dims[1] = num_nod_dim;
- if ((ncvardef (exoid, VAR_NOD_VAR_NEW(i),
- nc_flt_code(exoid), 2, dims)) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
- "Error: failed to define nodal variable %d in file id %d",
- i, exoid);
- ex_err("ex_put_var_param",errmsg,exerrval);
- goto error_ret; /* exit define mode and return */
- }
- }
+ dims[2] = num_nod_dim;
+ if ((status = nc_def_var(exoid, VAR_NOD_VAR,
+ nc_flt_code(exoid), 3, dims, &varid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ } else { /* Store new way */
+ for (i = 1; i <= vp->num_node; i++) {
+ dims[0] = time_dim;
+ dims[1] = num_nod_dim;
+ if ((status = nc_def_var(exoid, VAR_NOD_VAR_NEW(i),
+ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR)
+ {
+ exerrval = status;
+ sprintf(errmsg,
+ "Error: failed to define nodal variable %d in file id %d",
+ i, exoid);
+ ex_err("ex_put_var_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
}
-
- /* Now define nodal variable name variable */
- if (define_variable_name_variable(exoid, VAR_NAME_NOD_VAR, dimid, "nodal") == -1)
- goto error_ret;
}
+ /* Now define nodal variable name variable */
+ if (define_variable_name_variable(exoid, VAR_NAME_NOD_VAR, dimid, "nodal") != NC_NOERR)
+ goto error_ret;
+ }
+
#define EX_DEFINE_VARS(TID,STNAME,TNAME,NUMVAR,DNAME,DID1,DID2,DVAL,VIDS,VNOV,VTV,VSTATVAL,VTABVAL,VTABVAR) \
- if (NUMVAR > 0) { \
- DID2 = define_dimension(exoid, DNAME, NUMVAR, STNAME); \
- if (DID2 == -1) goto error_ret; \
- \
- /* Now define STNAME variable name variable */ \
- if (define_variable_name_variable(exoid, VNOV, DID2, STNAME) == -1) \
- goto error_ret; \
- \
- if (define_truth_table(TID, exoid, DVAL, NUMVAR, VTABVAL, VSTATVAL, VIDS, TNAME) == -1) \
- goto error_ret; \
- \
- VSTATVAL = safe_free (VSTATVAL); \
- VIDS = safe_free (VIDS); \
- \
+ if (NUMVAR > 0) { \
+ status = define_dimension(exoid, DNAME, NUMVAR, STNAME, &DID2); \
+ if (status != NC_NOERR) goto error_ret; \
+ \
+ /* Now define STNAME variable name variable */ \
+ if (define_variable_name_variable(exoid, VNOV, DID2, STNAME) != NC_NOERR) \
+ goto error_ret; \
+ \
+ if (define_truth_table(TID, exoid, DVAL, NUMVAR, VTABVAL, VSTATVAL, VIDS, TNAME) != NC_NOERR) \
+ goto error_ret; \
+ \
+ VSTATVAL = safe_free (VSTATVAL); \
+ VIDS = safe_free (VIDS); \
+ \
/* create a variable array in which to store the STNAME variable truth \
- * table \
- */ \
- \
- dims[0] = DID1; \
- dims[1] = DID2; \
- \
- if ((VTABVAR = ncvardef (exoid, VTV, NC_LONG, 2, dims)) == -1) { \
- exerrval = ncerr; \
- sprintf(errmsg, \
+ * table \
+ */ \
+ \
+ dims[0] = DID1; \
+ dims[1] = DID2; \
+ \
+ if ((status = nc_def_var(exoid, VTV, NC_INT, 2, dims, &VTABVAR)) != NC_NOERR) { \
+ exerrval = status; \
+ sprintf(errmsg, \
"Error: failed to define " STNAME " variable truth table in file id %d", \
- exoid); \
- ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \
- goto error_ret; /* exit define mode and return */ \
- } \
+ exoid); \
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \
+ goto error_ret; /* exit define mode and return */ \
+ } \
}
EX_DEFINE_VARS(EX_EDGE_BLOCK, "edge", "edge block",vp->num_edge, DIM_NUM_EDG_VAR, numedblkdim,numedvardim,num_edge_blk,edblk_ids,VAR_NAME_EDG_VAR, VAR_EBLK_TAB, edblk_stat,vp->edge_var_tab,edblk_varid);
EX_DEFINE_VARS(EX_FACE_BLOCK, "face", "face block",vp->num_face, DIM_NUM_FAC_VAR, numfablkdim,numfavardim,num_face_blk,fablk_ids,VAR_NAME_FAC_VAR, VAR_FBLK_TAB, fablk_stat,vp->face_var_tab,fablk_varid);
@@ -302,9 +298,9 @@ int ex_put_all_var_param_ext ( int exoid,
/* leave define mode */
in_define = 0;
- if (ncendef (exoid) == -1)
+ if ((status = nc_enddef (exoid)) != NC_NOERR)
{
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to complete definition in file id %d",
exoid);
@@ -314,43 +310,43 @@ int ex_put_all_var_param_ext ( int exoid,
/* write out the variable truth tables */
if (vp->num_edge > 0) {
- iresult = put_truth_table(exoid, num_edge_blk, vp->num_edge, edblk_varid, vp->edge_var_tab, "edge");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, edblk_varid, vp->edge_var_tab, "edge") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_face > 0) {
- iresult = put_truth_table(exoid, num_face_blk, vp->num_face, fablk_varid, vp->face_var_tab, "face");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, fablk_varid, vp->face_var_tab, "face") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_elem > 0) {
- iresult = put_truth_table(exoid, num_elem_blk, vp->num_elem, eblk_varid, vp->elem_var_tab, "element");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, eblk_varid, vp->elem_var_tab, "element") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_nset > 0) {
- iresult = put_truth_table(exoid, num_nset, vp->num_nset, nset_varid, vp->nset_var_tab, "nodeset");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, nset_varid, vp->nset_var_tab, "nodeset") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_eset > 0) {
- iresult = put_truth_table(exoid, num_eset, vp->num_eset, eset_varid, vp->eset_var_tab, "edgeset");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, eset_varid, vp->eset_var_tab, "edgeset") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_fset > 0) {
- iresult = put_truth_table(exoid, num_fset, vp->num_fset, fset_varid, vp->fset_var_tab, "faceset");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, fset_varid, vp->fset_var_tab, "faceset") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_sset > 0) {
- iresult = put_truth_table(exoid, num_sset, vp->num_sset, sset_varid, vp->sset_var_tab, "sideset");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, sset_varid, vp->sset_var_tab, "sideset") != NC_NOERR)
+ goto error_ret;
}
if (vp->num_elset > 0) {
- iresult = put_truth_table(exoid, num_elset, vp->num_elset, elset_varid, vp->elset_var_tab, "elemset");
- if (iresult == -1) goto error_ret;
+ if (put_truth_table(exoid, elset_varid, vp->elset_var_tab, "elemset") != NC_NOERR)
+ goto error_ret;
}
return(EX_NOERR);
@@ -358,7 +354,7 @@ int ex_put_all_var_param_ext ( int exoid,
/* Fatal error: exit definition mode and return */
error_ret:
if (in_define == 1) {
- if (ncendef (exoid) == -1) /* exit define mode */
+ if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */
{
sprintf(errmsg,
"Error: failed to complete definition for file id %d",
@@ -386,64 +382,64 @@ int ex_put_all_var_param_ext ( int exoid,
return(EX_FATAL);
}
-int define_dimension(int exoid, const char *DIMENSION, int count, const char *label)
+int define_dimension(int exoid, const char *DIMENSION, int count, const char *label, int *dimid)
{
char errmsg[MAX_ERR_LENGTH];
- int dimid = 0;
- if ((dimid = ncdimdef (exoid, DIMENSION, (long)count)) == -1) {
- if (ncerr == NC_ENAMEINUSE) {
- exerrval = ncerr;
+ int status;
+ if ((status = nc_def_dim(exoid, DIMENSION, count, dimid)) != NC_NOERR) {
+ exerrval = status;
+ if (status == NC_ENAMEINUSE) {
sprintf(errmsg,
"Error: %s variable name parameters are already defined in file id %d",
label, exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
} else {
- exerrval = ncerr;
sprintf(errmsg,
"Error: failed to define number of %s variables in file id %d",
label, exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
}
}
- return dimid;
+ return status;
}
-int define_variable_name_variable(int exoid, const char *VARIABLE, long dimension, const char *label)
+int define_variable_name_variable(int exoid, const char *VARIABLE, int dimension, const char *label)
{
char errmsg[MAX_ERR_LENGTH];
int dims[2];
int variable;
+ int status;
dims[0] = dimension;
- dims[1] = ncdimid(exoid, DIM_STR); /* Checked earlier, so known to exist */
+ nc_inq_dimid(exoid, DIM_STR, &dims[1]); /* Checked earlier, so known to exist */
- if ((variable = ncvardef (exoid, VARIABLE, NC_CHAR, 2, dims)) == -1) {
- if (ncerr == NC_ENAMEINUSE) {
- exerrval = ncerr;
+ if ((status=nc_def_var(exoid, VARIABLE, NC_CHAR, 2, dims, &variable)) != NC_NOERR) {
+ if (status == NC_ENAMEINUSE) {
+ exerrval = status;
sprintf(errmsg,
"Error: %s variable names are already defined in file id %d",
label, exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
} else {
- exerrval = ncerr;
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define %s variable names in file id %d",
label, exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
}
}
- return variable;
+ return status;
}
-nclong *get_status_array(int exoid, long var_count, const char *VARIABLE, const char *label)
+int *get_status_array(int exoid, int var_count, const char *VARIABLE, const char *label)
{
char errmsg[MAX_ERR_LENGTH];
int varid;
- long start[2], count[2];
- nclong *stat_vals = NULL;
+ int status;
+ int *stat_vals = NULL;
- if (!(stat_vals = malloc(var_count*sizeof(nclong)))) {
+ if (!(stat_vals = malloc(var_count*sizeof(int)))) {
exerrval = EX_MEMFAIL;
sprintf(errmsg,
"Error: failed to allocate memory for %s status array for file id %d",
@@ -453,17 +449,12 @@ nclong *get_status_array(int exoid, long var_count, const char *VARIABLE, const
}
/* get variable id of status array */
- if ((varid = ncvarid (exoid, VARIABLE)) != -1) {
+ if ((nc_inq_varid (exoid, VARIABLE, &varid)) == NC_NOERR) {
/* if status array exists (V 2.01+), use it, otherwise assume
object exists to be backward compatible */
- start[0] = 0;
- start[1] = 0;
- count[0] = var_count;
- count[1] = 0;
-
- if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1) {
- exerrval = ncerr;
+ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) {
+ exerrval = status;
stat_vals = safe_free(stat_vals);
sprintf(errmsg,
"Error: failed to get %s status array from file id %d",
@@ -486,32 +477,15 @@ void *safe_free(void *array)
return 0;
}
-int put_truth_table(int exoid, int num_blk, int num_var, int varid, int *table, const char *label)
+int put_truth_table(int exoid, int varid, int *table, const char *label)
{
- long start[2], count[2];
int iresult = 0;
- nclong *lptr;
char errmsg[MAX_ERR_LENGTH];
- /* this contortion is necessary because netCDF is expecting nclongs; fortunately
- it's necessary only when ints and nclongs aren't the same size */
-
- start[0] = 0;
- start[1] = 0;
-
- count[0] = num_blk;
- count[1] = num_var;
+ iresult = nc_put_var_int(exoid, varid, table);
- if (sizeof(int) == sizeof(nclong)) {
- iresult = ncvarput (exoid, varid, start, count, table);
- } else {
- lptr = itol (table, (int)(num_blk*num_var));
- iresult = ncvarput (exoid, varid, start, count, lptr);
- lptr = safe_free(lptr);
- }
-
- if (iresult == -1) {
- exerrval = ncerr;
+ if (iresult != NC_NOERR) {
+ exerrval = iresult;
sprintf(errmsg,
"Error: failed to store %s variable truth table in file id %d",
label, exoid);
@@ -520,8 +494,8 @@ int put_truth_table(int exoid, int num_blk, int num_var, int varid, int *table,
return iresult;
}
-int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
- int *var_tab, int *status, int *ids, const char *label)
+int define_truth_table(ex_entity_type obj_type, int exoid, int num_ent, int num_var,
+ int *var_tab, int *status_tab, int *ids, const char *label)
{
char errmsg[MAX_ERR_LENGTH];
int k = 0;
@@ -529,8 +503,9 @@ int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
int time_dim;
int dims[2];
int varid;
+ int status;
- time_dim = ncdimid (exoid, DIM_TIME);
+ nc_inq_dimid(exoid, DIM_TIME, &time_dim);
if (var_tab == NULL) {
exerrval = EX_NULLENTITY;
@@ -545,19 +520,19 @@ int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
/* check if variables are to be put out for this block */
if (var_tab[k] != 0) {
- if (status[i] != 0) {/* only define variable if active */
+ if (status_tab[i] != 0) {/* only define variable if active */
dims[0] = time_dim;
/* Determine number of entities in entity */
/* Need way to make this more generic... */
- dims[1] = ncdimid( exoid, ex_dim_num_entries_in_object( obj_type, i+1 ) );
- if (dims[1] == -1) {
- exerrval = ncerr;
+ status = nc_inq_dimid(exoid, ex_dim_num_entries_in_object( obj_type, i+1 ), &dims[1]);
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to locate number of entities in %s %d in file id %d",
label, ids[i], exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
- return -1;
+ return status;
}
/* define netCDF variable to store variable values;
@@ -565,15 +540,16 @@ int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
* that the index of the EXODUS II variable (which is part of
* the name of the netCDF variable) will begin at 1 instead of 0
*/
- varid = ncvardef( exoid, ex_name_var_of_object( obj_type, j, i+1 ), nc_flt_code(exoid), 2, dims );
- if (varid == -1) {
- if (ncerr != NC_ENAMEINUSE) {
- exerrval = ncerr;
+ status = nc_def_var(exoid, ex_name_var_of_object( obj_type, j, i+1 ),
+ nc_flt_code(exoid), 2, dims, &varid);
+ if (status != NC_NOERR) {
+ if (status != NC_ENAMEINUSE) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to define %s variable for %s %d in file id %d",
label, label, ids[i], exoid);
ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
- return -1;
+ return status;
}
}
}
@@ -581,5 +557,5 @@ int define_truth_table(int obj_type, int exoid, int num_ent, int num_var,
k++; /* increment truth table pointer */
} /* for j */
} /* for i */
- return 0;
+ return NC_NOERR;
}
diff --git a/cbind/src/expvpc.c b/cbind/src/expvpc.c
index 0d63386..f6812e5 100644
--- a/cbind/src/expvpc.c
+++ b/cbind/src/expvpc.c
@@ -36,22 +36,19 @@
*
* expvp - ex_put_concat_var_param
*
-* author - Sandia National Laboratories
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
* int num_g global variable count
* int num_n nodal variable count
* int num_e element variable count
-* int num_elem_blk number of element blocks
+* int num_elem_blk number of element blocks (unused)
* int* elem_var_tab element variable truth table array
*
* exit conditions -
*
* revision history -
*
-* $Id: expvpc.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*****************************************************************************/
#include <stdlib.h>
@@ -62,13 +59,20 @@
/*!
* writes the number of global, nodal, and element variables
* that will be written to the database
+ * \param exoid int exodus file id
+ * \param num_g int global variable count
+ * \param num_n int nodal variable count
+ * \param num_e int element variable count
+ * \param num_elem_blk int number of element blocks
+ * \param elem_var_tab int* element variable truth table array
+ * \deprecated Use ex_put_all_var_param()(exoid, num_g, num_n, num_e, elem_var_tab, 0, 0, 0, 0)
*/
int ex_put_concat_var_param (int exoid,
int num_g,
int num_n,
int num_e,
- int num_elem_blk,
+ int num_elem_blk, /* unused */
int *elem_var_tab)
{
return ex_put_all_var_param(exoid, num_g, num_n, num_e, elem_var_tab, 0, 0, 0, 0);
diff --git a/cbind/src/expvtt.c b/cbind/src/expvtt.c
index 623d349..a02fe42 100644
--- a/cbind/src/expvtt.c
+++ b/cbind/src/expvtt.c
@@ -49,7 +49,6 @@
*
* revision history -
*
-* $Id: expvtt.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -66,6 +65,11 @@
* of define mode (causing the entire file to be copied over and over)
* which is what occurs when the element variable values variables are
* defined in ex_put_elem_var
+ * \param exoid int exodus file id
+ * \param num_elem_blk int number of element blocks
+ * \param num_elem_var int number of element variables
+ * \param elem_var_tab int* element variable truth table array
+ * \deprecated Use ex_put_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab)
*/
int ex_put_elem_var_tab (int exoid,
@@ -73,5 +77,5 @@ int ex_put_elem_var_tab (int exoid,
int num_elem_var,
int *elem_var_tab)
{
- return ex_put_var_tab(exoid, "E", num_elem_blk, num_elem_var, elem_var_tab);
+ return ex_put_truth_table(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab);
}
diff --git a/cbind/src/expvv.c b/cbind/src/expvv.c
index c831bfb..52f69f6 100644
--- a/cbind/src/expvv.c
+++ b/cbind/src/expvv.c
@@ -48,7 +48,6 @@
*
* revision history -
*
-* $Id: expvv.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -74,7 +73,8 @@ int ex_put_varid_var(int exoid,
int num_entity,
const void *var_vals)
{
- long start[3], count[3];
+ size_t start[2], count[2];
+ int status;
char errmsg[MAX_ERR_LENGTH];
exerrval = 0; /* clear error code */
@@ -85,9 +85,14 @@ int ex_put_varid_var(int exoid,
count[0] = 1;
count[1] = num_entity;
- if (ncvarput (exoid, varid, start, count,
- ex_conv_array(exoid,WRITE_CONVERT,var_vals,num_entity)) == -1) {
- exerrval = ncerr;
+ if (ex_comp_ws(exoid) == 4) {
+ status = nc_put_vara_float(exoid, varid, start, count, var_vals);
+ } else {
+ status = nc_put_vara_double(exoid, varid, start, count, var_vals);
+ }
+
+ if (status != NC_NOERR) {
+ exerrval = status;
sprintf(errmsg,
"Error: failed to store variables with varid %d in file id %d",
varid, exoid);
diff --git a/cbind/src/exupda.c b/cbind/src/exupda.c
index a5dca97..9130994 100644
--- a/cbind/src/exupda.c
+++ b/cbind/src/exupda.c
@@ -36,23 +36,12 @@
*
* exupda - ex_update
*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* James A. Schutt - 8 byte float and standard C definitions
-* Vic Yarberry - Added headers and error logging
-*
-*
-* environment - UNIX
-*
* entry conditions -
* input parameters:
* int exoid exodus file id
*
* exit conditions -
*
-* revision history -
-*
-* $Id: exupda.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
*
*****************************************************************************/
@@ -61,24 +50,23 @@
/*!
* updates an opened EXODUS II file (or EXODUS II history file)
+ * \param exoid exodus file id
*/
int ex_update (int exoid)
{
- char errmsg[MAX_ERR_LENGTH];
+ char errmsg[MAX_ERR_LENGTH];
+ int status;
- exerrval = 0; /* clear error code */
+ exerrval = 0; /* clear error code */
- if (ncsync(exoid) == -1)
- {
- exerrval = ncerr;
- sprintf(errmsg,
+ if ((status = nc_sync(exoid)) != NC_NOERR) {
+ exerrval = status;
+ sprintf(errmsg,
"Error: failed to update file id %d",
- exoid);
- ex_err("ex_update",errmsg,exerrval);
- return (EX_FATAL);
- }
-
- return(EX_NOERR);
-
+ exoid);
+ ex_err("ex_update",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return(EX_NOERR);
}
diff --git a/cbind/test/CMakeLists.txt b/cbind/test/CMakeLists.txt
index 03ec8fd..36813a4 100644
--- a/cbind/test/CMakeLists.txt
+++ b/cbind/test/CMakeLists.txt
@@ -1,3 +1,5 @@
+ADD_DEFINITIONS(-DUSING_CMAKE)
+
SET( cbind_TEST_SRCS
CreateEdgeFace.c
ReadEdgeFace.c
@@ -15,7 +17,7 @@ CREATE_TEST_SOURCELIST( ExoIICTests
)
ADD_EXECUTABLE( ExoIICTests ${ExoIICTests} )
-TARGET_LINK_LIBRARIES( ExoIICTests exoIIc )
+TARGET_LINK_LIBRARIES( ExoIICTests exoIIv2c )
SET( TestsToRun ${ExoIICTests} )
REMOVE( TestsToRun ExoIICTests.cxx )
@@ -53,6 +55,12 @@ SET( cbind_OLDTESTS
testwt-zeron
testrdv
testwt-one-attrib
+ testwt-partial
+ testrd-partial
+ testrd-nsided
+ testwt-nsided
+ testrd-nfaced
+ testwt-nfaced
create_mesh
rd_wt_mesh
)
@@ -65,7 +73,7 @@ CONFIGURE_FILE(
FOREACH ( testName ${cbind_OLDTESTS} )
ADD_EXECUTABLE( ${testName} ${testName}.c )
- TARGET_LINK_LIBRARIES( ${testName} exoIIc )
+ TARGET_LINK_LIBRARIES( ${testName} exoIIv2c )
ENDFOREACH ( testName )
#SET( EXECUTABLE_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} )
diff --git a/cbind/test/CVS/Entries b/cbind/test/CVS/Entries
index de4f277..7aeaa76 100644
--- a/cbind/test/CVS/Entries
+++ b/cbind/test/CVS/Entries
@@ -1,59 +1,70 @@
-/CMakeLists.txt/1.2/Tue Nov 28 14:02:07 2006//
-/CreateEdgeFace.c/1.2/Tue Nov 28 14:02:07 2006//
-/Imakefile/1.4/Tue Nov 28 14:02:07 2006//
-/Makefile.standalone/1.3/Sun Nov 26 05:37:22 2006//
-/ReadEdgeFace.c/1.2/Tue Nov 28 14:02:07 2006//
-/create_mesh.c/1.3/Tue Nov 28 14:02:07 2006//
+/CMakeLists.txt/1.7/Wed Feb 24 13:48:30 2010//
+/CreateEdgeFace.c/1.7/Tue Jul 20 21:36:59 2010//
+/Imakefile/1.10/Tue Jul 20 21:36:59 2010//
+/Makefile.standalone/1.5/Tue Jul 20 21:36:59 2010//
+/ReadEdgeFace.c/1.5/Mon Mar 3 03:46:07 2008//
+/create_mesh.c/1.9/Wed Jul 15 19:17:38 2009//
/makedmp/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/rd_wt_mesh.c/1.3/Tue Nov 28 14:02:07 2006//
-/test.dmp/1.4/Tue Nov 28 14:02:07 2006//
+/rd_wt_mesh.c/1.11/Tue Jul 20 21:36:59 2010//
+/test.dmp/1.11/Wed Feb 24 13:48:30 2010//
/test.exo_c/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/test1.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/test2-1.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/test2-2.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/test2.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/test_clb.dmp/1.3/Tue Nov 28 14:02:07 2006//
-/testall/1.4/Tue Nov 28 14:02:07 2006//
-/testall.in/1.1/Sun Nov 26 05:37:22 2006//
-/testcp.c/1.2/Sun Nov 26 05:37:22 2006//
-/testcp_dd.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/testcp_ds.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/testcp_ln.c/1.1/Sun Nov 26 05:37:22 2006//
-/testcp_nl.c/1.1/Sun Nov 26 05:37:22 2006//
-/testcp_nl.dmp/1.2/Tue Nov 28 14:02:07 2006//
-/testcp_sd.dmp/1.4/Tue Nov 28 14:02:07 2006//
-/testcp_ss.dmp/1.4/Tue Nov 28 14:02:10 2006//
-/testcpd.c/1.2/Sun Nov 26 05:37:22 2006//
-/testd.dmp/1.4/Tue Nov 28 14:02:13 2006//
-/testrd.c/1.4/Tue Nov 28 14:02:16 2006//
-/testrd.dmp/1.4/Tue Nov 28 14:02:16 2006//
-/testrd1.c/1.4/Tue Nov 28 14:02:16 2006//
-/testrd1.dmp/1.4/Tue Nov 28 14:02:16 2006//
-/testrd_nc.c/1.4/Tue Nov 28 14:02:16 2006//
-/testrd_nc.dmp/1.3/Tue Nov 28 14:02:16 2006//
-/testrd_ss.c/1.3/Sun Nov 26 05:37:23 2006//
-/testrd_ss.dmp/1.4/Tue Nov 28 14:02:16 2006//
-/testrd_zeroe.dmp/1.4/Tue Nov 28 14:02:16 2006//
-/testrd_zeron.dmp/1.4/Tue Nov 28 14:02:16 2006//
-/testrdd.c/1.4/Tue Nov 28 14:02:16 2006//
-/testrdd.dmp/1.2/Wed Apr 12 17:43:51 2006//
-/testrdv.c/1.4/Tue Nov 28 14:02:17 2006//
-/testrdv.dmp/1.4/Tue Nov 28 14:02:17 2006//
-/testrdwt.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt-one-attrib.c/1.2/Sun Nov 26 05:37:23 2006//
-/testwt-zeroe.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt-zeroe.dmp/1.4/Tue Nov 28 14:02:17 2006//
-/testwt-zeron.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt-zeron.dmp/1.4/Tue Nov 28 14:02:17 2006//
-/testwt.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt1.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt2.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt_clb.c/1.4/Tue Nov 28 14:02:17 2006//
-/testwt_nc.c/1.4/Tue Nov 28 14:02:18 2006//
-/testwt_nossnsdf.c/1.4/Tue Nov 28 14:02:18 2006//
+/test1.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test2-1.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test2-2.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test2.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test_clb.dmp/1.10/Wed Feb 24 13:48:30 2010//
+/testall/1.15/Wed Feb 24 13:48:30 2010//
+/testall.in/1.8/Tue Jul 20 21:36:59 2010//
+/testcp.c/1.3/Tue Jul 20 21:36:59 2010//
+/testcp_dd.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testcp_ds.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testcp_ln.c/1.2/Tue Jul 20 21:36:59 2010//
+/testcp_ln.dmp/1.5/Wed Feb 24 13:48:30 2010//
+/testcp_nl.c/1.3/Tue Jul 20 21:36:59 2010//
+/testcp_nl.dmp/1.9/Wed Feb 24 13:48:30 2010//
+/testcp_sd.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testcp_ss.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testcpd.c/1.3/Tue Jul 20 21:36:59 2010//
+/testd.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testrd-nfaced.c/1.2/Tue Jul 20 21:36:59 2010//
+/testrd-nfaced.dmp/1.1/Wed Feb 24 13:48:30 2010//
+/testrd-nsided.c/1.2/Tue Jul 20 21:36:59 2010//
+/testrd-nsided.dmp/1.1/Sat Jan 23 01:15:17 2010//
+/testrd-partial.c/1.4/Tue Jul 20 21:36:59 2010//
+/testrd.c/1.11/Tue Jul 20 21:36:59 2010//
+/testrd.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrd1.c/1.11/Tue Jul 20 21:36:59 2010//
+/testrd1.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrd_nc.c/1.11/Tue Jul 20 21:36:59 2010//
+/testrd_nc.dmp/1.9/Thu Feb 26 20:01:43 2009//
+/testrd_ss.c/1.4/Tue Jul 20 21:36:59 2010//
+/testrd_ss.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrd_zeroe.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrd_zeron.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrdd.c/1.11/Tue Jul 20 21:36:59 2010//
+/testrdd.dmp/1.8/Thu Feb 26 20:01:43 2009//
+/testrdv.c/1.11/Tue Jul 20 21:36:59 2010//
+/testrdv.dmp/1.10/Thu Feb 26 20:01:43 2009//
+/testrdwt.c/1.5/Tue Jul 20 21:36:59 2010//
+/testwt-nfaced.c/1.2/Tue Jul 20 21:36:59 2010//
+/testwt-nfaced.dmp/1.1/Wed Feb 24 13:48:30 2010//
+/testwt-nsided.c/1.2/Tue Jul 20 21:36:59 2010//
+/testwt-nsided.dmp/1.1/Sat Jan 23 01:15:17 2010//
+/testwt-one-attrib.c/1.4/Wed Feb 24 13:48:30 2010//
+/testwt-partial.c/1.3/Wed Jul 15 19:17:38 2009//
+/testwt-zeroe.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt-zeroe.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testwt-zeron.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt-zeron.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testwt.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt1.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt2.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt_clb.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt_nc.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwt_nossnsdf.c/1.10/Wed Jul 15 19:17:38 2009//
/testwt_ss.c/1.2/Sun Nov 26 05:37:23 2006//
-/testwt_ss.dmp/1.4/Tue Nov 28 14:02:18 2006//
-/testwtbig.c/1.4/Tue Nov 28 14:02:18 2006//
-/testwtd.c/1.4/Tue Nov 28 14:02:19 2006//
-/testwtm.c/1.4/Tue Nov 28 14:02:19 2006//
+/testwt_ss.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testwtbig.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwtd.c/1.10/Wed Jul 15 19:17:38 2009//
+/testwtm.c/1.10/Wed Jul 15 19:17:38 2009//
D
diff --git a/cbind/test/CreateEdgeFace.c b/cbind/test/CreateEdgeFace.c
index 3ed2255..f80be73 100644
--- a/cbind/test/CreateEdgeFace.c
+++ b/cbind/test/CreateEdgeFace.c
@@ -1,6 +1,7 @@
#include "exodusII.h"
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#define EX_TEST_FILENAME "edgeFace.exo"
@@ -23,13 +24,15 @@ double coordsZ[] = {
-3., -3., 3., 3.
};
-char* coordsNames[] = { "X", "Y", "Z" };
+const char* coordsNames[] = { "X", "Y", "Z" };
int conn1[] = {
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 1, 2, 3, 4
};
+int conn2[] = { 1, 2, 3, 5 };
+
int econn1[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 1, 2, 3, 4, 17, 18, 19, 20
@@ -99,18 +102,21 @@ int emap1[] = {
1, 2
};
-char* eblk_names[] = { "Eli WALLACH" };
-char* edblk_names[] = { "Aldo GIUFFRE" };
-char* fablk_names[] = {
+const char* eblk_names[] = {
+ "Eli WALLACH",
+ "Angelo NOVI"
+};
+const char* edblk_names[] = { "Aldo GIUFFRE" };
+const char* fablk_names[] = {
"Livio LORENZON",
"Claudio SCARCHILLI",
"John BARTHA"
};
-char* nmap_names[] = { "Luigi PISTILLI" };
-char* edmap_names[] = { "Antonio CASALE" };
-char* famap_names[] = { "Sandro SCARCHILLI" };
-char* emap_names[] = { "Benito STEFANELLI" };
+const char* nmap_names[] = { "Luigi PISTILLI" };
+const char* edmap_names[] = { "Antonio CASALE" };
+const char* famap_names[] = { "Sandro SCARCHILLI" };
+const char* emap_names[] = { "Benito STEFANELLI" };
/* ======== Sets ========= */
int nset_nodes[] = {
@@ -150,24 +156,24 @@ int elset_elems[] = {
2
};
-char* elset_names[] = {
+const char* elset_names[] = {
"Clint EASTWOOD",
"Lee VAN CLEEF"
};
-char* nset_names[] = { "Ennio MORRICONE" };
-char* eset_names[] = { "Rada RASSIMOV" };
-char* fset_names[] = { "Enzo PETITO" };
-char* sset_names[] = { "Luciano VINCENZONI" };
+const char* nset_names[] = { "Ennio MORRICONE" };
+const char* eset_names[] = { "Rada RASSIMOV" };
+const char* fset_names[] = { "Enzo PETITO" };
+const char* sset_names[] = { "Luciano VINCENZONI" };
/* ======== Attributes ========= */
-char* edge_attr_names1[] = {"Sergio LEONE"};
+const char* edge_attr_names1[] = {"Sergio LEONE"};
-char* face_attr_names1[] = {"GOOD"};
-char* face_attr_names2[] = {"BAD"};
-char* face_attr_names3[] = {"UGLY"};
+const char* face_attr_names1[] = {"GOOD"};
+const char* face_attr_names2[] = {"BAD"};
+const char* face_attr_names3[] = {"UGLY"};
-char* elem_attr_names1[] = {
+const char* elem_attr_names1[] = {
"SPAGHETTI",
"WESTERN"
};
@@ -273,7 +279,7 @@ int cCreateEdgeFace( int argc, char* argv[] )
11, /* num_face */
3, /* num_face_blk */
2, /* num_elem */
- 1, /* num_elem_blk */
+ 2, /* num_elem_blk */
1, /* num_node_sets */
1, /* num_edge_sets */
1, /* num_face_sets */
@@ -285,110 +291,170 @@ int cCreateEdgeFace( int argc, char* argv[] )
1, /* num_elem_map */
};
- ex_block_params blockParams = {
- (int[]){ 100 }, /* edge_blk_id */
- (char*[]){ "STRAIGHT2" }, /* edge_type */
- (int[]){ 20 }, /* num_edge_this_blk */
- (int[]){ 2 }, /* num_nodes_per_edge */
- (int[]){ 1 }, /* num_attr_edge */
- (int[]){ 500, 600, 700 }, /* face_blk_id */
- (char*[]){ "QUAD4", "QUAD4", "QUAD4" }, /* face_type */
- (int[]){ 2, 1, 8 }, /* num_face_this_blk */
- (int[]){ 4, 4, 4 }, /* num_nodes_per_face */
- (int[]){ 1, 1, 1 }, /* num_attr_face */
- (int[]){ 200 }, /* elem_blk_id */
- (char*[]){ "HEX8" }, /* elem_type */
- (int[]){ 2 }, /* num_elem_this_blk */
- (int[]){ 8 }, /* num_nodes_per_elem */
- (int[]){ 12 }, /* num_edges_per_elem */
- (int[]){ 6 }, /* num_faces_per_elem */
- (int[]){ 2 }, /* num_attr_elem */
- 0 /* define_maps */
- };
-
- ex_var_params varParams = {
- (int) 2, /* num_glob */
- (int) 1, /* num_node */
- (int) 2, /* num_edge */
- (int[]) { 1, 1 }, /* edge_var_tab */
- (int) 1, /* num_face */
- (int[]) { 1, 0, 1 }, /* face_var_tab */
- (int) 1, /* num_elem */
- (int[]) { 1 }, /* elem_var_tab */
- (int) 0, /* num_nset */
- (int[]) {}, /* nset_var_tab */
- (int) 0, /* num_eset */
- (int[]) {}, /* eset_var_tab */
- (int) 1, /* num_fset */
- (int[]) { 1 }, /* fset_var_tab */
- (int) 0, /* num_sset */
- (int[]) {}, /* sset_var_tab */
- (int) 0, /* num_elset */
- (int[]) {} /* elset_var_tab */
- };
+ ex_block_params blockParams;
+ ex_var_params varParams;
+
+ blockParams.edge_blk_id = (int*)malloc(1 * sizeof(int));
+ blockParams.num_edge_this_blk = (int*)malloc(1 * sizeof(int));
+ blockParams.num_nodes_per_edge = (int*)malloc(1 * sizeof(int));
+ blockParams.num_attr_edge = (int*)malloc(1 * sizeof(int));
+ blockParams.face_blk_id = (int*)malloc(3 * sizeof(int));
+ blockParams.num_face_this_blk = (int*)malloc(3 * sizeof(int));
+ blockParams.num_nodes_per_face = (int*)malloc(3 * sizeof(int));
+ blockParams.num_attr_face = (int*)malloc(3 * sizeof(int));
+ blockParams.elem_blk_id = (int*)malloc(2 * sizeof(int));
+ blockParams.num_elem_this_blk = (int*)malloc(2 * sizeof(int));
+ blockParams.num_nodes_per_elem = (int*)malloc(2 * sizeof(int));
+ blockParams.num_edges_per_elem = (int*)malloc(2 * sizeof(int));
+ blockParams.num_faces_per_elem = (int*)malloc(2 * sizeof(int));
+ blockParams.num_attr_elem = (int*)malloc(2 * sizeof(int));
+
+ blockParams.edge_type = (char**)malloc(1 * sizeof(char*));
+ blockParams.edge_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+ blockParams.face_type = (char**)malloc(3 * sizeof(char*));
+ blockParams.face_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+ blockParams.face_type[1] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+ blockParams.face_type[2] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+ blockParams.elem_type = (char**)malloc(2 * sizeof(char*));
+ blockParams.elem_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+ blockParams.elem_type[1] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char));
+
+ blockParams.edge_blk_id[0] = 100;
+ blockParams.num_edge_this_blk[0] = 20;
+ blockParams.num_nodes_per_edge[0] = 2;
+ blockParams.num_attr_edge[0] = 1;
+
+ blockParams.face_blk_id[0] = 500;
+ blockParams.face_blk_id[1] = 600;
+ blockParams.face_blk_id[2] = 700;
+ blockParams.num_face_this_blk[0] = 2;
+ blockParams.num_face_this_blk[1] = 1;
+ blockParams.num_face_this_blk[2] = 8;
+ blockParams.num_nodes_per_face[0] = 4;
+ blockParams.num_nodes_per_face[1] = 4;
+ blockParams.num_nodes_per_face[2] = 4;
+ blockParams.num_attr_face[0] = 1;
+ blockParams.num_attr_face[1] = 1;
+ blockParams.num_attr_face[2] = 1;
+
+ blockParams.elem_blk_id[0] = 200;
+ blockParams.elem_blk_id[1] = 201;
+ blockParams.num_elem_this_blk[0] = 2;
+ blockParams.num_elem_this_blk[1] = 1;
+ blockParams.num_nodes_per_elem[0] = 8;
+ blockParams.num_nodes_per_elem[1] = 4;
+ blockParams.num_edges_per_elem[0] = 12;
+ blockParams.num_edges_per_elem[1] = 0;
+ blockParams.num_faces_per_elem[0] = 6;
+ blockParams.num_faces_per_elem[1] = 0;
+ blockParams.num_attr_elem[0] = 2;
+ blockParams.num_attr_elem[1] = 0;
+
+ blockParams.define_maps = 0;
+
+ strcpy(blockParams.edge_type[0], "STRAIGHT2");
+
+ strcpy(blockParams.face_type[0], "QUAD4");
+ strcpy(blockParams.face_type[1], "QUAD4");
+ strcpy(blockParams.face_type[2], "QUAD4");
+
+ strcpy(blockParams.elem_type[0], "HEX8");
+ strcpy(blockParams.elem_type[1], "TET4");
+
+ varParams.edge_var_tab = (int*)malloc(2 * sizeof(int));
+ varParams.face_var_tab = (int*)malloc(3 * sizeof(int));
+ varParams.elem_var_tab = (int*)malloc(2 * sizeof(int));
+ varParams.nset_var_tab = (int*)0;
+ varParams.eset_var_tab = (int*)0;
+ varParams.fset_var_tab = (int*)malloc(1 * sizeof(int));
+ varParams.sset_var_tab = (int*)0;
+ varParams.elset_var_tab = (int*)0;
+
+ varParams.num_glob = 2;
+ varParams.num_node = 1;
+ varParams.num_edge = 2;
+ varParams.edge_var_tab[0] = 1;
+ varParams.edge_var_tab[1] = 1;
+ varParams.num_face = 1;
+ varParams.face_var_tab[0] = 1;
+ varParams.face_var_tab[1] = 1;
+ varParams.face_var_tab[2] = 1;
+ varParams.num_elem = 1;
+ varParams.elem_var_tab[0] = 1;
+ varParams.elem_var_tab[1] = 0;
+ varParams.num_nset = 0;
+ varParams.num_eset = 0;;
+ varParams.num_fset = 1;
+ varParams.fset_var_tab[0] = 1;
+ varParams.num_sset = 0;
+ varParams.num_elset = 0;
exoid = ex_create( EX_TEST_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize );
if ( exoid <= 0 )
{
- fprintf( stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FILENAME );
- return 1;
+ fprintf( stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FILENAME );
+ return 1;
}
/* *** NEW API *** */
EXCHECK( ex_put_init_ext( exoid, &modelParams ),
- "Unable to initialize database.\n" );
+ "Unable to initialize database.\n" );
/* *** NEW API *** */
if ( concatBlocks ) {
EXCHECK( ex_put_concat_all_blocks( exoid, &blockParams ),
- "Unable to initialize block params.\n" );
+ "Unable to initialize block params.\n" );
} else {
int blk;
for ( blk = 0; blk < modelParams.num_edge_blk; ++blk ) {
EXCHECK( ex_put_block( exoid, EX_EDGE_BLOCK, blockParams.edge_blk_id[blk], blockParams.edge_type[blk],
- blockParams.num_edge_this_blk[blk], blockParams.num_nodes_per_edge[blk], 0, 0,
- blockParams.num_attr_edge[blk] ), "Unable to write edge block" );
+ blockParams.num_edge_this_blk[blk], blockParams.num_nodes_per_edge[blk], 0, 0,
+ blockParams.num_attr_edge[blk] ), "Unable to write edge block" );
}
for ( blk = 0; blk < modelParams.num_face_blk; ++blk ) {
EXCHECK( ex_put_block( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[blk], blockParams.face_type[blk],
- blockParams.num_face_this_blk[blk], blockParams.num_nodes_per_face[blk], 0, 0,
- blockParams.num_attr_face[blk] ), "Unable to write face block" );
+ blockParams.num_face_this_blk[blk], blockParams.num_nodes_per_face[blk], 0, 0,
+ blockParams.num_attr_face[blk] ), "Unable to write face block" );
}
for ( blk = 0; blk < modelParams.num_elem_blk; ++blk ) {
EXCHECK( ex_put_block( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[blk], blockParams.elem_type[blk],
- blockParams.num_elem_this_blk[blk], blockParams.num_nodes_per_elem[blk],
- blockParams.num_edges_per_elem[blk], blockParams.num_faces_per_elem[blk],
- blockParams.num_attr_elem[blk] ), "Unable to write elem block" );
+ blockParams.num_elem_this_blk[blk], blockParams.num_nodes_per_elem[blk],
+ blockParams.num_edges_per_elem[blk], blockParams.num_faces_per_elem[blk],
+ blockParams.num_attr_elem[blk] ), "Unable to write elem block" );
}
}
EXCHECK( ex_put_coord( exoid, (void*)coordsX, (void*)coordsY, (void*)coordsZ ),
- "Unable to write coordinates.\n" );
+ "Unable to write coordinates.\n" );
- EXCHECK( ex_put_coord_names( exoid, coordsNames ),
- "Unable to write coordinate names.\n" );
+ EXCHECK( ex_put_coord_names( exoid, (char**)coordsNames ),
+ "Unable to write coordinate names.\n" );
/* =============== Connectivity ================== */
/* *** NEW API *** */
EXCHECK( ex_put_conn( exoid, EX_EDGE_BLOCK, blockParams.edge_blk_id[0], ebconn1, 0, 0 ),
- "Unable to write edge block connectivity.\n" );
+ "Unable to write edge block connectivity.\n" );
/* *** NEW API *** */
EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[0], fbconn1, 0, 0 ),
- "Unable to write face block 1 connectivity.\n" );
+ "Unable to write face block 1 connectivity.\n" );
EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[1], fbconn2, 0, 0 ),
- "Unable to write face block 2 connectivity.\n" );
+ "Unable to write face block 2 connectivity.\n" );
EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[2], fbconn3, 0, 0 ),
- "Unable to write face block 3 connectivity.\n" );
+ "Unable to write face block 3 connectivity.\n" );
/* *** NEW API *** */
EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[0], conn1, econn1, fconn1 ),
- "Unable to write elem block 1 connectivity.\n" );
+ "Unable to write elem block 1 connectivity.\n" );
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[1], conn2, 0, 0 ),
+ "Unable to write elem block 2 connectivity.\n" );
/* *** NEW API *** */
- EXCHECK( ex_put_names( exoid, EX_EDGE_BLOCK, edblk_names ), "Unable to write edge block names.\n" );
- EXCHECK( ex_put_names( exoid, EX_FACE_BLOCK, fablk_names ), "Unable to write face block names.\n" );
- EXCHECK( ex_put_names( exoid, EX_ELEM_BLOCK, eblk_names ), "Unable to write element block names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_EDGE_BLOCK, (char**)edblk_names ), "Unable to write edge block names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_FACE_BLOCK, (char**)fablk_names ), "Unable to write face block names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_ELEM_BLOCK, (char**) eblk_names ), "Unable to write element block names.\n" );
/* =============== Number Maps ================== */
/* *** NEW API *** */
@@ -398,114 +464,134 @@ int cCreateEdgeFace( int argc, char* argv[] )
EXCHECK( ex_put_num_map( exoid, EX_ELEM_MAP, 400, emap1 ), "Unable to write element map.\n" );
/* *** NEW API *** */
- EXCHECK( ex_put_names( exoid, EX_NODE_MAP, nmap_names ), "Unable to write node map names.\n" );
- EXCHECK( ex_put_names( exoid, EX_EDGE_MAP, edmap_names ), "Unable to write edge map names.\n" );
- EXCHECK( ex_put_names( exoid, EX_FACE_MAP, famap_names ), "Unable to write face map names.\n" );
- EXCHECK( ex_put_names( exoid, EX_ELEM_MAP, emap_names ), "Unable to write element map names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_NODE_MAP, (char**) nmap_names ), "Unable to write node map names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_EDGE_MAP, (char**)edmap_names ), "Unable to write edge map names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_FACE_MAP, (char**)famap_names ), "Unable to write face map names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_ELEM_MAP, (char**) emap_names ), "Unable to write element map names.\n" );
/* =============== Attribute names ================ */
/* *** NEW API *** */
- EXCHECK( ex_put_attr_names( exoid, EX_EDGE_BLOCK, blockParams.edge_blk_id[0], edge_attr_names1 ),
- "Unable to write edge block 1 attribute names.\n" );
+ EXCHECK( ex_put_attr_names( exoid, EX_EDGE_BLOCK, blockParams.edge_blk_id[0], (char**)edge_attr_names1 ),
+ "Unable to write edge block 1 attribute names.\n" );
/* *** NEW API *** */
- EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[0], face_attr_names1 ),
- "Unable to write face block 1 attribute names.\n" );
- EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[1], face_attr_names2 ),
- "Unable to write face block 1 attribute names.\n" );
- EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[2], face_attr_names3 ),
- "Unable to write face block 1 attribute names.\n" );
+ EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[0], (char**)face_attr_names1 ),
+ "Unable to write face block 1 attribute names.\n" );
+ EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[1], (char**)face_attr_names2 ),
+ "Unable to write face block 1 attribute names.\n" );
+ EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[2], (char**)face_attr_names3 ),
+ "Unable to write face block 1 attribute names.\n" );
/* *** NEW API *** */
- EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[0], elem_attr_names1 ),
- "Unable to write elem block 1 attribute names.\n" );
+ EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[0], (char**)elem_attr_names1 ),
+ "Unable to write elem block 1 attribute names.\n" );
/* =============== Attribute values =============== */
/* *** NEW API *** */
EXCHECK( ex_put_attr( exoid, EX_EDGE_BLOCK, blockParams.edge_blk_id[0], edge_attr_values1 ),
- "Unable to write edge block 1 attribute values.\n" );
+ "Unable to write edge block 1 attribute values.\n" );
/* *** NEW API *** */
EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[0], face_attr_values1 ),
- "Unable to write face block 1 attribute values.\n" );
+ "Unable to write face block 1 attribute values.\n" );
EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[1], face_attr_values2 ),
- "Unable to write face block 1 attribute values.\n" );
+ "Unable to write face block 1 attribute values.\n" );
EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[2], face_attr_values3 ),
- "Unable to write face block 1 attribute values.\n" );
+ "Unable to write face block 1 attribute values.\n" );
/* *** NEW API *** */
EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, blockParams.elem_blk_id[0], elem_attr_values1 ),
- "Unable to write elem block 1 attribute values.\n" );
+ "Unable to write elem block 1 attribute values.\n" );
/* =============== Set parameters ================= */
- // *** NEW API ***
- EXCHECK( ex_put_names( exoid, EX_NODE_SET, nset_names ), "Unable to write node set names.\n" );
- EXCHECK( ex_put_names( exoid, EX_EDGE_SET, eset_names ), "Unable to write edge set names.\n" );
- EXCHECK( ex_put_names( exoid, EX_FACE_SET, fset_names ), "Unable to write face set names.\n" );
- EXCHECK( ex_put_names( exoid, EX_SIDE_SET, sset_names ), "Unable to write side set names.\n" );
- EXCHECK( ex_put_names( exoid, EX_ELEM_SET, elset_names ), "Unable to write element set names.\n" );
+ /* *** NEW API *** */
+ EXCHECK( ex_put_names( exoid, EX_NODE_SET, (char**)nset_names ), "Unable to write node set names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_EDGE_SET, (char**)eset_names ), "Unable to write edge set names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_FACE_SET, (char**)fset_names ), "Unable to write face set names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_SIDE_SET, (char**)sset_names ), "Unable to write side set names.\n" );
+ EXCHECK( ex_put_names( exoid, EX_ELEM_SET, (char**)elset_names ), "Unable to write element set names.\n" );
if ( concatSets ) {
ex_set_specs setParams;
- setParams = (ex_set_specs) {
- (int[]) {1000},
- (int[]) {3},
- (int[]) {0},
- (int[]) {0},
- (int[]) {0},
- (int*) nset_nodes,
- (int*) 0,
- (void*) 0
- };
+ setParams.sets_ids = (int*)malloc(2*sizeof(int));
+ setParams.num_entries_per_set = (int*)malloc(2*sizeof(int));
+ setParams.num_dist_per_set = (int*)malloc(2*sizeof(int));
+ setParams.sets_entry_index = (int*)malloc(2*sizeof(int));
+ setParams.sets_dist_index = (int*)malloc(2*sizeof(int));
+ setParams.sets_entry_list = (int*)malloc(6*sizeof(int));
+ setParams.sets_extra_list = (int*)malloc(6*sizeof(int));
+ setParams.sets_dist_fact = (double*)malloc(6*sizeof(double));
+
+ setParams.sets_ids[0] = 1000;
+ setParams.num_entries_per_set[0] = 3;
+ setParams.num_dist_per_set[0] = 0;
+ setParams.sets_entry_index[0] = 0;
+ setParams.sets_dist_index[0] = 0;
+ setParams.sets_entry_list[0] = nset_nodes[0];
+ setParams.sets_entry_list[1] = nset_nodes[1];
+ setParams.sets_entry_list[2] = nset_nodes[2];
+
EXCHECK( ex_put_concat_sets( exoid, EX_NODE_SET, &setParams ), "Unable to write node sets.\n" );
- setParams = (ex_set_specs) {
- (int[]) {1200},
- (int[]) {6},
- (int[]) {6},
- (int[]) {0},
- (int[]) {0},
- (int*) eset_edges,
- (int*) eset_orient,
- (void*) eset_df
- };
+ setParams.sets_ids[0] = 1200;
+ setParams.num_entries_per_set[0] = 6;
+ setParams.num_dist_per_set[0] = 6;
+ setParams.sets_entry_index[0] = 0;
+ setParams.sets_dist_index[0] = 0;
+ setParams.sets_entry_list[0] = eset_edges[0];
+ setParams.sets_entry_list[1] = eset_edges[1];
+ setParams.sets_entry_list[2] = eset_edges[2];
+ setParams.sets_entry_list[3] = eset_edges[3];
+ setParams.sets_entry_list[4] = eset_edges[4];
+ setParams.sets_entry_list[5] = eset_edges[5];
+
+ setParams.sets_extra_list[0] = eset_orient[0];
+ setParams.sets_extra_list[1] = eset_orient[1];
+ setParams.sets_extra_list[2] = eset_orient[2];
+ setParams.sets_extra_list[3] = eset_orient[3];
+ setParams.sets_extra_list[4] = eset_orient[4];
+ setParams.sets_extra_list[5] = eset_orient[5];
+
+ memcpy(setParams.sets_dist_fact, eset_df, sizeof(eset_df)/sizeof(eset_df[0]));
+
EXCHECK( ex_put_concat_sets( exoid, EX_EDGE_SET, &setParams ), "Unable to write edge sets.\n" );
- setParams = (ex_set_specs) {
- (int[]) {1400},
- (int[]) {2},
- (int[]) {0},
- (int[]) {0},
- (int[]) {0},
- (int*) fset_faces,
- (int*) fset_orient,
- (void*) 0
- };
+ setParams.sets_ids[0] = 1400;
+ setParams.num_entries_per_set[0] = 2;
+ setParams.num_dist_per_set[0] = 0;
+ setParams.sets_entry_index[0] = 0;
+ setParams.sets_dist_index[0] = 0;
+ setParams.sets_entry_list[0] = fset_faces[0];
+ setParams.sets_entry_list[1] = fset_faces[1];
+
+ setParams.sets_extra_list[0] = fset_orient[0];
+ setParams.sets_extra_list[1] = fset_orient[1];
+
EXCHECK( ex_put_concat_sets( exoid, EX_FACE_SET, &setParams ), "Unable to write face sets.\n" );
- setParams = (ex_set_specs) {
- (int[]) {1600},
- (int[]) {5},
- (int[]) {0},
- (int[]) {0},
- (int[]) {0},
- (int*) sset_elems,
- (int*) sset_sides,
- (void*) 0
- };
+ setParams.sets_ids[0] = 1400;
+ setParams.num_entries_per_set[0] = 5;
+ setParams.num_dist_per_set[0] = 0;
+ setParams.sets_entry_index[0] = 0;
+ setParams.sets_dist_index[0] = 0;
+ memcpy(setParams.sets_entry_list, sset_elems, sizeof(sset_elems)/sizeof(sset_elems[0]));
+ memcpy(setParams.sets_extra_list, sset_sides, sizeof(sset_sides)/sizeof(sset_sides[0]));
+
EXCHECK( ex_put_concat_sets( exoid, EX_SIDE_SET, &setParams ), "Unable to write side sets.\n" );
- setParams = (ex_set_specs) {
- (int[]) {1800, 1900},
- (int[]) {1, 1},
- (int[]) {0, 0},
- (int[]) {0, 1},
- (int[]) {0, 0},
- (int*) elset_elems,
- (int*) 0,
- (void*) 0
- };
+ setParams.sets_ids[0] = 1800;
+ setParams.sets_ids[1] = 1900;
+ setParams.num_entries_per_set[0] = 1;
+ setParams.num_entries_per_set[1] = 1;
+ setParams.num_dist_per_set[0] = 0;
+ setParams.num_dist_per_set[1] = 0;
+ setParams.sets_entry_index[0] = 0;
+ setParams.sets_entry_index[1] = 1;
+ setParams.sets_dist_index[0] = 0;
+ setParams.sets_dist_index[1] = 0;
+ memcpy(setParams.sets_entry_list, elset_elems, sizeof(elset_elems)/sizeof(elset_elems[0]));
+
EXCHECK( ex_put_concat_sets( exoid, EX_ELEM_SET, &setParams ), "Unable to write element sets.\n" );
} else {
@@ -537,20 +623,20 @@ int cCreateEdgeFace( int argc, char* argv[] )
/* *** NEW API *** */
if ( concatResult ) {
EXCHECK( ex_put_all_var_param_ext( exoid, &varParams ),
- "Unable to write result variable parameter information.\n" );
+ "Unable to write result variable parameter information.\n" );
} else {
EXCHECK( ex_put_var_param( exoid, "G", 2 ),
- "Unable to write global result variable parameters.\n" );
+ "Unable to write global result variable parameters.\n" );
EXCHECK( ex_put_var_param( exoid, "N", 1 ),
- "Unable to write nodal result variable parameters.\n" );
+ "Unable to write nodal result variable parameters.\n" );
EXCHECK( ex_put_var_param( exoid, "E", 1 ),
- "Unable to write element result variable parameters.\n" );
+ "Unable to write element result variable parameters.\n" );
EXCHECK( ex_put_var_param( exoid, "L", 2 ),
- "Unable to write edge result variable parameters.\n" );
+ "Unable to write edge result variable parameters.\n" );
EXCHECK( ex_put_var_param( exoid, "F", 1 ),
- "Unable to write face result variable parameters.\n" );
+ "Unable to write face result variable parameters.\n" );
EXCHECK( ex_put_var_param( exoid, "A", 1 ),
- "Unable to write faceset result variable parameters.\n" );
+ "Unable to write faceset result variable parameters.\n" );
}
/* =============== Result variable names ========== */
@@ -590,12 +676,14 @@ int cCreateEdgeFace( int argc, char* argv[] )
EXCHECK( ex_put_nodal_var( exoid, 2, 1, 12, vals_nod_var[1] ), "Unable to write nodal var 1.\n" );
EXCHECK( ex_close( exoid ),
- "Unable to close database.\n" );
+ "Unable to close database.\n" );
return 0;
}
+#if !defined(USING_CMAKE)
int main( int argc, char* argv[] )
{
return cCreateEdgeFace(argc, argv);
}
+#endif
diff --git a/cbind/test/Imakefile b/cbind/test/Imakefile
index 6055d14..12a6391 100644
--- a/cbind/test/Imakefile
+++ b/cbind/test/Imakefile
@@ -35,15 +35,20 @@
INCLUDES = -I../include
-EXOIITEST = -L../.. -lexoIIv2c
-LOCALEXO = ../../libexoIIv2c.a
+EXOIITEST = -L../.. -lexodus
+LOCALEXO = ../../libexodus.a
LIBS = $(EXOIITEST) -L$(USRLIBDIR) $(NETCDF) $(EXTRANETCDFLIB)
PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm \
testwt_ss testwt_nossnsdf testrd_ss testrdwt testcp testcpd testcp_nl \
testcp_ln testwt_clb testwt_nc testrd_nc testwt-zeroe testwt-zeron \
testrdv testwt-one-attrib create_mesh rd_wt_mesh \
+ testrd-partial testwt-partial testwt-nsided testrd-nsided testwt-nfaced \
+ testrd-nfaced
+
+#if 0
CreateEdgeFace ReadEdgeFace
+#endif
all:: check
@@ -72,6 +77,12 @@ NormalProgramTarget(testrd_nc, testrd_nc.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(testwt-zeroe, testwt-zeroe.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(testwt-zeron, testwt-zeron.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(testwt-one-attrib, testwt-one-attrib.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt-partial, testwt-partial.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrd-partial, testrd-partial.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt-nsided, testwt-nsided.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrd-nsided, testrd-nsided.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt-nfaced, testwt-nfaced.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrd-nfaced, testrd-nfaced.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(create_mesh, create_mesh.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(rd_wt_mesh, rd_wt_mesh.o, $(LOCALEXO), /**/, $(LIBS))
@@ -79,10 +90,15 @@ NormalProgramTarget(rd_wt_mesh, rd_wt_mesh.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(CreateEdgeFace, CreateEdgeFace.o, $(LOCALEXO), /**/, $(LIBS))
NormalProgramTarget(ReadEdgeFace, ReadEdgeFace.o, $(LOCALEXO), /**/, $(LIBS))
+testall: testall.in1 $(CONFIGDIR)/$(MACROFILE)
+ rm -f testall
+ $(ETCDIR)/MsubCmd +R"@<" -R">@" testall.in1 >testall
+
test: check
-check: $(PROGS)
+check: $(PROGS) testall
csh -f ./testall
ExtraStuffToClean(*.res)
ExtraStuffToClean(*.exo)
ExtraStuffToClean(test.output)
+ExtraStuffToClean(testall)
diff --git a/cbind/test/Makefile.standalone b/cbind/test/Makefile.standalone
index 10738bd..00064ba 100644
--- a/cbind/test/Makefile.standalone
+++ b/cbind/test/Makefile.standalone
@@ -31,15 +31,15 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-EXOIITEST = -L../.. -lexoIIv2c
-LOCALEXO = ../../libexoIIv2c.a
+EXOIITEST = -L../.. -lexodus
+LOCALEXO = ../../libexodus.a
LIBS = $(EXOIITEST) $(NETCDF_LIB) -lm
PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm \
testwt_ss testwt_nossnsdf testrd_ss testrdwt testcp testcpd \
testwt_clb testwt_nc testrd_nc testwt-zeroe testwt-zeron \
testrdv testwt-one-attrib create_mesh rd_wt_mesh testcef \
- testref
+ testref testwt-nsided testrd-nsided testwt-nfaced testrd-nfaced
all:: check
@@ -106,6 +106,18 @@ testwt-zeron: testwt-zeron.o $(LOCALEXO)
testwt-one-attrib: testwt-one-attrib.o $(LOCALEXO)
$(CC) $(CFLAGS) -o $@ testwt-one-attrib.o $(LDFLAGS) $(LIBS)
+testwt-nsided: testwt-nsided.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt-nsided.o $(LDFLAGS) $(LIBS)
+
+testrd-nsided: testrd-nsided.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd-nsided.o $(LDFLAGS) $(LIBS)
+
+testwt-nfaced: testwt-nfaced.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt-nfaced.o $(LDFLAGS) $(LIBS)
+
+testrd-nfaced: testrd-nfaced.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd-nfaced.o $(LDFLAGS) $(LIBS)
+
create_mesh: create_mesh.o $(LOCALEXO)
$(CC) $(CFLAGS) -o $@ create_mesh.o $(LDFLAGS) $(LIBS)
diff --git a/cbind/test/ReadEdgeFace.c b/cbind/test/ReadEdgeFace.c
index 90daefe..75924f6 100644
--- a/cbind/test/ReadEdgeFace.c
+++ b/cbind/test/ReadEdgeFace.c
@@ -1,9 +1,6 @@
#include "exodusII.h"
#include <stdio.h>
-#include <stdlib.h> /* for free() */
-#ifdef EXODUSII_HAVE_MALLOC_H
-# include <malloc.h>
-#endif /* EXODUSII_HAVE_MALLOC_H */
+#include <stdlib.h> /* for malloc(), free() */
#define EX_TEST_FILENAME "edgeFace.exo"
@@ -442,7 +439,9 @@ int cReadEdgeFace( int argc, char* argv[] )
return 0;
}
+#if !defined(USING_CMAKE)
int main( int argc, char* argv[] )
{
return cReadEdgeFace(argc, argv);
}
+#endif
diff --git a/cbind/test/create_mesh.c b/cbind/test/create_mesh.c
index 2569388..26c46f1 100644
--- a/cbind/test/create_mesh.c
+++ b/cbind/test/create_mesh.c
@@ -33,59 +33,77 @@
*
*/
-/* $Id: create_mesh.c,v 1.3 2006/11/28 14:02:07 gdsjaar Exp $ */
-
-#define HAVE_EXODUSII
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "exodusII.h"
#define DEFAULT_FILE_NAME "mesh"
#define DEFAULT_MAP_ORIGIN 1
#define DEFAULT_NUM_DOMAINS 1
-#define DEFAULT_NUM_ELEMENTS 10000
+#define DEFAULT_NUM_ELEMENTS 1000000
#define DEFAULT_NUM_FIELDS 0
#define DEFAULT_NUM_TIMESTEPS 1
#define MAX_STRING_LEN 128
#define NUM_BYTES_PER_INT 4
-#define NUM_NODES_PER_ELEM 4
+#define NUM_NODES_PER_ELEM 8
#define EXODUSII_FILE_TYPE ".e"
+typedef double realtyp;
+
+int
+StringToCount(char * size_str)
+{
+ int size = 0;
+ char range;
+ int rc;
+
+ rc = sscanf(size_str, "%d%c", &size, &range);
+ if (rc == 2) {
+ switch ((int)range) {
+ case 'k': case 'K': size *= 1000; break;
+ case 'm': case 'M': size *= 1000000; break;
+ case 'g': case 'G': size *= 1000000000; break;
+ }
+ } else if (rc == 0) {
+ size = -1;
+ }
+ return(size);
+} /* StringToCount() */
+
void get_file_name(const char* base, const char* ext, int rank, int nprocs,
const char* other,char *output);
-/**
- * Mark Borgerding's algorithm...
- */
-
-/* We need to do a sqrt to find the number of elements on each
- * side of the square, but don't want to link in -lm just for
- * a single square root. Use this routine which is better than
- * a brute force approach, but not as good as some much larger
- * optimized versions.
+/* We need to do a cube-root to find the number of elements on each
+ * side of the cube, but don't want to link in -lm just for
+ * this. Use this routine which is better than
+ * a brute force approach. Found at
+ * http://www.hackersdelight.org/HDcode/icbrt.c
*/
-static int isqrt(int val) {
- int guess=0;
- int bit = 1 << 15;
- do {
- guess ^= bit;
- /* check to see if we can set this bit without going over sqrt(val)... */
- if (guess * guess > val )
- guess ^= bit; /* it was too much, unset the bit... */
- } while ((bit >>= 1) != 0);
-
- return guess;
+int icbrt(unsigned x) {
+ int s;
+ unsigned y, b;
+
+ s = 30;
+ y = 0;
+ while(s >= 0) { /* Do 11 times. */
+ y = 2*y;
+ b = (3*y*(y + 1) + 1) << s;
+ s = s - 3;
+ if (x >= b) {
+ x = x - b;
+ y = y + 1;
+ }
+ }
+ return y;
}
-/*
- * Prototypes
- */
-
+/* Prototypes */
void create_rr_elem_map(
int loc_num_elements,
int *elem_map,
@@ -111,7 +129,7 @@ void create_local_connect(
);
void extract_connect(
- int element_offset,
+ int element_offset,
int num_elem,
int *elem_map,
int *connect,
@@ -120,8 +138,9 @@ void extract_connect(
);
void make_mesh(
- float *x,
- float *y,
+ realtyp *x,
+ realtyp *y,
+ realtyp *z,
int *connect,
int map_origin,
int num_elements
@@ -154,8 +173,9 @@ void write_exo_mesh(
int num_global_fields,
int num_element_fields,
int num_timesteps,
- float *x,
- float *y,
+ realtyp *x,
+ realtyp *y,
+ realtyp *z,
int *connect
);
@@ -189,9 +209,11 @@ main( int argc, char *argv[] ) {
int num_element_fields = DEFAULT_NUM_FIELDS;
int num_timesteps = DEFAULT_NUM_TIMESTEPS;
int num_nodes;
-
- float *x;
- float *y;
+ size_t size;
+
+ realtyp *x;
+ realtyp *y;
+ realtyp *z;
ex_opts (EX_VERBOSE | EX_ABORT);
@@ -202,15 +224,23 @@ main( int argc, char *argv[] ) {
device_name,file_name, &exodus);
/* Create Coordinates and Connectivity Array */
- num_elements_1d = isqrt(num_elements);
- num_nodes = (num_elements_1d + 1) * (num_elements_1d + 1);
- x = malloc( num_nodes * sizeof( float ) );
- y = malloc( num_nodes * sizeof( float ) );
-
- num_elements = num_elements_1d * num_elements_1d;
- connect = malloc( NUM_NODES_PER_ELEM * num_elements * sizeof( int ) );
+ num_elements_1d = icbrt(num_elements);
+ num_nodes = (num_elements_1d + 1) * (num_elements_1d + 1) * (num_elements_1d + 1);
+ x = malloc( num_nodes * sizeof( realtyp ) );
+ y = malloc( num_nodes * sizeof( realtyp ) );
+ z = malloc( num_nodes * sizeof( realtyp ) );
+ assert(x != NULL && y != NULL && z != NULL);
+
+ num_elements = num_elements_1d * num_elements_1d * num_elements_1d;
+ size = (size_t)NUM_NODES_PER_ELEM * num_elements * sizeof( int );
+ assert(size > 0);
+ connect = malloc(size);
+ assert(connect != NULL);
+
+ fprintf(stderr, "Creating a 3D mesh of %d hex elements and %d nodes.\n", num_elements, num_nodes);
- make_mesh(x, y, connect, map_origin, num_elements_1d);
+ make_mesh(x, y, z, connect, map_origin, num_elements_1d);
+ fprintf(stderr, "\t...Mesh topology created.\n");
/*
* Write Out Mesh
@@ -230,12 +260,14 @@ main( int argc, char *argv[] ) {
num_timesteps,
x,
y,
+ z,
connect
);
}
free(x);
free(y);
+ free(z);
free(connect);
return 0;
} /* end of main() */
@@ -286,7 +318,7 @@ void parse_input(
if ( ++arg < argc ) *map_origin = atoi( argv[arg] );
}
else if ( strcmp( "-n", argv[arg] ) == 0 ) {
- if ( ++arg < argc ) *num_elements_1d = atoi( argv[arg] );
+ if ( ++arg < argc ) *num_elements_1d = StringToCount( argv[arg] );
}
else if ( strcmp( "-p", argv[arg] ) == 0 ) {
if ( ++arg < argc ) *num_domains = atoi( argv[arg] );
@@ -333,6 +365,7 @@ void parse_input(
printf( "-h display help/usage information. \n" );
printf( "-m map_origin element map origin. Default: %d \n", DEFAULT_MAP_ORIGIN );
printf( "-n elements number of elements in mesh \n" );
+ printf( " Can suffix with 'k', 'm', 'g' for thousand, million, billion\n");
printf( " elements/file = elements/number_of_domains. \n" );
printf( " Default: %d \n", DEFAULT_NUM_ELEMENTS);
printf( "-p domains number of domains. Default: %d \n", DEFAULT_NUM_DOMAINS );
@@ -358,36 +391,44 @@ void parse_input(
***********************************************************************/
void make_mesh(
- float *x,
- float *y,
+ realtyp *x,
+ realtyp *y,
+ realtyp *z,
int *connect,
int map_origin,
int num_elements_1d
) {
- int i, j, k, base, cnt;
+ size_t i, j, k, m, base, cnt;
+ size_t elp1sq = (num_elements_1d+1) * (num_elements_1d+1);
/* create global coordinates */
- for (i=0, k=0; i < (num_elements_1d+1); i++)
- {
- for (j=0; j < (num_elements_1d+1); j++, k++)
- {
- x[k] = (float)j;
- y[k] = (float)i;
+ for (m=0, k=0; m < (num_elements_1d+1); m++) {
+ for (i=0; i < (num_elements_1d+1); i++) {
+ for (j=0; j < (num_elements_1d+1); j++, k++) {
+ x[k] = (realtyp)j;
+ y[k] = (realtyp)i;
+ z[k] = (realtyp)m;
+ }
}
}
/* build connectivity array (node list) for mesh */
- for (i=0, k=0, cnt=0; i < num_elements_1d; i++)
- {
- for (j=0; j < num_elements_1d; j++, k++)
- {
- base = k+i+map_origin;
- connect[cnt++] = base;
- connect[cnt++] = base+1;
- connect[cnt++] = base+num_elements_1d+2;
- connect[cnt++] = base+num_elements_1d+1;
+ for (m=0, k=0, cnt=0; m < num_elements_1d; m++) {
+ for (i=0, k=0; i < num_elements_1d; i++) {
+ for (j=0; j < num_elements_1d; j++, k++) {
+ base = (m*elp1sq) + k + i + map_origin;
+ connect[cnt++] = base;
+ connect[cnt++] = base+1;
+ connect[cnt++] = base+num_elements_1d+2;
+ connect[cnt++] = base+num_elements_1d+1;
+
+ connect[cnt++] = elp1sq + base;
+ connect[cnt++] = elp1sq + base+1;
+ connect[cnt++] = elp1sq + base+num_elements_1d+2;
+ connect[cnt++] = elp1sq + base+num_elements_1d+1;
+ }
}
}
} /* end of make_mesh() */
@@ -405,19 +446,24 @@ void write_exo_mesh(
int num_global_fields,
int num_element_fields,
int num_timesteps,
- float *x,
- float *y,
+ realtyp *x,
+ realtyp *y,
+ realtyp *z,
int *connect
) {
- int CPU_word_size=0;
- int IO_word_size=4;
+ int CPU_word_size=sizeof(realtyp);
+ int IO_word_size=sizeof(realtyp);
int exoid, err, num_dim, num_elem_blk, num_node_sets, num_side_sets;
int i, j, t, index, loc_num_elements, loc_num_nodes, len_connect;
int *elem_map, *node_map, *domain_connect, *loc_connect;
int *elem_var_tab;
int accum_num_elements = 0;
+ int loc_node_size = -1;
- float *z, *loc_xcoords, *loc_ycoords, *globals = NULL;
+ realtyp *loc_xcoords = NULL;
+ realtyp *loc_ycoords = NULL;
+ realtyp *loc_zcoords = NULL;
+ realtyp *globals = NULL;
char temporary_name[MAX_STRING_LEN];
char **var_name;
@@ -434,63 +480,68 @@ void write_exo_mesh(
exit(-1);
}
- /* Determine local number of elements */
- if (num_elements < num_domains)
- {
- fprintf(stderr, "number of elements is less than number of domains.\n");
- if (i < num_elements) loc_num_elements = 1;
- else loc_num_elements = 0;
- } else {
- loc_num_elements = num_elements / num_domains;
- if (i < (num_elements % num_domains)) loc_num_elements++;
- }
-
- len_connect = NUM_NODES_PER_ELEM * loc_num_elements;
-
- /* malloc things we need */
-
- if (i == 0) { /* first time through; max size arrays occur on
- first iteration */
- elem_map = malloc(loc_num_elements * sizeof(int));
- domain_connect = malloc(len_connect * sizeof(int));
- loc_connect = malloc(len_connect * sizeof(int));
- node_map = malloc(num_nodes * sizeof(int));
- }
+ if (num_domains > 1) {
+ /* Determine local number of elements */
+ if (num_elements < num_domains)
+ {
+ fprintf(stderr, "number of elements is less than number of domains.\n");
+ if (i < num_elements) loc_num_elements = 1;
+ else loc_num_elements = 0;
+ } else {
+ loc_num_elements = num_elements / num_domains;
+ if (i < (num_elements % num_domains)) loc_num_elements++;
+ }
+
+ len_connect = NUM_NODES_PER_ELEM * loc_num_elements;
+
+ /* malloc things we need */
+
+ if (i == 0) { /* first time through; max size arrays occur on
+ first iteration */
+ elem_map = malloc(loc_num_elements * sizeof(int));
+ domain_connect = malloc(len_connect * sizeof(int));
+ loc_connect = malloc(len_connect * sizeof(int));
+ node_map = malloc(num_nodes * sizeof(int));
+ }
- /* Create element local/global map */
- create_elem_map(
- loc_num_elements,
- accum_num_elements,
- elem_map,
- map_origin
- );
+ /* Create element local/global map */
+ create_elem_map(
+ loc_num_elements,
+ accum_num_elements,
+ elem_map,
+ map_origin
+ );
- /* Extract current domain's connectivity, referencing global node ids */
- extract_connect(accum_num_elements,
- loc_num_elements,
- elem_map,
- connect,
- domain_connect,
- map_origin);
-
- accum_num_elements += loc_num_elements;
-
- /* The local/global node map is just the current domain's connectivity,
- sorted with duplicate entries removed */
- create_node_map (num_nodes, len_connect, domain_connect, node_map, &loc_num_nodes, map_origin);
-
- /* Using local/global node map, convert the domain connectivity
- (referencing global node ids) to local connectivity (referencing
- local node ids) */
-
- create_local_connect(
- node_map,
- loc_num_nodes,
- len_connect,
- domain_connect,
- loc_connect,
- map_origin
- );
+ /* Extract current domain's connectivity, referencing global node ids */
+ extract_connect(accum_num_elements,
+ loc_num_elements,
+ elem_map,
+ connect,
+ domain_connect,
+ map_origin);
+
+ accum_num_elements += loc_num_elements;
+
+ /* The local/global node map is just the current domain's connectivity,
+ sorted with duplicate entries removed */
+ create_node_map (num_nodes, len_connect, domain_connect, node_map, &loc_num_nodes, map_origin);
+
+ /* Using local/global node map, convert the domain connectivity
+ (referencing global node ids) to local connectivity (referencing
+ local node ids) */
+
+ create_local_connect(
+ node_map,
+ loc_num_nodes,
+ len_connect,
+ domain_connect,
+ loc_connect,
+ map_origin
+ );
+ } else {
+ loc_num_elements = num_elements;
+ loc_num_nodes = num_nodes;
+ }
if ( debug ) {
fprintf(stderr, "\n\n\n");
@@ -498,21 +549,9 @@ void write_exo_mesh(
fprintf(stderr, "\n domain: %d\n", i);
fprintf(stderr, "\n loc_num_elements: %d\n", loc_num_elements);
fprintf(stderr, "\n loc_num_nodes: %d\n", loc_num_nodes);
-
- fprintf(stderr, "\n element map:\n");
- for (j=0; j<loc_num_elements; j++) fprintf(stderr, " %d,", elem_map[j]);
-
- fprintf(stderr, "\n domain connectivity:\n");
- for (j=0; j<len_connect; j++) fprintf(stderr, " %d,", domain_connect[j]);
-
- fprintf(stderr, "\n node map:\n");
- for (j=0; j<loc_num_nodes; j++) fprintf(stderr, " %d,", node_map[j]);
-
- fprintf(stderr, "\n local connectivity:\n");
- for (j=0; j<len_connect; j++) fprintf(stderr, " %d,", loc_connect[j]);
}
- num_dim = 2;
+ num_dim = 3;
num_elem_blk = 1;
num_node_sets = 0;
num_side_sets = 0;
@@ -528,37 +567,64 @@ void write_exo_mesh(
}
/* Extract the local x and y coordinates */
-
- if (i == 0) { /* first time through; max size occurs on
- first iteration */
- loc_xcoords = malloc(loc_num_nodes * sizeof(float));
- loc_ycoords = malloc(loc_num_nodes * sizeof(float));
- }
-
- for (j=0; j<loc_num_nodes; j++) {
- index = node_map[j] - map_origin;
- loc_xcoords[j] = x[index];
- loc_ycoords[j] = y[index];
+ if (num_domains > 1) {
+ if (loc_num_nodes > loc_node_size) {
+ loc_xcoords = realloc(loc_xcoords, loc_num_nodes * sizeof(realtyp));
+ loc_ycoords = realloc(loc_ycoords, loc_num_nodes * sizeof(realtyp));
+ loc_zcoords = realloc(loc_zcoords, loc_num_nodes * sizeof(realtyp));
+ loc_node_size = loc_num_nodes;
+ }
+
+ for (j=0; j<loc_num_nodes; j++) {
+ index = node_map[j] - map_origin;
+ loc_xcoords[j] = x[index];
+ loc_ycoords[j] = y[index];
+ loc_zcoords[j] = z[index];
+ }
+
+ err = ex_put_coord (exoid, loc_xcoords, loc_ycoords, loc_zcoords);
+ } else {
+ err = ex_put_coord (exoid, x, y, z);
}
-
- err = ex_put_coord (exoid, loc_xcoords, loc_ycoords, z);
-
if (err) {
fprintf(stderr, "after ex_put_coord, error = %d\n", err);
ex_close (exoid);
exit(-1);
}
-
+ if ( debug ) {
+ fprintf(stderr, "\tCoordinates output.\n");
+ }
+#if 1
+ {
+ int ids[1] = {10};
+ int num_elem_per_block[1];
+ char *names[1] = {"hex"};
+ int num_node_per_elem[1];
+ int num_attr_per_block[1];
+ int write_map = num_domains > 1 ? TRUE : FALSE;
+ write_map = TRUE;
+ num_elem_per_block[0] = loc_num_elements;
+ num_node_per_elem[0] = NUM_NODES_PER_ELEM;
+ num_attr_per_block[0] = 0;
+ err = ex_put_concat_elem_block (exoid, ids, names, num_elem_per_block,
+ num_node_per_elem, num_attr_per_block, write_map);
+ }
+#else
err = ex_put_elem_block
- (exoid, 10, "quad", loc_num_elements, NUM_NODES_PER_ELEM, 0);
-
+ (exoid, 10, "hex", loc_num_elements, NUM_NODES_PER_ELEM, 0);
+#endif
+
if (err) {
fprintf(stderr, "after ex_put_elem_block, error = %d\n", err);
ex_close (exoid);
exit(-1);
}
- err = ex_put_elem_conn (exoid, 10, loc_connect);
+ if (num_domains > 1) {
+ err = ex_put_elem_conn (exoid, 10, loc_connect);
+ } else {
+ err = ex_put_elem_conn (exoid, 10, connect);
+ }
if (err) {
fprintf(stderr, "after ex_put_elem_conn, error = %d\n", err);
@@ -566,22 +632,31 @@ void write_exo_mesh(
exit(-1);
}
- /* write out element and node maps */
-
- err = ex_put_node_num_map (exoid, node_map);
-
- if (err) {
- fprintf(stderr, "after ex_put_node_num_map, error = %d\n", err);
- ex_close (exoid);
- exit(-1);
+ if ( debug ) {
+ fprintf(stderr, "\tConnectivity output.\n");
}
+ /* write out element and node maps */
- err = ex_put_elem_num_map (exoid, elem_map);
-
- if (err) {
- fprintf(stderr, "after ex_put_elem_num_map, error = %d\n", err);
- ex_close (exoid);
- exit(-1);
+ if (num_domains > 1) {
+ err = ex_put_id_map (exoid, EX_NODE_MAP, node_map);
+
+ if (err) {
+ fprintf(stderr, "after ex_put_id_map, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ err = ex_put_id_map (exoid, EX_ELEM_MAP, elem_map);
+
+ if (err) {
+ fprintf(stderr, "after ex_put_id_map, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ if ( debug ) {
+ fprintf(stderr, "\tMaps output.\n");
+ }
}
/* write out simulated results fields;
@@ -618,7 +693,7 @@ void write_exo_mesh(
var_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
sprintf (var_name[j], "node_field_%d", j+1);
}
- err = ex_put_var_names (exoid, "n", num_nodal_fields, var_name);
+ err = ex_put_variable_names (exoid, EX_NODAL, num_nodal_fields, var_name);
for (j=0; j<num_nodal_fields; j++) {
free(var_name[j]);
}
@@ -626,14 +701,14 @@ void write_exo_mesh(
}
if (num_global_fields > 0) {
- globals = malloc(num_global_fields * sizeof(float));
+ globals = malloc(num_global_fields * sizeof(realtyp));
var_name = malloc (num_global_fields * sizeof(char *));
for (j=0; j<num_global_fields; j++) {
var_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
sprintf (var_name[j], "global_field_%d", j+1);
globals[j] = j;
}
- err = ex_put_var_names (exoid, "g", num_global_fields, var_name);
+ err = ex_put_variable_names (exoid, EX_GLOBAL, num_global_fields, var_name);
for (j=0; j<num_global_fields; j++) {
free(var_name[j]);
}
@@ -647,7 +722,7 @@ void write_exo_mesh(
var_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
sprintf (var_name[j], "element_field_%d", j+1);
}
- err = ex_put_var_names (exoid, "e", num_element_fields, var_name);
+ err = ex_put_variable_names (exoid, EX_ELEM_BLOCK, num_element_fields, var_name);
for (j=0; j<num_element_fields; j++) {
free(var_name[j]);
}
@@ -657,11 +732,11 @@ void write_exo_mesh(
if (num_nodal_fields+num_global_fields+num_element_fields > 0) {
fprintf(stderr, "Domain %d/%d, Writing Timestep: ", i+1, num_domains);
for (t=0; t<num_timesteps; t++) {
- float time = t;
+ realtyp time = t;
ex_put_time(exoid, t+1, &time);
fprintf(stderr, "%d, ", t+1);
if (num_global_fields > 0) {
- err = ex_put_glob_vars (exoid, t+1, num_global_fields, globals);
+ err = ex_put_var(exoid, t+1, EX_GLOBAL, 1, 0, num_global_fields, globals);
if (err) {
fprintf(stderr, "after ex_put_global_var, error = %d\n", err);
ex_close (exoid);
@@ -669,7 +744,7 @@ void write_exo_mesh(
}
}
for (j=0; j<num_nodal_fields; j++) {
- err = ex_put_nodal_var (exoid, t+1, j+1, loc_num_nodes, loc_xcoords);
+ err = ex_put_var (exoid, t+1, EX_NODAL, j+1, 0, loc_num_nodes, x);
if (err) {
fprintf(stderr, "after ex_put_nodal_var, error = %d\n", err);
ex_close (exoid);
@@ -677,7 +752,7 @@ void write_exo_mesh(
}
}
for (j=0; j<num_element_fields; j++) {
- err = ex_put_elem_var (exoid, t+1, j+1, 10, loc_num_elements, loc_xcoords);
+ err = ex_put_var (exoid, t+1, EX_ELEM_BLOCK, j+1, 10, loc_num_elements, x);
if (err) {
fprintf(stderr, "after ex_put_element_var, error = %d\n", err);
ex_close (exoid);
@@ -694,18 +769,24 @@ void write_exo_mesh(
fprintf(stderr, "after ex_close, error = %d\n", err);
exit(-1);
}
+ if ( debug ) {
+ fprintf(stderr, "\tFile written.\n");
+ }
}
/*
* Free Memory
*/
- free( domain_connect );
- free( elem_map );
- free( loc_connect );
- free( loc_xcoords );
- free( loc_ycoords );
- free( node_map );
+ if (num_domains > 1) {
+ free( domain_connect );
+ free( elem_map );
+ free( loc_connect );
+ free( loc_xcoords );
+ free( loc_ycoords );
+ free( loc_zcoords );
+ free( node_map );
+ }
if (num_global_fields > 0)
free(globals);
}
diff --git a/cbind/test/rd_wt_mesh.c b/cbind/test/rd_wt_mesh.c
index 5a359fc..cecf2e5 100644
--- a/cbind/test/rd_wt_mesh.c
+++ b/cbind/test/rd_wt_mesh.c
@@ -33,7 +33,6 @@
*
*/
-/* $Id: rd_wt_mesh.c,v 1.3 2006/11/28 14:02:07 gdsjaar Exp $ */
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE
@@ -47,8 +46,7 @@
#include <mpi.h>
#else
#include <string.h>
-#include <unistd.h>
-#include <sys/times.h>
+#include <time.h>
#endif
#include <stdio.h>
@@ -56,8 +54,10 @@
#include <limits.h>
#include <float.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <assert.h>
#include "exodusII.h"
@@ -67,7 +67,7 @@
#define EXODUS_FILE_TYPE "e"
#define MBYTES (1024*1024)
#define MAX_STRING_LEN 128
-#define NUM_NODES_PER_ELEM 4
+#define NUM_NODES_PER_ELEM 8
#define QUIT FALSE
#define WRITE_FILE_TYPE "new"
@@ -75,6 +75,8 @@
* Prototypes
*/
+typedef double realtyp;
+
void get_file_name(const char* base, const char* ext, int rank, int nprocs,
const char* other,char *output);
@@ -92,40 +94,32 @@ int parse_input(
int *sleep_time
);
-int read_exo_mesh ( char *file_name, int rank, int num_domains, int *num_nodal_fields,
+int read_exo_mesh ( char *file_name, int rank, int *ndim, int num_domains, int *num_nodal_fields,
int *num_global_fields, int *num_element_fields,
int *num_timesteps,
int sleep_time, int num_iterations,
int *num_nodes, int **node_map,
int *num_elems, int **elem_map,
- float **x_coords, float **y_coords, int **loc_connect );
+ realtyp **x_coords, realtyp **y_coords, realtyp **z_coords, int **loc_connect );
-int write_exo_mesh ( char *file_name, int rank, int num_domains,
+int write_exo_mesh ( char *file_name, int rank, int ndim, int num_domains,
int num_nodal_fields, int num_global_fields, int num_element_fields,
int num_timesteps, int files_per_domain,
int sleep_time, int num_iterations,
int loc_num_nodes, int *node_map,
int loc_num_elems, int *elem_map,
- float *x_coords, float *y_coords, int *loc_connect, int close_files);
+ realtyp *x_coords, realtyp *y_coords, realtyp *z_coords, int *loc_connect, int close_files);
double my_timer()
{
- static double ticks_per_second = -1.0;
-
double t1 = 0.0;
#if !defined(__LIBCATAMOUNT__)
#ifdef HAVE_PARALLEL
t1 = MPI_Wtime();
#else
- if (ticks_per_second < 0.0)
- ticks_per_second = sysconf(_SC_CLK_TCK);
-
- {
- struct tms time_buf;
- clock_t ctime = times(&time_buf);
- t1 = ctime / ticks_per_second;
- }
+ clock_t ctime = clock();
+ t1 = ctime / (double)CLOCKS_PER_SEC;
#endif
#else
return dclock();
@@ -183,8 +177,10 @@ int main( int argc, char **argv )
char value[MAX_STRING_LEN]; /* Value of a key/value pair in a MPI Info */
#endif
/* object. */
- float *x_coords;
- float *y_coords;
+ realtyp *x_coords;
+ realtyp *y_coords;
+ realtyp *z_coords;
+ int ndim;
#ifdef HAVE_PARALLEL
MPI_Info new_mpi_info_object;
#endif
@@ -212,10 +208,10 @@ int main( int argc, char **argv )
*/
if ( rank == 0 ) {
- quit = EXIT_SUCCESS != parse_input(argc, argv,
- &exodus, &close_files, file_name,
- &num_nodal_fields, &num_global_fields, &num_element_fields,
- &files_per_domain, &num_iterations, &sleep_time);
+ quit = (1 == parse_input(argc, argv,
+ &exodus, &close_files, file_name,
+ &num_nodal_fields, &num_global_fields, &num_element_fields,
+ &files_per_domain, &num_iterations, &sleep_time));
}
@@ -231,7 +227,7 @@ int main( int argc, char **argv )
#ifdef HAVE_PARALLEL
MPI_Finalize();
#endif
- exit(EXIT_SUCCESS);
+ exit(0);
}
#ifdef HAVE_PARALLEL
@@ -275,7 +271,7 @@ int main( int argc, char **argv )
#endif
if (rank == 0) {
- fprintf(stderr, "\nEXODUSII 2-D Benchmark\n\n" );
+ fprintf(stderr, "\nEXODUSII 3D Benchmark\n\n" );
fprintf(stderr, " Number of Domains\t\t%8d\n", num_domains );
fprintf(stderr, " Number of Files/Domain\t%8d\n", files_per_domain );
fprintf(stderr, " Number of Iterations\t\t%8d\n", num_iterations );
@@ -302,23 +298,24 @@ int main( int argc, char **argv )
if ( exodus ) {
int *node_map;
- if (EXIT_SUCCESS == read_exo_mesh(file_name, rank, num_domains,
- &num_nodal_fields, &num_global_fields, &num_element_fields,
- &num_timesteps, sleep_time, num_iterations,
- &loc_num_nodes, &node_map, &loc_num_elems, &elem_map,
- &x_coords, &y_coords, &loc_connect)
- ) {
- write_exo_mesh(file_name, rank, num_domains,
+ if (0 == read_exo_mesh(file_name, rank, &ndim, num_domains,
+ &num_nodal_fields, &num_global_fields, &num_element_fields,
+ &num_timesteps, sleep_time, num_iterations,
+ &loc_num_nodes, &node_map, &loc_num_elems, &elem_map,
+ &x_coords, &y_coords, &z_coords, &loc_connect)
+ ) {
+ write_exo_mesh(file_name, rank, ndim, num_domains,
num_nodal_fields, num_global_fields, num_element_fields,
num_timesteps, files_per_domain, sleep_time, num_iterations,
loc_num_nodes, node_map, loc_num_elems, elem_map,
- x_coords, y_coords, loc_connect, close_files);
+ x_coords, y_coords, z_coords, loc_connect, close_files);
free( elem_map );
free( loc_connect );
free( node_map );
free( x_coords );
free( y_coords );
+ free( z_coords );
}
}
#ifdef HAVE_PARALLEL
@@ -410,45 +407,45 @@ int parse_input (int argc,
fprintf(stderr, "-C minimize open files. \n" );
fprintf(stderr, "-u display help/usage information \n" );
fprintf(stderr, "-w time wait (sleep) specified time between timesteps.\n" );
- return(EXIT_FAILURE);
+ return(1);
}
else {
fprintf(stderr, "Unknown option: %s\n", argv[arg] );
fprintf(stderr, "Enter rd_wt_mesh -h for description of valid options.\n" );
- return(EXIT_FAILURE);
+ return(1);
}
}
- return(EXIT_SUCCESS);
+ return(0);
}
/***********************************************************************
***********************************************************************/
-int read_exo_mesh (char *file_name, int rank, int num_domains,
+int read_exo_mesh (char *file_name, int rank, int *num_dim, int num_domains,
int *num_nodal_fields, int *num_global_fields, int *num_element_fields,
int *num_timesteps,
int sleep_time, int num_iterations,
int *num_nodes, int **node_map,
int *num_elems, int **elem_map,
- float **x_coords, float **y_coords, int **connect )
+ realtyp **x_coords, realtyp **y_coords, realtyp **z_coords, int **connect )
{
- int CPU_word_size=4;
+ int CPU_word_size=sizeof(realtyp);
int IO_word_size=0;
- int exoid, err, num_dim, num_elem_blk, num_node_sets, num_side_sets;
+ int exoid, err, num_elem_blk, num_node_sets, num_side_sets;
int num_nodes_per_elem, num_attrs, num_vars, i, iter;
- int len_connect;
- double file_size;
+ size_t len_connect;
+ size_t file_size;
double fdum;
- char *cdum;
+ char *cdum = 0;
struct stat file_status;
- double glob_file_size;
- double glob_raw_data_vol;
- double raw_data_vol;
+ size_t glob_file_size;
+ size_t glob_raw_data_vol;
+ size_t raw_data_vol;
- float *z, version;
- float *globals = NULL;
+ float version;
+ realtyp *globals = NULL;
double tstart, tend, t_tmp1, t_tmp2;
double raw_read_time, max_raw_read_time=0.0, min_raw_read_time=DBL_MAX;
@@ -467,121 +464,127 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
if (exoid < 0) {
printf ("after ex_open\n");
- return( EXIT_FAILURE );
+ return(1);
}
raw_read_time = 0.0;
- raw_data_vol = 0.;
+ raw_data_vol = 0;
tstart = my_timer();
- err = ex_get_init (exoid, title, &num_dim,
+ err = ex_get_init (exoid, title, num_dim,
num_nodes, num_elems, &num_elem_blk,
&num_node_sets, &num_side_sets);
if (err) {
printf ("after ex_get_init, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE);
+ return(1);
}
- len_connect = NUM_NODES_PER_ELEM * (*num_elems);
+ len_connect = (size_t)NUM_NODES_PER_ELEM * (*num_elems);
/* malloc things we need */
if( iter == 0) {
- *elem_map = malloc( (*num_elems) * sizeof( int ) );
- *connect = malloc( len_connect * sizeof( int ) );
- *node_map = malloc( len_connect * sizeof( int ) );
-
- *x_coords = malloc( (*num_nodes) * sizeof( float ) );
- *y_coords = malloc( (*num_nodes) * sizeof( float ) );
+ *elem_map = malloc(sizeof(int) * (*num_elems));
+ assert(elem_map);
+ *connect = malloc(sizeof(int) * len_connect );
+ assert(connect);
+ *node_map = malloc(sizeof(int) * (*num_nodes));
+ assert(node_map);
+
+ *x_coords = malloc(sizeof(realtyp) * (*num_nodes));
+ assert(x_coords);
+ *y_coords = malloc(sizeof(realtyp) * (*num_nodes));
+ assert(y_coords);
+ *z_coords = malloc(sizeof(realtyp) * (*num_nodes));
+ assert(z_coords);
}
t_tmp1 = my_timer();
- err = ex_get_coord (exoid, *x_coords, *y_coords, z);
+ err = ex_get_coord (exoid, *x_coords, *y_coords, *z_coords);
t_tmp2 = my_timer();
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)(2 * (*num_nodes) * sizeof(float));
+ raw_data_vol += sizeof(realtyp) * 3 * (*num_nodes);
if (err) {
printf ("after ex_get_coord, error = %d\n", err);
ex_close (exoid);
- return (EXIT_FAILURE );
+ return (1 );
}
- err = ex_get_elem_block
- (exoid, 10, type, num_elems, &num_nodes_per_elem, &num_attrs);
+ err = ex_get_block
+ (exoid, EX_ELEM_BLOCK, 10, type, num_elems, &num_nodes_per_elem, 0, 0, &num_attrs);
if (err) {
printf ("after ex_get_elem_block, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
t_tmp1 = my_timer();
- err = ex_get_elem_conn (exoid, 10, *connect);
+ err = ex_get_conn (exoid, EX_ELEM_BLOCK, 10, *connect, 0, 0);
t_tmp2 = my_timer();
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)(len_connect * sizeof(int));
+ raw_data_vol += sizeof(int) * len_connect;
if (err) {
printf ("after ex_get_elem_conn, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
/* read element and node maps */
t_tmp1 = my_timer();
- err = ex_get_node_num_map (exoid, *node_map);
-
+ err = ex_get_id_map (exoid, EX_NODE_MAP, *node_map);
t_tmp2 = my_timer();
-
+ raw_data_vol += sizeof(int) * (*num_nodes);
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)((*num_nodes) * sizeof(int));
t_tmp1 = my_timer();
- err = ex_get_elem_num_map (exoid, *elem_map);
+ err = ex_get_id_map (exoid, EX_ELEM_MAP, *elem_map);
t_tmp2 = my_timer();
-
+ raw_data_vol += sizeof(int)*(*num_elems);
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)((*num_elems) * sizeof(int));
+
/* read results variables */
- err = ex_get_var_param (exoid, "n", &num_vars);
+ err = ex_get_variable_param (exoid, EX_NODAL, &num_vars);
if (err) {
printf ("after ex_get_var_param, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
*num_nodal_fields = num_vars;
- err = ex_get_var_param (exoid, "g", &num_vars);
+ err = ex_get_variable_param (exoid, EX_GLOBAL, &num_vars);
if (err) {
printf ("after ex_get_var_param, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
*num_global_fields = num_vars;
if (*num_global_fields > 0) {
- globals = malloc(*num_global_fields * sizeof(float));
+ globals = malloc(*num_global_fields * sizeof(realtyp));
+ assert(globals);
}
- err = ex_get_var_param (exoid, "e", &num_vars);
+ err = ex_get_variable_param (exoid, EX_ELEM_BLOCK, &num_vars);
if (err) {
printf ("after ex_get_var_param, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
*num_element_fields = num_vars;
@@ -618,44 +621,44 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
for (i=1; i <= *num_nodal_fields; i++) {
t_tmp1 = my_timer();
- err = ex_get_nodal_var (exoid, t+1, i, *num_nodes, *x_coords);
+ err = ex_get_var (exoid, t+1, EX_NODAL, i, 0, *num_nodes, *x_coords);
t_tmp2 = my_timer();
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)((*num_nodes) * sizeof(float));
+ raw_data_vol += sizeof(realtyp)*(*num_nodes);
if (err) {
printf ("after ex_get_nodal_var, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
}
t_tmp1 = my_timer();
- err = ex_get_glob_vars (exoid, t+1, *num_global_fields, globals);
+ err = ex_get_var (exoid, t+1, EX_GLOBAL, 0, 0, *num_global_fields, globals);
t_tmp2 = my_timer();
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)(*num_global_fields * sizeof(float));
+ raw_data_vol += sizeof(realtyp) * *num_global_fields;
if (err) {
printf ("after ex_get_glob_vars, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
for (i=1; i <= *num_element_fields; i++) {
t_tmp1 = my_timer();
- err = ex_get_elem_var (exoid, t+1, i, 10, *num_elems, *x_coords);
+ err = ex_get_var (exoid, t+1, EX_ELEM_BLOCK, i, 10, *num_elems, *x_coords);
t_tmp2 = my_timer();
raw_read_time += t_tmp2-t_tmp1;
- raw_data_vol += (double)((*num_elems) * sizeof(float));
+ raw_data_vol += sizeof(realtyp) * (*num_elems);
if (err) {
printf ("after ex_get_elem_var, error = %d\n", err);
ex_close (exoid);
- return( EXIT_FAILURE );
+ return( 1 );
}
}
}
@@ -668,7 +671,7 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
err = ex_close (exoid);
if (err) {
printf ("after ex_close, error = %d\n", err);
- return ( EXIT_FAILURE );
+ return ( 1 );
}
tend = my_timer();
@@ -683,7 +686,7 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
} /* end of for (iter...) */
#ifdef HAVE_PARALLEL
- MPI_Allreduce (&raw_data_vol, &glob_raw_data_vol, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_Allreduce (&raw_data_vol, &glob_raw_data_vol, 1, MPI_LONG, MPI_SUM,
MPI_COMM_WORLD);
#else
glob_raw_data_vol = raw_data_vol;
@@ -698,16 +701,16 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
if (stat( tmp_name, &file_status)) {
if ( rank == 0 )
fprintf ( stderr, "Exodus Read: cannot get %s file size.\n", tmp_name );
- return( EXIT_FAILURE );
+ return( 1 );
}
else
- file_size = (double)file_status.st_size;
+ file_size = file_status.st_size;
#ifdef HAVE_PARALLEL
MPI_Allreduce(&file_size,
&glob_file_size,
1,
- MPI_DOUBLE,
+ MPI_LONG,
MPI_SUM,
MPI_COMM_WORLD);
#else
@@ -719,10 +722,11 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
fprintf(stderr, " Exodus Read Results \n" );
fprintf(stderr, " \n" );
fprintf(stderr, " Sizes (bytes) \n" );
- fprintf(stderr, " File %14.12g \n", glob_file_size);
- fprintf(stderr, " Raw Data %14.12g \n", glob_raw_data_vol);
- fprintf(stderr, " Difference %14.12g (%5.2f%%) \n",
- glob_file_size - glob_raw_data_vol, (glob_file_size-glob_raw_data_vol)/(0.01*glob_file_size) );
+ fprintf(stderr, " File %14ld \n", (long)glob_file_size);
+ fprintf(stderr, " Raw Data %14ld \n", (long)glob_raw_data_vol);
+ fprintf(stderr, " Difference %14ld (%5.2f%%) \n",
+ (long)(glob_file_size - glob_raw_data_vol),
+ (1.0*glob_file_size-1.0*glob_raw_data_vol)/(0.01*glob_file_size) );
fprintf(stderr, " \n" );
fprintf(stderr, " Times (sec) \t Minimum\t Maximum\t Average\n" );
fprintf(stderr, " Raw Data Read (sec) \t%8.4g\t%8.4g\t%8.4g \n",
@@ -734,40 +738,40 @@ int read_exo_mesh (char *file_name, int rank, int num_domains,
fprintf(stderr, " \n" );
fprintf(stderr, " Input Bandwidths (MiB/sec) \t Minimum\t Maximum\t Average\n" );
fprintf(stderr, " Raw Data Read (MiB/sec) \t%8.4g\t%8.4g\t%8.4g \n",
- glob_raw_data_vol / max_raw_read_time / MBYTES,
- glob_raw_data_vol / min_raw_read_time / MBYTES,
- glob_raw_data_vol / cum_raw_read_time / MBYTES * num_iterations);
+ (double)glob_raw_data_vol / max_raw_read_time / MBYTES,
+ (double)glob_raw_data_vol / min_raw_read_time / MBYTES,
+ (double)glob_raw_data_vol / cum_raw_read_time / MBYTES * num_iterations);
fprintf(stderr, " Raw + Meta Data Read (MiB/sec)\t \t \t%8.4g \n",
- glob_file_size / cum_total_time / MBYTES * num_iterations );
+ (double)glob_file_size / cum_total_time / MBYTES * num_iterations );
}
if (*num_global_fields > 0)
free(globals);
- return( EXIT_SUCCESS );
+ return(0);
}
/***********************************************************************
***********************************************************************/
-int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fields,
+int write_exo_mesh (char *file_name, int rank, int num_dim, int num_domains, int num_nodal_fields,
int num_global_fields, int num_element_fields, int num_timesteps,
int files_per_domain, int sleep_time, int num_iterations,
int num_nodes, int *node_map,
int num_elems, int *elem_map,
- float *x_coords, float *y_coords, int *connect, int close_files )
+ realtyp *x_coords, realtyp *y_coords, realtyp *z_coords, int *connect, int close_files )
{
- int CPU_word_size=4;
- int IO_word_size=4;
- int j, t, npd, err, num_dim, num_elem_blk, num_node_sets, num_side_sets;
+ int CPU_word_size = sizeof(realtyp);
+ int IO_word_size = sizeof(realtyp);
+ int j, t, npd, err, num_elem_blk, num_node_sets, num_side_sets;
int iter;
int *elem_var_tab;
- double file_size;
+ size_t file_size;
struct stat file_status;
- double glob_file_size;
- double glob_raw_data_vol;
- double raw_data_vol;
+ size_t glob_file_size;
+ size_t glob_raw_data_vol;
+ size_t raw_data_vol;
- float *z, *globals = NULL;
+ realtyp *globals = NULL;
double raw_open_close_time = 0.0;
double cum_open_close_time = 0.0;
@@ -804,7 +808,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
if (exoid[npd] < 0) {
printf ("after ex_create\n");
- return( EXIT_FAILURE );
+ return( 1 );
}
}
t_tmp2 = my_timer();
@@ -815,7 +819,6 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
tstart = my_timer();
- num_dim = 2;
num_elem_blk = 1;
num_node_sets = 0;
num_side_sets = 0;
@@ -830,10 +833,10 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
if (exoid[npd] < 0) {
printf ("after ex_create\n");
- return( EXIT_FAILURE );
+ return( 1 );
}
}
- err = ex_put_init (exoid[npd], "This is a EXODUSII performance test.", num_dim,
+ err = ex_put_init (exoid[npd], "This is an EXODUSII performance test.", num_dim,
num_nodes, num_elems, num_elem_blk,
num_node_sets, num_side_sets);
@@ -841,46 +844,47 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
printf ("after ex_put_init, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE);
+ return( 1);
}
-#if 1
+#if 0
{
int ids[1] = {10};
int num_elem_per_block[1];
- char *names[1] = {"quad"};
+ char *names[1] = {"hex"};
int num_node_per_elem[1];
int num_attr_per_block[1];
+ int write_map = num_domains > 1 ? TRUE : FALSE;
num_elem_per_block[0] = num_elems;
num_node_per_elem[0] = NUM_NODES_PER_ELEM;
num_attr_per_block[0] = 0;
err = ex_put_concat_elem_block (exoid[npd], ids, names, num_elem_per_block,
- num_node_per_elem, num_attr_per_block, TRUE);
+ num_node_per_elem, num_attr_per_block, write_map);
}
#else
- err = ex_put_elem_block
- (exoid[npd], 10, "quad", num_elems, NUM_NODES_PER_ELEM, 0);
+ err = ex_put_block
+ (exoid[npd], EX_ELEM_BLOCK, 10, "hex", num_elems, NUM_NODES_PER_ELEM, 0, 0, 0);
#endif
if (err) {
printf ("after ex_put_elem_block, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE );
+ return( 1 );
}
t_tmp1 = my_timer();
- err = ex_put_coord (exoid[npd], x_coords, y_coords, z);
+ err = ex_put_coord (exoid[npd], x_coords, y_coords, z_coords);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
- raw_data_vol += (2 * num_nodes * sizeof(float));
+ raw_data_vol += sizeof(realtyp)*num_dim * num_nodes;
if (err) {
printf ("after ex_put_coord, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE );
+ return( 1 );
}
t_tmp1 = my_timer();
@@ -888,51 +892,52 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
- raw_data_vol += (num_elems * NUM_NODES_PER_ELEM * sizeof(int));
+ raw_data_vol += sizeof(int) * num_elems * NUM_NODES_PER_ELEM;
if (err) {
printf ("after ex_put_elem_conn, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE);
+ return( 1);
}
/* write out element and node maps */
t_tmp1 = my_timer();
- err = ex_put_node_num_map (exoid[npd], node_map);
+ err = ex_put_id_map (exoid[npd], EX_NODE_MAP, node_map);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
- raw_data_vol += (num_nodes * sizeof(int));
+ raw_data_vol += sizeof(int)*num_nodes;
if (err) {
- printf ("after ex_put_node_num_map, error = %d\n", err);
+ printf ("after ex_put_id_map, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE );
+ return( 1 );
}
t_tmp1 = my_timer();
- err = ex_put_elem_num_map (exoid[npd], elem_map);
+ err = ex_put_id_map (exoid[npd], EX_ELEM_MAP, elem_map);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
- raw_data_vol += (num_elems * sizeof(int));
+ raw_data_vol += sizeof(int)*num_elems;
if (err) {
- printf ("after ex_put_elem_num_map, error = %d\n", err);
+ printf ("after ex_put_id_map, error = %d\n", err);
ex_close (exoid[npd]);
- return( EXIT_FAILURE );
+ return( 1 );
}
/* write out simulated results fields;
- we'll just write out the x coordinate field 'num_nodal_fields' times */
+ we'll just write out the x coordinate field 'num_element_fields' times */
if (num_element_fields > 0) {
if (npd == 0) {
elem_var_tab = malloc(num_element_fields * sizeof(int));
+ assert(elem_var_tab);
for (j = 0; j < num_element_fields; j++)
elem_var_tab[j] = 1;
}
@@ -948,19 +953,20 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
if (err) {
fprintf(stderr, "after ex_put_all_var_param, error = %d\n", err);
ex_close (exoid[npd]);
- exit(EXIT_FAILURE);
+ exit(1);
}
if (num_nodal_fields > 0) {
if (npd == 0) {
nvar_name = malloc (num_nodal_fields * sizeof(char *));
+ assert(nvar_name);
for (j=0; j<num_nodal_fields; j++) {
nvar_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
sprintf (nvar_name[j], "node_field_%d", j+1);
}
}
- err = ex_put_var_names (exoid[npd], "n", num_nodal_fields, nvar_name);
+ err = ex_put_variable_names (exoid[npd], EX_NODAL, num_nodal_fields, nvar_name);
if (npd == files_per_domain-1) {
for (j=0; j<num_nodal_fields; j++) {
free(nvar_name[j]);
@@ -971,7 +977,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
if (num_global_fields > 0) {
if (npd == 0) {
- globals = malloc(num_global_fields * sizeof(float));
+ globals = malloc(num_global_fields * sizeof(realtyp));
gvar_name = malloc (num_global_fields * sizeof(char *));
for (j=0; j<num_global_fields; j++) {
gvar_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
@@ -980,7 +986,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
}
}
- err = ex_put_var_names (exoid[npd], "g", num_global_fields, gvar_name);
+ err = ex_put_variable_names (exoid[npd], EX_GLOBAL, num_global_fields, gvar_name);
if (npd == files_per_domain-1) {
for (j=0; j<num_global_fields; j++) {
@@ -999,7 +1005,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
}
}
- err = ex_put_var_names (exoid[npd], "e", num_element_fields, evar_name);
+ err = ex_put_variable_names (exoid[npd], EX_ELEM_BLOCK, num_element_fields, evar_name);
if (npd == files_per_domain-1) {
free(elem_var_tab);
@@ -1023,7 +1029,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
}
for (t=0; t<num_timesteps; t++) {
for (npd = 0; npd < files_per_domain; npd++) {
- float time = t;
+ realtyp time = t;
if (close_files) {
float version;
@@ -1054,35 +1060,35 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
}
if (num_global_fields > 0) {
t_tmp1 = my_timer();
- err = ex_put_glob_vars (exoid[npd], t+1, num_global_fields, globals);
+ err = ex_put_var (exoid[npd], t+1, EX_GLOBAL, 1, 0, num_global_fields, globals);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
if (err) {
fprintf(stderr, "after ex_put_global_var, error = %d\n", err);
ex_close (exoid[npd]);
- exit(EXIT_FAILURE);
+ exit(1);
}
}
for (j=0; j<num_nodal_fields; j++) {
t_tmp1 = my_timer();
- err = ex_put_nodal_var (exoid[npd], t+1, j+1, num_nodes, x_coords);
+ err = ex_put_var (exoid[npd], t+1, EX_NODAL, j+1, 0, num_nodes, x_coords);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
if (err) {
fprintf(stderr, "after ex_put_nodal_var, error = %d\n", err);
ex_close (exoid[npd]);
- exit(EXIT_FAILURE);
+ exit(1);
}
}
for (j=0; j<num_element_fields; j++) {
t_tmp1 = my_timer();
- err = ex_put_elem_var (exoid[npd], t+1, j+1, 10, num_elems, x_coords);
+ err = ex_put_var (exoid[npd], t+1, EX_ELEM_BLOCK, j+1, 10, num_elems, x_coords);
t_tmp2 = my_timer();
raw_write_time += t_tmp2-t_tmp1;
if (err) {
fprintf(stderr, "after ex_put_element_var, error = %d\n", err);
ex_close (exoid[npd]);
- exit(EXIT_FAILURE);
+ exit(1);
}
}
if (close_files) {
@@ -1105,7 +1111,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
err = ex_close (exoid[npd]);
if (err) {
printf ("after ex_close, error = %d\n", err);
- return( EXIT_FAILURE);
+ return( 1);
}
}
if ( rank == 0 ) {fprintf(stderr, "\n");}
@@ -1136,9 +1142,9 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
cum_open_close_time += raw_open_close_time;
- raw_data_vol += ((double)(num_nodes*num_nodal_fields) +
+ raw_data_vol += sizeof(realtyp)*(((size_t)num_nodes*num_nodal_fields) +
(num_elems * num_element_fields) +
- (num_global_fields)) * num_timesteps*files_per_domain*sizeof(float);
+ (num_global_fields)) * num_timesteps*files_per_domain;
} /* end of for (iter...) */
@@ -1147,7 +1153,7 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
&raw_data_vol,
&glob_raw_data_vol,
1,
- MPI_DOUBLE,
+ MPI_LONG,
MPI_SUM,
MPI_COMM_WORLD
);
@@ -1165,13 +1171,13 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
if ( rank == 0 )
fprintf ( stderr, "Exodus Write: cannot get %s file size.\n", tmp_name );
- return( EXIT_FAILURE );
+ return( 1 );
}
else
- file_size = (double)file_status.st_size * files_per_domain;
+ file_size = file_status.st_size * files_per_domain;
#ifdef HAVE_PARALLEL
- MPI_Allreduce (&file_size, &glob_file_size, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_Allreduce (&file_size, &glob_file_size, 1, MPI_LONG, MPI_SUM,
MPI_COMM_WORLD);
#else
glob_file_size = file_size;
@@ -1182,10 +1188,11 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
fprintf(stderr, " Exodus Write Results \n" );
fprintf(stderr, " \n" );
fprintf(stderr, " Sizes (bytes) \n" );
- fprintf(stderr, " File %14.12g \n", glob_file_size);
- fprintf(stderr, " Raw Data %14.12g \n", glob_raw_data_vol);
- fprintf(stderr, " Difference %14.12g (%5.2f%%) \n",
- glob_file_size - glob_raw_data_vol, (glob_file_size-glob_raw_data_vol)/(0.01*glob_file_size) );
+ fprintf(stderr, " File %14ld \n", (long)glob_file_size);
+ fprintf(stderr, " Raw Data %14ld \n", (long)glob_raw_data_vol);
+ fprintf(stderr, " Difference %14ld (%5.2f%%) \n",
+ (long)(glob_file_size - glob_raw_data_vol),
+ (1.0*glob_file_size-1.0*glob_raw_data_vol)/(0.01*glob_file_size) );
fprintf(stderr, " \n" );
fprintf(stderr, " Times \t Minimum\t Maximum\t Average\n" );
fprintf(stderr, " Raw Data Write (sec) \t%8.4g\t%8.4g\t%8.4g \n",
@@ -1199,16 +1206,16 @@ int write_exo_mesh (char *file_name, int rank, int num_domains, int num_nodal_fi
fprintf(stderr, " \n" );
fprintf(stderr, " Output Bandwidths \t Minimum\t Maximum\t Average\n" );
fprintf(stderr, " Raw Data Write (MiB/sec) \t%8.4g\t%8.4g\t%8.4g \n",
- glob_raw_data_vol / max_raw_write_time / MBYTES,
- glob_raw_data_vol / min_raw_write_time / MBYTES,
- glob_raw_data_vol / cum_raw_write_time / MBYTES * num_iterations);
+ (double)glob_raw_data_vol / max_raw_write_time / MBYTES,
+ (double)glob_raw_data_vol / min_raw_write_time / MBYTES,
+ (double)glob_raw_data_vol / cum_raw_write_time / MBYTES * num_iterations);
fprintf(stderr, " Raw + Meta Data Write (MiB/sec) \t \t%8.4g\n",
- glob_file_size / cum_total_time / MBYTES * num_iterations );
+ (double)glob_file_size / cum_total_time / MBYTES * num_iterations );
}
free(exoid);
if (num_global_fields > 0)
free(globals);
- return( EXIT_SUCCESS );
+ return(0);
}
/*****************************************************************************/
diff --git a/cbind/test/test.dmp b/cbind/test/test.dmp
index 1b77584..2853709 100644
--- a/cbind/test/test.dmp
+++ b/cbind/test/test.dmp
@@ -10,6 +10,7 @@ dimensions:
num_el_blk = 7 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
+ num_att_in_nblk = 2 ;
num_el_in_blk1 = 1 ;
num_nod_per_el1 = 4 ;
num_att_in_blk1 = 1 ;
@@ -33,6 +34,7 @@ dimensions:
num_att_in_blk7 = 1 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -58,11 +60,15 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ float nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -107,6 +113,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ float nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
float dist_fact_ss1(num_df_ss1) ;
@@ -126,7 +134,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
char name_nset_var(num_nset_var, len_string) ;
@@ -176,10 +185,8 @@ variables:
float vals_nset_var3ns2(time_step, num_nod_ns2) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -197,18 +204,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
eb_names =
"block_1",
@@ -230,6 +233,50 @@ data:
"sset_4",
"sset_5" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
attrib1 =
@@ -311,6 +358,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
@@ -367,64 +424,66 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56, 1.58, 1.6, 1.62, 1.64, 1.66,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84, 1.87, 1.9, 1.93, 1.96, 1.99,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68, 2.74, 2.8, 2.86, 2.92, 2.98,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96, 3.03, 3.1, 3.17, 3.24, 3.31,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24, 3.32, 3.4, 3.48, 3.56, 3.64,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
+ 4.1, 4.2, 4.3 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
- 4.1, 4.2, 4.3,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5,
5.1, 5.2, 5.3 ;
diff --git a/cbind/test/test1.dmp b/cbind/test/test1.dmp
index c1e9b5e..5e8fe7b 100644
--- a/cbind/test/test1.dmp
+++ b/cbind/test/test1.dmp
@@ -58,11 +58,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int nm_prop1(num_node_maps) ;
nm_prop1:name = "ID" ;
char nmap_names(num_node_maps, len_string) ;
@@ -143,7 +145,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -168,10 +171,8 @@ variables:
float vals_elem_var3eb7(time_step, num_el_in_blk7) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is testwt1" ;
data:
@@ -189,18 +190,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 100, 50,
- 3, 6, 0, 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 100, 50, 0,
- 0, 0, 2, 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 0, 20,
- 6, 0, 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7,
+ 100, 50, 3, 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5,
+ 100, 50, 0, 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 0, 20, 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -222,6 +219,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
nm_prop1 = 333 ;
nmap_names =
@@ -397,63 +399,65 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 ;
diff --git a/cbind/test/test2-1.dmp b/cbind/test/test2-1.dmp
index 0b3b06d..fa8a74e 100644
--- a/cbind/test/test2-1.dmp
+++ b/cbind/test/test2-1.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -302,53 +304,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/cbind/test/test2-2.dmp b/cbind/test/test2-2.dmp
index 9c21cab..498f075 100644
--- a/cbind/test/test2-2.dmp
+++ b/cbind/test/test2-2.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is test 2" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -302,53 +304,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/cbind/test/test2.dmp b/cbind/test/test2.dmp
index 4d98697..0f35951 100644
--- a/cbind/test/test2.dmp
+++ b/cbind/test/test2.dmp
@@ -47,11 +47,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -114,10 +116,8 @@ variables:
char info_records(num_info, len_line) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -133,18 +133,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -164,6 +160,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
diff --git a/cbind/test/test_clb.dmp b/cbind/test/test_clb.dmp
index d5d42f1..7aa0536 100644
--- a/cbind/test/test_clb.dmp
+++ b/cbind/test/test_clb.dmp
@@ -58,40 +58,42 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
- float attrib1(num_el_in_blk1, num_att_in_blk1) ;
- char attrib_name1(num_att_in_blk1, len_string) ;
int connect1(num_el_in_blk1, num_nod_per_el1) ;
connect1:elem_type = "quad" ;
- float attrib2(num_el_in_blk2, num_att_in_blk2) ;
- char attrib_name2(num_att_in_blk2, len_string) ;
+ char attrib_name1(num_att_in_blk1, len_string) ;
+ float attrib1(num_el_in_blk1, num_att_in_blk1) ;
int connect2(num_el_in_blk2, num_nod_per_el2) ;
connect2:elem_type = "quad" ;
- float attrib3(num_el_in_blk3, num_att_in_blk3) ;
- char attrib_name3(num_att_in_blk3, len_string) ;
+ char attrib_name2(num_att_in_blk2, len_string) ;
+ float attrib2(num_el_in_blk2, num_att_in_blk2) ;
int connect3(num_el_in_blk3, num_nod_per_el3) ;
connect3:elem_type = "hex" ;
- float attrib4(num_el_in_blk4, num_att_in_blk4) ;
- char attrib_name4(num_att_in_blk4, len_string) ;
+ char attrib_name3(num_att_in_blk3, len_string) ;
+ float attrib3(num_el_in_blk3, num_att_in_blk3) ;
int connect4(num_el_in_blk4, num_nod_per_el4) ;
connect4:elem_type = "tetra" ;
- float attrib5(num_el_in_blk5, num_att_in_blk5) ;
- char attrib_name5(num_att_in_blk5, len_string) ;
+ char attrib_name4(num_att_in_blk4, len_string) ;
+ float attrib4(num_el_in_blk4, num_att_in_blk4) ;
int connect5(num_el_in_blk5, num_nod_per_el5) ;
connect5:elem_type = "wedge" ;
- float attrib6(num_el_in_blk6, num_att_in_blk6) ;
- char attrib_name6(num_att_in_blk6, len_string) ;
+ char attrib_name5(num_att_in_blk5, len_string) ;
+ float attrib5(num_el_in_blk5, num_att_in_blk5) ;
int connect6(num_el_in_blk6, num_nod_per_el6) ;
connect6:elem_type = "tetra" ;
- float attrib7(num_el_in_blk7, num_att_in_blk7) ;
- char attrib_name7(num_att_in_blk7, len_string) ;
+ char attrib_name6(num_att_in_blk6, len_string) ;
+ float attrib6(num_el_in_blk6, num_att_in_blk6) ;
int connect7(num_el_in_blk7, num_nod_per_el7) ;
connect7:elem_type = "tri" ;
+ char attrib_name7(num_att_in_blk7, len_string) ;
+ float attrib7(num_el_in_blk7, num_att_in_blk7) ;
int eb_prop2(num_el_blk) ;
eb_prop2:_FillValue = 0 ;
eb_prop2:name = "MATL" ;
@@ -126,7 +128,8 @@ variables:
char info_records(num_info, len_line) ;
float vals_glo_var(time_step, num_glo_var) ;
char name_glo_var(num_glo_var, len_string) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -178,10 +181,8 @@ variables:
int sset_var_tab(num_side_sets, num_sset_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -199,18 +200,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
eb_names =
"",
@@ -232,70 +229,75 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
- attrib1 =
- 3.1416 ;
+ connect1 =
+ 1, 2, 3, 4 ;
attrib_name1 =
"" ;
- connect1 =
- 1, 2, 3, 4 ;
+ attrib1 =
+ 3.1416 ;
- attrib2 =
- 6.1416 ;
+ connect2 =
+ 5, 6, 7, 8 ;
attrib_name2 =
"" ;
- connect2 =
- 5, 6, 7, 8 ;
-
- attrib3 =
+ attrib2 =
6.1416 ;
- attrib_name3 =
- "" ;
-
connect3 =
9, 10, 11, 12, 13, 14, 15, 16 ;
- attrib4 =
- 6.1416 ;
-
- attrib_name4 =
+ attrib_name3 =
"" ;
+ attrib3 =
+ 6.1416 ;
+
connect4 =
17, 18, 19, 20 ;
- attrib5 =
- 6.1416 ;
-
- attrib_name5 =
+ attrib_name4 =
"" ;
+ attrib4 =
+ 6.1416 ;
+
connect5 =
21, 22, 23, 24, 25, 26 ;
- attrib6 =
- 6.1416 ;
-
- attrib_name6 =
+ attrib_name5 =
"" ;
+ attrib5 =
+ 6.1416 ;
+
connect6 =
17, 18, 19, 20, 27, 28, 30, 29 ;
- attrib7 =
+ attrib_name6 =
+ "" ;
+
+ attrib6 =
6.1416 ;
+ connect7 =
+ 31, 32, 33 ;
+
attrib_name7 =
"" ;
- connect7 =
- 31, 32, 33 ;
+ attrib7 =
+ 6.1416 ;
eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
@@ -369,64 +371,66 @@ data:
name_glo_var =
"glo_vars" ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56, 1.58, 1.6, 1.62, 1.64, 1.66,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84, 1.87, 1.9, 1.93, 1.96, 1.99,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68, 2.74, 2.8, 2.86, 2.92, 2.98,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96, 3.03, 3.1, 3.17, 3.24, 3.31,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24, 3.32, 3.4, 3.48, 3.56, 3.64,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
+ 4.1, 4.2, 4.3 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
- 4.1, 4.2, 4.3,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5,
5.1, 5.2, 5.3 ;
diff --git a/cbind/test/testall b/cbind/test/testall
index 3ad1b87..beea756 100644
--- a/cbind/test/testall
+++ b/cbind/test/testall
@@ -36,157 +36,171 @@
# To run the tests with valgrind checking, uncomment the next line and comment the
# following line. Can also define other prefixes if wanted.
-#set PREFIX = "/var/scratch2/bin/valgrind --tool=memcheck"
+#set PREFIX = "valgrind --tool=memcheck"
set PREFIX = ""
+set BINDIR = /home/gdsjaar/src/exodusII-sf/exodusii/cbind/test
+set SRCDIR = /home/gdsjaar/src/exodusII-sf/exodusii/cbind/test
+set NCDUMP = /home/gdsjaar/src/SEACAS.git/bin/ncdump
echo "************************************************************************"
echo "************************************************************************"
rm -f test.output
echo "testwt - single precision write test..."
echo "begin testwt" > test.output
-${PREFIX} ./testwt >> test.output
+${PREFIX} ${BINDIR}/testwt >> test.output
echo "end testwt" >> test.output
-ncdump -d5,5 test.exo | diff - test.dmp | tee testwt.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test.dmp | tee testwt.res
echo "testrd - single precision read test..."
echo "begin testrd" >> test.output
-${PREFIX} ./testrd | diff - testrd.dmp | tee testrd.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd.dmp | tee testrd.res
echo "end testrd" >> test.output
echo "testrdv - single precision read test with varid..."
echo "begin testrdv" >> test.output
-${PREFIX} ./testrdv | diff - testrdv.dmp | tee testrdv.res
+${PREFIX} ${BINDIR}/testrdv | grep -v version | diff - ${SRCDIR}/testrdv.dmp | tee testrdv.res
echo "end testrdv" >> test.output
echo "testcp_ss - single-to-single precision copy test..."
echo "begin testcp_ss" >> test.output
-${PREFIX} ./testcp >> test.output
+${PREFIX} ${BINDIR}/testcp >> test.output
echo "end testcp_ss" >> test.output
-ncdump -d5,5 testcp.exo | diff - testcp_ss.dmp | tee testcp_ss.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res
echo "testcp_sd - single-to-double precision copy test..."
echo "begin testcp_sd" >> test.output
-${PREFIX} ./testcpd >> test.output
+${PREFIX} ${BINDIR}/testcpd >> test.output
echo "end testcp_sd" >> test.output
-ncdump -d5,5 testcpd.exo | diff - testcp_sd.dmp | tee testcp_sd.res
-
-echo "testcp_nl - normal_model to large_model single precision copy test..."
-echo "begin testcp_nl" >> test.output
-${PREFIX} ./testcp_nl >> test.output
-echo "end testcp_nl" >> test.output
-ncdump -d5,5 testcp_nl.exo | diff - testcp_nl.dmp | tee testcp_nl.res
+${NCDUMP} -d5,5 testcpd.exo | grep -v version | diff - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res
echo "testcp_ln - large model to normal model single precision copy test..."
echo "begin testcp_ln" >> test.output
-${PREFIX} ./testcp_ln >> test.output
+${PREFIX} ${BINDIR}/testcp_ln >> test.output
echo "end testcp_ln" >> test.output
-ncdump -d5,5 testcp.exo | diff - testcp_ss.dmp | tee testcp_ln.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ln.dmp | tee testcp_ln.res
+
+echo "testcp_nl - normal_model to large_model single precision copy test..."
+echo "begin testcp_nl" >> test.output
+${PREFIX} ${BINDIR}/testcp_nl >> test.output
+echo "end testcp_nl" >> test.output
+${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | diff - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res
echo "testwt_clb - single precision write test using concatenated puts..."
echo "begin testwt_clb" >> test.output
-${PREFIX} ./testwt_clb >> test.output
+${PREFIX} ${BINDIR}/testwt_clb >> test.output
echo "end testwt_clb" >> test.output
-ncdump -d5,5 test.exo | diff - test_clb.dmp | tee testwt_clb.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res
echo "testwtd - double precision write test..."
echo "begin testwtd" >> test.output
-${PREFIX} ./testwtd >> test.output
+${PREFIX} ${BINDIR}/testwtd >> test.output
echo "end testwtd" >> test.output
-ncdump -d5,5 test.exo | diff - testd.dmp | tee testwtd.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testd.dmp | tee testwtd.res
echo "testrdd - double precision read test..."
echo "begin testrdd" >> test.output
-${PREFIX} ./testrdd | diff - testrdd.dmp | tee testrdd.res
+${PREFIX} ${BINDIR}/testrdd | grep -v version | diff - ${SRCDIR}/testrdd.dmp | tee testrdd.res
echo "end testrdd" >> test.output
echo "testcp_dd - double-to-double precision copy test..."
echo "begin testcp_dd" >> test.output
-${PREFIX} ./testcpd >> test.output
+${PREFIX} ${BINDIR}/testcpd >> test.output
echo "end testcp_dd" >> test.output
-ncdump -d5,5 testcpd.exo | diff - testcp_dd.dmp | tee testcp_dd.res
+${NCDUMP} -d5,5 testcpd.exo | grep -v version | diff - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res
echo "testcp_ds - double-to-single precision copy test..."
echo "begin testcp_ds" >> test.output
-${PREFIX} ./testcp >> test.output
+${PREFIX} ${BINDIR}/testcp >> test.output
echo "end testcp_ds" >> test.output
-ncdump -d5,5 testcp.exo | diff - testcp_ds.dmp | tee testcp_ds.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res
echo "testwt1 - single precision write files with several side sets..."
echo "testwt1 ... [Expect WEDGE6 warning from this test]"
echo "begin testwt1" >> test.output
-${PREFIX} ./testwt1 >> test.output
+${PREFIX} ${BINDIR}/testwt1 >> test.output
echo "end testwt1" >> test.output
-ncdump -d5,5 test.exo | diff - test1.dmp | tee testwt1.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test1.dmp | tee testwt1.res
echo "testrd1 - single precision read test of a file with several side sets..."
echo "testrd1 ... [Expect file create failure error, NOCLOBBER]"
echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]"
echo "begin testrd1" >> test.output
-${PREFIX} ./testrd1 | diff - testrd1.dmp | tee testrd1.res
+${PREFIX} ${BINDIR}/testrd1 | grep -v version | diff - ${SRCDIR}/testrd1.dmp | tee testrd1.res
echo "end testrd1" >> test.output
echo "testwt_ss - write files to test side sets..."
echo "testwt_ss ... [Expect WEDGE6 warning from this test]"
echo "begin testwt_ss" >> test.output
-${PREFIX} ./testwt_ss >> test.output
+${PREFIX} ${BINDIR}/testwt_ss >> test.output
echo "end testwt_ss" >> test.output
-ncdump -d5,5 test.exo | diff - testwt_ss.dmp | tee testwt_ss.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res
echo "testrd_ss - read test of a file with several side sets..."
echo "testrd_ss ... [Expect warning for NULL sidesets 30 and 31]"
echo "begin testrd_ss" >> test.output
-${PREFIX} ./testrd_ss | diff - testrd_ss.dmp | tee testrd_ss.res
+${PREFIX} ${BINDIR}/testrd_ss | grep -v version | diff - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res
echo "end testrd_ss" >> test.output
echo "testwt2 - single precision write 2 files (simultaneously open) test..."
echo "begin testwt2" >> test.output
-${PREFIX} ./testwt2 >> test.output
+${PREFIX} ${BINDIR}/testwt2 >> test.output
echo "end testwt2" >> test.output
-ncdump -d5,5 test.exo | diff - test2-1.dmp | tee testwt2-1.res
-ncdump -d5,5 test2.exo | diff - test2-2.dmp | tee testwt2-2.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res
+${NCDUMP} -d5,5 test2.exo | grep -v version | diff - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res
echo "testrdwt - read from one and write to another (simutaneously open) file..."
echo "begin testrdwt" >> test.output
-${PREFIX} ./testrdwt >> test.output
+${PREFIX} ${BINDIR}/testrdwt >> test.output
echo "end testrdwt" >> test.output
-ncdump -d5,5 test2.exo | diff - test2.dmp | tee testrdwt.res
+${NCDUMP} -d5,5 test2.exo | grep -v version | diff - ${SRCDIR}/test2.dmp | tee testrdwt.res
echo "testwt_nc - write x y z components of coordinates separately..."
echo "begin testwt_nc" >> test.output
-${PREFIX} ./testwt_nc >> test.output
+${PREFIX} ${BINDIR}/testwt_nc >> test.output
echo "end testwt_nc" >> test.output
-ncdump -d5,5 test.exo | diff - test.dmp | tee testwt_nc.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test.dmp | tee testwt_nc.res
echo "testrd_nc - read x y z components of coordinates separately..."
echo "begin testrd_nc" >> test.output
-${PREFIX} ./testrd_nc | diff - testrd_nc.dmp | tee testrd_nc.res
+${PREFIX} ${BINDIR}/testrd_nc | grep -v version | diff - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res
echo "end testrd" >> test.output
echo "testwt-zeron - write file with zero nodes and elements..."
echo "begin testwt-zeron" >> test.output
-${PREFIX} ./testwt-zeron >> test.output
+${PREFIX} ${BINDIR}/testwt-zeron >> test.output
echo "end testwt-zeron" >> test.output
-ncdump -d5,5 test.exo | diff - testwt-zeron.dmp | tee testwt-zeron.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res
echo "testrd - read test of file with zero nodes and elements..."
echo "begin testrd zero nodes" >> test.output
-${PREFIX} ./testrd | diff - testrd_zeron.dmp | tee testrd_zeron.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res
echo "end testrd zero nodes" >> test.output
echo "testwt-zeroe - write file with zero elements..."
echo "begin testwt-zeroe" >> test.output
-${PREFIX} ./testwt-zeroe >> test.output
+${PREFIX} ${BINDIR}/testwt-zeroe >> test.output
echo "end testwt-zeroe" >> test.output
-ncdump -d5,5 test.exo | diff - testwt-zeroe.dmp | tee testwt-zeroe.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res
echo "testrd - read test of file with zero elements..."
echo "begin testrd zero elements" >> test.output
-${PREFIX} ./testrd | diff - testrd_zeroe.dmp | tee testrd_zeroe.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res
echo "end testrd zero elements" >> test.output
echo "testwt-one-attrib - read/write test of element attributes - read one at a time..."
echo "begin testwt-one-attrib - read attributes one at a time" >> test.output
-${PREFIX} ./testwt-one-attrib | tee testrd_zeroe.res
+${PREFIX} ${BINDIR}/testwt-one-attrib | tee testrd_zeroe.res
echo "end testwt-one-attrib - read attributes one at a time" >> test.output
+echo "testwt-nsided - write file with nsided elements..."
+echo "begin testwt-nsided" >> test.output
+${PREFIX} ${BINDIR}/testwt-nsided >> test.output
+echo "end testwt-nsided" >> test.output
+${NCDUMP} -d5,5 test-nsided.exo | grep -v version | diff - ${SRCDIR}/testwt-nsided.dmp | tee testwt-nsided.res
+
+echo "testrd-nsided - read file with nsided elements..."
+echo "begin testrd-nsided" >> test.output
+${PREFIX} ${BINDIR}/testrd-nsided | grep -v version | diff - ${SRCDIR}/testrd-nsided.dmp | tee testrd-nsided.res
+echo "end testrd-nsided" >> test.output
+
echo "************************************************************************"
echo "************************************************************************"
diff --git a/cbind/test/testall.in b/cbind/test/testall.in
index 42299a2..c0a234a 100755
--- a/cbind/test/testall.in
+++ b/cbind/test/testall.in
@@ -38,8 +38,9 @@
#set PREFIX = "valgrind --tool=memcheck"
set PREFIX = ""
-set BINDIR = @EXECUTABLE_OUTPUT_PATH@
-set SRCDIR = @ExodusII_SOURCE_DIR@/cbind/test
+set BINDIR = @CMAKE_CURRENT_BINARY_DIR@
+set SRCDIR = @CMAKE_CURRENT_SOURCE_DIR@
+set NCDUMP = @Netcdf_LIBRARY_DIRS@/../bin/ncdump
echo "************************************************************************"
echo "************************************************************************"
rm -f test.output
@@ -47,83 +48,83 @@ echo "testwt - single precision write test..."
echo "begin testwt" > test.output
${PREFIX} ${BINDIR}/testwt >> test.output
echo "end testwt" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/test.dmp | tee testwt.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test.dmp | tee testwt.res
echo "testrd - single precision read test..."
echo "begin testrd" >> test.output
-${PREFIX} ${BINDIR}/testrd | diff - ${SRCDIR}/testrd.dmp | tee testrd.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd.dmp | tee testrd.res
echo "end testrd" >> test.output
echo "testrdv - single precision read test with varid..."
echo "begin testrdv" >> test.output
-${PREFIX} ${BINDIR}/testrdv | diff - ${SRCDIR}/testrdv.dmp | tee testrdv.res
+${PREFIX} ${BINDIR}/testrdv | grep -v version | diff - ${SRCDIR}/testrdv.dmp | tee testrdv.res
echo "end testrdv" >> test.output
echo "testcp_ss - single-to-single precision copy test..."
echo "begin testcp_ss" >> test.output
${PREFIX} ${BINDIR}/testcp >> test.output
echo "end testcp_ss" >> test.output
-ncdump -d5,5 testcp.exo | diff - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res
echo "testcp_sd - single-to-double precision copy test..."
echo "begin testcp_sd" >> test.output
${PREFIX} ${BINDIR}/testcpd >> test.output
echo "end testcp_sd" >> test.output
-ncdump -d5,5 testcpd.exo | diff - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res
-
-echo "testcp_nl - normal_model to large_model single precision copy test..."
-echo "begin testcp_nl" >> test.output
-${PREFIX} ${BINDIR}/testcp_nl >> test.output
-echo "end testcp_nl" >> test.output
-ncdump -d5,5 testcp_nl.exo | diff - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res
+${NCDUMP} -d5,5 testcpd.exo | grep -v version | diff - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res
echo "testcp_ln - large model to normal model single precision copy test..."
echo "begin testcp_ln" >> test.output
${PREFIX} ${BINDIR}/testcp_ln >> test.output
echo "end testcp_ln" >> test.output
-ncdump -d5,5 testcp.exo | diff - ${SRCDIR}/testcp_ss.dmp | tee testcp_ln.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ln.dmp | tee testcp_ln.res
+
+echo "testcp_nl - normal_model to large_model single precision copy test..."
+echo "begin testcp_nl" >> test.output
+${PREFIX} ${BINDIR}/testcp_nl >> test.output
+echo "end testcp_nl" >> test.output
+${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | diff - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res
echo "testwt_clb - single precision write test using concatenated puts..."
echo "begin testwt_clb" >> test.output
${PREFIX} ${BINDIR}/testwt_clb >> test.output
echo "end testwt_clb" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res
echo "testwtd - double precision write test..."
echo "begin testwtd" >> test.output
${PREFIX} ${BINDIR}/testwtd >> test.output
echo "end testwtd" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/testd.dmp | tee testwtd.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testd.dmp | tee testwtd.res
echo "testrdd - double precision read test..."
echo "begin testrdd" >> test.output
-${PREFIX} ${BINDIR}/testrdd | diff - ${SRCDIR}/testrdd.dmp | tee testrdd.res
+${PREFIX} ${BINDIR}/testrdd | grep -v version | diff - ${SRCDIR}/testrdd.dmp | tee testrdd.res
echo "end testrdd" >> test.output
echo "testcp_dd - double-to-double precision copy test..."
echo "begin testcp_dd" >> test.output
${PREFIX} ${BINDIR}/testcpd >> test.output
echo "end testcp_dd" >> test.output
-ncdump -d5,5 testcpd.exo | diff - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res
+${NCDUMP} -d5,5 testcpd.exo | grep -v version | diff - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res
echo "testcp_ds - double-to-single precision copy test..."
echo "begin testcp_ds" >> test.output
${PREFIX} ${BINDIR}/testcp >> test.output
echo "end testcp_ds" >> test.output
-ncdump -d5,5 testcp.exo | diff - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res
+${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res
echo "testwt1 - single precision write files with several side sets..."
echo "testwt1 ... [Expect WEDGE6 warning from this test]"
echo "begin testwt1" >> test.output
${PREFIX} ${BINDIR}/testwt1 >> test.output
echo "end testwt1" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/test1.dmp | tee testwt1.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test1.dmp | tee testwt1.res
echo "testrd1 - single precision read test of a file with several side sets..."
echo "testrd1 ... [Expect file create failure error, NOCLOBBER]"
echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]"
echo "begin testrd1" >> test.output
-${PREFIX} ${BINDIR}/testrd1 | diff - ${SRCDIR}/testrd1.dmp | tee testrd1.res
+${PREFIX} ${BINDIR}/testrd1 | grep -v version | diff - ${SRCDIR}/testrd1.dmp | tee testrd1.res
echo "end testrd1" >> test.output
echo "testwt_ss - write files to test side sets..."
@@ -131,58 +132,58 @@ echo "testwt_ss ... [Expect WEDGE6 warning from this test]"
echo "begin testwt_ss" >> test.output
${PREFIX} ${BINDIR}/testwt_ss >> test.output
echo "end testwt_ss" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res
echo "testrd_ss - read test of a file with several side sets..."
echo "testrd_ss ... [Expect warning for NULL sidesets 30 and 31]"
echo "begin testrd_ss" >> test.output
-${PREFIX} ${BINDIR}/testrd_ss | diff - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res
+${PREFIX} ${BINDIR}/testrd_ss | grep -v version | diff - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res
echo "end testrd_ss" >> test.output
echo "testwt2 - single precision write 2 files (simultaneously open) test..."
echo "begin testwt2" >> test.output
${PREFIX} ${BINDIR}/testwt2 >> test.output
echo "end testwt2" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res
-ncdump -d5,5 test2.exo | diff - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res
+${NCDUMP} -d5,5 test2.exo | grep -v version | diff - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res
echo "testrdwt - read from one and write to another (simutaneously open) file..."
echo "begin testrdwt" >> test.output
${PREFIX} ${BINDIR}/testrdwt >> test.output
echo "end testrdwt" >> test.output
-ncdump -d5,5 test2.exo | diff - ${SRCDIR}/test2.dmp | tee testrdwt.res
+${NCDUMP} -d5,5 test2.exo | grep -v version | diff - ${SRCDIR}/test2.dmp | tee testrdwt.res
echo "testwt_nc - write x y z components of coordinates separately..."
echo "begin testwt_nc" >> test.output
${PREFIX} ${BINDIR}/testwt_nc >> test.output
echo "end testwt_nc" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/test.dmp | tee testwt_nc.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test.dmp | tee testwt_nc.res
echo "testrd_nc - read x y z components of coordinates separately..."
echo "begin testrd_nc" >> test.output
-${PREFIX} ${BINDIR}/testrd_nc | diff - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res
+${PREFIX} ${BINDIR}/testrd_nc | grep -v version | diff - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res
echo "end testrd" >> test.output
echo "testwt-zeron - write file with zero nodes and elements..."
echo "begin testwt-zeron" >> test.output
${PREFIX} ${BINDIR}/testwt-zeron >> test.output
echo "end testwt-zeron" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res
echo "testrd - read test of file with zero nodes and elements..."
echo "begin testrd zero nodes" >> test.output
-${PREFIX} ${BINDIR}/testrd | diff - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res
echo "end testrd zero nodes" >> test.output
echo "testwt-zeroe - write file with zero elements..."
echo "begin testwt-zeroe" >> test.output
${PREFIX} ${BINDIR}/testwt-zeroe >> test.output
echo "end testwt-zeroe" >> test.output
-ncdump -d5,5 test.exo | diff - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res
+${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res
echo "testrd - read test of file with zero elements..."
echo "begin testrd zero elements" >> test.output
-${PREFIX} ${BINDIR}/testrd | diff - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res
+${PREFIX} ${BINDIR}/testrd | grep -v version | diff - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res
echo "end testrd zero elements" >> test.output
echo "testwt-one-attrib - read/write test of element attributes - read one at a time..."
@@ -190,5 +191,27 @@ echo "begin testwt-one-attrib - read attributes one at a time" >> test.output
${PREFIX} ${BINDIR}/testwt-one-attrib | tee testrd_zeroe.res
echo "end testwt-one-attrib - read attributes one at a time" >> test.output
+echo "testwt-nsided - write file with nsided elements..."
+echo "begin testwt-nsided" >> test.output
+${PREFIX} ${BINDIR}/testwt-nsided >> test.output
+echo "end testwt-nsided" >> test.output
+${NCDUMP} -d5,5 test-nsided.exo | grep -v version | diff - ${SRCDIR}/testwt-nsided.dmp | tee testwt-nsided.res
+
+echo "testrd-nsided - read file with nsided elements..."
+echo "begin testrd-nsided" >> test.output
+${PREFIX} ${BINDIR}/testrd-nsided | grep -v version | diff - ${SRCDIR}/testrd-nsided.dmp | tee testrd-nsided.res
+echo "end testrd-nsided" >> test.output
+
+echo "testwt-nfaced - write file with nfaced elements..."
+echo "begin testwt-nfaced" >> test.output
+${PREFIX} ${BINDIR}/testwt-nfaced >> test.output
+echo "end testwt-nfaced" >> test.output
+${NCDUMP} -d5,5 test-nfaced.exo | grep -v version | diff - ${SRCDIR}/testwt-nfaced.dmp | tee testwt-nfaced.res
+
+echo "testrd-nfaced - read file with nfaced elements..."
+echo "begin testrd-nfaced" >> test.output
+${PREFIX} ${BINDIR}/testrd-nfaced | grep -v version | diff - ${SRCDIR}/testrd-nfaced.dmp | tee testrd-nfaced.res
+echo "end testrd-nfaced" >> test.output
+
echo "************************************************************************"
echo "************************************************************************"
diff --git a/cbind/test/testcp.c b/cbind/test/testcp.c
index a43b420..5858ec8 100644
--- a/cbind/test/testcp.c
+++ b/cbind/test/testcp.c
@@ -64,7 +64,7 @@ int main (int argc, char **argv)
float version;
- char *cdum;
+ char *cdum = 0;
ex_opts(EX_VERBOSE | EX_ABORT);
diff --git a/cbind/test/testcp_dd.dmp b/cbind/test/testcp_dd.dmp
index 6b4baac..e439388 100644
--- a/cbind/test/testcp_dd.dmp
+++ b/cbind/test/testcp_dd.dmp
@@ -45,11 +45,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- double coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ double coordx(num_nodes) ;
+ double coordy(num_nodes) ;
+ double coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
double attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -103,10 +105,8 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -122,18 +122,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -153,6 +149,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
diff --git a/cbind/test/testcp_ds.dmp b/cbind/test/testcp_ds.dmp
index d7ed671..194f66e 100644
--- a/cbind/test/testcp_ds.dmp
+++ b/cbind/test/testcp_ds.dmp
@@ -45,11 +45,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -103,10 +105,8 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -122,18 +122,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -153,6 +149,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
diff --git a/cbind/test/testcp_ln.c b/cbind/test/testcp_ln.c
index 11cadb7..cb37d3d 100644
--- a/cbind/test/testcp_ln.c
+++ b/cbind/test/testcp_ln.c
@@ -64,7 +64,7 @@ int main (int argc, char **argv)
float version;
- char *cdum;
+ char *cdum = 0;
ex_opts(EX_VERBOSE | EX_ABORT);
diff --git a/cbind/test/testcp_ss.dmp b/cbind/test/testcp_ln.dmp
similarity index 89%
copy from cbind/test/testcp_ss.dmp
copy to cbind/test/testcp_ln.dmp
index 4523069..4cddab0 100644
--- a/cbind/test/testcp_ss.dmp
+++ b/cbind/test/testcp_ln.dmp
@@ -10,6 +10,7 @@ dimensions:
num_el_blk = 7 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
+ num_att_in_nblk = 2 ;
num_el_in_blk1 = 1 ;
num_nod_per_el1 = 4 ;
num_att_in_blk1 = 1 ;
@@ -33,6 +34,7 @@ dimensions:
num_att_in_blk7 = 1 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -52,10 +54,12 @@ variables:
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ float nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -100,6 +104,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ float nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
float dist_fact_ss1(num_df_ss1) ;
@@ -117,8 +123,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
:file_size = 0 ;
:title = "This is a test" ;
@@ -144,11 +148,6 @@ data:
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
-
eb_names =
"block_1",
"block_2",
@@ -169,6 +168,50 @@ data:
"sset_4",
"sset_5" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
attrib1 =
@@ -250,6 +293,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
diff --git a/cbind/test/testcp_nl.c b/cbind/test/testcp_nl.c
index 79d86ce..d6dac40 100644
--- a/cbind/test/testcp_nl.c
+++ b/cbind/test/testcp_nl.c
@@ -64,7 +64,7 @@ int main (int argc, char **argv)
float version;
- char *cdum;
+ char *cdum = 0;
ex_opts(EX_VERBOSE | EX_ABORT);
@@ -73,7 +73,7 @@ int main (int argc, char **argv)
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use size in file */
- exoid = ex_open ("test.exo", /* filename path */
+ exoid = ex_open ("testcp.exo", /* filename path */
EX_READ, /* access mode = READ */
&CPU_word_size, /* CPU word size */
&IO_word_size, /* IO word size */
diff --git a/cbind/test/testcp_nl.dmp b/cbind/test/testcp_nl.dmp
index 7b53bf4..63ce157 100644
--- a/cbind/test/testcp_nl.dmp
+++ b/cbind/test/testcp_nl.dmp
@@ -1,4 +1,4 @@
-netcdf testcp_nl { // format variant: 64bit
+netcdf testcp_nl {
dimensions:
len_string = 33 ;
len_line = 81 ;
@@ -10,6 +10,7 @@ dimensions:
num_el_blk = 7 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
+ num_att_in_nblk = 2 ;
num_el_in_blk1 = 1 ;
num_nod_per_el1 = 4 ;
num_att_in_blk1 = 1 ;
@@ -33,6 +34,7 @@ dimensions:
num_att_in_blk7 = 1 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -54,10 +56,12 @@ variables:
float coordx(num_nodes) ;
float coordy(num_nodes) ;
float coordz(num_nodes) ;
- char coor_names(num_dim, len_string) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ float nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -102,6 +106,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ float nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
float dist_fact_ss1(num_df_ss1) ;
@@ -119,8 +125,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
:file_size = 1 ;
:title = "This is a test" ;
@@ -147,11 +151,6 @@ data:
coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
-
eb_names =
"block_1",
"block_2",
@@ -172,6 +171,50 @@ data:
"sset_4",
"sset_5" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
attrib1 =
@@ -253,6 +296,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
diff --git a/cbind/test/testcp_sd.dmp b/cbind/test/testcp_sd.dmp
index 5dc1f75..bb2771d 100644
--- a/cbind/test/testcp_sd.dmp
+++ b/cbind/test/testcp_sd.dmp
@@ -10,6 +10,7 @@ dimensions:
num_el_blk = 7 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
+ num_att_in_nblk = 2 ;
num_el_in_blk1 = 1 ;
num_nod_per_el1 = 4 ;
num_att_in_blk1 = 1 ;
@@ -33,6 +34,7 @@ dimensions:
num_att_in_blk7 = 1 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -51,11 +53,15 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- double coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ double coordx(num_nodes) ;
+ double coordy(num_nodes) ;
+ double coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ double nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
double attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -100,6 +106,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ double nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
double dist_fact_ss1(num_df_ss1) ;
@@ -117,10 +125,8 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -136,18 +142,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
eb_names =
"block_1",
@@ -169,6 +171,50 @@ data:
"sset_4",
"sset_5" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
attrib1 =
@@ -250,6 +296,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
diff --git a/cbind/test/testcp_ss.dmp b/cbind/test/testcp_ss.dmp
index 4523069..86d1604 100644
--- a/cbind/test/testcp_ss.dmp
+++ b/cbind/test/testcp_ss.dmp
@@ -10,6 +10,7 @@ dimensions:
num_el_blk = 7 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
+ num_att_in_nblk = 2 ;
num_el_in_blk1 = 1 ;
num_nod_per_el1 = 4 ;
num_att_in_blk1 = 1 ;
@@ -33,6 +34,7 @@ dimensions:
num_att_in_blk7 = 1 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -51,11 +53,15 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ float nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -100,6 +106,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ float nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
float dist_fact_ss1(num_df_ss1) ;
@@ -117,10 +125,8 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -136,18 +142,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
eb_names =
"block_1",
@@ -169,6 +171,50 @@ data:
"sset_4",
"sset_5" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
+
elem_map = 1, 2, 3, 4, 5, 6, 7 ;
attrib1 =
@@ -250,6 +296,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
diff --git a/cbind/test/testcpd.c b/cbind/test/testcpd.c
index 37f475f..754083c 100644
--- a/cbind/test/testcpd.c
+++ b/cbind/test/testcpd.c
@@ -64,7 +64,7 @@ int main (int argc, char **argv)
float version;
- char *cdum;
+ char *cdum = 0;
/* open EXODUS II files */
diff --git a/cbind/test/testd.dmp b/cbind/test/testd.dmp
index 0952fe1..06a015b 100644
--- a/cbind/test/testd.dmp
+++ b/cbind/test/testd.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- double coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ double coordx(num_nodes) ;
+ double coordy(num_nodes) ;
+ double coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
double attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
double vals_glo_var(time_step, num_glo_var) ;
- double vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ double vals_nod_var1(time_step, num_nodes) ;
+ double vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
double vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -302,53 +304,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/cbind/test/testrd-nfaced.c b/cbind/test/testrd-nfaced.c
new file mode 100644
index 0000000..0fc5b87
--- /dev/null
+++ b/cbind/test/testrd-nfaced.c
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2010 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* testrd - read exodus file test-nsided.exo created by testwt-nsided
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.h"
+#include <assert.h>
+#include "exodusII.h"
+
+int main (int argc, char **argv)
+{
+ int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
+ int *num_elem_in_block, *num_face_in_block, *num_nodes_per_elem, *num_edges_per_elem, *num_faces_per_elem, *num_attr;
+ int error, nnodes;
+ int i, j, k;
+ int *connect, *fconnect;
+ int *ids, *nnpe, *nnpf;
+ int num_qa_rec, num_info;
+ int CPU_word_size,IO_word_size;
+ int idum;
+
+ float *x, *y, *z;
+ float version, fdum;
+
+ char *coord_names[3], *qa_record[2][4], *info[3];
+ char *block_names[10];
+ char *elem_type[10];
+ char name[MAX_STR_LENGTH+1];
+ char *cdum = 0;
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use what is stored in file */
+
+ ex_opts (EX_VERBOSE | EX_ABORT );
+
+ /* open EXODUS II files */
+ exoid = ex_open ("test-nfaced.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 ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ printf ("test.exo is an EXODUSII file; version %4.2f\n",
+ version);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum);
+ printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum);
+
+ /* read database parameters */
+ {
+ ex_init_params par;
+ error = ex_get_init_ext (exoid, &par);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",par.title);
+ printf ("num_dim = %3d\n",par.num_dim);
+ printf ("num_nodes = %3d\n",par.num_nodes);
+ printf ("num_edge = %3d\n",par.num_edge);
+ printf ("num_face = %3d\n",par.num_face);
+ printf ("num_elem = %3d\n",par.num_elem);
+ printf ("num_elem_blk = %3d\n",par.num_elem_blk);
+ printf ("num_node_sets = %3d\n",par.num_node_sets);
+ printf ("num_side_sets = %3d\n",par.num_side_sets);
+
+ num_dim = par.num_dim;
+ num_nodes = par.num_nodes;
+ num_elem = par.num_elem;
+ num_elem_blk = par.num_elem_blk;
+ }
+
+ assert(num_dim == 3);
+
+ /* read nodal coordinates values and names from database */
+
+ x = (float *) calloc(num_nodes, sizeof(float));
+ y = (float *) calloc(num_nodes, sizeof(float));
+ z = (float *) calloc(num_nodes, sizeof(float));
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ printf ("x, y, z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\t%5.1f\t%5.1f\n", x[i], y[i], z[i]);
+ }
+
+ free (x);
+ free (y);
+ free (z);
+
+ for (i=0; i<num_dim; i++) {
+ coord_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_coord_names (exoid, coord_names);
+ printf ("\nafter ex_get_coord_names, error = %3d\n", error);
+
+ printf ("x coord name = '%s'\n", coord_names[0]);
+ printf ("y coord name = '%s'\n", coord_names[1]);
+ printf ("z coord name = '%s'\n", coord_names[2]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+ /* read element block parameters */
+ if (num_elem_blk > 0) {
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+ num_elem_in_block = (int *) calloc(num_elem_blk, sizeof(int));
+ num_face_in_block = (int *) calloc(num_elem_blk, sizeof(int));
+ num_nodes_per_elem = (int *) calloc(num_elem_blk, sizeof(int));
+ num_edges_per_elem = (int *) calloc(num_elem_blk, sizeof(int));
+ num_faces_per_elem = (int *) calloc(num_elem_blk, sizeof(int));
+ num_attr = (int *) calloc(num_elem_blk, sizeof(int));
+
+ for (i=0; i<num_elem_blk; i++) {
+ elem_type[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ block_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ error = ex_get_names(exoid, EX_ELEM_BLOCK, block_names);
+ printf ("\nafter ex_get_names, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++) {
+ ex_get_name(exoid, EX_ELEM_BLOCK, ids[i], name);
+ if (strcmp(name, block_names[i]) != 0) {
+ printf ("error in ex_get_name for block id %d\n", ids[i]);
+ }
+ error = ex_get_block (exoid, EX_ELEM_BLOCK, ids[i], elem_type[i],
+ &(num_elem_in_block[i]),
+ &(num_nodes_per_elem[i]),
+ &(num_edges_per_elem[i]),
+ &(num_faces_per_elem[i]),
+ &(num_attr[i]));
+ printf ("\nafter ex_get_elem_block, error = %d\n", error);
+
+ printf ("element block id = %2d\n",ids[i]);
+ printf ("element block type = '%s'\n", elem_type[i]);
+ printf ("num_elem_in_block = %2d\n",num_elem_in_block[i]);
+ printf ("num_total_nodes_per_block = %2d\n",num_nodes_per_elem[i]);
+ printf ("num_total_edges_per_block = %2d\n",num_edges_per_elem[i]);
+ printf ("num_total_faces_per_block = %2d\n",num_faces_per_elem[i]);
+ printf ("num_attr = %2d\n",num_attr[i]);
+ printf ("name = '%s'\n",block_names[i]);
+ }
+
+ }
+
+ /* read connectivity */
+ for (i=0; i<num_elem_blk; i++) {
+ if (num_elem_in_block[i] > 0) {
+ if (strcmp(elem_type[i], "NFACED") == 0 || strcmp(elem_type[i], "nfaced") == 0) {
+ int nfaces = 0;
+ connect = (int *) calloc((num_faces_per_elem[i]), sizeof(int));
+
+ nnpe = (int *) calloc(num_elem_in_block[i], sizeof(int));
+ error = ex_get_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ids[i], nnpe);
+ printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error);
+
+ for (j=0; j < num_elem_in_block[i]; j++) {
+ nfaces += nnpe[j];
+ }
+ assert(nfaces == num_faces_per_elem[i]);
+
+ error = ex_get_conn (exoid, EX_ELEM_BLOCK, ids[i], NULL, NULL, connect);
+ printf ("\nafter ex_get_conn, error = %d\n", error);
+
+ printf ("face connectivity array for elem block %2d\n", ids[i]);
+ nfaces = 0;
+ for (j=0; j < num_elem_in_block[i]; j++) {
+ printf("Element %d, %d faces:\t", j+1, nnpe[j]);
+ for (k=0; k < nnpe[j]; k++) {
+ printf("%3d ", connect[nfaces+k]);
+ }
+ printf("\n");
+ nfaces += nnpe[j];
+ }
+
+ /* Now get the faces and their connectivity... */
+ /*
+ * Convention is that the faces for an nfaced block are in a
+ * face block which has the same id as the element block...
+ * (Or, at least let's try that for awhile and see if it works...)
+ */
+
+ /* NOTE: We are overwriting the element block data here... */
+ error = ex_get_block (exoid, EX_FACE_BLOCK, ids[i], elem_type[i],
+ &(num_face_in_block[i]),
+ &(num_nodes_per_elem[i]),
+ NULL, NULL,
+ &(num_attr[i]));
+
+ printf ("\nafter ex_get_block (EX_FACE_BLOCK), error = %d\n", error);
+
+ error = ex_get_names(exoid, EX_FACE_BLOCK, block_names);
+ printf ("\nafter ex_get_names, error = %3d\n", error);
+
+ printf ("\tface block id = %2d\n",ids[i]);
+ printf ("\tface block type = '%s'\n", elem_type[i]);
+ printf ("\tnum_face_in_block = %2d\n",num_face_in_block[i]);
+ printf ("\tnum_total_nodes_per_block = %2d\n",num_nodes_per_elem[i]);
+ printf ("\tnum_attr = %2d\n",num_attr[i]);
+ printf ("\tname = '%s'\n",block_names[i]);
+
+ fconnect = (int *) calloc((num_nodes_per_elem[i]), sizeof(int));
+ nnpf = (int *) calloc(num_face_in_block[i], sizeof(int));
+ error = ex_get_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, ids[i], nnpf);
+ printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error);
+
+ nnodes = 0;
+ for (j=0; j < num_face_in_block[i]; j++) {
+ nnodes += nnpf[j];
+ }
+ assert(nnodes == num_nodes_per_elem[i]);
+
+ error = ex_get_conn (exoid, EX_FACE_BLOCK, ids[i], fconnect, NULL, NULL);
+ printf ("\nafter ex_get_conn, error = %d\n", error);
+
+ printf ("node connectivity array for face block %2d\n", ids[i]);
+ nnodes = 0;
+ for (j=0; j < num_face_in_block[i]; j++) {
+ printf("Face %d, %d nodes:\t", j+1, nnpf[j]);
+ for (k=0; k < nnpf[j]; k++) {
+ printf("%3d ", fconnect[nnodes+k]);
+ }
+ printf("\n");
+ nnodes += nnpf[j];
+ }
+ free(fconnect);
+ free(nnpe);
+ free(nnpf);
+ } else {
+ connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
+ sizeof(int));
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ printf ("connect array for elem block %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_per_elem[i]; j++) {
+ printf ("%3d\n", connect[j]);
+ }
+ }
+ free (connect);
+ }
+ }
+
+ for (i=0; i<num_elem_blk; i++) {
+ free(elem_type[i]);
+ free(block_names[i]);
+ }
+ if (num_elem_blk > 0) {
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_edges_per_elem);
+ free (num_faces_per_elem);
+ free (num_attr);
+ }
+
+ /* read QA records */
+ ex_inquire (exoid, EX_INQ_QA, &num_qa_rec, &fdum, cdum);
+
+ for (i=0; i<num_qa_rec; i++)
+ {
+ for (j=0; j<4; j++)
+ {
+ qa_record[i][j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ }
+
+ error = ex_get_qa (exoid, qa_record);
+ printf ("\nafter ex_get_qa, error = %3d\n", error);
+
+ printf ("QA records = \n");
+ for (i=0; i<num_qa_rec; i++)
+ {
+ for (j=0; j<4; j++)
+ {
+ printf (" '%s'\n", qa_record[i][j]);
+ free(qa_record[i][j]);
+ }
+ }
+
+ /* read information records */
+
+ error = ex_inquire (exoid, EX_INQ_INFO, &num_info, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+
+ for (i=0; i<num_info; i++)
+ {
+ info[i] = (char *) calloc ((MAX_LINE_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_info (exoid, info);
+ printf ("\nafter ex_get_info, error = %3d\n", error);
+
+ printf ("info records = \n");
+ for (i=0; i<num_info; i++)
+ {
+ printf (" '%s'\n", info[i]);
+ free(info[i]);
+ }
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrd-nfaced.dmp b/cbind/test/testrd-nfaced.dmp
new file mode 100644
index 0000000..74b691d
--- /dev/null
+++ b/cbind/test/testrd-nfaced.dmp
@@ -0,0 +1,109 @@
+
+after ex_open
+ I/O word size 4
+after ex_get_init, error = 0
+database parameters:
+title = 'This is a test'
+num_dim = 3
+num_nodes = 14
+num_edge = 0
+num_face = 15
+num_elem = 3
+num_elem_blk = 1
+num_node_sets = 0
+num_side_sets = 0
+
+after ex_get_coord, error = 0
+x, y, z coords =
+ 0.0 0.0 0.0
+ 2.0 0.0 0.0
+ 0.0 2.0 0.0
+ 2.0 2.0 0.0
+ 0.0 0.0 2.0
+ 2.0 0.0 2.0
+ 0.0 2.0 2.0
+ 2.0 2.0 2.0
+ 0.0 3.5 1.0
+ 2.0 3.5 1.0
+ 0.0 3.0 1.5
+ 2.0 3.0 1.5
+ 0.0 3.0 0.5
+ 2.0 3.0 0.5
+
+after ex_get_coord_names, error = 0
+x coord name = 'x'
+y coord name = 'y'
+z coord name = 'z'
+
+after ex_get_elem_blk_ids, error = 0
+
+after ex_get_names, error = 0
+
+after ex_get_elem_block, error = 0
+element block id = 10
+element block type = 'nfaced'
+num_elem_in_block = 3
+num_total_nodes_per_block = 0
+num_total_edges_per_block = 0
+num_total_faces_per_block = 17
+num_attr = 0
+name = 'nfaced_1'
+
+after ex_get_entity_count_per_polyhedra, error = 0
+
+after ex_get_conn, error = 0
+face connectivity array for elem block 10
+Element 1, 5 faces: 1 2 3 4 5
+Element 2, 5 faces: 4 6 7 8 9
+Element 3, 7 faces: 8 10 11 12 13 14 15
+
+after ex_get_block (EX_FACE_BLOCK), error = 0
+
+after ex_get_names, error = 0
+ face block id = 10
+ face block type = 'nsided'
+ num_face_in_block = 15
+ num_total_nodes_per_block = 58
+ num_attr = 0
+ name = 'face_block_1'
+
+after ex_get_entity_count_per_polyhedra, error = 0
+
+after ex_get_conn, error = 0
+node connectivity array for face block 10
+Face 1, 3 nodes: 5 6 8
+Face 2, 3 nodes: 2 1 4
+Face 3, 4 nodes: 6 2 4 8
+Face 4, 4 nodes: 8 4 1 5
+Face 5, 4 nodes: 1 2 6 5
+Face 6, 3 nodes: 5 8 7
+Face 7, 3 nodes: 1 3 4
+Face 8, 4 nodes: 7 8 4 3
+Face 9, 4 nodes: 7 3 1 5
+Face 10, 5 nodes: 8 4 14 10 12
+Face 11, 5 nodes: 7 11 9 13 3
+Face 12, 4 nodes: 7 8 12 11
+Face 13, 4 nodes: 11 12 10 9
+Face 14, 4 nodes: 9 10 14 13
+Face 15, 4 nodes: 13 14 4 3
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT-NFACED'
+ 'testwt-nfaced'
+ '2010/02/15'
+ '06:35:15'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_close, error = 0
diff --git a/cbind/test/testrd.c b/cbind/test/testrd-nsided.c
similarity index 65%
copy from cbind/test/testrd.c
copy to cbind/test/testrd-nsided.c
index 925ab46..6302510 100644
--- a/cbind/test/testrd.c
+++ b/cbind/test/testrd-nsided.c
@@ -34,23 +34,7 @@
*/
/*****************************************************************************
*
-* testrd - read exodus file test.exo created by testwt
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-*
-*
-* environment - UNIX
-*
-* entry conditions -
-* input parameters:
-* int exoid exodus file id
-*
-* exit conditions -
-*
-* revision history -
-*
-* $Id: testrd.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
+* testrd - read exodus file test-nsided.exo created by testwt-nsided
*
*****************************************************************************/
@@ -58,17 +42,16 @@
#include <stdio.h>
#include <string.h>
#include "netcdf.h"
+#include <assert.h>
#include "exodusII.h"
-/* #include "drmd.h" */
-
int main (int argc, char **argv)
{
int exoid, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets;
- int num_side_sets, error;
- int i, j, k, node_ctr;
+ int num_side_sets, error, nnodes;
+ int i, j, k;
int *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
- int *ids;
+ int *ids, *nnpe;
int *num_nodes_per_set, *num_elem_per_set;
int *num_df_per_set;
int *node_ind, *elem_ind, *df_ind, num_qa_rec, num_info;
@@ -79,7 +62,7 @@ int main (int argc, char **argv)
int *num_elem_in_block, *num_nodes_per_elem, *num_attr;
int num_nodes_in_set, num_elem_in_set;
int num_sides_in_set, num_df_in_set;
- int list_len, elem_list_len, node_list_len, df_list_len;
+ int list_len, elem_list_len, df_list_len;
int node_num, time_step, var_index, beg_time, end_time, elem_num;
int CPU_word_size,IO_word_size;
int num_props, prop_value, *prop_values;
@@ -93,20 +76,19 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *block_names[10], *nset_names[10], *sset_names[10];
char *attrib_names[10];
+ char *elem_type[10];
char name[MAX_STR_LENGTH+1];
- char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char title[MAX_LINE_LENGTH+1];
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
ex_opts (EX_VERBOSE | EX_ABORT );
/* open EXODUS II files */
- exoid = ex_open ("test.exo", /* filename path */
+ exoid = ex_open ("test-nsided.exo", /* filename path */
EX_READ, /* access mode = READ */
&CPU_word_size, /* CPU word size */
&IO_word_size, /* IO word size */
@@ -117,15 +99,12 @@ int main (int argc, char **argv)
printf ("test.exo is an EXODUSII file; version %4.2f\n",
version);
- /* printf (" CPU word size %1d\n",CPU_word_size); */
printf (" I/O word size %1d\n",IO_word_size);
- ex_inquire(exoid,EX_INQ_API_VERS, &idum, &version, cdum);
- printf ("EXODUSII API; version %4.2f\n", version);
- /* ncopts = NC_VERBOSE; */
+ ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum);
+ printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum);
/* read database parameters */
-
error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
&num_elem_blk, &num_node_sets, &num_side_sets);
@@ -173,16 +152,6 @@ int main (int argc, char **argv)
}
}
- /*
- error = ex_get_1_coord (exoid, 2, x, y, z);
- printf ("\nafter ex_get_1_coord, error = %3d\n", error);
-
- printf ("x coord of node 2 = \n");
- printf ("%f \n", x[0]);
-
- printf ("y coord of node 2 = \n");
- printf ("%f \n", y[0]);
- */
free (x);
free (y);
if (num_dim >= 3)
@@ -203,29 +172,55 @@ int main (int argc, char **argv)
for (i=0; i<num_dim; i++)
free(coord_names[i]);
-
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODAL, 0, &num_attrs);
+ printf ("num nodal attributes = %d\n", num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodal attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODAL, 0, j+1, attrib);
+ for (i=0; i < num_nodes; i++) {
+ printf ("%5.1f\n", attrib[i]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
+
/* read element order map */
-
elem_map = (int *) calloc(num_elem, sizeof(int));
error = ex_get_map (exoid, elem_map);
printf ("\nafter ex_get_map, error = %3d\n", error);
- for (i=0; i<num_elem; i++)
- {
- printf ("elem_map(%d) = %d \n", i, elem_map[i]);
- }
+ for (i=0; i<num_elem; i++) {
+ printf ("elem_map(%d) = %d \n", i, elem_map[i]);
+ }
free (elem_map);
/* read element block parameters */
-
if (num_elem_blk > 0) {
ids = (int *) calloc(num_elem_blk, sizeof(int));
num_elem_in_block = (int *) calloc(num_elem_blk, sizeof(int));
num_nodes_per_elem = (int *) calloc(num_elem_blk, sizeof(int));
num_attr = (int *) calloc(num_elem_blk, sizeof(int));
+ for (i=0; i<num_elem_blk; i++) {
+ elem_type[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
error = ex_get_elem_blk_ids (exoid, ids);
printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
@@ -236,113 +231,125 @@ int main (int argc, char **argv)
error = ex_get_names(exoid, EX_ELEM_BLOCK, block_names);
printf ("\nafter ex_get_names, error = %3d\n", error);
- for (i=0; i<num_elem_blk; i++)
- {
- ex_get_name(exoid, EX_ELEM_BLOCK, ids[i], name);
- if (strcmp(name, block_names[i]) != 0) {
- printf ("error in ex_get_name for block id %d\n", ids[i]);
- }
- error = ex_get_elem_block (exoid, ids[i], elem_type,
- &(num_elem_in_block[i]),
- &(num_nodes_per_elem[i]), &(num_attr[i]));
- printf ("\nafter ex_get_elem_block, error = %d\n", error);
-
- printf ("element block id = %2d\n",ids[i]);
- printf ("element type = '%s'\n", elem_type);
- printf ("num_elem_in_block = %2d\n",num_elem_in_block[i]);
- printf ("num_nodes_per_elem = %2d\n",num_nodes_per_elem[i]);
- printf ("num_attr = %2d\n",num_attr[i]);
- printf ("name = '%s'\n",block_names[i]);
- free(block_names[i]);
+ for (i=0; i<num_elem_blk; i++) {
+ ex_get_name(exoid, EX_ELEM_BLOCK, ids[i], name);
+ if (strcmp(name, block_names[i]) != 0) {
+ printf ("error in ex_get_name for block id %d\n", ids[i]);
}
+ error = ex_get_elem_block (exoid, ids[i], elem_type[i],
+ &(num_elem_in_block[i]),
+ &(num_nodes_per_elem[i]), &(num_attr[i]));
+ printf ("\nafter ex_get_elem_block, error = %d\n", error);
+
+ printf ("element block id = %2d\n",ids[i]);
+ printf ("element type = '%s'\n", elem_type[i]);
+ printf ("num_elem_in_block = %2d\n",num_elem_in_block[i]);
+ printf ("num_total_nodes_per_block = %2d\n",num_nodes_per_elem[i]);
+ printf ("num_attr = %2d\n",num_attr[i]);
+ printf ("name = '%s'\n",block_names[i]);
+ free(block_names[i]);
+ }
/* read element block properties */
error = ex_inquire (exoid, EX_INQ_EB_PROP, &num_props, &fdum, cdum);
printf ("\nafter ex_inquire, error = %d\n", error);
printf ("\nThere are %2d properties for each element block\n", num_props);
- for (i=0; i<num_props; i++)
- {
- prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
- }
+ for (i=0; i<num_props; i++) {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
error = ex_get_prop_names(exoid,EX_ELEM_BLOCK,prop_names);
printf ("after ex_get_prop_names, error = %d\n", error);
- for (i=0; i<num_props; i++)
- {
- for (j=0; j<num_elem_blk; j++)
- {
- error = ex_get_prop(exoid, EX_ELEM_BLOCK, ids[j], prop_names[i],
- &prop_value);
- if (error == 0)
- printf ("element block %2d, property(%2d): '%s'= %5d\n",
- j+1, i+1, prop_names[i], prop_value);
- else
- printf ("after ex_get_prop, error = %d\n", error);
- }
+ for (i=1; i<num_props; i++) {/* Prop 1 is id; skip that here */
+ for (j=0; j<num_elem_blk; j++) {
+ error = ex_get_prop(exoid, EX_ELEM_BLOCK, ids[j], prop_names[i],
+ &prop_value);
+ if (error == 0)
+ printf ("element block %2d, property(%2d): '%s'= %5d\n",
+ j+1, i+1, prop_names[i], prop_value);
+ else
+ printf ("after ex_get_prop, error = %d\n", error);
}
-
+ }
+
for (i=0; i<num_props; i++)
free(prop_names[i]);
}
/* read element connectivity */
-
- for (i=0; i<num_elem_blk; i++)
- {
- connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
- sizeof(int));
-
- error = ex_get_elem_conn (exoid, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
-
- printf ("connect array for elem block %2d\n", ids[i]);
-
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%3d\n", connect[j]);
- }
- /*
- error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
- printf ("node list for first element of element block %d \n ", ids[i]);
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%d \n", connect[j]);
- }
- */
+ for (i=0; i<num_elem_blk; i++) {
+ if (num_elem_in_block[i] > 0) {
+ if (strcmp(elem_type[i], "NSIDED") == 0 || strcmp(elem_type[i], "nsided") == 0) {
+ connect = (int *) calloc((num_nodes_per_elem[i]), sizeof(int));
+
+ nnpe = (int *) calloc(num_elem_in_block[i], sizeof(int));
+ error = ex_get_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ids[i], nnpe);
+ printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error);
+
+ nnodes = 0;
+ for (j=0; j < num_elem_in_block[i]; j++) {
+ nnodes += nnpe[j];
+ }
+ assert(nnodes == num_nodes_per_elem[i]);
+
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ printf ("connect array for elem block %2d\n", ids[i]);
+ nnodes = 0;
+ for (j=0; j < num_elem_in_block[i]; j++) {
+ printf("Element %d, %d nodes:\t", j+1, nnpe[j]);
+ for (k=0; k < nnpe[j]; k++) {
+ printf("%3d ", connect[nnodes+k]);
+ }
+ printf("\n");
+ nnodes += nnpe[j];
+ }
+ } else {
+ connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
+ sizeof(int));
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ printf ("connect array for elem block %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_per_elem[i]; j++) {
+ printf ("%3d\n", connect[j]);
+ }
+ }
free (connect);
-
}
+ }
/* read element block attributes */
-
- for (i=0; i<num_elem_blk; i++)
- {
- for (j=0; j<num_attr[i]; j++)
- attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
-
- attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
- error = ex_get_elem_attr (exoid, ids[i], attrib);
- printf ("\n after ex_get_elem_attr, error = %d\n", error);
-
- if (error == 0) {
- error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
- printf (" after ex_get_elem_attr_names, error = %d\n", error);
+ if (num_attr[i] > 0) {
+ for (i=0; i<num_elem_blk; i++) {
+ if (num_elem_in_block[i] > 0) {
+ for (j=0; j<num_attr[i]; j++)
+ attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+
+ attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
+ error = ex_get_elem_attr (exoid, ids[i], attrib);
+ printf ("\n after ex_get_elem_attr, error = %d\n", error);
if (error == 0) {
- printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
+ printf (" after ex_get_elem_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ }
}
+ free (attrib);
+ for (j=0; j<num_attr[i]; j++)
+ free (attrib_names[j]);
}
- free (attrib);
- for (j=0; j<num_attr[i]; j++)
- free (attrib_names[j]);
}
-
+ }
+
if (num_elem_blk > 0) {
free (ids);
free (num_nodes_per_elem);
@@ -370,47 +377,73 @@ int main (int argc, char **argv)
printf ("error in ex_get_name for nodeset id %d\n", ids[i]);
}
- error = ex_get_node_set_param (exoid, ids[i],
- &num_nodes_in_set, &num_df_in_set);
- printf ("\nafter ex_get_node_set_param, error = %3d\n", error);
+ error = ex_get_node_set_param (exoid, ids[i],
+ &num_nodes_in_set, &num_df_in_set);
+ printf ("\nafter ex_get_node_set_param, error = %3d\n", error);
- printf ("\nnode set %2d parameters: \n", ids[i]);
- printf ("num_nodes = %2d\n", num_nodes_in_set);
+ printf ("\nnode set %2d parameters: \n", ids[i]);
+ printf ("num_nodes = %2d\n", num_nodes_in_set);
printf ("name = '%s'\n", nset_names[i]);
free(nset_names[i]);
- node_list = (int *) calloc(num_nodes_in_set, sizeof(int));
- dist_fact = (float *) calloc(num_nodes_in_set, sizeof(float));
-
- error = ex_get_node_set (exoid, ids[i], node_list);
- printf ("\nafter ex_get_node_set, error = %3d\n", error);
-
- if (num_df_in_set > 0)
- {
- error = ex_get_node_set_dist_fact (exoid, ids[i], dist_fact);
- printf ("\nafter ex_get_node_set_dist_fact, error = %3d\n", error);
- }
-
- printf ("\nnode list for node set %2d\n", ids[i]);
-
- for (j=0; j<num_nodes_in_set; j++)
- {
- printf ("%3d\n", node_list[j]);
- }
-
- if (num_df_in_set > 0)
- {
- printf ("dist factors for node set %2d\n", ids[i]);
-
- for (j=0; j<num_nodes_in_set; j++)
- {
- printf ("%5.2f\n", dist_fact[j]);
- }
- }
- else
- printf ("no dist factors for node set %2d\n", ids[i]);
-
- free (node_list);
- free (dist_fact);
+ node_list = (int *) calloc(num_nodes_in_set, sizeof(int));
+ dist_fact = (float *) calloc(num_nodes_in_set, sizeof(float));
+
+ error = ex_get_node_set (exoid, ids[i], node_list);
+ printf ("\nafter ex_get_node_set, error = %3d\n", error);
+
+ if (num_df_in_set > 0)
+ {
+ error = ex_get_node_set_dist_fact (exoid, ids[i], dist_fact);
+ printf ("\nafter ex_get_node_set_dist_fact, error = %3d\n", error);
+ }
+
+ printf ("\nnode list for node set %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_in_set; j++)
+ {
+ printf ("%3d\n", node_list[j]);
+ }
+
+ if (num_df_in_set > 0)
+ {
+ printf ("dist factors for node set %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_in_set; j++)
+ {
+ printf ("%5.2f\n", dist_fact[j]);
+ }
+ }
+ else
+ printf ("no dist factors for node set %2d\n", ids[i]);
+
+ free (node_list);
+ free (dist_fact);
+
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODE_SET, ids[i], &num_attrs);
+ printf ("num nodeset attributes for nodeset %d = %d\n", ids[i], num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODE_SET, ids[i], attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes_in_set,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodeset attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODE_SET, ids[i], j+1, attrib);
+ for (k=0; k < num_nodes_in_set; k++) {
+ printf ("%5.1f\n", attrib[k]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
}
free(ids);
@@ -421,7 +454,7 @@ int main (int argc, char **argv)
for (i=0; i<num_props; i++)
{
- prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
}
prop_values = (int *) calloc (num_node_sets, sizeof(int));
@@ -431,14 +464,14 @@ int main (int argc, char **argv)
for (i=0; i<num_props; i++)
{
- error = ex_get_prop_array(exoid, EX_NODE_SET, prop_names[i],
- prop_values);
- if (error == 0)
- for (j=0; j<num_node_sets; j++)
- printf ("node set %2d, property(%2d): '%s'= %5d\n",
- j+1, i+1, prop_names[i], prop_values[j]);
- else
- printf ("after ex_get_prop_array, error = %d\n", error);
+ error = ex_get_prop_array(exoid, EX_NODE_SET, prop_names[i],
+ prop_values);
+ if (error == 0)
+ for (j=0; j<num_node_sets; j++)
+ printf ("node set %2d, property(%2d): '%s'= %5d\n",
+ j+1, i+1, prop_names[i], prop_values[j]);
+ else
+ printf ("after ex_get_prop_array, error = %d\n", error);
}
for (i=0; i<num_props; i++)
free(prop_names[i]);
@@ -459,16 +492,16 @@ int main (int argc, char **argv)
error = ex_inquire (exoid, EX_INQ_NS_NODE_LEN, &list_len, &fdum, cdum);
printf ("\nafter ex_inquire: EX_INQ_NS_NODE_LEN = %d, error = %3d\n",
- list_len, error);
+ list_len, error);
node_list = (int *) calloc(list_len, sizeof(int));
error = ex_inquire (exoid, EX_INQ_NS_DF_LEN, &list_len, &fdum, cdum);
printf ("\nafter ex_inquire: EX_INQ_NS_DF_LEN = %d, error = %3d\n",
- list_len, error);
+ list_len, error);
dist_fact = (float *) calloc(list_len, sizeof(float));
error = ex_get_concat_node_sets (exoid,ids,num_nodes_per_set,num_df_per_set,
- node_ind, df_ind, node_list, dist_fact);
+ node_ind, df_ind, node_list, dist_fact);
printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
printf ("\nconcatenated node set info\n");
@@ -518,78 +551,62 @@ int main (int argc, char **argv)
printf ("error in ex_get_name for sideset id %d\n", ids[i]);
}
- error = ex_get_side_set_param (exoid, ids[i], &num_sides_in_set,
- &num_df_in_set);
- printf ("\nafter ex_get_side_set_param, error = %3d\n", error);
+ error = ex_get_side_set_param (exoid, ids[i], &num_sides_in_set,
+ &num_df_in_set);
+ printf ("\nafter ex_get_side_set_param, error = %3d\n", error);
- printf ("side set %2d parameters:\n",ids[i]);
+ printf ("side set %2d parameters:\n",ids[i]);
printf ("name = '%s'\n", sset_names[i]);
- printf ("num_sides = %3d\n",num_sides_in_set);
- printf ("num_dist_factors = %3d\n", num_df_in_set);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
free(sset_names[i]);
- /* Note: The # of elements is same as # of sides! */
- num_elem_in_set = num_sides_in_set;
- elem_list = (int *) calloc(num_elem_in_set, sizeof(int));
- side_list = (int *) calloc(num_sides_in_set, sizeof(int));
- node_ctr_list = (int *) calloc(num_elem_in_set, sizeof(int));
- node_list = (int *) calloc(num_elem_in_set*21, sizeof(int));
- dist_fact = (float *) calloc(num_df_in_set, sizeof(float));
+ /* Note: The # of elements is same as # of sides! */
+ num_elem_in_set = num_sides_in_set;
+ elem_list = (int *) calloc(num_elem_in_set, sizeof(int));
+ side_list = (int *) calloc(num_sides_in_set, sizeof(int));
+ node_ctr_list = (int *) calloc(num_elem_in_set, sizeof(int));
+ node_list = (int *) calloc(num_elem_in_set*21, sizeof(int));
+ dist_fact = (float *) calloc(num_df_in_set, sizeof(float));
- error = ex_get_side_set (exoid, ids[i], elem_list, side_list);
- printf ("\nafter ex_get_side_set, error = %3d\n", error);
+ error = ex_get_side_set (exoid, ids[i], elem_list, side_list);
+ printf ("\nafter ex_get_side_set, error = %3d\n", error);
- error = ex_get_side_set_node_list (exoid, ids[i], node_ctr_list,
- node_list);
- printf ("\nafter ex_get_side_set_node_list, error = %3d\n", error);
-
- if (num_df_in_set > 0)
- {
- error = ex_get_side_set_dist_fact (exoid, ids[i], dist_fact);
- printf ("\nafter ex_get_side_set_dist_fact, error = %3d\n", error);
- }
-
- printf ("element list for side set %2d\n", ids[i]);
- for (j=0; j<num_elem_in_set; j++)
- {
- printf ("%3d\n", elem_list[j]);
- }
+ if (num_df_in_set > 0) {
+ error = ex_get_side_set_dist_fact (exoid, ids[i], dist_fact);
+ printf ("\nafter ex_get_side_set_dist_fact, error = %3d\n", error);
+ }
- printf ("side list for side set %2d\n", ids[i]);
- for (j=0; j<num_sides_in_set; j++)
- {
- printf ("%3d\n", side_list[j]);
- }
+ printf ("element list for side set %2d\n", ids[i]);
+ for (j=0; j<num_elem_in_set; j++)
+ {
+ printf ("%3d\n", elem_list[j]);
+ }
- node_ctr = 0;
- printf ("node list for side set %2d\n", ids[i]);
- for (k=0; k<num_elem_in_set; k++)
- {
- for (j=0; j<node_ctr_list[k]; j++)
- {
- printf ("%3d\n", node_list[node_ctr+j]);
- }
- node_ctr += node_ctr_list[k];
- }
+ printf ("side list for side set %2d\n", ids[i]);
+ for (j=0; j<num_sides_in_set; j++)
+ {
+ printf ("%3d\n", side_list[j]);
+ }
- if (num_df_in_set > 0)
- {
- printf ("dist factors for side set %2d\n", ids[i]);
+ if (num_df_in_set > 0)
+ {
+ printf ("dist factors for side set %2d\n", ids[i]);
- for (j=0; j<num_df_in_set; j++)
- {
- printf ("%5.3f\n", dist_fact[j]);
- }
- }
- else
- printf ("no dist factors for side set %2d\n", ids[i]);
+ for (j=0; j<num_df_in_set; j++)
+ {
+ printf ("%5.3f\n", dist_fact[j]);
+ }
+ }
+ else
+ printf ("no dist factors for side set %2d\n", ids[i]);
- free (elem_list);
- free (side_list);
- free (node_ctr_list);
- free (node_list);
- free (dist_fact);
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
}
@@ -598,50 +615,43 @@ int main (int argc, char **argv)
printf ("\nafter ex_inquire, error = %d\n", error);
printf ("\nThere are %2d properties for each side set\n", num_props);
- for (i=0; i<num_props; i++)
- {
- prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
- }
+ for (i=0; i<num_props; i++) {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
error = ex_get_prop_names(exoid,EX_SIDE_SET,prop_names);
printf ("after ex_get_prop_names, error = %d\n", error);
- for (i=0; i<num_props; i++)
- {
- for (j=0; j<num_side_sets; j++)
- {
- error = ex_get_prop(exoid, EX_SIDE_SET, ids[j], prop_names[i],
- &prop_value);
- if (error == 0)
- printf ("side set %2d, property(%2d): '%s'= %5d\n",
- j+1, i+1, prop_names[i], prop_value);
- else
- printf ("after ex_get_prop, error = %d\n", error);
- }
- }
+ for (i=0; i<num_props; i++) {
+ for (j=0; j<num_side_sets; j++)
+ {
+ error = ex_get_prop(exoid, EX_SIDE_SET, ids[j], prop_names[i],
+ &prop_value);
+ if (error == 0)
+ printf ("side set %2d, property(%2d): '%s'= %5d\n",
+ j+1, i+1, prop_names[i], prop_value);
+ else
+ printf ("after ex_get_prop, error = %d\n", error);
+ }
+ }
for (i=0; i<num_props; i++)
free(prop_names[i]);
free (ids);
error = ex_inquire (exoid, EX_INQ_SIDE_SETS, &num_side_sets, &fdum, cdum);
printf ("\nafter ex_inquire: EX_INQ_SIDE_SETS = %d, error = %d\n",
- num_side_sets, error);
-
- if (num_side_sets > 0)
- {
- error = ex_inquire(exoid, EX_INQ_SS_ELEM_LEN, &elem_list_len, &fdum, cdum);
- printf ("\nafter ex_inquire: EX_INQ_SS_ELEM_LEN = %d, error = %d\n",
- elem_list_len, error);
+ num_side_sets, error);
- error = ex_inquire(exoid, EX_INQ_SS_NODE_LEN, &node_list_len, &fdum, cdum);
- printf ("\nafter ex_inquire: EX_INQ_SS_NODE_LEN = %d, error = %d\n",
- node_list_len, error);
+ if (num_side_sets > 0) {
+ error = ex_inquire(exoid, EX_INQ_SS_ELEM_LEN, &elem_list_len, &fdum, cdum);
+ printf ("\nafter ex_inquire: EX_INQ_SS_ELEM_LEN = %d, error = %d\n",
+ elem_list_len, error);
- error = ex_inquire(exoid, EX_INQ_SS_DF_LEN, &df_list_len, &fdum, cdum);
- printf ("\nafter ex_inquire: EX_INQ_SS_DF_LEN = %d, error = %d\n",
- df_list_len, error);
- }
+ error = ex_inquire(exoid, EX_INQ_SS_DF_LEN, &df_list_len, &fdum, cdum);
+ printf ("\nafter ex_inquire: EX_INQ_SS_DF_LEN = %d, error = %d\n",
+ df_list_len, error);
+ }
/* read concatenated side sets; this produces the same information as
* the above code which reads individual side sets
@@ -660,8 +670,8 @@ int main (int argc, char **argv)
dist_fact = (float *) calloc(df_list_len, sizeof(float));
error = ex_get_concat_side_sets (exoid, ids, num_elem_per_set,
- num_df_per_set, elem_ind, df_ind,
- elem_list, side_list, dist_fact);
+ num_df_per_set, elem_ind, df_ind,
+ elem_list, side_list, dist_fact);
printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
printf ("concatenated side set info\n");
@@ -708,9 +718,9 @@ int main (int argc, char **argv)
for (i=0; i<num_qa_rec; i++)
{
for (j=0; j<4; j++)
- {
- qa_record[i][j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
- }
+ {
+ qa_record[i][j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
}
error = ex_get_qa (exoid, qa_record);
@@ -720,10 +730,10 @@ int main (int argc, char **argv)
for (i=0; i<num_qa_rec; i++)
{
for (j=0; j<4; j++)
- {
- printf (" '%s'\n", qa_record[i][j]);
- free(qa_record[i][j]);
- }
+ {
+ printf (" '%s'\n", qa_record[i][j]);
+ free(qa_record[i][j]);
+ }
}
/* read information records */
@@ -760,7 +770,7 @@ int main (int argc, char **argv)
printf ("\nafter ex_get_var_names, error = %3d\n", error);
printf ("There are %2d global variables; their names are :\n",
- num_glo_vars);
+ num_glo_vars);
for (i=0; i<num_glo_vars; i++)
{
printf (" '%s'\n", var_names[i]);
@@ -775,7 +785,7 @@ int main (int argc, char **argv)
for (i=0; i<num_nod_vars; i++)
{
- var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
}
error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
@@ -784,8 +794,8 @@ int main (int argc, char **argv)
printf ("There are %2d nodal variables; their names are :\n", num_nod_vars);
for (i=0; i<num_nod_vars; i++)
{
- printf (" '%s'\n", var_names[i]);
- free(var_names[i]);
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
}
}
@@ -798,18 +808,18 @@ int main (int argc, char **argv)
for (i=0; i<num_ele_vars; i++)
{
- var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
}
error = ex_get_var_names (exoid, "e", num_ele_vars, var_names);
printf ("\nafter ex_get_var_names, error = %3d\n", error);
printf ("There are %2d element variables; their names are :\n",
- num_ele_vars);
+ num_ele_vars);
for (i=0; i<num_ele_vars; i++)
{
- printf (" '%s'\n", var_names[i]);
- free(var_names[i]);
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
}
/* read element variable truth table */
@@ -824,9 +834,9 @@ int main (int argc, char **argv)
k = 0;
for (i=0; i<num_elem_blk*num_ele_vars; i++)
- {
- printf ("%2d\n", truth_tab[k++]);
- }
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
free (truth_tab);
}
}
@@ -966,7 +976,7 @@ int main (int argc, char **argv)
var_values = (float *) calloc (num_time_steps, sizeof(float));
error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
- var_values);
+ var_values);
printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
printf ("global variable %2d values through time:\n", var_index);
@@ -980,11 +990,11 @@ int main (int argc, char **argv)
var_values = (float *) calloc (num_nodes, sizeof(float));
error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes,
- var_values);
+ var_values);
printf ("\nafter ex_get_nodal_var, error = %3d\n", error);
printf ("nodal variable %2d values at time step %2d\n", var_index,
- time_step);
+ time_step);
for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
free (var_values);
@@ -995,11 +1005,11 @@ int main (int argc, char **argv)
node_num = 1;
error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
- end_time, var_values);
+ end_time, var_values);
printf ("\nafter ex_get_nodal_var_time, error = %3d\n", error);
printf ("nodal variable %2d values for node %2d through time:\n", var_index,
- node_num);
+ node_num);
for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
free (var_values);
@@ -1014,22 +1024,24 @@ int main (int argc, char **argv)
for (i=0; i<num_elem_blk; i++)
{
- var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
+ if (num_elem_in_block[i] > 0) {
+ var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
- error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
- num_elem_in_block[i], var_values);
- printf ("\nafter ex_get_elem_var, error = %3d\n", error);
+ error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
+ num_elem_in_block[i], var_values);
+ printf ("\nafter ex_get_elem_var, error = %3d\n", error);
- if (!error)
- {
- printf
- ("element variable %2d values of element block %2d at time step %2d\n",
- var_index, ids[i], time_step);
- for (j=0; j<num_elem_in_block[i]; j++)
- printf ("%5.3f\n", var_values[j]);
- }
+ if (!error)
+ {
+ printf
+ ("element variable %2d values of element block %2d at time step %2d\n",
+ var_index, ids[i], time_step);
+ for (j=0; j<num_elem_in_block[i]; j++)
+ printf ("%5.3f\n", var_values[j]);
+ }
- free (var_values);
+ free (var_values);
+ }
}
free (num_elem_in_block);
free(ids);
@@ -1042,11 +1054,11 @@ int main (int argc, char **argv)
var_index = 2;
elem_num = 2;
error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
- end_time, var_values);
+ end_time, var_values);
printf ("\nafter ex_get_elem_var_time, error = %3d\n", error);
printf ("element variable %2d values for element %2d through time:\n",
- var_index, elem_num);
+ var_index, elem_num);
for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
free (var_values);
@@ -1062,22 +1074,22 @@ int main (int argc, char **argv)
for (i=0; i<num_side_sets; i++)
{
- var_values = (float *) calloc (num_elem_per_set[i], sizeof(float));
+ var_values = (float *) calloc (num_elem_per_set[i], sizeof(float));
- error = ex_get_sset_var (exoid, time_step, var_index, ids[i],
- num_elem_per_set[i], var_values);
- printf ("\nafter ex_get_sset_var, error = %3d\n", error);
+ error = ex_get_sset_var (exoid, time_step, var_index, ids[i],
+ num_elem_per_set[i], var_values);
+ printf ("\nafter ex_get_sset_var, error = %3d\n", error);
- if (!error)
- {
- printf
- ("sideset variable %2d values of sideset %2d at time step %2d\n",
- var_index, ids[i], time_step);
- for (j=0; j<num_elem_per_set[i]; j++)
- printf ("%5.3f\n", var_values[j]);
- }
+ if (!error)
+ {
+ printf
+ ("sideset variable %2d values of sideset %2d at time step %2d\n",
+ var_index, ids[i], time_step);
+ for (j=0; j<num_elem_per_set[i]; j++)
+ printf ("%5.3f\n", var_values[j]);
+ }
- free (var_values);
+ free (var_values);
}
free (num_elem_per_set);
free(ids);
@@ -1093,22 +1105,22 @@ int main (int argc, char **argv)
for (i=0; i<num_node_sets; i++)
{
- var_values = (float *) calloc (num_nodes_per_set[i], sizeof(float));
+ var_values = (float *) calloc (num_nodes_per_set[i], sizeof(float));
- error = ex_get_nset_var (exoid, time_step, var_index, ids[i],
- num_nodes_per_set[i], var_values);
- printf ("\nafter ex_get_nset_var, error = %3d\n", error);
+ error = ex_get_nset_var (exoid, time_step, var_index, ids[i],
+ num_nodes_per_set[i], var_values);
+ printf ("\nafter ex_get_nset_var, error = %3d\n", error);
- if (!error)
- {
- printf
- ("nodeset variable %2d values of nodeset %2d at time step %2d\n",
- var_index, ids[i], time_step);
- for (j=0; j<num_nodes_per_set[i]; j++)
- printf ("%5.3f\n", var_values[j]);
- }
+ if (!error)
+ {
+ printf
+ ("nodeset variable %2d values of nodeset %2d at time step %2d\n",
+ var_index, ids[i], time_step);
+ for (j=0; j<num_nodes_per_set[i]; j++)
+ printf ("%5.3f\n", var_values[j]);
+ }
- free (var_values);
+ free (var_values);
}
free(ids);
}
diff --git a/cbind/test/testrdd.dmp b/cbind/test/testrd-nsided.dmp
similarity index 65%
copy from cbind/test/testrdd.dmp
copy to cbind/test/testrd-nsided.dmp
index ed2165b..ab42f39 100644
--- a/cbind/test/testrdd.dmp
+++ b/cbind/test/testrd-nsided.dmp
@@ -1,15 +1,13 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
- CPU word size 8
- I/O word size 8
+ I/O word size 4
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
num_dim = 3
-num_nodes = 26
-num_elem = 5
-num_elem_blk = 5
+num_nodes = 33
+num_elem = 7
+num_elem_blk = 1
num_node_sets = 2
num_side_sets = 5
@@ -41,6 +39,13 @@ x coords =
3.0
6.0
0.0
+ 2.7
+ 6.0
+ 5.7
+ 3.7
+ 0.0
+ 10.0
+ 10.0
y coords =
0.0
0.0
@@ -68,6 +73,13 @@ y coords =
2.0
2.0
2.0
+ 1.7
+ 1.7
+ 1.7
+ 0.0
+ 0.0
+ 0.0
+ 10.0
z coords =
0.0
0.0
@@ -95,10 +107,87 @@ z coords =
6.0
2.0
0.0
+ 2.7
+ 3.3
+ 1.7
+ 2.3
+ 0.0
+ 0.0
+ 10.0
after ex_get_coord_names, error = 0
x coord name = 'xcoor'
y coord name = 'ycoor'
+num nodal attributes = 2
+ after ex_get_attr_names, error = 0
+nodal attribute 0 = 'Node_attr_1'
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
+ 2.0
+ 2.0
+ 1.0
+ 0.0
+ 10.0
+ 10.0
+ 1.0
+ 1.0
+ 10.0
+ 10.0
+ 1.0
+ 0.0
+ 1.0
+ 10.0
+ 7.0
+ 3.0
+ 6.0
+ 0.0
+ 3.0
+ 6.0
+ 0.0
+ 2.7
+ 6.0
+ 5.7
+ 3.7
+ 0.0
+ 10.0
+ 10.0
+nodal attribute 1 = 'Node_attr_2'
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 10.0
+ 10.0
+ 10.0
+ 10.0
+ 0.0
+ 0.0
+ 0.0
+ 5.0
+ 0.0
+ 0.0
+ 0.0
+ 2.0
+ 2.0
+ 2.0
+ 1.7
+ 1.7
+ 1.7
+ 0.0
+ 0.0
+ 0.0
+ 10.0
after ex_get_map, error = 0
elem_map(0) = 1
@@ -106,126 +195,47 @@ elem_map(1) = 2
elem_map(2) = 3
elem_map(3) = 4
elem_map(4) = 5
+elem_map(5) = 6
+elem_map(6) = 7
after ex_get_elem_blk_ids, error = 0
-after ex_get_elem_block, error = 0
-element block id = 10
-element type = 'quad'
-num_elem_in_block = 1
-num_nodes_per_elem = 4
-num_attr = 1
-
-after ex_get_elem_block, error = 0
-element block id = 11
-element type = 'quad'
-num_elem_in_block = 1
-num_nodes_per_elem = 4
-num_attr = 1
+after ex_get_names, error = 0
after ex_get_elem_block, error = 0
-element block id = 12
-element type = 'hex'
-num_elem_in_block = 1
-num_nodes_per_elem = 8
-num_attr = 1
-
-after ex_get_elem_block, error = 0
-element block id = 13
-element type = 'tetra'
-num_elem_in_block = 1
-num_nodes_per_elem = 4
-num_attr = 1
-
-after ex_get_elem_block, error = 0
-element block id = 14
-element type = 'wedge'
-num_elem_in_block = 1
-num_nodes_per_elem = 6
-num_attr = 1
+element block id = 10
+element type = 'nsided'
+num_elem_in_block = 7
+num_total_nodes_per_block = 37
+num_attr = 0
+name = 'nsided_1'
after ex_inquire, error = 0
-There are 3 properties for each element block
+There are 1 properties for each element block
after ex_get_prop_names, error = 0
-element block 1, property( 1): 'ID'= 10
-element block 2, property( 1): 'ID'= 11
-element block 3, property( 1): 'ID'= 12
-element block 4, property( 1): 'ID'= 13
-element block 5, property( 1): 'ID'= 14
-element block 1, property( 2): 'MATL'= 10
-element block 2, property( 2): 'MATL'= 20
-element block 3, property( 2): 'MATL'= 30
-element block 4, property( 2): 'MATL'= 40
-element block 5, property( 2): 'MATL'= 50
-element block 1, property( 3): 'DENSITY'= 0
-element block 2, property( 3): 'DENSITY'= 0
-element block 3, property( 3): 'DENSITY'= 0
-element block 4, property( 3): 'DENSITY'= 0
-element block 5, property( 3): 'DENSITY'= 0
-
-after ex_get_elem_conn, error = 0
-connect array for elem block 10
- 1
- 2
- 3
- 4
-after ex_get_elem_conn, error = 0
-connect array for elem block 11
- 5
- 6
- 7
- 8
+after ex_get_entity_count_per_polyhedra, error = 0
after ex_get_elem_conn, error = 0
-connect array for elem block 12
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
-
-after ex_get_elem_conn, error = 0
-connect array for elem block 13
- 17
- 18
- 19
- 20
-
-after ex_get_elem_conn, error = 0
-connect array for elem block 14
- 21
- 22
- 23
- 24
- 25
- 26
-
- after ex_get_elem_attr, error = 0
-element block 10 attributes = 3.14159000
-
- after ex_get_elem_attr, error = 0
-element block 11 attributes = 6.14159000
-
- after ex_get_elem_attr, error = 0
-element block 12 attributes = 6.14159000
-
- after ex_get_elem_attr, error = 0
-element block 13 attributes = 6.14159000
-
- after ex_get_elem_attr, error = 0
-element block 14 attributes = 6.14159000
+connect array for elem block 10
+Element 1, 4 nodes: 1 2 3 4
+Element 2, 4 nodes: 5 6 7 8
+Element 3, 8 nodes: 9 10 11 12 13 14 15 16
+Element 4, 4 nodes: 17 18 19 20
+Element 5, 6 nodes: 21 22 23 24 25 26
+Element 6, 8 nodes: 17 18 19 20 27 28 30 29
+Element 7, 3 nodes: 31 32 33
after ex_get_node_set_ids, error = 0
+after ex_get_names, error = 0
+
after ex_get_node_set_param, error = 0
node set 20 parameters:
num_nodes = 5
+name = 'nset_1'
after ex_get_node_set, error = 0
@@ -243,11 +253,20 @@ dist factors for node set 20
3.00
4.00
5.00
+num nodeset attributes for nodeset 20 = 1
+ after ex_get_attr_names, error = 0
+nodeset attribute 0 = 'Nodeset_attribute'
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
after ex_get_node_set_param, error = 0
node set 21 parameters:
num_nodes = 3
+name = 'nset_2'
after ex_get_node_set, error = 0
@@ -261,6 +280,7 @@ dist factors for node set 21
1.10
2.10
3.10
+num nodeset attributes for nodeset 21 = 0
after ex_inquire, error = 0
@@ -312,15 +332,16 @@ dist_fact =
after ex_get_side_set_ids, error = 0
+after ex_get_names, error = 0
+
after ex_get_side_set_param, error = 0
side set 30 parameters:
+name = 'sset_1'
num_sides = 2
num_dist_factors = 4
after ex_get_side_set, error = 0
-after ex_get_side_set_node_list, error = 0
-
after ex_get_side_set_dist_fact, error = 0
element list for side set 30
2
@@ -328,11 +349,6 @@ element list for side set 30
side list for side set 30
4
2
-node list for side set 30
- 8
- 5
- 6
- 7
dist factors for side set 30
30.000
30.100
@@ -341,13 +357,12 @@ dist factors for side set 30
after ex_get_side_set_param, error = 0
side set 31 parameters:
+name = 'sset_2'
num_sides = 2
num_dist_factors = 4
after ex_get_side_set, error = 0
-after ex_get_side_set_node_list, error = 0
-
after ex_get_side_set_dist_fact, error = 0
element list for side set 31
1
@@ -355,11 +370,6 @@ element list for side set 31
side list for side set 31
2
3
-node list for side set 31
- 2
- 3
- 7
- 8
dist factors for side set 31
31.000
31.100
@@ -368,12 +378,11 @@ dist factors for side set 31
after ex_get_side_set_param, error = 0
side set 32 parameters:
+name = 'sset_3'
num_sides = 7
num_dist_factors = 0
after ex_get_side_set, error = 0
-
-after ex_get_side_set_node_list, error = 0
element list for side set 32
3
3
@@ -390,109 +399,64 @@ side list for side set 32
4
1
6
-node list for side set 32
- 9
- 12
- 11
- 10
- 11
- 12
- 16
- 15
- 11
- 12
- 16
- 15
- 10
- 11
- 15
- 14
- 9
- 13
- 16
- 12
- 9
- 10
- 14
- 13
- 13
- 14
- 15
- 16
no dist factors for side set 32
after ex_get_side_set_param, error = 0
side set 33 parameters:
-num_sides = 4
+name = 'sset_4'
+num_sides = 8
num_dist_factors = 0
after ex_get_side_set, error = 0
-
-after ex_get_side_set_node_list, error = 0
element list for side set 33
4
4
4
4
+ 6
+ 6
+ 6
+ 6
side list for side set 33
1
2
3
4
-node list for side set 33
- 17
- 18
- 20
- 18
- 19
- 20
- 17
- 20
- 19
- 17
- 19
- 18
+ 1
+ 2
+ 3
+ 4
no dist factors for side set 33
after ex_get_side_set_param, error = 0
side set 34 parameters:
-num_sides = 5
+name = 'sset_5'
+num_sides = 10
num_dist_factors = 0
after ex_get_side_set, error = 0
-
-after ex_get_side_set_node_list, error = 0
element list for side set 34
5
5
5
5
5
+ 7
+ 7
+ 7
+ 7
+ 7
side list for side set 34
1
2
3
4
5
-node list for side set 34
- 21
- 22
- 25
- 24
- 22
- 23
- 26
- 25
- 21
- 24
- 26
- 23
- 21
- 23
- 22
- 24
- 25
- 26
+ 1
+ 2
+ 3
+ 4
+ 5
no dist factors for side set 34
after ex_inquire, error = 0
@@ -512,9 +476,7 @@ side set 5, property( 2): 'COLOR'= 0
after ex_inquire: EX_INQ_SIDE_SETS = 5, error = 0
-after ex_inquire: EX_INQ_SS_ELEM_LEN = 20, error = 0
-
-after ex_inquire: EX_INQ_SS_NODE_LEN = 66, error = 0
+after ex_inquire: EX_INQ_SS_ELEM_LEN = 29, error = 0
after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
@@ -530,8 +492,8 @@ num_elem_per_set =
2
2
7
- 4
- 5
+ 8
+ 10
num_dist_per_set =
4
4
@@ -543,7 +505,7 @@ elem_ind =
2
4
11
- 15
+ 19
dist_ind =
0
4
@@ -566,11 +528,20 @@ elem_list =
4
4
4
+ 6
+ 6
+ 6
+ 6
5
5
5
5
5
+ 7
+ 7
+ 7
+ 7
+ 7
side_list =
4
2
@@ -591,6 +562,15 @@ side_list =
2
3
4
+ 1
+ 2
+ 3
+ 4
+ 5
+ 1
+ 2
+ 3
+ 4
5
dist_fact =
30.000
@@ -604,22 +584,22 @@ dist_fact =
after ex_get_qa, error = 0
QA records =
- 'TESTWTD'
- 'testwtd'
+ 'TESTWT'
+ 'testwt'
'07/07/93'
'15:41:33'
- 'FASTQ'
- 'fastq'
- '07/07/93'
- '16:41:33'
+ ''
+ ''
+ ''
+ ''
after ex_inquire, error = 0
after ex_get_info, error = 0
info records =
'This is the first information record.'
- 'This is the second information record.'
- 'This is the third information record.'
+ ''
+ ''
after ex_get_var_param, error = 0
@@ -631,7 +611,7 @@ after ex_get_var_param, error = 0
after ex_get_var_names, error = 0
There are 2 nodal variables; their names are :
- 'nod_var0'
+ 'node_variable_a_very_long_name_0'
'nod_var1'
after ex_get_var_param, error = 0
@@ -647,6 +627,37 @@ This is the element variable truth table:
1
1
1
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 nodeset variables; their names are :
+ 'ns_var0'
+ 'ns_var1'
+ 'ns_var2'
+
+after ex_get_nset_var_tab, error = 0
+This is the nodeset variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 sideset variables; their names are :
+ 'ss_var0'
+ 'ss_var1'
+ 'ss_var2'
+
+after ex_get_sset_var_tab, error = 0
+This is the sideset variable truth table:
+ 1
+ 1
+ 1
1
1
1
@@ -724,6 +735,13 @@ nodal variable 1 values at time step 3
1.720
1.750
1.780
+1.810
+1.840
+1.870
+1.900
+1.930
+1.960
+1.990
after ex_get_nodal_var_time, error = 0
nodal variable 1 values for node 1 through time:
@@ -743,34 +761,86 @@ nodal variable 1 values for node 1 through time:
after ex_get_elem_var, error = 0
element variable 1 values of element block 10 at time step 3
4.030
+4.060
+4.090
+4.120
+4.150
+4.180
+4.210
-after ex_get_elem_var, error = 0
-element variable 1 values of element block 11 at time step 3
-5.030
-
-after ex_get_elem_var, error = 0
-element variable 1 values of element block 12 at time step 3
-6.030
-
-after ex_get_elem_var, error = 0
-element variable 1 values of element block 13 at time step 3
+after ex_get_elem_var_time, error = 0
+element variable 2 values for element 2 through time:
+5.020
+5.040
+5.060
+5.080
+5.100
+5.120
+5.140
+5.160
+5.180
+5.200
+
+ after ex_get_side_set_ids, error = 0
+
+after ex_get_sset_var, error = 0
+sideset variable 2 values of sideset 30 at time step 3
7.030
+7.060
-after ex_get_elem_var, error = 0
-element variable 1 values of element block 14 at time step 3
+after ex_get_sset_var, error = 0
+sideset variable 2 values of sideset 31 at time step 3
8.030
-
-after ex_get_elem_var_time, error = 0
-element variable 2 values for element 2 through time:
-6.010
-6.020
-6.030
-6.040
-6.050
-6.060
-6.070
-6.080
-6.090
-6.100
+8.060
+
+after ex_get_sset_var, error = 0
+sideset variable 2 values of sideset 32 at time step 3
+9.030
+9.060
+9.090
+9.120
+9.150
+9.180
+9.210
+
+after ex_get_sset_var, error = 0
+sideset variable 2 values of sideset 33 at time step 3
+10.030
+10.060
+10.090
+10.120
+10.150
+10.180
+10.210
+10.240
+
+after ex_get_sset_var, error = 0
+sideset variable 2 values of sideset 34 at time step 3
+11.030
+11.060
+11.090
+11.120
+11.150
+11.180
+11.210
+11.240
+11.270
+11.300
+
+ after ex_get_node_set_ids, error = 0
+
+after ex_get_nset_var, error = 0
+nodeset variable 2 values of nodeset 20 at time step 3
+9.030
+9.060
+9.090
+9.120
+9.150
+
+after ex_get_nset_var, error = 0
+nodeset variable 2 values of nodeset 21 at time step 3
+10.030
+10.060
+10.090
after ex_close, error = 0
diff --git a/cbind/test/testrd.c b/cbind/test/testrd-partial.c
similarity index 90%
copy from cbind/test/testrd.c
copy to cbind/test/testrd-partial.c
index 925ab46..04f1667 100644
--- a/cbind/test/testrd.c
+++ b/cbind/test/testrd-partial.c
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: testrd.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
*
*****************************************************************************/
@@ -95,11 +94,9 @@ int main (int argc, char **argv)
char *attrib_names[10];
char name[MAX_STR_LENGTH+1];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
@@ -122,6 +119,9 @@ int main (int argc, char **argv)
ex_inquire(exoid,EX_INQ_API_VERS, &idum, &version, cdum);
printf ("EXODUSII API; version %4.2f\n", version);
+ ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum);
+ printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum);
+
/* ncopts = NC_VERBOSE; */
/* read database parameters */
@@ -203,7 +203,32 @@ int main (int argc, char **argv)
for (i=0; i<num_dim; i++)
free(coord_names[i]);
-
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODAL, 0, &num_attrs);
+ printf ("num nodal attributes = %d\n", num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodal attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODAL, 0, j+1, attrib);
+ for (i=0; i < num_nodes; i++) {
+ printf ("%5.1f\n", attrib[i]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
+
/* read element order map */
elem_map = (int *) calloc(num_elem, sizeof(int));
@@ -270,7 +295,7 @@ int main (int argc, char **argv)
printf ("after ex_get_prop_names, error = %d\n", error);
- for (i=0; i<num_props; i++)
+ for (i=1; i<num_props; i++) /* Prop 1 is id; skip that here */
{
for (j=0; j<num_elem_blk; j++)
{
@@ -292,57 +317,60 @@ int main (int argc, char **argv)
for (i=0; i<num_elem_blk; i++)
{
- connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
- sizeof(int));
-
- error = ex_get_elem_conn (exoid, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
-
- printf ("connect array for elem block %2d\n", ids[i]);
-
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%3d\n", connect[j]);
- }
- /*
- error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
- printf ("node list for first element of element block %d \n ", ids[i]);
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%d \n", connect[j]);
- }
- */
- free (connect);
-
+ if (num_elem_in_block[i] > 0) {
+ connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
+ sizeof(int));
+
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+
+ printf ("connect array for elem block %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_per_elem[i]; j++)
+ {
+ printf ("%3d\n", connect[j]);
+ }
+ /*
+ error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ printf ("node list for first element of element block %d \n ", ids[i]);
+ for (j=0; j<num_nodes_per_elem[i]; j++)
+ {
+ printf ("%d \n", connect[j]);
+ }
+ */
+ free (connect);
+ }
}
/* read element block attributes */
for (i=0; i<num_elem_blk; i++)
{
- for (j=0; j<num_attr[i]; j++)
- attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
-
- attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
- error = ex_get_elem_attr (exoid, ids[i], attrib);
- printf ("\n after ex_get_elem_attr, error = %d\n", error);
-
- if (error == 0) {
- error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
- printf (" after ex_get_elem_attr_names, error = %d\n", error);
+ if (num_elem_in_block[i] > 0) {
+ for (j=0; j<num_attr[i]; j++)
+ attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+
+ attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
+ error = ex_get_elem_attr (exoid, ids[i], attrib);
+ printf ("\n after ex_get_elem_attr, error = %d\n", error);
if (error == 0) {
- printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
+ printf (" after ex_get_elem_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ }
}
+ free (attrib);
+ for (j=0; j<num_attr[i]; j++)
+ free (attrib_names[j]);
}
- free (attrib);
- for (j=0; j<num_attr[i]; j++)
- free (attrib_names[j]);
}
-
+
if (num_elem_blk > 0) {
free (ids);
free (num_nodes_per_elem);
@@ -411,6 +439,32 @@ int main (int argc, char **argv)
free (node_list);
free (dist_fact);
+
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODE_SET, ids[i], &num_attrs);
+ printf ("num nodeset attributes for nodeset %d = %d\n", ids[i], num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODE_SET, ids[i], attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes_in_set,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodeset attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODE_SET, ids[i], j+1, attrib);
+ for (k=0; k < num_nodes_in_set; k++) {
+ printf ("%5.1f\n", attrib[k]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
}
free(ids);
@@ -1014,22 +1068,24 @@ int main (int argc, char **argv)
for (i=0; i<num_elem_blk; i++)
{
- var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
+ if (num_elem_in_block[i] > 0) {
+ var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
- error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
- num_elem_in_block[i], var_values);
- printf ("\nafter ex_get_elem_var, error = %3d\n", error);
+ error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
+ num_elem_in_block[i], var_values);
+ printf ("\nafter ex_get_elem_var, error = %3d\n", error);
- if (!error)
- {
- printf
- ("element variable %2d values of element block %2d at time step %2d\n",
- var_index, ids[i], time_step);
- for (j=0; j<num_elem_in_block[i]; j++)
- printf ("%5.3f\n", var_values[j]);
- }
+ if (!error)
+ {
+ printf
+ ("element variable %2d values of element block %2d at time step %2d\n",
+ var_index, ids[i], time_step);
+ for (j=0; j<num_elem_in_block[i]; j++)
+ printf ("%5.3f\n", var_values[j]);
+ }
- free (var_values);
+ free (var_values);
+ }
}
free (num_elem_in_block);
free(ids);
diff --git a/cbind/test/testrd.c b/cbind/test/testrd.c
index 925ab46..04f1667 100644
--- a/cbind/test/testrd.c
+++ b/cbind/test/testrd.c
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: testrd.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
*
*****************************************************************************/
@@ -95,11 +94,9 @@ int main (int argc, char **argv)
char *attrib_names[10];
char name[MAX_STR_LENGTH+1];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
@@ -122,6 +119,9 @@ int main (int argc, char **argv)
ex_inquire(exoid,EX_INQ_API_VERS, &idum, &version, cdum);
printf ("EXODUSII API; version %4.2f\n", version);
+ ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum);
+ printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum);
+
/* ncopts = NC_VERBOSE; */
/* read database parameters */
@@ -203,7 +203,32 @@ int main (int argc, char **argv)
for (i=0; i<num_dim; i++)
free(coord_names[i]);
-
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODAL, 0, &num_attrs);
+ printf ("num nodal attributes = %d\n", num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodal attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODAL, 0, j+1, attrib);
+ for (i=0; i < num_nodes; i++) {
+ printf ("%5.1f\n", attrib[i]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
+
/* read element order map */
elem_map = (int *) calloc(num_elem, sizeof(int));
@@ -270,7 +295,7 @@ int main (int argc, char **argv)
printf ("after ex_get_prop_names, error = %d\n", error);
- for (i=0; i<num_props; i++)
+ for (i=1; i<num_props; i++) /* Prop 1 is id; skip that here */
{
for (j=0; j<num_elem_blk; j++)
{
@@ -292,57 +317,60 @@ int main (int argc, char **argv)
for (i=0; i<num_elem_blk; i++)
{
- connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
- sizeof(int));
-
- error = ex_get_elem_conn (exoid, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
-
- printf ("connect array for elem block %2d\n", ids[i]);
-
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%3d\n", connect[j]);
- }
- /*
- error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
- printf ("\nafter ex_get_elem_conn, error = %d\n", error);
-
- printf ("node list for first element of element block %d \n ", ids[i]);
- for (j=0; j<num_nodes_per_elem[i]; j++)
- {
- printf ("%d \n", connect[j]);
- }
- */
- free (connect);
-
+ if (num_elem_in_block[i] > 0) {
+ connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]),
+ sizeof(int));
+
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+
+ printf ("connect array for elem block %2d\n", ids[i]);
+
+ for (j=0; j<num_nodes_per_elem[i]; j++)
+ {
+ printf ("%3d\n", connect[j]);
+ }
+ /*
+ error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ printf ("node list for first element of element block %d \n ", ids[i]);
+ for (j=0; j<num_nodes_per_elem[i]; j++)
+ {
+ printf ("%d \n", connect[j]);
+ }
+ */
+ free (connect);
+ }
}
/* read element block attributes */
for (i=0; i<num_elem_blk; i++)
{
- for (j=0; j<num_attr[i]; j++)
- attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
-
- attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
- error = ex_get_elem_attr (exoid, ids[i], attrib);
- printf ("\n after ex_get_elem_attr, error = %d\n", error);
-
- if (error == 0) {
- error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
- printf (" after ex_get_elem_attr_names, error = %d\n", error);
+ if (num_elem_in_block[i] > 0) {
+ for (j=0; j<num_attr[i]; j++)
+ attrib_names[j] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+
+ attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
+ error = ex_get_elem_attr (exoid, ids[i], attrib);
+ printf ("\n after ex_get_elem_attr, error = %d\n", error);
if (error == 0) {
- printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
+ printf (" after ex_get_elem_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
+ }
}
+ free (attrib);
+ for (j=0; j<num_attr[i]; j++)
+ free (attrib_names[j]);
}
- free (attrib);
- for (j=0; j<num_attr[i]; j++)
- free (attrib_names[j]);
}
-
+
if (num_elem_blk > 0) {
free (ids);
free (num_nodes_per_elem);
@@ -411,6 +439,32 @@ int main (int argc, char **argv)
free (node_list);
free (dist_fact);
+
+ {
+ int num_attrs = 0;
+ error = ex_get_attr_param(exoid, EX_NODE_SET, ids[i], &num_attrs);
+ printf ("num nodeset attributes for nodeset %d = %d\n", ids[i], num_attrs);
+ if (num_attrs > 0) {
+ for (j=0; j<num_attrs; j++) {
+ attrib_names[j] = (char *)calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ error = ex_get_attr_names (exoid, EX_NODE_SET, ids[i], attrib_names);
+ printf (" after ex_get_attr_names, error = %d\n", error);
+
+ if (error == 0) {
+ attrib = (float *) calloc(num_nodes_in_set,sizeof(float));
+ for (j=0; j<num_attrs; j++) {
+ printf ("nodeset attribute %d = '%s'\n", j, attrib_names[j]);
+ error = ex_get_one_attr(exoid, EX_NODE_SET, ids[i], j+1, attrib);
+ for (k=0; k < num_nodes_in_set; k++) {
+ printf ("%5.1f\n", attrib[k]);
+ }
+ free(attrib_names[j]);
+ }
+ free(attrib);
+ }
+ }
+ }
}
free(ids);
@@ -1014,22 +1068,24 @@ int main (int argc, char **argv)
for (i=0; i<num_elem_blk; i++)
{
- var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
+ if (num_elem_in_block[i] > 0) {
+ var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
- error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
- num_elem_in_block[i], var_values);
- printf ("\nafter ex_get_elem_var, error = %3d\n", error);
+ error = ex_get_elem_var (exoid, time_step, var_index, ids[i],
+ num_elem_in_block[i], var_values);
+ printf ("\nafter ex_get_elem_var, error = %3d\n", error);
- if (!error)
- {
- printf
- ("element variable %2d values of element block %2d at time step %2d\n",
- var_index, ids[i], time_step);
- for (j=0; j<num_elem_in_block[i]; j++)
- printf ("%5.3f\n", var_values[j]);
- }
+ if (!error)
+ {
+ printf
+ ("element variable %2d values of element block %2d at time step %2d\n",
+ var_index, ids[i], time_step);
+ for (j=0; j<num_elem_in_block[i]; j++)
+ printf ("%5.3f\n", var_values[j]);
+ }
- free (var_values);
+ free (var_values);
+ }
}
free (num_elem_in_block);
free(ids);
diff --git a/cbind/test/testrd.dmp b/cbind/test/testrd.dmp
index e00bb31..d5ebca6 100644
--- a/cbind/test/testrd.dmp
+++ b/cbind/test/testrd.dmp
@@ -1,8 +1,6 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
@@ -120,6 +118,76 @@ z coords =
after ex_get_coord_names, error = 0
x coord name = 'xcoor'
y coord name = 'ycoor'
+num nodal attributes = 2
+ after ex_get_attr_names, error = 0
+nodal attribute 0 = 'Node_attr_1'
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
+ 2.0
+ 2.0
+ 1.0
+ 0.0
+ 10.0
+ 10.0
+ 1.0
+ 1.0
+ 10.0
+ 10.0
+ 1.0
+ 0.0
+ 1.0
+ 10.0
+ 7.0
+ 3.0
+ 6.0
+ 0.0
+ 3.0
+ 6.0
+ 0.0
+ 2.7
+ 6.0
+ 5.7
+ 3.7
+ 0.0
+ 10.0
+ 10.0
+nodal attribute 1 = 'Node_attr_2'
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 10.0
+ 10.0
+ 10.0
+ 10.0
+ 0.0
+ 0.0
+ 0.0
+ 5.0
+ 0.0
+ 0.0
+ 0.0
+ 2.0
+ 2.0
+ 2.0
+ 1.7
+ 1.7
+ 1.7
+ 0.0
+ 0.0
+ 0.0
+ 10.0
after ex_get_map, error = 0
elem_map(0) = 1
@@ -194,13 +262,6 @@ after ex_inquire, error = 0
There are 3 properties for each element block
after ex_get_prop_names, error = 0
-element block 1, property( 1): 'ID'= 10
-element block 2, property( 1): 'ID'= 11
-element block 3, property( 1): 'ID'= 12
-element block 4, property( 1): 'ID'= 13
-element block 5, property( 1): 'ID'= 14
-element block 6, property( 1): 'ID'= 15
-element block 7, property( 1): 'ID'= 16
element block 1, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 10
element block 2, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 20
element block 3, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 30
@@ -328,6 +389,14 @@ dist factors for node set 20
3.00
4.00
5.00
+num nodeset attributes for nodeset 20 = 1
+ after ex_get_attr_names, error = 0
+nodeset attribute 0 = 'Nodeset_attribute'
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
after ex_get_node_set_param, error = 0
@@ -347,6 +416,7 @@ dist factors for node set 21
1.10
2.10
3.10
+num nodeset attributes for nodeset 21 = 0
after ex_inquire, error = 0
diff --git a/cbind/test/testrd1.c b/cbind/test/testrd1.c
index 9c4998d..7cdca45 100644
--- a/cbind/test/testrd1.c
+++ b/cbind/test/testrd1.c
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: testrd1.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
*
*****************************************************************************/
@@ -89,12 +88,10 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
char *map_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
diff --git a/cbind/test/testrd1.dmp b/cbind/test/testrd1.dmp
index c8ce164..13ade90 100644
--- a/cbind/test/testrd1.dmp
+++ b/cbind/test/testrd1.dmp
@@ -2,9 +2,7 @@
after ex_create (NO_CLOBBER), error = -1
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is testwt1'
diff --git a/cbind/test/testrd_nc.c b/cbind/test/testrd_nc.c
index ddeb8ab..997c1c8 100644
--- a/cbind/test/testrd_nc.c
+++ b/cbind/test/testrd_nc.c
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: testrd_nc.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
*
*****************************************************************************/
@@ -90,11 +89,9 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
diff --git a/cbind/test/testrd_nc.dmp b/cbind/test/testrd_nc.dmp
index 506c17e..f497853 100644
--- a/cbind/test/testrd_nc.dmp
+++ b/cbind/test/testrd_nc.dmp
@@ -1,8 +1,6 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
diff --git a/cbind/test/testrd_ss.c b/cbind/test/testrd_ss.c
index 40b6509..5be5c2a 100644
--- a/cbind/test/testrd_ss.c
+++ b/cbind/test/testrd_ss.c
@@ -81,9 +81,7 @@ int main (int argc, char **argv)
float version, fdum;
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
-
- cdum = 0;
+ char *cdum = 0;
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
diff --git a/cbind/test/testrd_ss.dmp b/cbind/test/testrd_ss.dmp
index 2149fa0..e0bb5ec 100644
--- a/cbind/test/testrd_ss.dmp
+++ b/cbind/test/testrd_ss.dmp
@@ -1,8 +1,6 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
diff --git a/cbind/test/testrd_zeroe.dmp b/cbind/test/testrd_zeroe.dmp
index 43b7e0d..88f4686 100644
--- a/cbind/test/testrd_zeroe.dmp
+++ b/cbind/test/testrd_zeroe.dmp
@@ -1,8 +1,6 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
@@ -120,6 +118,7 @@ z coords =
after ex_get_coord_names, error = 0
x coord name = 'xcoor'
y coord name = 'ycoor'
+num nodal attributes = 0
after ex_get_map, error = 0
@@ -149,6 +148,7 @@ dist factors for node set 20
3.00
4.00
5.00
+num nodeset attributes for nodeset 20 = 0
after ex_get_node_set_param, error = 0
@@ -168,6 +168,7 @@ dist factors for node set 21
1.10
2.10
3.10
+num nodeset attributes for nodeset 21 = 0
after ex_inquire, error = 0
diff --git a/cbind/test/testrd_zeron.dmp b/cbind/test/testrd_zeron.dmp
index a222a94..4f5a3e3 100644
--- a/cbind/test/testrd_zeron.dmp
+++ b/cbind/test/testrd_zeron.dmp
@@ -1,15 +1,13 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
num_dim = 3
num_nodes = 0
num_elem = 0
-num_elem_blk = 0
+num_elem_blk = 7
num_node_sets = 0
num_side_sets = 0
@@ -21,9 +19,75 @@ z coords =
after ex_get_coord_names, error = 0
x coord name = 'xcoor'
y coord name = 'ycoor'
+num nodal attributes = 0
after ex_get_map, error = 0
+after ex_get_elem_blk_ids, error = 0
+
+after ex_get_names, error = 0
+
+after ex_get_elem_block, error = 0
+element block id = 10
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 11
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 12
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 13
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 14
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'NULL'
+num_elem_in_block = 0
+num_nodes_per_elem = 0
+num_attr = 0
+name = ''
+
+after ex_inquire, error = 0
+
+There are 1 properties for each element block
+after ex_get_prop_names, error = 0
+
after ex_get_qa, error = 0
QA records =
'TESTWT'
@@ -85,4 +149,6 @@ global variable 1 values through time:
0.180
0.200
+ after ex_get_elem_blk_ids, error = 0
+
after ex_close, error = 0
diff --git a/cbind/test/testrdd.c b/cbind/test/testrdd.c
index 34042eb..aaea247 100644
--- a/cbind/test/testrdd.c
+++ b/cbind/test/testrdd.c
@@ -52,7 +52,6 @@
* Original L. A. Schoof
* 04/05/93 V.R. Yarberry - revised so that output resembles Fortran version
* 06/25/93 VRY - revised to match 2.00 API.
-* $Id: testrdd.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
*
*****************************************************************************/
@@ -89,11 +88,9 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 8; /* sizeof(double) */
IO_word_size = 0; /* use what is stored in file */
diff --git a/cbind/test/testrdd.dmp b/cbind/test/testrdd.dmp
index ed2165b..024507c 100644
--- a/cbind/test/testrdd.dmp
+++ b/cbind/test/testrdd.dmp
@@ -1,6 +1,5 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
CPU word size 8
I/O word size 8
after ex_get_init, error = 0
diff --git a/cbind/test/testrdv.c b/cbind/test/testrdv.c
index aec5a3c..c4c5ddb 100644
--- a/cbind/test/testrdv.c
+++ b/cbind/test/testrdv.c
@@ -51,7 +51,6 @@
*
* revision history -
*
-* $Id: testrdv.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
@@ -93,11 +92,9 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
- char *cdum;
+ char *cdum = 0;
char *prop_names[3];
- cdum = 0;
-
CPU_word_size = 0; /* sizeof(float) */
IO_word_size = 0; /* use what is stored in file */
diff --git a/cbind/test/testrdv.dmp b/cbind/test/testrdv.dmp
index c889ca7..5af654e 100644
--- a/cbind/test/testrdv.dmp
+++ b/cbind/test/testrdv.dmp
@@ -1,8 +1,6 @@
after ex_open
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
-EXODUSII API; version 4.46
after ex_get_init, error = 0
database parameters:
title = 'This is a test'
diff --git a/cbind/test/testrdwt.c b/cbind/test/testrdwt.c
index ec05ca3..01933d4 100644
--- a/cbind/test/testrdwt.c
+++ b/cbind/test/testrdwt.c
@@ -81,9 +81,7 @@ int main (int argc, char **argv)
char *coord_names[3], *qa_record[2][4], *info[3];
char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
char *prop_names[3];
- char *cdum;
-
- cdum = 0;
+ char *cdum = 0;
/* Specify compute and i/o word size */
diff --git a/cbind/test/testwt-nfaced.c b/cbind/test/testwt-nfaced.c
new file mode 100644
index 0000000..c46e6f2
--- /dev/null
+++ b/cbind/test/testwt-nfaced.c
@@ -0,0 +1,429 @@
+/*
+ * Copyright (c) 2010 Sandia Corporation. Under the terms of Contract
+ * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+ * 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 Sandia Corporation 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwt - test write an ExodusII database file (testwt-nfaced.exo)
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include "exodusII.h"
+
+int main (int argc, char **argv)
+{
+ int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
+ int num_elem_in_block[10], num_total_nodes_per_blk[10];
+ int num_face_in_block[10], num_total_faces_per_blk[10];
+ int num_node_sets, error;
+ int i, j, *connect;
+ int bids, nnpe[10];
+ int num_qa_rec, num_info;
+ int CPU_word_size,IO_word_size;
+
+ float x[100], y[100], z[100];
+ char *coord_names[3], *qa_record[2][4], *info[3];
+ char *block_names[10];
+ char *title = "This is a test";
+ ex_opts (EX_VERBOSE | EX_ABORT );
+
+/* Specify compute and i/o word size */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 4; /* (4 bytes) */
+
+/* create EXODUS II file */
+
+ exoid = ex_create ("test-nfaced.exo", /* filename path */
+ EX_CLOBBER, /* create mode */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size); /* I/O float word size in bytes */
+ printf ("after ex_create for test.exo, exoid = %d\n", exoid);
+ printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+ /* initialize file with parameters */
+ {
+ ex_init_params par;
+
+ num_dim = 3;
+ num_nodes = 14;
+ num_elem = 3;
+ num_elem_blk = 1;
+ num_node_sets = 0;
+
+ strcpy( par.title, title );
+ par.num_dim = num_dim;
+ par.num_nodes = num_nodes;
+ par.num_edge = 0;
+ par.num_edge_blk = 0;
+ par.num_face = 15;
+ par.num_face_blk = 1;
+ par.num_elem = num_elem;
+ par.num_elem_blk = num_elem_blk;
+ par.num_node_sets = num_node_sets;
+ par.num_edge_sets = 0;
+ par.num_face_sets = 0;
+ par.num_side_sets = 0;
+ par.num_elem_sets = 0;
+ par.num_node_maps = 0;
+ par.num_edge_maps = 0;
+ par.num_face_maps = 0;
+ par.num_elem_maps = 0;
+
+ error = ex_put_init_ext (exoid, &par);
+
+ printf ("after ex_put_init_ext, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+/* write nodal coordinates values and names to database */
+ x[ 0] = 0.00000e+00 ; y[ 0] = 0.00000e+00 ; z[ 0] = 0.00000e+00 ;
+ x[ 1] = 2.00000e+00 ; y[ 1] = 0.00000e+00 ; z[ 1] = 0.00000e+00 ;
+ x[ 2] = 0.00000e+00 ; y[ 2] = 2.00000e+00 ; z[ 2] = 0.00000e+00 ;
+ x[ 3] = 2.00000e+00 ; y[ 3] = 2.00000e+00 ; z[ 3] = 0.00000e+00 ;
+ x[ 4] = 0.00000e+00 ; y[ 4] = 0.00000e+00 ; z[ 4] = 2.00000e+00 ;
+ x[ 5] = 2.00000e+00 ; y[ 5] = 0.00000e+00 ; z[ 5] = 2.00000e+00 ;
+ x[ 6] = 0.00000e+00 ; y[ 6] = 2.00000e+00 ; z[ 6] = 2.00000e+00 ;
+ x[ 7] = 2.00000e+00 ; y[ 7] = 2.00000e+00 ; z[ 7] = 2.00000e+00 ;
+ x[ 8] = 0.00000e+00 ; y[ 8] = 3.50000e+00 ; z[ 8] = 1.00000e+00 ;
+ x[ 9] = 2.00000e+00 ; y[ 9] = 3.50000e+00 ; z[ 9] = 1.00000e+00 ;
+ x[10] = 0.00000e+00 ; y[10] = 3.00000e+00 ; z[10] = 1.50000e+00 ;
+ x[11] = 2.00000e+00 ; y[11] = 3.00000e+00 ; z[11] = 1.50000e+00 ;
+ x[12] = 0.00000e+00 ; y[12] = 3.00000e+00 ; z[12] = 0.50000e+00 ;
+ x[13] = 2.00000e+00 ; y[13] = 3.00000e+00 ; z[13] = 0.50000e+00 ;
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "x";
+ coord_names[1] = "y";
+ coord_names[2] = "z";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* Write the face block parameters */
+ block_names[0] = "face_block_1";
+ num_face_in_block[0] = 15;
+ num_total_nodes_per_blk[0] = 58;
+ bids = 10;
+
+ error = ex_put_block (exoid, EX_FACE_BLOCK, bids, "nsided",
+ num_face_in_block[0],
+ num_total_nodes_per_blk[0],
+ 0, 0, 0);
+ printf ("after ex_put_block, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* Write face block names */
+ error = ex_put_names(exoid, EX_FACE_BLOCK, block_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+ /* write face connectivity */
+
+ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int));
+
+ i = 0;
+ j = 0;
+
+ connect[i++] = 5;
+ connect[i++] = 6;
+ connect[i++] = 8; /* connectivity of face 1 of element 1 */
+ nnpe[j++] = 3;
+
+ connect[i++] = 2;
+ connect[i++] = 1;
+ connect[i++] = 4; /* face 2 of element 1 */
+ nnpe[j++] = 3;
+
+ connect[i++] = 6;
+ connect[i++] = 2;
+ connect[i++] = 4;
+ connect[i++] = 8; /* face 3 of element 1 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 8;
+ connect[i++] = 4;
+ connect[i++] = 1;
+ connect[i++] = 5; /* face 4 of element 1 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 1;
+ connect[i++] = 2;
+ connect[i++] = 6;
+ connect[i++] = 5; /* face 5 of element 1 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 5;
+ connect[i++] = 8;
+ connect[i++] = 7; /* connectivity of face 1 of element 2 */
+ nnpe[j++] = 3;
+
+ connect[i++] = 1;
+ connect[i++] = 3;
+ connect[i++] = 4; /* face 2 of element 2 */
+ nnpe[j++] = 3;
+
+ connect[i++] = 7;
+ connect[i++] = 8;
+ connect[i++] = 4;
+ connect[i++] = 3; /* face 3 of element 2 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 7;
+ connect[i++] = 3;
+ connect[i++] = 1;
+ connect[i++] = 5; /* face 4 of element 2 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 8;
+ connect[i++] = 4;
+ connect[i++] = 14;
+ connect[i++] = 10;
+ connect[i++] = 12; /* connectivity of face 1 of element 3 */
+ nnpe[j++] = 5;
+
+ connect[i++] = 7;
+ connect[i++] = 11;
+ connect[i++] = 9;
+ connect[i++] = 13;
+ connect[i++] = 3; /* face 2 of element 3 */
+ nnpe[j++] = 5;
+
+ connect[i++] = 7;
+ connect[i++] = 8;
+ connect[i++] = 12;
+ connect[i++] = 11; /* face 3 of element 3 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 11;
+ connect[i++] = 12;
+ connect[i++] = 10;
+ connect[i++] = 9; /* face 4 of element 3 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 9;
+ connect[i++] = 10;
+ connect[i++] = 14;
+ connect[i++] = 13; /* face 5 of element 3 */
+ nnpe[j++] = 4;
+
+ connect[i++] = 13;
+ connect[i++] = 14;
+ connect[i++] = 4;
+ connect[i++] = 3; /* face 6 of element 3 */
+ nnpe[j++] = 4;
+
+ assert(i == num_total_nodes_per_blk[0]);
+ assert(j == num_face_in_block[0]);
+
+ error = ex_put_conn (exoid, EX_FACE_BLOCK, bids, connect, NULL, NULL);
+ printf ("after ex_put_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (connect);
+ connect = NULL;
+
+ error = ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, bids, nnpe);
+ printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write element block parameters */
+ block_names[0] = "nfaced_1";
+
+ num_elem_in_block[0] = 3;
+ num_total_faces_per_blk[0] = 5 + 5 + 7;
+
+ bids = 10;
+
+ error = ex_put_block (exoid, EX_ELEM_BLOCK, bids, "nfaced",
+ num_elem_in_block[0],
+ 0,
+ 0,
+ num_total_faces_per_blk[0],
+ 0);
+ printf ("after ex_put_block, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* Write element block names */
+ error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write element-face connectivity */
+ connect = (int *) calloc(num_total_faces_per_blk[0], sizeof(int));
+
+ i = 0;
+ j = 0;
+ connect[i++] = 1;
+ connect[i++] = 2;
+ connect[i++] = 3;
+ connect[i++] = 4;
+ connect[i++] = 5;
+ nnpe[j++] = 5; /* Number of faces per element 1 */
+
+ connect[i++] = 4;
+ connect[i++] = 6;
+ connect[i++] = 7;
+ connect[i++] = 8;
+ connect[i++] = 9;
+ nnpe[j++] = 5; /* Number of faces per element 2 */
+
+
+ connect[i++] = 8;
+ connect[i++] = 10;
+ connect[i++] = 11;
+ connect[i++] = 12;
+ connect[i++] = 13;
+ connect[i++] = 14;
+ connect[i++] = 15;
+ nnpe[j++] = 7; /* Number of faces per element 3 */
+
+ assert(i == num_total_faces_per_blk[0]);
+ assert(j == num_elem_in_block[0]);
+
+ error = ex_put_conn (exoid, EX_ELEM_BLOCK, bids, NULL, NULL, connect);
+ printf ("after ex_put_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (connect);
+
+ error = ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, bids, nnpe);
+ printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write QA records; test empty and just blank-filled records */
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT-NFACED";
+ qa_record[0][1] = "testwt-nfaced";
+ qa_record[0][2] = "2010/02/15";
+ qa_record[0][3] = "06:35:15";
+ qa_record[1][0] = "";
+ qa_record[1][1] = " ";
+ qa_record[1][2] = "";
+ qa_record[1][3] = " ";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* write information records; test empty and just blank-filled records */
+ num_info = 3;
+
+
+ info[0] = "This is the first information record.";
+ info[1] = "";
+ info[2] = " ";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ return 0;
+}
diff --git a/cbind/test/testwt-nfaced.dmp b/cbind/test/testwt-nfaced.dmp
new file mode 100644
index 0000000..5422b8d
--- /dev/null
+++ b/cbind/test/testwt-nfaced.dmp
@@ -0,0 +1,101 @@
+netcdf test-nfaced {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 14 ;
+ num_elem = 3 ;
+ num_face = 15 ;
+ num_el_blk = 1 ;
+ num_fa_blk = 1 ;
+ num_fa_in_blk1 = 15 ;
+ num_nod_per_fa1 = 58 ;
+ num_el_in_blk1 = 3 ;
+ num_fac_per_el1 = 17 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int fa_status(num_fa_blk) ;
+ int fa_prop1(num_fa_blk) ;
+ fa_prop1:name = "ID" ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
+ char eb_names(num_el_blk, len_string) ;
+ char fa_names(num_fa_blk, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ int fbconn1(num_nod_per_fa1) ;
+ fbconn1:elem_type = "nsided" ;
+ int fbepecnt1(num_fa_in_blk1) ;
+ fbepecnt1:entity_type1 = "NODE" ;
+ fbepecnt1:entity_type2 = "FACE" ;
+ int facconn1(num_fac_per_el1) ;
+ facconn1:elem_type = "nfaced" ;
+ int ebepecnt1(num_el_in_blk1) ;
+ ebepecnt1:entity_type1 = "FACE" ;
+ ebepecnt1:entity_type2 = "ELEM" ;
+ char qa_records(num_qa_rec, four, len_string) ;
+ char info_records(num_info, len_line) ;
+
+// global attributes:
+ :floating_point_word_size = 4 ;
+ :file_size = 1 ;
+ :title = "This is a test" ;
+data:
+
+ eb_status = 1 ;
+
+ eb_prop1 = 10 ;
+
+ fa_status = 1 ;
+
+ fa_prop1 = 10 ;
+
+ coordx = 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 ;
+
+ coordy = 0, 0, 2, 2, 0, 0, 2, 2, 3.5, 3.5, 3, 3, 3, 3 ;
+
+ coordz = 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1.5, 1.5, 0.5, 0.5 ;
+
+ eb_names =
+ "nfaced_1" ;
+
+ fa_names =
+ "face_block_1" ;
+
+ coor_names =
+ "x",
+ "y",
+ "z" ;
+
+ fbconn1 = 5, 6, 8, 2, 1, 4, 6, 2, 4, 8, 8, 4, 1, 5, 1, 2, 6, 5, 5, 8, 7, 1,
+ 3, 4, 7, 8, 4, 3, 7, 3, 1, 5, 8, 4, 14, 10, 12, 7, 11, 9, 13, 3, 7, 8,
+ 12, 11, 11, 12, 10, 9, 9, 10, 14, 13, 13, 14, 4, 3 ;
+
+ fbepecnt1 = 3, 3, 4, 4, 4, 3, 3, 4, 4, 5, 5, 4, 4, 4, 4 ;
+
+ facconn1 = 1, 2, 3, 4, 5, 4, 6, 7, 8, 9, 8, 10, 11, 12, 13, 14, 15 ;
+
+ ebepecnt1 = 5, 5, 7 ;
+
+ qa_records =
+ "TESTWT-NFACED",
+ "testwt-nfaced",
+ "2010/02/15",
+ "06:35:15",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+}
diff --git a/cbind/test/testwt_nc.c b/cbind/test/testwt-nsided.c
similarity index 72%
copy from cbind/test/testwt_nc.c
copy to cbind/test/testwt-nsided.c
index bdbf958..0fa53ea 100644
--- a/cbind/test/testwt_nc.c
+++ b/cbind/test/testwt-nsided.c
@@ -34,44 +34,25 @@
*/
/*****************************************************************************
*
-* testwt - test write an ExodusII database file
-*
-* author - Sandia National Laboratories
-* Larry A. Schoof - Original
-* Vic Yarberry - Added headers and error logging
-* 7/7/93 Modified for use with Exodus 2.00
-*
-*
-* environment - UNIX
-*
-* entry conditions -
-*
-* exit conditions -
-*
-* revision history -
-*
-* This is a test program for the C binding of the EXODUS II
-* database write routines.
-*
-* $Id: testwt_nc.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
+* testwt - test write an ExodusII database file (testwt-nsided.exo)
*
*****************************************************************************/
#include <stdlib.h>
#include <stdio.h>
-/* #include "netcdf.h" */
+#include <assert.h>
#include "exodusII.h"
int main (int argc, char **argv)
{
int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
- int num_elem_in_block[10], num_nodes_per_elem[10];
+ int num_elem_in_block[10], num_total_nodes_per_blk[10];
int num_face_in_sset[10], num_nodes_in_nset[10];
int num_node_sets, num_side_sets, error;
int i, j, k, m, *elem_map, *connect;
int node_list[100],elem_list[100],side_list[100];
- int ebids[10], ssids[10], nsids[10];
+ int ebids[10], ssids[10], nsids[10], nnpe[10];
int num_qa_rec, num_info;
int num_glo_vars, num_nod_vars, num_ele_vars, num_sset_vars, num_nset_vars;
int *truth_tab;
@@ -83,11 +64,11 @@ int main (int argc, char **argv)
float *sset_var_vals, *nset_var_vals;
float time_value;
float x[100], y[100], z[100];
- float attrib[1], dist_fact[100];
+ float dist_fact[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *block_names[10], *nset_names[10], *sset_names[10];
- char *prop_names[2], *attrib_names[1];
-
+ char *attrib_names[2];
+ char *title = "This is a test";
ex_opts (EX_VERBOSE | EX_ABORT );
/* Specify compute and i/o word size */
@@ -97,7 +78,7 @@ int main (int argc, char **argv)
/* create EXODUS II file */
- exoid = ex_create ("test.exo", /* filename path */
+ exoid = ex_create ("test-nsided.exo", /* filename path */
EX_CLOBBER, /* create mode */
&CPU_word_size, /* CPU float word size in bytes */
&IO_word_size); /* I/O float word size in bytes */
@@ -111,11 +92,12 @@ int main (int argc, char **argv)
num_dim = 3;
num_nodes = 33;
num_elem = 7;
- num_elem_blk = 7;
+ num_elem_blk = 1;
num_node_sets = 2;
num_side_sets = 5;
- error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+
+ error = ex_put_init (exoid, title, num_dim, num_nodes, num_elem,
num_elem_blk, num_node_sets, num_side_sets);
printf ("after ex_put_init, error = %d\n", error);
@@ -174,9 +156,7 @@ int main (int argc, char **argv)
x[31] = 10.0; y[31] = 0.0; z[31] = 0.0;
x[32] = 10.0; y[32] = 10.0; z[32] = 10.0;
- error = ex_put_coord (exoid, NULL, NULL, z);
- error = ex_put_coord (exoid, x, NULL, NULL);
- error = ex_put_coord (exoid, NULL, y, NULL);
+ error = ex_put_coord (exoid, x, y, z);
printf ("after ex_put_coord, error = %d\n", error);
if (error) {
@@ -196,264 +176,125 @@ int main (int argc, char **argv)
exit(-1);
}
-/* write element order map */
-
- elem_map = (int *) calloc(num_elem, sizeof(int));
-
- for (i=1; i<=num_elem; i++)
- {
- elem_map[i-1] = i;
- }
-
- error = ex_put_map (exoid, elem_map);
- printf ("after ex_put_map, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- free (elem_map);
-
-
-/* write element block parameters */
-
- block_names[0] = "block_1";
- block_names[1] = "block_2";
- block_names[2] = "block_3";
- block_names[3] = "block_4";
- block_names[4] = "block_5";
- block_names[5] = "block_6";
- block_names[6] = "block_7";
-
- num_elem_in_block[0] = 1;
- num_elem_in_block[1] = 1;
- num_elem_in_block[2] = 1;
- num_elem_in_block[3] = 1;
- num_elem_in_block[4] = 1;
- num_elem_in_block[5] = 1;
- num_elem_in_block[6] = 1;
-
- num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads */
- num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads */
- num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes */
- num_nodes_per_elem[3] = 4; /* elements in block #4 are 4-node tetras */
- num_nodes_per_elem[4] = 6; /* elements in block #5 are 6-node wedges */
- num_nodes_per_elem[5] = 8; /* elements in block #6 are 8-node tetras */
- num_nodes_per_elem[6] = 3; /* elements in block #7 are 3-node tris */
-
- ebids[0] = 10;
- ebids[1] = 11;
- ebids[2] = 12;
- ebids[3] = 13;
- ebids[4] = 14;
- ebids[5] = 15;
- ebids[6] = 16;
-
- error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
- num_nodes_per_elem[0], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
- num_nodes_per_elem[1], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
- num_nodes_per_elem[2], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
- num_nodes_per_elem[3], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_block (exoid, ebids[4], "wedge", num_elem_in_block[4],
- num_nodes_per_elem[4], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_block (exoid, ebids[5], "tetra", num_elem_in_block[5],
- num_nodes_per_elem[5], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
+ /* Add nodal attributes */
+ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2);
+ printf ("after ex_put_attr_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
-
- error = ex_put_elem_block (exoid, ebids[6], "tri", num_elem_in_block[6],
- num_nodes_per_elem[6], 1);
- printf ("after ex_put_elem_block, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- /* Write element block names */
- error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names);
- printf ("after ex_put_names, error = %d\n", error);
-
+
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x);
if (error) {
ex_close (exoid);
exit(-1);
}
-/* write element block properties */
-
- /* 12345678901234567890123456789012 */
- prop_names[0] = "MATERIAL_PROPERTY_LONG_NAME_32CH";
- prop_names[1] = "DENSITY";
- error = ex_put_prop_names(exoid,EX_ELEM_BLOCK,2,prop_names);
- printf ("after ex_put_prop_names, error = %d\n", error);
-
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y);
if (error) {
ex_close (exoid);
exit(-1);
}
-
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], prop_names[0], 10);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
+
+ {
+ attrib_names[0] = "Node_attr_1";
+ attrib_names[1] = "Node_attr_2";
+ error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
}
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], prop_names[0], 20);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+/* write element order map */
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], prop_names[0], 30);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ elem_map = (int *) calloc(num_elem, sizeof(int));
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], prop_names[0], 40);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
+ for (i=1; i<=num_elem; i++)
+ {
+ elem_map[i-1] = i;
}
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], prop_names[0], 50);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ error = ex_put_map (exoid, elem_map);
+ printf ("after ex_put_map, error = %d\n", error);
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[5], prop_names[0], 60);
- printf ("after ex_put_prop, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[6], prop_names[0], 70);
- printf ("after ex_put_prop, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ free (elem_map);
-/* write element connectivity */
+/* write element block parameters */
- connect = (int *) calloc(8, sizeof(int));
- connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+ block_names[0] = "nsided_1";
- error = ex_put_elem_conn (exoid, ebids[0], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ num_elem_in_block[0] = 7;
+ num_total_nodes_per_blk[0] = 37;
- connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+ ebids[0] = 10;
- error = ex_put_elem_conn (exoid, ebids[1], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
+#if 0
+ error = ex_put_nsided_block (exoid, EX_ELEM_BLOCK, ebids[0], num_elem_in_block[0],
+ num_total_nodes_per_blk[0], 0);
+#else
+ error = ex_put_block (exoid, EX_ELEM_BLOCK, ebids[0], "nsided",
+ num_elem_in_block[0],
+ num_total_nodes_per_blk[0],
+ 0, 0, 0);
+#endif
+ printf ("after ex_put_block, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- connect[0] = 9; connect[1] = 10; connect[2] = 11; connect[3] = 12;
- connect[4] = 13; connect[5] = 14; connect[6] = 15; connect[7] = 16;
-
- error = ex_put_elem_conn (exoid, ebids[2], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
+ /* Write element block names */
+ error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names);
+ printf ("after ex_put_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
+
+/* write element connectivity */
- connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int));
- error = ex_put_elem_conn (exoid, ebids[3], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
+ i = 0;
+ j = 0;
+ connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4;
+ nnpe[j++] = 4;
+ connect[i++] = 5; connect[i++] = 6; connect[i++] = 7; connect[i++] = 8;
+ nnpe[j++] = 4;
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ connect[i++] = 9; connect[i++] = 10; connect[i++] = 11; connect[i++] = 12;
+ connect[i++] = 13; connect[i++] = 14; connect[i++] = 15; connect[i++] = 16;
+ nnpe[j++] = 8 ;
- connect[0] = 21; connect[1] = 22; connect[2] = 23;
- connect[3] = 24; connect[4] = 25; connect[5] = 26;
+ connect[i++] = 17; connect[i++] = 18; connect[i++] = 19; connect[i++] = 20;
+ nnpe[j++] = 4;
- error = ex_put_elem_conn (exoid, ebids[4], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
+ connect[i++] = 21; connect[i++] = 22; connect[i++] = 23;
+ connect[i++] = 24; connect[i++] = 25; connect[i++] = 26;
+ nnpe[j++] = 6;
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
+ connect[i++] = 17; connect[i++] = 18; connect[i++] = 19; connect[i++] = 20;
+ connect[i++] = 27; connect[i++] = 28; connect[i++] = 30; connect[i++] = 29;
+ nnpe[j++] = 8;
- connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
- connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
+ connect[i++] = 31; connect[i++] = 32; connect[i++] = 33;
+ nnpe[j++] = 3;
- error = ex_put_elem_conn (exoid, ebids[5], connect);
- printf ("after ex_put_elem_conn, error = %d\n", error);
+ assert(i == num_total_nodes_per_blk[0]);
+ assert(j == num_elem_in_block[0]);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- connect[0] = 31; connect[1] = 32; connect[2] = 33;
-
- error = ex_put_elem_conn (exoid, ebids[6], connect);
+ error = ex_put_conn (exoid, EX_ELEM_BLOCK, ebids[0], connect, NULL, NULL);
printf ("after ex_put_elem_conn, error = %d\n", error);
if (error) {
@@ -463,76 +304,14 @@ int main (int argc, char **argv)
free (connect);
-
-/* write element block attributes */
-
- attrib[0] = 3.14159;
- error = ex_put_elem_attr (exoid, ebids[0], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- attrib[0] = 6.14159;
- error = ex_put_elem_attr (exoid, ebids[1], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_attr (exoid, ebids[2], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_attr (exoid, ebids[3], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_attr (exoid, ebids[4], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_attr (exoid, ebids[5], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
- error = ex_put_elem_attr (exoid, ebids[6], attrib);
- printf ("after ex_put_elem_attr, error = %d\n", error);
+ error = ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ebids[0], nnpe);
+ printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- attrib_names[0] = "THICKNESS";
- for (i=0; i < 7; i++) {
- error = ex_put_elem_attr_names (exoid, ebids[i], attrib_names);
- printf ("after ex_put_elem_attr_names, error = %d\n", error);
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
- }
/* write individual node sets */
@@ -635,6 +414,30 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodeset attributes */
+ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Nodeset_attribute";
+ error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write individual side sets */
num_face_in_sset[0] = 2;
num_face_in_sset[1] = 2;
@@ -1021,7 +824,7 @@ int main (int argc, char **argv)
glob_var_vals = (float *) calloc (num_glo_vars, CPU_word_size);
nodal_var_vals = (float *) calloc (num_nodes, CPU_word_size);
- elem_var_vals = (float *) calloc (4, CPU_word_size);
+ elem_var_vals = (float *) calloc (8, CPU_word_size);
sset_var_vals = (float *) calloc (10, CPU_word_size);
nset_var_vals = (float *) calloc (10, CPU_word_size);
diff --git a/cbind/test/test.dmp b/cbind/test/testwt-nsided.dmp
similarity index 72%
copy from cbind/test/test.dmp
copy to cbind/test/testwt-nsided.dmp
index 1b77584..b7f43a5 100644
--- a/cbind/test/test.dmp
+++ b/cbind/test/testwt-nsided.dmp
@@ -1,4 +1,4 @@
-netcdf test {
+netcdf test-nsided {
dimensions:
len_string = 33 ;
len_line = 81 ;
@@ -7,32 +7,15 @@ dimensions:
num_dim = 3 ;
num_nodes = 33 ;
num_elem = 7 ;
- num_el_blk = 7 ;
+ num_el_blk = 1 ;
num_node_sets = 2 ;
num_side_sets = 5 ;
- num_el_in_blk1 = 1 ;
- num_nod_per_el1 = 4 ;
- num_att_in_blk1 = 1 ;
- num_el_in_blk2 = 1 ;
- num_nod_per_el2 = 4 ;
- num_att_in_blk2 = 1 ;
- num_el_in_blk3 = 1 ;
- num_nod_per_el3 = 8 ;
- num_att_in_blk3 = 1 ;
- num_el_in_blk4 = 1 ;
- num_nod_per_el4 = 4 ;
- num_att_in_blk4 = 1 ;
- num_el_in_blk5 = 1 ;
- num_nod_per_el5 = 6 ;
- num_att_in_blk5 = 1 ;
- num_el_in_blk6 = 1 ;
- num_nod_per_el6 = 8 ;
- num_att_in_blk6 = 1 ;
- num_el_in_blk7 = 1 ;
- num_nod_per_el7 = 3 ;
- num_att_in_blk7 = 1 ;
+ num_att_in_nblk = 2 ;
+ num_el_in_blk1 = 7 ;
+ num_nod_per_el1 = 37 ;
num_nod_ns1 = 5 ;
num_nod_ns2 = 3 ;
+ num_att_in_ns1 = 1 ;
num_side_ss1 = 2 ;
num_df_ss1 = 4 ;
num_side_ss2 = 2 ;
@@ -58,46 +41,21 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ float nattrb(num_nodes, num_att_in_nblk) ;
+ char nattrib_name(num_att_in_nblk, len_string) ;
int elem_map(num_elem) ;
- float attrib1(num_el_in_blk1, num_att_in_blk1) ;
- char attrib_name1(num_att_in_blk1, len_string) ;
- int connect1(num_el_in_blk1, num_nod_per_el1) ;
- connect1:elem_type = "quad" ;
- float attrib2(num_el_in_blk2, num_att_in_blk2) ;
- char attrib_name2(num_att_in_blk2, len_string) ;
- int connect2(num_el_in_blk2, num_nod_per_el2) ;
- connect2:elem_type = "quad" ;
- float attrib3(num_el_in_blk3, num_att_in_blk3) ;
- char attrib_name3(num_att_in_blk3, len_string) ;
- int connect3(num_el_in_blk3, num_nod_per_el3) ;
- connect3:elem_type = "hex" ;
- float attrib4(num_el_in_blk4, num_att_in_blk4) ;
- char attrib_name4(num_att_in_blk4, len_string) ;
- int connect4(num_el_in_blk4, num_nod_per_el4) ;
- connect4:elem_type = "tetra" ;
- float attrib5(num_el_in_blk5, num_att_in_blk5) ;
- char attrib_name5(num_att_in_blk5, len_string) ;
- int connect5(num_el_in_blk5, num_nod_per_el5) ;
- connect5:elem_type = "wedge" ;
- float attrib6(num_el_in_blk6, num_att_in_blk6) ;
- char attrib_name6(num_att_in_blk6, len_string) ;
- int connect6(num_el_in_blk6, num_nod_per_el6) ;
- connect6:elem_type = "tetra" ;
- float attrib7(num_el_in_blk7, num_att_in_blk7) ;
- char attrib_name7(num_att_in_blk7, len_string) ;
- int connect7(num_el_in_blk7, num_nod_per_el7) ;
- connect7:elem_type = "tri" ;
- int eb_prop2(num_el_blk) ;
- eb_prop2:_FillValue = 0 ;
- eb_prop2:name = "MATERIAL_PROPERTY_LONG_NAME_32CH" ;
- int eb_prop3(num_el_blk) ;
- eb_prop3:_FillValue = 0 ;
- eb_prop3:name = "DENSITY" ;
+ int connect1(num_nod_per_el1) ;
+ connect1:elem_type = "nsided" ;
+ int ebepecnt1(num_el_in_blk1) ;
+ ebepecnt1:entity_type1 = "NODE" ;
+ ebepecnt1:entity_type2 = "ELEM" ;
int node_ns1(num_nod_ns1) ;
float dist_fact_ns1(num_nod_ns1) ;
int node_ns2(num_nod_ns2) ;
@@ -107,6 +65,8 @@ variables:
ns_prop2:name = "FACE" ;
int ns_prop3(num_node_sets) ;
ns_prop3:name = "VELOCITY" ;
+ float nsattrb1(num_nod_ns1, num_att_in_ns1) ;
+ char nsattrib_name1(num_att_in_ns1, len_string) ;
int elem_ss1(num_side_ss1) ;
int side_ss1(num_side_ss1) ;
float dist_fact_ss1(num_df_ss1) ;
@@ -126,7 +86,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
char name_nset_var(num_nset_var, len_string) ;
@@ -134,24 +95,6 @@ variables:
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
float vals_elem_var2eb1(time_step, num_el_in_blk1) ;
float vals_elem_var3eb1(time_step, num_el_in_blk1) ;
- float vals_elem_var1eb2(time_step, num_el_in_blk2) ;
- float vals_elem_var2eb2(time_step, num_el_in_blk2) ;
- float vals_elem_var3eb2(time_step, num_el_in_blk2) ;
- float vals_elem_var1eb3(time_step, num_el_in_blk3) ;
- float vals_elem_var2eb3(time_step, num_el_in_blk3) ;
- float vals_elem_var3eb3(time_step, num_el_in_blk3) ;
- float vals_elem_var1eb4(time_step, num_el_in_blk4) ;
- float vals_elem_var2eb4(time_step, num_el_in_blk4) ;
- float vals_elem_var3eb4(time_step, num_el_in_blk4) ;
- float vals_elem_var1eb5(time_step, num_el_in_blk5) ;
- float vals_elem_var2eb5(time_step, num_el_in_blk5) ;
- float vals_elem_var3eb5(time_step, num_el_in_blk5) ;
- float vals_elem_var1eb6(time_step, num_el_in_blk6) ;
- float vals_elem_var2eb6(time_step, num_el_in_blk6) ;
- float vals_elem_var3eb6(time_step, num_el_in_blk6) ;
- float vals_elem_var1eb7(time_step, num_el_in_blk7) ;
- float vals_elem_var2eb7(time_step, num_el_in_blk7) ;
- float vals_elem_var3eb7(time_step, num_el_in_blk7) ;
int elem_var_tab(num_el_blk, num_elem_var) ;
float vals_sset_var1ss1(time_step, num_side_ss1) ;
float vals_sset_var1ss2(time_step, num_side_ss2) ;
@@ -176,18 +119,16 @@ variables:
float vals_nset_var3ns2(time_step, num_nod_ns2) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
time_whole = 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 ;
- eb_status = 1, 1, 1, 1, 1, 1, 1 ;
+ eb_status = 1 ;
- eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+ eb_prop1 = 10 ;
ns_status = 1, 1 ;
@@ -197,27 +138,17 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
eb_names =
- "block_1",
- "block_2",
- "block_3",
- "block_4",
- "block_5",
- "block_6",
- "block_7" ;
+ "nsided_1" ;
ns_names =
"nset_1",
@@ -230,74 +161,56 @@ data:
"sset_4",
"sset_5" ;
- elem_map = 1, 2, 3, 4, 5, 6, 7 ;
-
- attrib1 =
- 3.1416 ;
-
- attrib_name1 =
- "THICKNESS" ;
-
- connect1 =
- 1, 2, 3, 4 ;
-
- attrib2 =
- 6.1416 ;
-
- attrib_name2 =
- "THICKNESS" ;
-
- connect2 =
- 5, 6, 7, 8 ;
-
- attrib3 =
- 6.1416 ;
-
- attrib_name3 =
- "THICKNESS" ;
-
- connect3 =
- 9, 10, 11, 12, 13, 14, 15, 16 ;
-
- attrib4 =
- 6.1416 ;
-
- attrib_name4 =
- "THICKNESS" ;
-
- connect4 =
- 17, 18, 19, 20 ;
-
- attrib5 =
- 6.1416 ;
-
- attrib_name5 =
- "THICKNESS" ;
-
- connect5 =
- 21, 22, 23, 24, 25, 26 ;
-
- attrib6 =
- 6.1416 ;
-
- attrib_name6 =
- "THICKNESS" ;
-
- connect6 =
- 17, 18, 19, 20, 27, 28, 30, 29 ;
-
- attrib7 =
- 6.1416 ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
- attrib_name7 =
- "THICKNESS" ;
+ nattrb =
+ 0, 0,
+ 1, 0,
+ 1, 1,
+ 0, 1,
+ 1, 0,
+ 2, 0,
+ 2, 1,
+ 1, 1,
+ 0, 0,
+ 10, 0,
+ 10, 0,
+ 1, 0,
+ 1, 10,
+ 10, 10,
+ 10, 10,
+ 1, 10,
+ 0, 0,
+ 1, 0,
+ 10, 0,
+ 7, 5,
+ 3, 0,
+ 6, 0,
+ 0, 0,
+ 3, 2,
+ 6, 2,
+ 0, 2,
+ 2.7, 1.7,
+ 6, 1.7,
+ 5.7, 1.7,
+ 3.7, 0,
+ 0, 0,
+ 10, 0,
+ 10, 10 ;
+
+ nattrib_name =
+ "Node_attr_1",
+ "Node_attr_2" ;
- connect7 =
- 31, 32, 33 ;
+ elem_map = 1, 2, 3, 4, 5, 6, 7 ;
- eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+ connect1 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 17, 18, 19, 20, 27, 28, 30, 29, 31, 32, 33 ;
- eb_prop3 = _, _, _, _, _, _, _ ;
+ ebepecnt1 = 4, 4, 8, 4, 6, 8, 3 ;
node_ns1 = 100, 101, 102, 103, 104 ;
@@ -311,6 +224,16 @@ data:
ns_prop3 = 1000, 2000 ;
+ nsattrb1 =
+ 0,
+ 1,
+ 1,
+ 0,
+ 1 ;
+
+ nsattrib_name1 =
+ "Nodeset_attribute" ;
+
elem_ss1 = 2, 2 ;
side_ss1 = 4, 2 ;
@@ -367,64 +290,66 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56, 1.58, 1.6, 1.62, 1.64, 1.66,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84, 1.87, 1.9, 1.93, 1.96, 1.99,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68, 2.74, 2.8, 2.86, 2.92, 2.98,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96, 3.03, 3.1, 3.17, 3.24, 3.31,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24, 3.32, 3.4, 3.48, 3.56, 3.64,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
+ 4.1, 4.2, 4.3 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
- 4.1, 4.2, 4.3,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5,
5.1, 5.2, 5.3 ;
@@ -449,264 +374,42 @@ data:
"ss_var2" ;
vals_elem_var1eb1 =
- 4.01,
- 4.02,
- 4.03,
- 4.04,
- 4.05,
- 4.06,
- 4.07,
- 4.08,
- 4.09,
- 4.1 ;
+ 4.01, 4.02, 4.03, 4.04, 4.05, 4.06, 4.07,
+ 4.02, 4.04, 4.06, 4.08, 4.1, 4.12, 4.14,
+ 4.03, 4.06, 4.09, 4.12, 4.15, 4.18, 4.21,
+ 4.04, 4.08, 4.12, 4.16, 4.2, 4.24, 4.28,
+ 4.05, 4.1, 4.15, 4.2, 4.25, 4.3, 4.35,
+ 4.06, 4.12, 4.18, 4.24, 4.3, 4.36, 4.42,
+ 4.07, 4.14, 4.21, 4.28, 4.35, 4.42, 4.49,
+ 4.08, 4.16, 4.24, 4.32, 4.4, 4.48, 4.56,
+ 4.09, 4.18, 4.27, 4.36, 4.45, 4.54, 4.63,
+ 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7 ;
vals_elem_var2eb1 =
- 5.01,
- 5.02,
- 5.03,
- 5.04,
- 5.05,
- 5.06,
- 5.07,
- 5.08,
- 5.09,
- 5.1 ;
+ 5.01, 5.02, 5.03, 5.04, 5.05, 5.06, 5.07,
+ 5.02, 5.04, 5.06, 5.08, 5.1, 5.12, 5.14,
+ 5.03, 5.06, 5.09, 5.12, 5.15, 5.18, 5.21,
+ 5.04, 5.08, 5.12, 5.16, 5.2, 5.24, 5.28,
+ 5.05, 5.1, 5.15, 5.2, 5.25, 5.3, 5.35,
+ 5.06, 5.12, 5.18, 5.24, 5.3, 5.36, 5.42,
+ 5.07, 5.14, 5.21, 5.28, 5.35, 5.42, 5.49,
+ 5.08, 5.16, 5.24, 5.32, 5.4, 5.48, 5.56,
+ 5.09, 5.18, 5.27, 5.36, 5.45, 5.54, 5.63,
+ 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7 ;
vals_elem_var3eb1 =
- 6.01,
- 6.02,
- 6.03,
- 6.04,
- 6.05,
- 6.06,
- 6.07,
- 6.08,
- 6.09,
- 6.1 ;
-
- vals_elem_var1eb2 =
- 5.01,
- 5.02,
- 5.03,
- 5.04,
- 5.05,
- 5.06,
- 5.07,
- 5.08,
- 5.09,
- 5.1 ;
-
- vals_elem_var2eb2 =
- 6.01,
- 6.02,
- 6.03,
- 6.04,
- 6.05,
- 6.06,
- 6.07,
- 6.08,
- 6.09,
- 6.1 ;
-
- vals_elem_var3eb2 =
- 7.01,
- 7.02,
- 7.03,
- 7.04,
- 7.05,
- 7.06,
- 7.07,
- 7.08,
- 7.09,
- 7.1 ;
-
- vals_elem_var1eb3 =
- 6.01,
- 6.02,
- 6.03,
- 6.04,
- 6.05,
- 6.06,
- 6.07,
- 6.08,
- 6.09,
- 6.1 ;
-
- vals_elem_var2eb3 =
- 7.01,
- 7.02,
- 7.03,
- 7.04,
- 7.05,
- 7.06,
- 7.07,
- 7.08,
- 7.09,
- 7.1 ;
-
- vals_elem_var3eb3 =
- 8.01,
- 8.02,
- 8.03,
- 8.04,
- 8.05,
- 8.06,
- 8.07,
- 8.08,
- 8.09,
- 8.1 ;
-
- vals_elem_var1eb4 =
- 7.01,
- 7.02,
- 7.03,
- 7.04,
- 7.05,
- 7.06,
- 7.07,
- 7.08,
- 7.09,
- 7.1 ;
-
- vals_elem_var2eb4 =
- 8.01,
- 8.02,
- 8.03,
- 8.04,
- 8.05,
- 8.06,
- 8.07,
- 8.08,
- 8.09,
- 8.1 ;
-
- vals_elem_var3eb4 =
- 9.01,
- 9.02,
- 9.03,
- 9.04,
- 9.05,
- 9.06,
- 9.07,
- 9.08,
- 9.09,
- 9.1 ;
-
- vals_elem_var1eb5 =
- 8.01,
- 8.02,
- 8.03,
- 8.04,
- 8.05,
- 8.06,
- 8.07,
- 8.08,
- 8.09,
- 8.1 ;
-
- vals_elem_var2eb5 =
- 9.01,
- 9.02,
- 9.03,
- 9.04,
- 9.05,
- 9.06,
- 9.07,
- 9.08,
- 9.09,
- 9.1 ;
-
- vals_elem_var3eb5 =
- 10.01,
- 10.02,
- 10.03,
- 10.04,
- 10.05,
- 10.06,
- 10.07,
- 10.08,
- 10.09,
- 10.1 ;
-
- vals_elem_var1eb6 =
- 9.01,
- 9.02,
- 9.03,
- 9.04,
- 9.05,
- 9.06,
- 9.07,
- 9.08,
- 9.09,
- 9.1 ;
-
- vals_elem_var2eb6 =
- 10.01,
- 10.02,
- 10.03,
- 10.04,
- 10.05,
- 10.06,
- 10.07,
- 10.08,
- 10.09,
- 10.1 ;
-
- vals_elem_var3eb6 =
- 11.01,
- 11.02,
- 11.03,
- 11.04,
- 11.05,
- 11.06,
- 11.07,
- 11.08,
- 11.09,
- 11.1 ;
-
- vals_elem_var1eb7 =
- 10.01,
- 10.02,
- 10.03,
- 10.04,
- 10.05,
- 10.06,
- 10.07,
- 10.08,
- 10.09,
- 10.1 ;
-
- vals_elem_var2eb7 =
- 11.01,
- 11.02,
- 11.03,
- 11.04,
- 11.05,
- 11.06,
- 11.07,
- 11.08,
- 11.09,
- 11.1 ;
-
- vals_elem_var3eb7 =
- 12.01,
- 12.02,
- 12.03,
- 12.04,
- 12.05,
- 12.06,
- 12.07,
- 12.08,
- 12.09,
- 12.1 ;
+ 6.01, 6.02, 6.03, 6.04, 6.05, 6.06, 6.07,
+ 6.02, 6.04, 6.06, 6.08, 6.1, 6.12, 6.14,
+ 6.03, 6.06, 6.09, 6.12, 6.15, 6.18, 6.21,
+ 6.04, 6.08, 6.12, 6.16, 6.2, 6.24, 6.28,
+ 6.05, 6.1, 6.15, 6.2, 6.25, 6.3, 6.35,
+ 6.06, 6.12, 6.18, 6.24, 6.3, 6.36, 6.42,
+ 6.07, 6.14, 6.21, 6.28, 6.35, 6.42, 6.49,
+ 6.08, 6.16, 6.24, 6.32, 6.4, 6.48, 6.56,
+ 6.09, 6.18, 6.27, 6.36, 6.45, 6.54, 6.63,
+ 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7 ;
elem_var_tab =
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
1, 1, 1 ;
vals_sset_var1ss1 =
diff --git a/cbind/test/testwt-one-attrib.c b/cbind/test/testwt-one-attrib.c
index 7a0cda1..a19f0d7 100644
--- a/cbind/test/testwt-one-attrib.c
+++ b/cbind/test/testwt-one-attrib.c
@@ -20,6 +20,12 @@ int main (int argc, char **argv)
float x[100], y[100], z[100];
char *coord_names[3];
+ /* Coordinate Frames */
+ int cf_ids[2] = {20, 13};
+ float pt_coords[9*2] = {1,0,0, 1,0,1, 2,0,0,
+ 0,0,0, 1,0,0, 0,1,0};
+ char tags[2]={'r', 'c'};
+
ex_opts (EX_VERBOSE | EX_ABORT);
/* Specify compute and i/o word size */
@@ -213,6 +219,12 @@ int main (int argc, char **argv)
#endif
free(attrib);
+ /* Add a coordinate frame just to give test coverage... */
+ {
+ error = ex_put_coordinate_frames(exoid, 2, cf_ids, pt_coords, tags);
+ assert(error == 0);
+ }
+
/* close the EXODUS files
*/
error = ex_close (exoid);
@@ -266,6 +278,26 @@ int main (int argc, char **argv)
}
free (attrib);
}
+
+ /* Read the coordinate frame... */
+ {
+ int nframes;
+ int rdcf_ids[2];
+ float rdpt_coords[9*2];
+ char rdtags[2];
+
+ nframes = ex_inquire_int(exoid, EX_INQ_COORD_FRAMES);
+ assert(nframes == 2);
+
+ error = ex_get_coordinate_frames(exoid, &nframes, rdcf_ids, rdpt_coords, rdtags);
+ assert(error == 0);
+ assert(rdtags[0] == tags[0] && rdtags[1] == tags[1]);
+ assert(rdcf_ids[0] == cf_ids[0] && rdcf_ids[1] == cf_ids[1]);
+
+ for (i=0; i < nframes*9; i++) {
+ assert(rdpt_coords[i] == pt_coords[i]);
+ }
+ }
error = ex_close (exoid);
assert(error == 0);
return 0;
diff --git a/cbind/test/testwt.c b/cbind/test/testwt-partial.c
similarity index 87%
copy from cbind/test/testwt.c
copy to cbind/test/testwt-partial.c
index 6e0fd96..81898cc 100644
--- a/cbind/test/testwt.c
+++ b/cbind/test/testwt-partial.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
@@ -86,8 +85,8 @@ int main (int argc, char **argv)
float attrib[1], dist_fact[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *block_names[10], *nset_names[10], *sset_names[10];
- char *prop_names[2], *attrib_names[1];
-
+ char *prop_names[2], *attrib_names[2];
+ char *title = "This is a test";
ex_opts (EX_VERBOSE | EX_ABORT );
/* Specify compute and i/o word size */
@@ -115,7 +114,8 @@ int main (int argc, char **argv)
num_node_sets = 2;
num_side_sets = 5;
- error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+
+ error = ex_put_init (exoid, title, num_dim, num_nodes, num_elem,
num_elem_blk, num_node_sets, num_side_sets);
printf ("after ex_put_init, error = %d\n", error);
@@ -174,8 +174,10 @@ int main (int argc, char **argv)
x[31] = 10.0; y[31] = 0.0; z[31] = 0.0;
x[32] = 10.0; y[32] = 10.0; z[32] = 10.0;
- error = ex_put_coord (exoid, x, y, z);
- printf ("after ex_put_coord, error = %d\n", error);
+ for (i=0; i < num_nodes; i+=11) {
+ error = ex_put_n_coord (exoid, i+1, 11, &x[i], &y[i], &z[i]);
+ printf ("after ex_put_coord, error = %d\n", error);
+ }
if (error) {
ex_close (exoid);
@@ -194,6 +196,39 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodal attributes */
+ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ for (i=0; i < num_nodes; i+=11) {
+ error = ex_put_n_one_attr(exoid, EX_NODAL, 0, i+1, 11, 1, &x[i]);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_n_one_attr(exoid, EX_NODAL, 0, i+1, 11, 2, &y[i]);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+ {
+ attrib_names[0] = "Node_attr_1";
+ attrib_names[1] = "Node_attr_2";
+ error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write element order map */
elem_map = (int *) calloc(num_elem, sizeof(int));
@@ -216,6 +251,7 @@ int main (int argc, char **argv)
/* write element block parameters */
+/* 1234567890123456789012345678901234567890 */
block_names[0] = "block_1";
block_names[1] = "block_2";
block_names[2] = "block_3";
@@ -640,6 +676,30 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodeset attributes */
+ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Nodeset_attribute";
+ error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write individual side sets */
num_face_in_sset[0] = 2;
num_face_in_sset[1] = 2;
@@ -889,15 +949,15 @@ int main (int argc, char **argv)
var_names[0] = "glo_vars";
- error = ex_put_var_param (exoid, "g", num_glo_vars);
- printf ("after ex_put_var_param, error = %d\n", error);
+ error = ex_put_variable_param (exoid, EX_GLOBAL, num_glo_vars);
+ printf ("after ex_put_variable_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_var_names (exoid, "g", num_glo_vars, var_names);
- printf ("after ex_put_var_names, error = %d\n", error);
+ error = ex_put_variable_names (exoid, EX_GLOBAL, num_glo_vars, var_names);
+ printf ("after ex_put_variable_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -910,15 +970,15 @@ int main (int argc, char **argv)
var_names[0] = "node_variable_a_very_long_name_0";
var_names[1] = "nod_var1";
- error = ex_put_var_param (exoid, "n", num_nod_vars);
- printf ("after ex_put_var_param, error = %d\n", error);
+ error = ex_put_variable_param (exoid, EX_NODAL, num_nod_vars);
+ printf ("after ex_put_variable_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_var_names (exoid, "n", num_nod_vars, var_names);
- printf ("after ex_put_var_names, error = %d\n", error);
+ error = ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, var_names);
+ printf ("after ex_put_variable_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -931,15 +991,15 @@ int main (int argc, char **argv)
var_names[1] = "ele_var1";
var_names[2] = "ele_var2";
- error = ex_put_var_param (exoid, "e", num_ele_vars);
- printf ("after ex_put_var_param, error = %d\n", error);
+ error = ex_put_variable_param (exoid, EX_ELEM_BLOCK, num_ele_vars);
+ printf ("after ex_put_variable_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_var_names (exoid, "e", num_ele_vars, var_names);
- printf ("after ex_put_var_names, error = %d\n", error);
+ error = ex_put_variable_names (exoid, EX_ELEM_BLOCK, num_ele_vars, var_names);
+ printf ("after ex_put_variable_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -952,15 +1012,15 @@ int main (int argc, char **argv)
var_names[1] = "ns_var1";
var_names[2] = "ns_var2";
- error = ex_put_var_param (exoid, "m", num_nset_vars);
- printf ("after ex_put_var_param, error = %d\n", error);
+ error = ex_put_variable_param (exoid, EX_NODE_SET, num_nset_vars);
+ printf ("after ex_put_variable_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_var_names (exoid, "m", num_nset_vars, var_names);
- printf ("after ex_put_var_names, error = %d\n", error);
+ error = ex_put_variable_names (exoid, EX_NODE_SET, num_nset_vars, var_names);
+ printf ("after ex_put_variable_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -974,15 +1034,15 @@ int main (int argc, char **argv)
var_names[1] = "ss_var1";
var_names[2] = "ss_var2";
- error = ex_put_var_param (exoid, "s", num_sset_vars);
- printf ("after ex_put_var_param, error = %d\n", error);
+ error = ex_put_variable_param (exoid, EX_SIDE_SET, num_sset_vars);
+ printf ("after ex_put_variable_param, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
- error = ex_put_var_names (exoid, "s", num_sset_vars, var_names);
- printf ("after ex_put_var_names, error = %d\n", error);
+ error = ex_put_variable_names (exoid, EX_SIDE_SET, num_sset_vars, var_names);
+ printf ("after ex_put_variable_names, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -1046,8 +1106,7 @@ int main (int argc, char **argv)
/* write global variables */
- for (j=0; j<num_glo_vars; j++)
- {
+ for (j=0; j<num_glo_vars; j++) {
glob_var_vals[j] = (float)(j+2) * time_value;
}
@@ -1060,39 +1119,30 @@ int main (int argc, char **argv)
exit(-1);
}
-/* write nodal variables */
-
- for (k=1; k<=num_nod_vars; k++)
- {
- for (j=0; j<num_nodes; j++)
- {
+ /* write nodal variables */
+ for (k=1; k<=num_nod_vars; k++) {
+ for (j=0; j<num_nodes; j++) {
nodal_var_vals[j] = (float)k + ((float)(j+1) * time_value);
}
-
- error = ex_put_nodal_var (exoid, whole_time_step, k, num_nodes,
- nodal_var_vals);
+ error = ex_put_var(exoid, whole_time_step, EX_NODAL,
+ k, 0, num_nodes, nodal_var_vals);
printf ("after ex_put_nodal_var, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
}
-
}
-/* write element variables */
-
- for (k=1; k<=num_ele_vars; k++)
- {
- for (j=0; j<num_elem_blk; j++)
- {
- for (m=0; m<num_elem_in_block[j]; m++)
- {
+ /* write element variables */
+ for (k=1; k<=num_ele_vars; k++) {
+ for (j=0; j<num_elem_blk; j++) {
+ for (m=0; m<num_elem_in_block[j]; m++) {
elem_var_vals[m] = (float)(k+1) + (float)(j+2) +
((float)(m+1)*time_value);
/* printf("elem_var_vals[%d]: %f\n",m,elem_var_vals[m]); */
}
- error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
- num_elem_in_block[j], elem_var_vals);
+ error = ex_put_var(exoid, whole_time_step, EX_ELEM_BLOCK,
+ k, ebids[j], num_elem_in_block[j], elem_var_vals);
printf ("after ex_put_elem_var, error = %d\n", error);
if (error) {
ex_close (exoid);
@@ -1101,20 +1151,16 @@ int main (int argc, char **argv)
}
}
-/* write sideset variables */
-
- for (k=1; k<=num_sset_vars; k++)
- {
- for (j=0; j<num_side_sets; j++)
- {
- for (m=0; m<num_face_in_sset[j]; m++)
- {
+ /* write sideset variables */
+ for (k=1; k<=num_sset_vars; k++) {
+ for (j=0; j<num_side_sets; j++) {
+ for (m=0; m<num_face_in_sset[j]; m++) {
sset_var_vals[m] = (float)(k+2) + (float)(j+3) +
((float)(m+1)*time_value);
/* printf("sset_var_vals[%d]: %f\n",m,sset_var_vals[m]); */
}
- error = ex_put_sset_var (exoid, whole_time_step, k, ssids[j],
- num_face_in_sset[j], sset_var_vals);
+ error = ex_put_var(exoid, whole_time_step, EX_SIDE_SET,
+ k, ssids[j], num_face_in_sset[j], sset_var_vals);
printf ("after ex_put_sset_var, error = %d\n", error);
if (error) {
ex_close (exoid);
@@ -1123,20 +1169,16 @@ int main (int argc, char **argv)
}
}
-/* write nodeset variables */
-
- for (k=1; k<=num_nset_vars; k++)
- {
- for (j=0; j<num_node_sets; j++)
- {
- for (m=0; m<num_nodes_in_nset[j]; m++)
- {
+ /* write nodeset variables */
+ for (k=1; k<=num_nset_vars; k++) {
+ for (j=0; j<num_node_sets; j++) {
+ for (m=0; m<num_nodes_in_nset[j]; m++) {
nset_var_vals[m] = (float)(k+3) + (float)(j+4) +
- ((float)(m+1)*time_value);
+ ((float)(m+1)*time_value);
/* printf("nset_var_vals[%d]: %f\n",m,nset_var_vals[m]); */
}
- error = ex_put_nset_var (exoid, whole_time_step, k, nsids[j],
- num_nodes_in_nset[j], nset_var_vals);
+ error = ex_put_var(exoid, whole_time_step, EX_NODE_SET,
+ k, nsids[j], num_nodes_in_nset[j], nset_var_vals);
printf ("after ex_put_nset_var, error = %d\n", error);
if (error) {
ex_close (exoid);
diff --git a/cbind/test/testwt-zeroe.c b/cbind/test/testwt-zeroe.c
index a499ab4..9ea69e4 100644
--- a/cbind/test/testwt-zeroe.c
+++ b/cbind/test/testwt-zeroe.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt-zeroe.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/cbind/test/testwt-zeroe.dmp b/cbind/test/testwt-zeroe.dmp
index f3271a4..ea4deca 100644
--- a/cbind/test/testwt-zeroe.dmp
+++ b/cbind/test/testwt-zeroe.dmp
@@ -18,9 +18,11 @@ variables:
int ns_status(num_node_sets) ;
int ns_prop1(num_node_sets) ;
ns_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char ns_names(num_node_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int node_ns1(num_nod_ns1) ;
float dist_fact_ns1(num_nod_ns1) ;
int node_ns2(num_nod_ns2) ;
@@ -34,14 +36,13 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -51,23 +52,24 @@ data:
ns_prop1 = 20, 21 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
ns_names =
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
node_ns1 = 100, 101, 102, 103, 104 ;
dist_fact_ns1 = 1, 2, 3, 4, 5 ;
@@ -110,64 +112,66 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56, 1.58, 1.6, 1.62, 1.64, 1.66,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84, 1.87, 1.9, 1.93, 1.96, 1.99,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68, 2.74, 2.8, 2.86, 2.92, 2.98,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96, 3.03, 3.1, 3.17, 3.24, 3.31,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24, 3.32, 3.4, 3.48, 3.56, 3.64,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
+ 4.1, 4.2, 4.3 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4,
- 4.1, 4.2, 4.3,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5,
5.1, 5.2, 5.3 ;
diff --git a/cbind/test/testwt-zeron.c b/cbind/test/testwt-zeron.c
index 4267af6..f75e412 100644
--- a/cbind/test/testwt-zeron.c
+++ b/cbind/test/testwt-zeron.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt-zeron.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
@@ -79,7 +78,6 @@ int main (int argc, char **argv)
float time_value;
float x[100], y[100], z[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
- char *prop_names[2];
ex_opts (EX_VERBOSE | EX_ABORT );
@@ -296,18 +294,6 @@ int main (int argc, char **argv)
exit(-1);
}
-/* write element block properties */
-
- prop_names[0] = "MATL";
- prop_names[1] = "DENSITY";
- error = ex_put_prop_names(exoid,EX_ELEM_BLOCK,2,prop_names);
- printf ("after ex_put_prop_names, error = %d\n", error);
-
- if (error) {
- ex_close (exoid);
- exit(-1);
- }
-
/* write QA records; test empty and just blank-filled records */
num_qa_rec = 2;
diff --git a/cbind/test/testwt-zeron.dmp b/cbind/test/testwt-zeron.dmp
index b7a38ca..c453fa9 100644
--- a/cbind/test/testwt-zeron.dmp
+++ b/cbind/test/testwt-zeron.dmp
@@ -14,24 +14,16 @@ variables:
int eb_status(num_el_blk) ;
int eb_prop1(num_el_blk) ;
eb_prop1:name = "ID" ;
- char coor_names(num_dim, len_string) ;
char eb_names(num_el_blk, len_string) ;
- int eb_prop2(num_el_blk) ;
- eb_prop2:_FillValue = 0 ;
- eb_prop2:name = "MATL" ;
- int eb_prop3(num_el_blk) ;
- eb_prop3:_FillValue = 0 ;
- eb_prop3:name = "DENSITY" ;
+ char coor_names(num_dim, len_string) ;
char qa_records(num_qa_rec, four, len_string) ;
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -41,11 +33,6 @@ data:
eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
-
eb_names =
"",
"",
@@ -55,9 +42,10 @@ data:
"",
"" ;
- eb_prop2 = _, _, _, _, _, _, _ ;
-
- eb_prop3 = _, _, _, _, _, _, _ ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
qa_records =
"TESTWT",
diff --git a/cbind/test/testwt.c b/cbind/test/testwt.c
index 6e0fd96..1eb0a0d 100644
--- a/cbind/test/testwt.c
+++ b/cbind/test/testwt.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
@@ -86,8 +85,8 @@ int main (int argc, char **argv)
float attrib[1], dist_fact[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *block_names[10], *nset_names[10], *sset_names[10];
- char *prop_names[2], *attrib_names[1];
-
+ char *prop_names[2], *attrib_names[2];
+ char *title = "This is a test";
ex_opts (EX_VERBOSE | EX_ABORT );
/* Specify compute and i/o word size */
@@ -115,7 +114,8 @@ int main (int argc, char **argv)
num_node_sets = 2;
num_side_sets = 5;
- error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+
+ error = ex_put_init (exoid, title, num_dim, num_nodes, num_elem,
num_elem_blk, num_node_sets, num_side_sets);
printf ("after ex_put_init, error = %d\n", error);
@@ -194,6 +194,37 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodal attributes */
+ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Node_attr_1";
+ attrib_names[1] = "Node_attr_2";
+ error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write element order map */
elem_map = (int *) calloc(num_elem, sizeof(int));
@@ -640,6 +671,30 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodeset attributes */
+ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Nodeset_attribute";
+ error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write individual side sets */
num_face_in_sset[0] = 2;
num_face_in_sset[1] = 2;
diff --git a/cbind/test/testwt1.c b/cbind/test/testwt1.c
index 38eb0bb..ecc8130 100644
--- a/cbind/test/testwt1.c
+++ b/cbind/test/testwt1.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt1.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/cbind/test/testwt2.c b/cbind/test/testwt2.c
index 79e2b1a..a1c5b9d 100644
--- a/cbind/test/testwt2.c
+++ b/cbind/test/testwt2.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines. It tests multiple simultaneous output files.
*
-* $Id: testwt2.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/cbind/test/testwt_clb.c b/cbind/test/testwt_clb.c
index fea9b0d..824f3d7 100644
--- a/cbind/test/testwt_clb.c
+++ b/cbind/test/testwt_clb.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt_clb.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
*****************************************************************************/
diff --git a/cbind/test/testwt_nc.c b/cbind/test/testwt_nc.c
index bdbf958..b597245 100644
--- a/cbind/test/testwt_nc.c
+++ b/cbind/test/testwt_nc.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt_nc.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
*
*****************************************************************************/
@@ -86,7 +85,7 @@ int main (int argc, char **argv)
float attrib[1], dist_fact[100];
char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
char *block_names[10], *nset_names[10], *sset_names[10];
- char *prop_names[2], *attrib_names[1];
+ char *prop_names[2], *attrib_names[2];
ex_opts (EX_VERBOSE | EX_ABORT );
@@ -175,7 +174,9 @@ int main (int argc, char **argv)
x[32] = 10.0; y[32] = 10.0; z[32] = 10.0;
error = ex_put_coord (exoid, NULL, NULL, z);
+ printf ("after ex_put_coord, error = %d\n", error);
error = ex_put_coord (exoid, x, NULL, NULL);
+ printf ("after ex_put_coord, error = %d\n", error);
error = ex_put_coord (exoid, NULL, y, NULL);
printf ("after ex_put_coord, error = %d\n", error);
@@ -196,6 +197,37 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodal attributes */
+ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Node_attr_1";
+ attrib_names[1] = "Node_attr_2";
+ error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write element order map */
elem_map = (int *) calloc(num_elem, sizeof(int));
@@ -469,7 +501,13 @@ int main (int argc, char **argv)
attrib[0] = 3.14159;
error = ex_put_elem_attr (exoid, ebids[0], attrib);
printf ("after ex_put_elem_attr, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ error = ex_put_elem_attr (exoid, ebids[0], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
if (error) {
ex_close (exoid);
exit(-1);
@@ -533,6 +571,7 @@ int main (int argc, char **argv)
exit(-1);
}
}
+
/* write individual node sets */
@@ -635,6 +674,30 @@ int main (int argc, char **argv)
exit(-1);
}
+ /* Add nodeset attributes */
+ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1);
+ printf ("after ex_put_attr_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ attrib_names[0] = "Nodeset_attribute";
+ error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
/* write individual side sets */
num_face_in_sset[0] = 2;
num_face_in_sset[1] = 2;
diff --git a/cbind/test/testwt_nossnsdf.c b/cbind/test/testwt_nossnsdf.c
index ad35871..96bef9f 100644
--- a/cbind/test/testwt_nossnsdf.c
+++ b/cbind/test/testwt_nossnsdf.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwt_nossnsdf.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/cbind/test/testwt_ss.dmp b/cbind/test/testwt_ss.dmp
index a764024..790627c 100644
--- a/cbind/test/testwt_ss.dmp
+++ b/cbind/test/testwt_ss.dmp
@@ -56,11 +56,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
int connect1(num_el_in_blk1, num_nod_per_el1) ;
@@ -113,10 +115,8 @@ variables:
char info_records(num_info, len_line) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -132,18 +132,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34, 35, 36, 37, 38 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0, 2.7, 6, 5.7, 3.7, 2.7, 6, 5.7,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2, 1.7, 1.7, 1.7, 0, 1.7, 1.7, 1.7,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 2.7, 3.3, 1.7 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 2.7, 6, 5.7 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 1.7, 1.7, 1.7 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 2.7, 3.3, 1.7 ;
eb_names =
"",
@@ -170,6 +166,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
attrib1 =
0 ;
diff --git a/cbind/test/testwtbig.c b/cbind/test/testwtbig.c
index 75b35cc..bf441df 100644
--- a/cbind/test/testwtbig.c
+++ b/cbind/test/testwtbig.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwtbig.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/cbind/test/testwtd.c b/cbind/test/testwtd.c
index c95da0a..0dc23e9 100644
--- a/cbind/test/testwtd.c
+++ b/cbind/test/testwtd.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines.
*
-* $Id: testwtd.c,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
*
*****************************************************************************/
@@ -70,10 +69,7 @@ int main (int argc, char **argv)
int num_node_sets, num_side_sets, error;
int i, j, k, m, *elem_map, *connect;
int node_list[100],elem_list[100],side_list[100];
- int ebids[100], ids[100];
- int num_nodes_per_set[10], num_elem_per_set[10];
- int num_df_per_set[10];
- int df_ind[10], node_ind[10], elem_ind[10];
+ int ebids[100];
int num_qa_rec, num_info;
int num_glo_vars, num_nod_vars, num_ele_vars;
int *truth_tab;
@@ -342,53 +338,7 @@ int main (int argc, char **argv)
printf ("after ex_put_prop_array, error = %d\n", error);
-/* write concatenated node sets; this produces the same information as
- * the above code which writes individual node sets
- */
-
-/* THIS SECTION IS COMMENTED OUT - TO USE: COMMENT OUT PREVIOUS SECTION
-
- ids[0] = 20; ids[1] = 21;
-
- num_nodes_per_set[0] = 5; num_nodes_per_set[1] = 3;
-
- node_ind[0] = 0; node_ind[1] = 5;
-
- node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
- node_list[3] = 103; node_list[4] = 104;
- node_list[5] = 200; node_list[6] = 201; node_list[7] = 202;
-
- num_df_per_set[0] = 5; num_df_per_set[1] = 3;
-
- df_ind[0] = 0; df_ind[1] = 5;
-
- dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0;
- dist_fact[3] = 4.0; dist_fact[4] = 5.0;
- dist_fact[5] = 1.1; dist_fact[6] = 2.1; dist_fact[7] = 3.1;
-
- error = ex_put_concat_node_sets (exoid, ids, num_nodes_per_set,
- num_df_per_set, node_ind,
- df_ind, node_list, dist_fact);
- printf ("after ex_put_concat_node_sets, error = %d\n", error);
-
- error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
- printf ("after ex_put_prop, error = %d\n", error);
- error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
- printf ("after ex_put_prop, error = %d\n", error);
-
- prop_array[0] = 1000;
- prop_array[1] = 2000;
-
- error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array);
- printf ("after ex_put_prop_array, error = %d\n", error);
-
- END COMMENTED OUT SECTION */
-
-
-/* write individual side sets */
-
- if (FALSE) goto concat_side_sets;
-
+ /* write individual side sets */
error = ex_put_side_set_param (exoid, 30, 2, 4);
printf ("after ex_put_side_set_param, error = %d\n", error);
@@ -472,142 +422,6 @@ int main (int argc, char **argv)
error = ex_put_side_set (exoid, 34, elem_list, side_list);
printf ("after ex_put_side_set, error = %d\n", error);
- goto done_side_sets;
-
-/* write concatenated side sets; this produces the same information as
- * the above code which writes individual side sets
- */
-
-/* THIS SECTION IS COMMENTED OUT - TO USE: COMMENT OUT PREVIOUS SECTION */
-
-concat_side_sets:
-
- ids[0] = 30;
- ids[1] = 31;
- ids[2] = 32;
- ids[3] = 33;
- ids[4] = 34;
-
- node_list[0] = 8; node_list[1] = 5;
- node_list[2] = 6; node_list[3] = 7;
-
- node_list[4] = 2; node_list[5] = 3;
- node_list[6] = 7; node_list[7] = 8;
-
- node_list[8] = 9; node_list[9] = 12;
- node_list[10] = 11; node_list[11] = 10;
-
- node_list[12] = 11; node_list[13] = 12;
- node_list[14] = 16; node_list[15] = 15;
-
- node_list[16] = 16; node_list[17] = 15;
- node_list[18] = 11; node_list[19] = 12;
-
- node_list[20] = 10; node_list[21] = 11;
- node_list[22] = 15; node_list[23] = 14;
-
- node_list[24] = 13; node_list[25] = 16;
- node_list[26] = 12; node_list[27] = 9;
-
- node_list[28] = 14; node_list[29] = 13;
- node_list[30] = 9; node_list[31] = 10;
-
- node_list[32] = 16; node_list[33] = 13;
- node_list[34] = 14; node_list[35] = 15;
-
- node_list[36] = 17; node_list[37] = 18;
- node_list[38] = 20;
-
- node_list[39] = 18; node_list[40] = 19;
- node_list[41] = 20;
-
- node_list[42] = 20; node_list[43] = 19;
- node_list[44] = 17;
-
- node_list[45] = 19; node_list[46] = 18;
- node_list[47] = 17;
-
- node_list[48] = 25; node_list[49] = 24;
- node_list[50] = 21; node_list[51] = 22;
-
- node_list[52] = 26; node_list[53] = 25;
- node_list[54] = 22; node_list[55] = 23;
-
- node_list[56] = 26; node_list[57] = 23;
- node_list[58] = 21; node_list[59] = 24;
-
- node_list[60] = 23; node_list[61] = 22;
- node_list[62] = 21;
-
- node_list[63] = 24; node_list[64] = 25;
- node_list[65] = 26;
-
- node_ind[0] = 0;
- node_ind[1] = 4;
- node_ind[2] = 8;
- node_ind[3] = 36;
- node_ind[4] = 47;
-
- num_elem_per_set[0] = 2;
- num_elem_per_set[1] = 2;
- num_elem_per_set[2] = 7;
- num_elem_per_set[3] = 4;
- num_elem_per_set[4] = 5;
-
- num_nodes_per_set[0] = 4;
- num_nodes_per_set[1] = 4;
- num_nodes_per_set[2] = 28;
- num_nodes_per_set[3] = 12;
- num_nodes_per_set[4] = 18;
-
- elem_ind[0] = 0;
- elem_ind[1] = 2;
- elem_ind[2] = 4;
- elem_ind[3] = 11;
- elem_ind[4] = 15;
-
- elem_list[0] = 2; elem_list[1] = 2;
- elem_list[2] = 1; elem_list[3] = 2;
- elem_list[4] = 3; elem_list[5] = 3;
- elem_list[6] = 3; elem_list[7] = 3;
- elem_list[8] = 3; elem_list[9] = 3;
- elem_list[10] = 3; elem_list[11] = 4;
- elem_list[12] = 4; elem_list[13] = 4;
- elem_list[14] = 4; elem_list[15] = 5;
- elem_list[16] = 5; elem_list[17] = 5;
- elem_list[18] = 5; elem_list[19] = 5;
-
- error = ex_cvt_nodes_to_sides(exoid,
- num_elem_per_set,
- num_nodes_per_set,
- elem_ind,
- node_ind,
- elem_list,
- node_list,
- side_list);
- printf ("after ex_cvt_nodes_to_sides, error = %d\n", error);
-
- num_df_per_set[0] = 4;
- num_df_per_set[1] = 4;
- num_df_per_set[2] = 0;
- num_df_per_set[3] = 0;
- num_df_per_set[4] = 0;
-
- df_ind[0] = 0;
- df_ind[1] = 4;
-
- dist_fact[0] = 30.0; dist_fact[1] = 30.1;
- dist_fact[2] = 30.2; dist_fact[3] = 30.3;
- dist_fact[4] = 31.0; dist_fact[5] = 31.1;
- dist_fact[6] = 31.2; dist_fact[7] = 31.3;
-
- error = ex_put_concat_side_sets (exoid, ids, num_elem_per_set,
- num_df_per_set, elem_ind, df_ind,
- elem_list, side_list, dist_fact);
- printf ("after ex_put_concat_side_sets, error = %d\n", error);
-
-done_side_sets:
-
error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
printf ("after ex_put_prop, error = %d\n", error);
diff --git a/cbind/test/testwtm.c b/cbind/test/testwtm.c
index c0a9328..f1cf47b 100644
--- a/cbind/test/testwtm.c
+++ b/cbind/test/testwtm.c
@@ -53,7 +53,6 @@
* This is a test program for the C binding of the EXODUS II
* database write routines. It tests multiple simultaneous output files.
*
-* $Id: testwtm.c,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
*
*****************************************************************************/
diff --git a/doc/CVS/Entries b/doc/CVS/Entries
new file mode 100644
index 0000000..43f499a
--- /dev/null
+++ b/doc/CVS/Entries
@@ -0,0 +1,2 @@
+/doc.poly.txt/1.1/Wed Feb 24 13:50:00 2010//
+D
diff --git a/doc/CVS/Repository b/doc/CVS/Repository
new file mode 100644
index 0000000..b6de6ad
--- /dev/null
+++ b/doc/CVS/Repository
@@ -0,0 +1 @@
+exodusii/doc
diff --git a/doc/CVS/Root b/doc/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/doc/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/doc/doc.poly.txt b/doc/doc.poly.txt
new file mode 100644
index 0000000..1f0153e
--- /dev/null
+++ b/doc/doc.poly.txt
@@ -0,0 +1,216 @@
+Storage of 3d arbitrary polyhedra elements in exodusII.
+
+The 3d polyhedra elements are represented as elements with a variable
+number of faces in their connectivity. The faces can either be
+regular faces such as quadrilateral or triangles; or they can be
+topologically two-dimensional arbitary polyhedra themselves.
+
+An arbitrary polyhedra 3D element block will have an element type of
+"nfaced" or "NFACED".
+
+The faces that are used in the connectivity of this block should be
+defined in one or more face blocks. If the faces are arbitrary
+polyhedra, then they will have a face type of "nsided" or "NSIDED".
+
+An annotated example of defining an arbitrary polyhedral element block
+consisting of 3 elements is shown below. The geometry is shown in
+Figure 1.
+
+The three elements have the following geometry:
+* Element 1: 5 faces.
+ * Face 1: triangle with nodes 5, 6, 8
+ * Face 2: triangle with nodes 2, 1, 4
+ * Face 3: quadrilateral with nodes 6, 2, 4, 8
+ * Face 4: quadrilateral with nodes 8, 4, 1, 5
+ * Face 5: quadrilateral with nodes 1, 2, 6, 5
+
+* Element 2: 5 faces.
+ * Face 6: triangle with nodes 5, 8, 7
+ * Face 7: triangle with nodes 1, 3, 4
+ * Face 8: quadrilateral with nodes 7, 8, 4, 3
+ * Face 9: quadrilateral with nodes 7, 3, 1, 5
+ * Face 4: quadrilateral with nodes 8, 4, 1, 5 (shared with element 1)
+
+Element 3: 7 faces.
+ * Face 8: quadrilateral with nodes 7, 8, 4, 3 (shared with element 2)
+ * Face 10: pentagonal with nodes 8, 4, 14, 10, 12
+ * Face 11: pentagonal with nodes 7, 11, 9, 13, 3
+ * Face 12: quadrilateral with nodes 7, 8, 12, 11
+ * Face 13: quadrilateral with nodes 11, 12, 10, 9
+ * Face 14: quadrilateral with nodes 9, 10, 14, 13
+ * Face 15: quadrilateral with nodes 12, 14, 4, 3
+
+The exodusII model is created via the following calls:
+
+* Output the initial information. Since the model contains faces and
+ a face block, the "extended" version of the ex_put_init_ext call must be used:
+
+ ex_init_params par;
+ strcpy( par.title, "This is the title" );
+ par.num_dim = 3;
+ par.num_nodes = 14;
+ par.num_edge = 0;
+ par.num_edge_blk = 0;
+ par.num_face = 15;
+ par.num_face_blk = 1;
+ par.num_elem = 3;
+ par.num_elem_blk = 1;
+ par.num_node_sets = 0;
+ par.num_edge_sets = 0;
+ par.num_face_sets = 0;
+ par.num_side_sets = 0;
+ par.num_elem_sets = 0;
+ par.num_node_maps = 0;
+ par.num_edge_maps = 0;
+ par.num_face_maps = 0;
+ par.num_elem_maps = 0;
+
+ ex_put_init_ext (exoid, &par);
+
+* Coordinate output is normal...
+
+* Define the face block.
+
+ block_name = "face_block_1";
+ num_face_in_block[0] = 15;
+ num_total_nodes_per_blk[0] = 58;
+ block_id = 10;
+
+ ex_put_block (exoid, EX_FACE_BLOCK, block_id, "nsided",
+ num_face_in_block[0],
+ num_total_nodes_per_blk[0],
+ 0, 0, 0);
+ ex_put_name(exoid, EX_FACE_BLOCK, block_id, block_name);
+
+* Output the face connectivity for face_block_1.
+ The data for the face connectivity is listed above; a portion is shown below...
+
+ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int));
+ i = 0
+ connect[i++] = 5;
+ connect[i++] = 6;
+ connect[i++] = 8; /* connectivity of face 1 of element 1 */
+
+ connect[i++] = 2;
+ connect[i++] = 1;
+ connect[i++] = 4; /* face 2 of element 1 */
+
+ connect[i++] = 6;
+ connect[i++] = 2;
+ connect[i++] = 4;
+ connect[i++] = 8; /* face 3 of element 1 */
+
+ connect[i++] = 8;
+ connect[i++] = 4;
+ connect[i++] = 1;
+ connect[i++] = 5; /* face 4 of element 1 */
+
+ connect[i++] = 1;
+ connect[i++] = 2;
+ connect[i++] = 6;
+ connect[i++] = 5; /* face 5 of element 1 */
+
+ connect[i++] = 5;
+ connect[i++] = 8;
+ connect[i++] = 7; /* connectivity of face 1 of element 2 */
+
+ ... and so on....
+ assert(i == num_total_nodes_per_blk[0]);
+
+ ex_put_conn (exoid, EX_FACE_BLOCK, block_id, connect, NULL, NULL);
+
+* Output the number of nodes per face count for face_block_1:
+
+ j = 0;
+ nnpe[ 1] = 3; /* Face 1 */
+ nnpe[ 2] = 3;
+ nnpe[ 3] = 4;
+ nnpe[ 4] = 4;
+ nnpe[ 5] = 4;
+ nnpe[ 6] = 3;
+ nnpe[ 7] = 3;
+ nnpe[ 8] = 4;
+ nnpe[ 9] = 4;
+ nnpe[10] = 5;
+ nnpe[11] = 5;
+ nnpe[12] = 4;
+ nnpe[13] = 4;
+ nnpe[14] = 4;
+ nnpe[15] = 4;
+
+ ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, block_id, nnpe);
+
+* The face block is now fully defined; now define the nfaced element
+ block which uses these faces.
+
+ block_name = "nfaced_1";
+
+ num_elem_in_block = 3;
+ num_total_faces_per_blk = 5 + 5 + 7;
+ block_id = 10;
+
+ ex_put_block (exoid, EX_ELEM_BLOCK, block_id, "nfaced",
+ num_elem_in_block,
+ 0, /* nodes */
+ 0, /* edges */
+ num_total_faces_per_blk,
+ 0); /* attribute count */
+ ex_put_name(exoid, EX_ELEM_BLOCK, block_id, block_name);
+
+
+ In the "ex_put_block" function, the element type is "nfaced". The
+ connectivity is defined in terms of the faces, so the node and edge
+ arguments are passed zeros. The nodal connectivity can be defined,
+ but it isn't required. The face connectivity argument for an
+ nfaced block is the total number of faces in the connectivity for all
+ elements in the nfaced block.
+
+* Write the face connectivity:
+ /* write element-face connectivity */
+ connect = (int *) calloc(num_total_faces_per_blk, sizeof(int));
+
+ i = 0;
+ connect[i++] = 1;
+ connect[i++] = 2;
+ connect[i++] = 3;
+ connect[i++] = 4;
+ connect[i++] = 5;
+
+ connect[i++] = 4;
+ connect[i++] = 6;
+ connect[i++] = 7;
+ connect[i++] = 8;
+ connect[i++] = 9;
+
+ connect[i++] = 8;
+ connect[i++] = 10;
+ connect[i++] = 11;
+ connect[i++] = 12;
+ connect[i++] = 13;
+ connect[i++] = 14;
+ connect[i++] = 15;
+
+ assert(i == num_total_faces_per_blk);
+ ex_put_conn (exoid, EX_ELEM_BLOCK, block_id, NULL, NULL, connect);
+
+* Output the number of faces per element count for "nfaced_1":
+
+ nnpe[1] = 5; /* Number of faces per element 1 */
+ nnpe[2] = 5; /* Number of faces per element 2 */
+ nnpe[3] = 7; /* Number of faces per element 3 */
+
+ ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, block_id, nnpe);
+
+* That's all; the rest of the calls are the same as normal exodusII except:
+
+ * There is a similar "ex_get_entity_count_per_polyhedra" function for read.
+ * The ex_get_block functions return the total number of nodes or
+ faces for all faces or element for "nfaced" and "nsided" blocks
+ and not the number per element
+
+* An example read/write usage is shown in the the
+ cbind/test/testwt-nfaced.c and cbind/test/testrd-nfaced.c files.
+
+* These changes are in exodusII version bv4.93 and later.
+
+
diff --git a/forbind/CVS/Entries b/forbind/CVS/Entries
index f235e61..1784810 100644
--- a/forbind/CVS/Entries
+++ b/forbind/CVS/Entries
@@ -1,3 +1 @@
-D/include////
-D/src////
-D/test////
+D
diff --git a/forbind/CVS/Entries.Log b/forbind/CVS/Entries.Log
new file mode 100644
index 0000000..0d7c7bb
--- /dev/null
+++ b/forbind/CVS/Entries.Log
@@ -0,0 +1,3 @@
+A D/include////
+A D/src////
+A D/test////
diff --git a/forbind/include/CVS/Entries b/forbind/include/CVS/Entries
index aa22f7b..a440a32 100644
--- a/forbind/include/CVS/Entries
+++ b/forbind/include/CVS/Entries
@@ -1,4 +1,4 @@
-/Imakefile/1.4/Tue Nov 28 14:02:19 2006//
-/exodusII.inc/1.4/Tue Nov 28 14:02:19 2006//
-/exodusII_int.inc/1.4/Tue Nov 28 14:02:19 2006//
+/Imakefile/1.13/Tue Jul 20 21:36:59 2010//
+/exodusII.inc/1.13/Tue Jul 20 21:36:59 2010//
+/exodusII_int.inc/1.13/Tue Jul 20 21:36:59 2010//
D
diff --git a/forbind/include/Imakefile b/forbind/include/Imakefile
index 470a686..b67da7b 100644
--- a/forbind/include/Imakefile
+++ b/forbind/include/Imakefile
@@ -1,4 +1,3 @@
-XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
INCLIST=exodusII.inc exodusII_int.inc
diff --git a/forbind/include/exodusII.inc b/forbind/include/exodusII.inc
index 24d8e37..029faf9 100644
--- a/forbind/include/exodusII.inc
+++ b/forbind/include/exodusII.inc
@@ -16,13 +16,6 @@
!
! environment - UNIX F77
!
-! revision history -
-!
-! History:
-! 02/25/93 V.R. Yarberry, Original derived from exodus.inc
-!
-! $Id: exodusII.inc,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
-!
!*****************************************************************************
!
! Define Exodus functions that return values
diff --git a/forbind/include/exodusII_int.inc b/forbind/include/exodusII_int.inc
index 96c31e6..d4b189f 100644
--- a/forbind/include/exodusII_int.inc
+++ b/forbind/include/exodusII_int.inc
@@ -9,16 +9,6 @@ C*****************************************************************************
C
C EXODUSII_INT - exodus II internals include file
C
-C author - Victor R. Yarberry, Sandia National Laboratories
-C
-C environment - UNIX F77
-C
-C revision history -
-C
-C Based on original written by Lynn Clements (RE/SPEC)
-C
-C $Id: exodusII_int.inc,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
-C
C*****************************************************************************
C --
C -- This file contains define constants that are used to refer to
diff --git a/forbind/src/CVS/Entries b/forbind/src/CVS/Entries
index daf5a9b..1c36fef 100644
--- a/forbind/src/CVS/Entries
+++ b/forbind/src/CVS/Entries
@@ -1,6 +1,6 @@
-/Imakefile/1.4/Tue Nov 28 14:02:20 2006//
+/Imakefile/1.10/Wed Jul 15 19:17:38 2009//
/Makefile.standalone/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/addrwrap.F/1.3/Sun Nov 26 05:37:24 2006//
+/addrwrap.F/1.4/Sat Jan 23 01:15:17 2010//
/aix.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
/aix0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
/catamount.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
@@ -12,20 +12,20 @@
/darwin.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
/excopy_jack.src/1.1.1.1/Tue Sep 6 15:59:03 2005//
/exgem_jack.src/1.2/Wed Apr 12 17:44:34 2006//
-/exgenm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
+/exgenm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
/exgmp_jack.src/1.1.1.1/Tue Sep 6 15:59:03 2005//
/exgnm_jack.src/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/exgnnm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
-/exgvnm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
-/exo_jack.src/1.4/Tue Nov 28 14:02:20 2006//
+/exgnnm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
+/exgvnm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
+/exo_jack.src/1.11/Sat Jan 23 01:15:18 2010//
/exodus.hh/1.1.1.1/Tue Sep 6 15:59:03 2005//
/expem_jack.src/1.2/Wed Apr 12 17:44:34 2006//
-/expenm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
+/expenm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
/expmp_jack.src/1.1.1.1/Tue Sep 6 15:59:03 2005//
/expnm_jack.src/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/expnnm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
-/expvnm_jack.src/1.4/Tue Nov 28 14:02:20 2006//
-/fortc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/expnnm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
+/expvnm_jack.src/1.10/Wed Jul 15 19:17:38 2009//
+/fortc/1.2/Wed Jul 15 19:17:38 2009//
/fortc1.sed/1.1.1.1/Tue Sep 6 15:59:03 2005//
/fortc2.sed/1.1.1.1/Tue Sep 6 15:59:03 2005//
/fortc3.sed/1.1.1.1/Tue Sep 6 15:59:03 2005//
diff --git a/forbind/src/Imakefile b/forbind/src/Imakefile
index 7ea3718..6910420 100644
--- a/forbind/src/Imakefile
+++ b/forbind/src/Imakefile
@@ -31,7 +31,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
#if defined CrayArchitecture || defined SunArchitecture || defined AIXArchitecture
#define Libtype sharable
diff --git a/forbind/src/addrwrap.F b/forbind/src/addrwrap.F
index a7de596..83ae5be 100644
--- a/forbind/src/addrwrap.F
+++ b/forbind/src/addrwrap.F
@@ -377,6 +377,79 @@ C
IERR = IERR4
END
+ SUBROUTINE EXGCSSF (IDEXO, IDESSS, NSESS, NDESS, IXEESS,
+ & IXDESS, LTEESS, LTSESS, IERR)
+C
+C READ CONCATENATED SIDE SETS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESSS (*) ! (W)
+ INTEGER NSESS (*) ! (W)
+ INTEGER NDESS (*) ! (W)
+ INTEGER IXEESS (*) ! (W)
+ INTEGER IXDESS (*) ! (W)
+ INTEGER LTEESS (*) ! (W)
+ INTEGER LTSESS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESSS4 (1) ! (W)
+ INTEGER*4 NSESS4 (1) ! (W)
+ INTEGER*4 NDESS4 (1) ! (W)
+ INTEGER*4 IXEESS4 (1) ! (W)
+ INTEGER*4 IXDESS4 (1) ! (W)
+ INTEGER*4 LTEESS4 (1) ! (W)
+ INTEGER*4 LTSESS4 (1) ! (W)
+ POINTER (PIDESSS4, IDESSS4)
+ POINTER (PNSESS4, NSESS4)
+ POINTER (PNDESS4, NDESS4)
+ POINTER (PIXEESS4, IXEESS4)
+ POINTER (PIXDESS4, IXDESS4)
+ POINTER (PLTEESS4, LTEESS4)
+ POINTER (PLTSESS4, LTSESS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXSIDS
+ INTEGER*4 NEXSSEL
+ INTEGER*4 NEXSSDF
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXSIDS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSIDS = INTRET4
+ INFREQ4 = EXSSEL
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSSEL = INTRET4
+ INFREQ4 = EXSSDF
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSSDF = INTRET4
+ CALL I4ALLOC (NEXSIDS, PIDESSS4)
+ CALL I4ALLOC (NEXSIDS, PNSESS4)
+ CALL I4ALLOC (NEXSIDS, PNDESS4)
+ CALL I4ALLOC (NEXSIDS, PIXEESS4)
+ CALL I4ALLOC (NEXSIDS, PIXDESS4)
+ CALL I4ALLOC (NEXSSEL, PLTEESS4)
+ CALL I4ALLOC (NEXSSEL, PLTSESS4)
+ CALL EXGCSSF4 (IDEXO4, IDESSS4, NSESS4, NDESS4, IXEESS4,
+ & IXDESS4, LTEESS4, LTSESS4, IERR4)
+ CALL I4I8 (NEXSIDS, PIDESSS4, IDESSS)
+ CALL I4I8 (NEXSIDS, PNSESS4, NSESS)
+ CALL I4I8 (NEXSIDS, PNDESS4, NDESS)
+ CALL I4I8 (NEXSIDS, PIXEESS4, IXEESS)
+ CALL I4I8 (NEXSIDS, PIXDESS4, IXDESS)
+ CALL I4I8 (NEXSSEL, PLTEESS4, LTEESS)
+ CALL I4I8 (NEXSSEL, PLTSESS4, LTSESS)
+
+ IERR = IERR4
+ END
+
SUBROUTINE EXGEAT (IDEXO, IDELB, ATRIB, IERR)
C
C READ ELEMENT BLOCK ATTRIBUTES
@@ -512,9 +585,50 @@ C
IDELB4 = IDELB
CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
& NUMATR4, IERR4)
- CALL I4ALLOC (NUMLNK4*NUMELB4, PLINK4)
- CALL EXGELC4 (IDEXO4, IDELB4, LINK4, IERR4)
- CALL I4I8 (NUMLNK4*NUMELB4, PLINK4, LINK)
+ IF (NAMELB .EQ. 'NSIDED' .OR. NAMELB .EQ. 'nsided') THEN
+ 1 CALL I4ALLOC (NUMLNK4, PLINK4)
+ CALL EXGELC4 (IDEXO4, IDELB4, LINK4, IERR4)
+ CALL I4I8 (NUMLNK4, PLINK4, LINK)
+ ELSE
+ CALL I4ALLOC (NUMLNK4*NUMELB4, PLINK4)
+ CALL EXGELC4 (IDEXO4, IDELB4, LINK4, IERR4)
+ CALL I4I8 (NUMLNK4*NUMELB4, PLINK4, LINK)
+ ENDIF
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGECPP (IDEXO, ITYPE, IDELB, COUNTS, IERR)
+C
+C READ ENTITY_COUNT-PER-POLYHEDRA
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER ITYPE ! (R)
+ INTEGER COUNTS (*) ! (NUMELB) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 COUNTS4 (1) ! (NUMELB) ! (W)
+ POINTER (PCOUNTS4, COUNTS4)
+ INTEGER*4 IERR4 ! (W)
+
+ CHARACTER* (MXSTLN) NAMELB
+ INTEGER*4 NUMELB4
+ INTEGER*4 NUMLNK4
+ INTEGER*4 NUMATR4
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ IDELB4 = IDELB
+ CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, IERR4)
+ CALL I4ALLOC (NUMELB4, PCOUNTS4)
+ CALL EXGECPP4 (IDEXO4, ITYPE4, IDELB4, COUNTS4, IERR4)
+ CALL I4I8 (NUMELB4, PCOUNTS4, COUNTS)
IERR = IERR4
END
@@ -1507,6 +1621,43 @@ C
IERR = IERR4
END
+ SUBROUTINE EXGCSSC (IDEXO, INCNT, IERR)
+C
+C READ CONCATENATED SIDE SET NODE COUNT LIST
+C (nodes/face for all faces)
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER INCNT (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 INCNT4 (1) ! (W)
+ POINTER (PINCNT4, INCNT4)
+ INTEGER*4 IERR4 ! (W)
+
+ integer*4 nsess4
+ INTEGER*4 NINCNT
+
+ INTEGER*4 INFREQ4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXSSEL
+ CALL EXINQ4 (IDEXO4, INFREQ4, NSESS4, RELRET4, CHRRET, IERR4)
+ NINCNT = NSESS4
+ CALL I4ALLOC (NINCNT, PINCNT4)
+
+ CALL EXGCSSC4 (IDEXO4, INCNT4, IERR4)
+
+ CALL I4I8 (NINCNT, PINCNT4, INCNT)
+ IERR = IERR4
+ END
+
SUBROUTINE EXGTIM (IDEXO, NSTEP, TIME, IERR)
C
C READ TIME VALUE FOR A TIME STEP
@@ -2145,12 +2296,51 @@ C
IDELB4 = IDELB
CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
& NUMATR4, IERR4)
- CALL I8I4 (NUMLNK4*NUMELB4, LINK, PLINK4)
+ IF (NAMELB .EQ. 'NSIDED' .OR. NAMELB .EQ. 'nsided') THEN
+ CALL I8I4 (NUMLNK4, LINK, PLINK4)
+ ELSE
+ CALL I8I4 (NUMLNK4*NUMELB4, LINK, PLINK4)
+ ENDIF
CALL EXPELC4 (IDEXO4, IDELB4, LINK4, IERR4)
CALL I4FREE (PLINK4)
IERR = IERR4
END
+ SUBROUTINE EXPECPP (IDEXO, ITYPE, IDELB, COUNTS, IERR)
+C
+C WRITE ELEMENT BLOCK CONNECTIVITY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER COUNTS (*) ! (NUMELB) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 COUNTS4 (1) ! (NUMELB) ! (R)
+ POINTER (PCOUNTS4, COUNTS4)
+ INTEGER*4 IERR4 ! (W)
+
+ CHARACTER* (MXSTLN) NAMELB
+ INTEGER*4 NUMELB4
+ INTEGER*4 NUMLNK4
+ INTEGER*4 NUMATR4
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ IDELB4 = IDELB
+ CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, IERR4)
+ CALL I8I4 (NUMELB4, COUNTS, PCOUNTS4)
+ CALL EXPECPP4 (IDEXO4, ITYPE4, IDELB4, COUNTS4, IERR4)
+ CALL I4FREE (PCOUNTS4)
+ IERR = IERR4
+ END
+
SUBROUTINE EXPENM (IDEXO, MAPEL, IERR)
C
C WRITE ELEMENT NUMBER MAP
diff --git a/forbind/src/exgenm_jack.src b/forbind/src/exgenm_jack.src
index 7592141..5d8f6fb 100644
--- a/forbind/src/exgenm_jack.src
+++ b/forbind/src/exgenm_jack.src
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: exgenm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/exgnnm_jack.src b/forbind/src/exgnnm_jack.src
index 8a47bbc..bb67c27 100644
--- a/forbind/src/exgnnm_jack.src
+++ b/forbind/src/exgnnm_jack.src
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: exgnnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/exgvnm_jack.src b/forbind/src/exgvnm_jack.src
index 53b8844..624d976 100644
--- a/forbind/src/exgvnm_jack.src
+++ b/forbind/src/exgvnm_jack.src
@@ -53,7 +53,6 @@
*
* revision history -
*
-* $Id: exgvnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/exo_jack.src b/forbind/src/exo_jack.src
index d580d17..991b93d 100644
--- a/forbind/src/exo_jack.src
+++ b/forbind/src/exo_jack.src
@@ -47,7 +47,6 @@
*
* revision history -
*
-* $Id: exo_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
%*
@@ -141,6 +140,7 @@ ex_fcdcpy (fstring, fslen, sstring)
if (sstring != NULL) {
len = strlen(sstring);
+ if (len > fslen) len = fslen;
for (i = 0; i < len; i++)
*(fstring + i) = *(sstring + i);
@@ -356,7 +356,7 @@ itos(ints, dims, ndims)
return (idexo);
}
free(name);
- *ierr = ncerr;
+ *ierr = exerrval;
return (EX_FATAL);
}
@@ -1680,13 +1680,74 @@ itos(ints, dims, ndims)
}
/*
+ * write entity count-per-polyhedra information for nsided block
+ */
+% void
+% expecpp (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% int *elem_blk_id, /* element block ID */
+% int *counts, /* entity count-per-polyhedra array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_put_entity_count_per_polyhedra(*idexo,(ex_entity_type)*obj_type,*elem_blk_id, counts) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store entity_count-per-polyhedra information in file id %d",
+ *idexo);
+ ex_err("expecpp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read entity count-per-polyhedra information for nsided block
+ */
+% void
+% exgecpp (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% int *elem_blk_id, /* element block ID */
+% int *counts, /* entity count-per-polyhedra array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_get_entity_count_per_polyhedra(*idexo,(ex_entity_type)*obj_type,*elem_blk_id,counts) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get entity_count-per-polyhedra information from file id %d",
+ *idexo);
+ ex_err("exgecpp",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
* write element block attributes
*/
% void
% expeat (
% int *idexo, /* EXODUS file ID */
% int *elem_blk_id, /* element block ID */
-% real *attrib, /* list of attributes for the element block */
+% real *attrib, /* list of attributes for the element block */
% int *ierr /* returned error code */
% )
% {
@@ -1999,7 +2060,7 @@ itos(ints, dims, ndims)
}
*(aptr+i) = 0; /* null out last ptr */
/* do ExodusII C call to write results variables names */
- if (ex_put_names(*idexo,*type,aptr) == EX_FATAL)
+ if (ex_put_names(*idexo,(ex_entity_type)*type,aptr) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2083,7 +2144,7 @@ itos(ints, dims, ndims)
*(aptr+i) = 0; /* null out last ptr */
/* do ExodusII C call to read results variables names */
- if (ex_get_names(*idexo,*type,aptr) == EX_FATAL)
+ if (ex_get_names(*idexo,(ex_entity_type)*type,aptr) == EX_FATAL)
{
*ierr = EX_FATAL;
free(sptr); /* free up allocated space */
@@ -2187,7 +2248,7 @@ itos(ints, dims, ndims)
*(aptr+i) = 0; /* set last pointer to null */
- if (ex_put_prop_names(*idexo,*obj_type, *num_props, aptr) == EX_FATAL)
+ if (ex_put_prop_names(*idexo,(ex_entity_type)*obj_type, *num_props, aptr) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2222,7 +2283,8 @@ itos(ints, dims, ndims)
char *sptr; /* internal string pointer for malloc use */
char *cdummy = 0;
int i, slen;
- int inq_code, num_props;
+ ex_inquiry inq_code;
+ int num_props;
real fdummy;
*ierr = 0;
@@ -2241,7 +2303,7 @@ itos(ints, dims, ndims)
#endif
}
- switch (*obj_type)
+ switch ((ex_entity_type)*obj_type)
{
case EX_ELEM_BLOCK:
inq_code = EX_INQ_EB_PROP;
@@ -2321,7 +2383,7 @@ itos(ints, dims, ndims)
*(aptr+i) = 0; /* set last pointer to null */
/* do ExodusII C call to get property name records */
- if (ex_get_prop_names(*idexo,*obj_type, aptr) == EX_FATAL)
+ if (ex_get_prop_names(*idexo,(ex_entity_type)*obj_type, aptr) == EX_FATAL)
{
*ierr = EX_FATAL;
free(sptr); /* free up string space */
@@ -2400,7 +2462,7 @@ itos(ints, dims, ndims)
/* nstrncpy(sptr,prop_name,slen); */
ex_fstrncpy(sptr,prop_name,slen);
- if (ex_put_prop (*idexo, *obj_type, *obj_id, sptr, *value) == EX_FATAL)
+ if (ex_put_prop (*idexo, (ex_entity_type)*obj_type, *obj_id, sptr, *value) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2468,7 +2530,7 @@ itos(ints, dims, ndims)
ex_fstrncpy(sptr,prop_name,slen);
/* use exodusII C routine to get the property value */
- if (ex_get_prop (*idexo, *obj_type, *obj_id, sptr, value) == EX_FATAL)
+ if (ex_get_prop (*idexo, (ex_entity_type)*obj_type, *obj_id, sptr, value) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2537,7 +2599,7 @@ itos(ints, dims, ndims)
/* use exodusII C routine to get the values array */
- if (ex_get_prop_array (*idexo, *obj_type, sptr, values) == EX_FATAL)
+ if (ex_get_prop_array (*idexo, (ex_entity_type)*obj_type, sptr, values) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2605,7 +2667,7 @@ itos(ints, dims, ndims)
/* Use exodusII C routine to store the property values */
- if (ex_put_prop_array (*idexo, *obj_type, sptr, values) == EX_FATAL)
+ if (ex_put_prop_array (*idexo, (ex_entity_type)*obj_type, sptr, values) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -2844,7 +2906,7 @@ itos(ints, dims, ndims)
% /* for each node set - 1 based */
% int *node_sets_node_list, /* concatenated list of nodes for all the */
% /* node sets */
-% int *node_sets_dist_fact, /* concatenated list of distribution factors */
+% real *node_sets_dist_fact, /* concatenated list of distribution factors */
% /* for all node sets */
% int *ierr /* returned error code */
% )
@@ -2947,7 +3009,7 @@ itos(ints, dims, ndims)
% /* for each node set - 1 based */
% int *node_sets_node_list, /* concatenated list of nodes for all the */
% /* node sets */
-% int *node_sets_dist_fact, /* concatenated list of distribution factors */
+% real *node_sets_dist_fact, /* concatenated list of distribution factors */
% /* for all node sets */
% int *ierr /* returned error code */
% )
@@ -3510,6 +3572,109 @@ itos(ints, dims, ndims)
}
/*
+ * read concatenated side sets (no dist factors)
+ */
+% void
+% exgcssf (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_ids, /* returned side set IDs for each side set */
+% int *num_elem_per_set, /* returned number of elements for each side */
+% /* set */
+% int *num_dist_per_set, /* returned number of nodes for each side set */
+% int *side_sets_elem_index,/* returned indices into the */
+% /* side_set_elem_list which are the locations*/
+% /* of the first element for each side set */
+% int *side_sets_dist_index,/* returned indices into the */
+% /* side_set_node_list which are the locations*/
+% /* of the first node for each side set */
+% int *side_sets_elem_list, /* returned concatenated list of elements for*/
+% /* all the side sets */
+% int *side_sets_side_list, /* returned concatenated list of nodes for */
+% /* all the side sets */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ int i, num_side_sets, *elem_index_ptr, *dist_index_ptr;
+ real fdummy;
+ char cdummy[2];
+
+ *ierr = 0;
+
+ if (ex_inquire(*idexo,EX_INQ_SIDE_SETS,&num_side_sets,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of sides sets for file id %d",
+ *idexo);
+ ex_err("exgcss",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory for C elem index array */
+ if (!(elem_index_ptr=malloc(num_side_sets*sizeof(int))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element index array for file id %d",
+ *idexo);
+ ex_err("exgcss",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* allocate memory for C dist factor index array */
+ if (!(dist_index_ptr=malloc(num_side_sets*sizeof(int))))
+ {
+ free(elem_index_ptr);
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for dist index array for file id %d",
+ *idexo);
+ ex_err("exgcss",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ if (ex_get_concat_side_sets(*idexo,side_set_ids,num_elem_per_set,
+ num_dist_per_set,elem_index_ptr,
+ dist_index_ptr,side_sets_elem_list,
+ side_sets_side_list,0) == EX_FATAL)
+ {
+ free (elem_index_ptr);
+ free (dist_index_ptr);
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get concatenated side sets from file id %d",
+ *idexo);
+ ex_err("exgcss",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ for (i=0;i<num_side_sets;i++) /* change from 0-based to 1 index */
+ {
+ side_sets_elem_index[i] = elem_index_ptr[i] + 1;
+ side_sets_dist_index[i] = dist_index_ptr[i] + 1;
+ }
+ free (elem_index_ptr);
+ free (dist_index_ptr);
+}
+
+/*
* write results variables parameters
*/
% void
@@ -4531,7 +4696,7 @@ itos(ints, dims, ndims)
% int *req_info, /* flag designating what information is */
% /* requested */
% int *ret_int, /* returned integer, if integer value requested*/
-% real *ret_real, /* returned real, if real value requested */
+% float *ret_float, /* returned real, if real value requested */
% string ret_char, /* returned string, if string value requested */
% int *ierr /* returned error code */
% )
@@ -4542,7 +4707,7 @@ itos(ints, dims, ndims)
*ierr = 0;
- if (ex_inquire(*idexo,*req_info,ret_int,ret_real,ret_char) == EX_FATAL)
+ if (ex_inquire(*idexo,(ex_inquiry)*req_info,ret_int,ret_float,ret_char) == EX_FATAL)
{
*ierr = EX_FATAL;
if (exoptval & EX_DEBUG)
@@ -4710,6 +4875,33 @@ itos(ints, dims, ndims)
}
}
+/*
+ * read concatenated side set node count
+ */
+% void
+% exgcssc(
+% int *idexo, /* EXODUS file ID */
+% int *side_set_node_cnt_list,/* array of node counts */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_get_concat_side_set_node_count(*idexo, side_set_node_cnt_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node counts for side sets in file id %d", *idexo);
+ ex_err("exgcssc",errmsg,EX_MSG);
+ }
+ }
+}
+
/* Routine to return floating point word size */
% int
% excpws ()
@@ -4770,7 +4962,7 @@ itos(ints, dims, ndims)
char errmsg[MAX_ERR_LENGTH];
*ierr = 0;
- ex_opts(*option_val);
+ ex_opts((ex_options)*option_val);
if (exerrval != 0)
{
*ierr = EX_FATAL;
diff --git a/forbind/src/expenm_jack.src b/forbind/src/expenm_jack.src
index 176f777..f5c4142 100644
--- a/forbind/src/expenm_jack.src
+++ b/forbind/src/expenm_jack.src
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: expenm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/expnnm_jack.src b/forbind/src/expnnm_jack.src
index 4a58099..fdc3cf1 100644
--- a/forbind/src/expnnm_jack.src
+++ b/forbind/src/expnnm_jack.src
@@ -50,7 +50,6 @@
*
* revision history -
*
-* $Id: expnnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/expvnm_jack.src b/forbind/src/expvnm_jack.src
index f06fdf6..861b831 100644
--- a/forbind/src/expvnm_jack.src
+++ b/forbind/src/expvnm_jack.src
@@ -53,7 +53,6 @@
*
* revision history -
*
-* $Id: expvnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
*
*****************************************************************************/
/*
diff --git a/forbind/src/fortc b/forbind/src/fortc
index 56d12c2..c40b483 100755
--- a/forbind/src/fortc
+++ b/forbind/src/fortc
@@ -96,7 +96,7 @@ case "$OS" in
linux*)
OS=linux;COMMON=common;TO64=fortc3_.sed;;
darwin*)
- OS=darwin;COMMON=common;;
+ OS=darwin;COMMON=common;TO64=fortc3_.sed;;
vms*)
OS=vms;;
"") echo 1>&2 \
diff --git a/forbind/test/CVS/Entries b/forbind/test/CVS/Entries
index df20467..6f5cf27 100644
--- a/forbind/test/CVS/Entries
+++ b/forbind/test/CVS/Entries
@@ -1,33 +1,38 @@
-/Imakefile/1.3/Sun Nov 26 05:37:24 2006//
-/Makefile.standalone/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/Imakefile/1.7/Tue Jul 20 21:36:59 2010//
+/Makefile.standalone/1.2/Tue Jul 20 21:36:59 2010//
/makedmp/1.1.1.1/Tue Sep 6 15:59:03 2005//
/t.f.tmp/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/test.dmp/1.4/Tue Nov 28 14:02:21 2006//
-/test.exo_f/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/test1.dmp/1.4/Tue Nov 28 14:02:21 2006//
-/test2-1.dmp/1.4/Tue Nov 28 14:02:21 2006//
-/test2-2.dmp/1.4/Tue Nov 28 14:02:21 2006//
-/testall/1.3/Sun Nov 26 05:37:24 2006//
+/test-nsided.dmp/1.1/Sat Jan 23 01:15:18 2010//
+/test.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test.exo_f/1.2/Wed Jul 15 19:17:38 2009//
+/test1.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test2-1.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/test2-2.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testall/1.5/Thu Feb 26 20:01:44 2009//
/testcp.f/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/testcp_dd.dmp/1.2/Wed Apr 12 17:44:49 2006//
-/testcp_ds.dmp/1.2/Wed Apr 12 17:44:49 2006//
-/testcp_sd.dmp/1.2/Wed Apr 12 17:44:49 2006//
-/testcp_ss.dmp/1.4/Tue Nov 28 14:02:21 2006//
+/testcp_dd.dmp/1.8/Thu Feb 26 20:01:44 2009//
+/testcp_ds.dmp/1.8/Thu Feb 26 20:01:44 2009//
+/testcp_sd.dmp/1.8/Thu Feb 26 20:01:44 2009//
+/testcp_ss.dmp/1.11/Wed Feb 24 13:48:30 2010//
/testcpd.f/1.1.1.1/Tue Sep 6 15:59:03 2005//
-/testcpln.f/1.1/Sun Nov 26 05:37:24 2006//
-/testcpnl.dmp/1.2/Tue Nov 28 14:02:21 2006//
+/testcpln.dmp/1.5/Wed Feb 24 13:48:30 2010//
+/testcpln.f/1.2/Wed Feb 20 19:50:21 2008//
+/testcpnl.dmp/1.9/Wed Feb 24 13:48:30 2010//
/testcpnl.f/1.1/Sun Nov 26 05:37:24 2006//
-/testd.dmp/1.4/Tue Nov 28 14:02:21 2006//
-/testrd.dmp/1.3/Sun Nov 26 05:37:25 2006//
+/testd.dmp/1.11/Wed Feb 24 13:48:30 2010//
+/testrd.dmp/1.9/Thu Feb 26 20:01:44 2009//
/testrd.f/1.3/Sun Nov 26 05:37:25 2006//
-/testrd1.dmp/1.2/Wed Apr 12 17:44:49 2006//
+/testrd1.dmp/1.8/Thu Feb 26 20:01:44 2009//
/testrd1.f/1.2/Wed Apr 12 17:44:49 2006//
-/testrdd.dmp/1.2/Wed Apr 12 17:44:49 2006//
+/testrd_nsid.dmp/1.1/Sat Jan 23 01:15:18 2010//
+/testrd_nsid.f/1.1/Sat Jan 23 01:15:18 2010//
+/testrdd.dmp/1.8/Thu Feb 26 20:01:44 2009//
/testrdd.f/1.1.1.1/Tue Sep 6 15:59:03 2005//
/testwt.f/1.2/Wed Apr 12 17:44:49 2006//
/testwt1.f/1.2/Wed Apr 12 17:44:49 2006//
/testwt2.f/1.1.1.1/Tue Sep 6 15:59:03 2005//
/testwt3.f/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/testwt_nsid.f/1.1/Sat Jan 23 01:15:18 2010//
/testwtd.f/1.1.1.1/Tue Sep 6 15:59:04 2005//
/testwtm.f/1.1.1.1/Tue Sep 6 15:59:04 2005//
D
diff --git a/forbind/test/Imakefile b/forbind/test/Imakefile
index 5a14663..8ff4223 100644
--- a/forbind/test/Imakefile
+++ b/forbind/test/Imakefile
@@ -36,16 +36,16 @@
ALTINC = -I../include
#if defined CatamountArchitecture
-EXOIITEST = -L../.. -lexoIIv2for32 -lexoIIv2c
-LOCALEXO = ../../libexoIIv2for32.a ../../libexoIIv2c.a
+EXOIITEST = -L../.. -lexoIIv2for32 -lexodus
+LOCALEXO = ../../libexoIIv2for32.a ../../libexodus.a
#else
-EXOIITEST = -L../.. -lexoIIv2for -lexoIIv2c
-LOCALEXO = ../../libexoIIv2for.a ../../libexoIIv2c.a
+EXOIITEST = -L../.. -lexoIIv2for -lexodus
+LOCALEXO = ../../libexoIIv2for.a ../../libexodus.a
#endif
LIBS = $(LOCALEXO) -L$(USRLIBDIR) $(NETCDF)
-PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln
+PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln testwt_nsid testrd_nsid
all:: check
@@ -60,11 +60,18 @@ NormalFortranTarget(testwtm, testwtm.o, $(LOCALEXO), /**/, $(LIBS))
NormalFortranTarget(testcp, testcp.o, $(LOCALEXO), /**/, $(LIBS))
NormalFortranTarget(testcpnl, testcpnl.o, $(LOCALEXO), /**/, $(LIBS))
NormalFortranTarget(testcpln, testcpln.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testwt_nsid, testwt_nsid.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testrd_nsid, testrd_nsid.o, $(LOCALEXO), /**/, $(LIBS))
+
+testall: testall.in1 $(CONFIGDIR)/$(MACROFILE)
+ rm -f testall
+ $(ETCDIR)/MsubCmd +R"@<" -R">@" testall.in1 >testall
test: check
-check: $(PROGS)
+check: $(PROGS) testall
csh -f ./testall
ExtraStuffToClean(*.res)
ExtraStuffToClean(*.exo)
ExtraStuffToClean(test.output)
+ExtraStuffToClean(testall)
diff --git a/forbind/test/Makefile.standalone b/forbind/test/Makefile.standalone
index a46177f..ff02980 100644
--- a/forbind/test/Makefile.standalone
+++ b/forbind/test/Makefile.standalone
@@ -32,8 +32,8 @@
#
-EXOIITEST = -L../.. -lexoIIv2for -lexoIIv2c
-LOCALEXO = ../../libexoIIv2for.a ../../libexoIIv2c.a
+EXOIITEST = -L../.. -lexoIIv2for -lexodus
+LOCALEXO = ../../libexoIIv2for.a ../../libexodus.a
LIBS = $(LOCALEXO) $(NETCDF_LIB)
PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp
diff --git a/forbind/test/test-nsided.dmp b/forbind/test/test-nsided.dmp
new file mode 100644
index 0000000..d582e7d
--- /dev/null
+++ b/forbind/test/test-nsided.dmp
@@ -0,0 +1,81 @@
+netcdf test-nsided {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 33 ;
+ num_elem = 7 ;
+ num_el_blk = 1 ;
+ num_el_in_blk1 = 7 ;
+ num_nod_per_el1 = 37 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
+ char eb_names(num_el_blk, len_string) ;
+ char coor_names(num_dim, len_string) ;
+ int elem_map(num_elem) ;
+ int connect1(num_nod_per_el1) ;
+ connect1:elem_type = "nsided" ;
+ int ebepecnt1(num_el_in_blk1) ;
+ ebepecnt1:entity_type1 = "NODE" ;
+ ebepecnt1:entity_type2 = "ELEM" ;
+ char qa_records(num_qa_rec, four, len_string) ;
+ char info_records(num_info, len_line) ;
+
+// global attributes:
+ :floating_point_word_size = 4 ;
+ :file_size = 1 ;
+ :title = "This is a test" ;
+data:
+
+ eb_status = 1 ;
+
+ eb_prop1 = 10 ;
+
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ;
+
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ;
+
+ eb_names =
+ "" ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ elem_map = 1, 2, 3, 4, 5, 6, 7 ;
+
+ connect1 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 17, 18, 19, 20, 27, 28, 30, 29, 31, 32, 33 ;
+
+ ebepecnt1 = 4, 4, 8, 4, 6, 8, 3 ;
+
+ qa_records =
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "FASTQ",
+ "fastq",
+ "07/07/93",
+ "16:41:33" ;
+
+ info_records =
+ "This is the first information record.",
+ "This is the second information record.",
+ "This is the third information record." ;
+}
diff --git a/forbind/test/test.dmp b/forbind/test/test.dmp
index ae5793c..46b3e61 100644
--- a/forbind/test/test.dmp
+++ b/forbind/test/test.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -273,7 +275,6 @@ data:
ss_prop2 = 100, 101, _, _, _ ;
qa_records =
- "TESTWT fortran version",
"testwt",
"07/07/93",
"15:41:33",
@@ -302,53 +303,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/forbind/test/test.exo_f b/forbind/test/test.exo_f
index f3c6673..2a772c1 100644
Binary files a/forbind/test/test.exo_f and b/forbind/test/test.exo_f differ
diff --git a/forbind/test/test1.dmp b/forbind/test/test1.dmp
index e034ae0..3ffef5a 100644
--- a/forbind/test/test1.dmp
+++ b/forbind/test/test1.dmp
@@ -58,11 +58,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int nm_prop1(num_node_maps) ;
nm_prop1:name = "ID" ;
char nmap_names(num_node_maps, len_string) ;
@@ -143,7 +145,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -168,10 +171,8 @@ variables:
float vals_elem_var3eb7(time_step, num_el_in_blk7) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is testwt1" ;
data:
@@ -189,18 +190,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 100, 50,
- 3, 6, 0, 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 100, 50, 0,
- 0, 0, 2, 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 0, 20,
- 6, 0, 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7,
+ 100, 50, 3, 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5,
+ 100, 50, 0, 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 0, 20, 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -222,6 +219,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
nm_prop1 = 333 ;
nmap_names =
@@ -368,7 +370,6 @@ data:
ss_prop2 = 100, 101, _, _, _ ;
qa_records =
- "TESTWT1 fortran version",
"testwt1",
"03/16/94",
"15:41:33",
@@ -397,63 +398,65 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26, 1.27, 1.28,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26, 2.27, 2.28,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5,
1.52, 1.54, 1.56,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
- 2.52, 2.54, 2.56,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78, 1.81, 1.84,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78, 2.81, 2.84,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
2.08, 2.12,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
- 3.08, 3.12,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.35, 2.4,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
- 3.35, 3.4,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5,
2.56, 2.62, 2.68,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
- 3.56, 3.62, 3.68,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82, 2.89, 2.96,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82, 3.89, 3.96,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
3.16, 3.24,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
- 4.16, 4.24,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34, 3.43, 3.52,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26, 2.27, 2.28,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5,
+ 2.52, 2.54, 2.56,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78, 2.81, 2.84,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 3.08, 3.12,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 3.35, 3.4,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5,
+ 3.56, 3.62, 3.68,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82, 3.89, 3.96,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
+ 4.16, 4.24,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34, 4.43, 4.52,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 ;
diff --git a/forbind/test/test2-1.dmp b/forbind/test/test2-1.dmp
index fc15fae..a7801f6 100644
--- a/forbind/test/test2-1.dmp
+++ b/forbind/test/test2-1.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is test 2" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -273,7 +275,6 @@ data:
ss_prop2 = 100, 101, _, _, _ ;
qa_records =
- "TESTWT2 fortran version",
"testwt2",
"07/07/93",
"15:41:33",
@@ -302,53 +303,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/forbind/test/test2-2.dmp b/forbind/test/test2-2.dmp
index a5311e6..ba2bcba 100644
--- a/forbind/test/test2-2.dmp
+++ b/forbind/test/test2-2.dmp
@@ -50,11 +50,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -110,7 +112,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
float vals_glo_var(time_step, num_glo_var) ;
- float vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ float vals_nod_var1(time_step, num_nodes) ;
+ float vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
float vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -131,10 +134,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is test 2" ;
data:
@@ -152,18 +153,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -183,6 +180,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
@@ -273,7 +275,6 @@ data:
ss_prop2 = 100, 101, _, _, _ ;
qa_records =
- "TESTWT2 fortran version",
"testwt2",
"07/07/93",
"15:41:33",
@@ -302,53 +303,55 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12,
1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24,
1.25, 1.26,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
- 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
- 2.25, 2.26,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.18, 1.2, 1.22, 1.24, 1.26,
1.28, 1.3, 1.32, 1.34, 1.36, 1.38, 1.4, 1.42, 1.44, 1.46, 1.48, 1.5, 1.52,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
- 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.27, 1.3, 1.33, 1.36,
1.39, 1.42, 1.45, 1.48, 1.51, 1.54, 1.57, 1.6, 1.63, 1.66, 1.69, 1.72,
1.75, 1.78,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
- 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
- 2.75, 2.78,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.36, 1.4, 1.44, 1.48, 1.52,
1.56, 1.6, 1.64, 1.68, 1.72, 1.76, 1.8, 1.84, 1.88, 1.92, 1.96, 2, 2.04,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
- 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.7, 1.75, 1.8, 1.85, 1.9, 1.95, 2, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
- 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78,
1.84, 1.9, 1.96, 2.02, 2.08, 2.14, 2.2, 2.26, 2.32, 2.38, 2.44, 2.5, 2.56,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
- 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.63, 1.7, 1.77, 1.84,
1.91, 1.98, 2.05, 2.12, 2.19, 2.26, 2.33, 2.4, 2.47, 2.54, 2.61, 2.68,
2.75, 2.82,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
- 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
- 3.75, 3.82,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.72, 1.8, 1.88, 1.96, 2.04,
2.12, 2.2, 2.28, 2.36, 2.44, 2.52, 2.6, 2.68, 2.76, 2.84, 2.92, 3, 3.08,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
- 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08,
2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16,
3.25, 3.34,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
+ 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12,
+ 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24,
+ 2.25, 2.26,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26,
+ 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36,
+ 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72,
+ 2.75, 2.78,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52,
+ 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65,
+ 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78,
+ 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84,
+ 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68,
+ 3.75, 3.82,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04,
+ 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08,
3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16,
4.25, 4.34,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5,
- 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5,
3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 ;
diff --git a/forbind/test/testall b/forbind/test/testall
index 97aa340..4e8a175 100644
--- a/forbind/test/testall
+++ b/forbind/test/testall
@@ -46,33 +46,33 @@ echo "testwt ..."
echo "begin testwt" > test.output
${PREFIX} ./testwt >> test.output
echo "end testwt" >> test.output
-ncdump -d5,5 test.exo | diff - test.dmp | tee testwt.res
+ncdump -d5,5 test.exo | grep -v version | diff - test.dmp | tee testwt.res
# testrd - single precision read test
echo "testrd ..."
echo "testrd ... [Expect ex_create NOCLOBBER error from this test]"
-${PREFIX} ./testrd | diff - testrd.dmp | tee testrd.res
+${PREFIX} ./testrd | grep -v version | diff - testrd.dmp | tee testrd.res
# testcp_ss - single-to-single precision copy test
echo "testcp_ss ..."
echo "begin testcp_ss" >> test.output
${PREFIX} ./testcp >> test.output
echo "end testcp_ss" >> test.output
-ncdump -d5,5 testcp.exo | diff - testcp_ss.dmp | tee testcp_ss.res
-
-# testcpnl - single-to-single, normal to large copy test
-echo "testcpnl ..."
-echo "begin testcpnl" >> test.output
-${PREFIX} ./testcpnl >> test.output
-echo "end testcpnl" >> test.output
-ncdump -d5,5 testcpnl.exo | diff - testcpnl.dmp | tee testcpnl.res
+ncdump -d5,5 testcp.exo | grep -v version | diff - testcp_ss.dmp | tee testcp_ss.res
# testcpln - single-to-single, large to normal copy test
echo "testcpln ..."
echo "begin testcpln" >> test.output
${PREFIX} ./testcpln >> test.output
echo "end testcpln" >> test.output
-ncdump -d5,5 testcp.exo | diff - testcp_ss.dmp | tee testcpln.res
+ncdump -d5,5 testcp.exo | grep -v version | diff - testcpln.dmp | tee testcpln.res
+
+# testcpnl - single-to-single, normal to large copy test
+echo "testcpnl ..."
+echo "begin testcpnl" >> test.output
+${PREFIX} ./testcpnl >> test.output
+echo "end testcpnl" >> test.output
+ncdump -d5,5 testcpnl.exo | grep -v version | diff - testcpnl.dmp | tee testcpnl.res
# testwt1 - single precision write test with multiple side sets
echo "testwt1 ..."
@@ -80,31 +80,31 @@ echo "testwt1 ... [Expect WEDGE6 warning from this test]"
echo "begin testwt1" >> test.output
${PREFIX} ./testwt1 >> test.output
echo "end testwt1" >> test.output
-ncdump -d5,5 test.exo | diff - test1.dmp | tee testwt1.res
+ncdump -d5,5 test.exo | grep -v version | diff - test1.dmp | tee testwt1.res
# testrd1 - single precision read test with multiple side sets
echo "testrd1 ..."
echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]"
-${PREFIX} ./testrd1 | diff - testrd1.dmp | tee testrd1.res
+${PREFIX} ./testrd1 | grep -v version | diff - testrd1.dmp | tee testrd1.res
# testwtd - double precision write test
echo "testwtd ..."
echo "begin testwtd" >> test.output
${PREFIX} ./testwtd >> test.output
echo "end testwtd" >> test.output
-ncdump -d5,5 test.exo | diff - testd.dmp | tee testwtd.res
+ncdump -d5,5 test.exo | grep -v version | diff - testd.dmp | tee testwtd.res
# testrdd - double precision read test
echo "testrdd ..."
-${PREFIX} ./testrdd | diff - testrdd.dmp | tee testrdd.res
+${PREFIX} ./testrdd | grep -v version | diff - testrdd.dmp | tee testrdd.res
# testwt2 - single precision write 2 files (simultaneously open) test
echo "testwt2 ..."
echo "begin testwt2" >> test.output
${PREFIX} ./testwt2 >> test.output |&grep -v "property name string"
echo "end testwt2" >> test.output
-ncdump -d5,5 test.exo | diff - test2-1.dmp | tee testwt2-1.res
-ncdump -d5,5 test2.exo | diff - test2-2.dmp | tee testwt2-2.res
+ncdump -d5,5 test.exo | grep -v version | diff - test2-1.dmp | tee testwt2-1.res
+ncdump -d5,5 test2.exo | grep -v version | diff - test2-2.dmp | tee testwt2-2.res
echo "************************************************************************"
echo "************************************************************************"
diff --git a/forbind/test/testcp_dd.dmp b/forbind/test/testcp_dd.dmp
index 50ccc4d..6c860af 100644
--- a/forbind/test/testcp_dd.dmp
+++ b/forbind/test/testcp_dd.dmp
@@ -66,8 +66,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.28f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
:file_size = 0 ;
:title = "This is a test" ;
diff --git a/forbind/test/testcp_ds.dmp b/forbind/test/testcp_ds.dmp
index 617721f..104f54e 100644
--- a/forbind/test/testcp_ds.dmp
+++ b/forbind/test/testcp_ds.dmp
@@ -66,8 +66,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.28f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
:file_size = 0 ;
:title = "This is a test" ;
diff --git a/forbind/test/testcp_sd.dmp b/forbind/test/testcp_sd.dmp
index 17ec210..da8663c 100644
--- a/forbind/test/testcp_sd.dmp
+++ b/forbind/test/testcp_sd.dmp
@@ -93,8 +93,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.28f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
:file_size = 0 ;
:title = "This is a test" ;
diff --git a/forbind/test/testcp_ss.dmp b/forbind/test/testcp_ss.dmp
index 89872c0..0ab1a37 100644
--- a/forbind/test/testcp_ss.dmp
+++ b/forbind/test/testcp_ss.dmp
@@ -45,11 +45,13 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ float coordx(num_nodes) ;
+ float coordy(num_nodes) ;
+ float coordz(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -103,10 +105,8 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -122,18 +122,14 @@ data:
ss_prop1 = 30, 31, 32, 33, 34 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3,
+ 6, 0, 3, 6, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0,
+ 0, 0, 2, 2, 2 ;
+
+ coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
+ 6, 0, 0, 6, 2, 0 ;
eb_names =
"",
@@ -153,6 +149,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
diff --git a/cbind/test/testcp_ds.dmp b/forbind/test/testcpln.dmp
similarity index 73%
copy from cbind/test/testcp_ds.dmp
copy to forbind/test/testcpln.dmp
index d7ed671..40930c4 100644
--- a/cbind/test/testcp_ds.dmp
+++ b/forbind/test/testcpln.dmp
@@ -46,10 +46,10 @@ variables:
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
float coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -103,37 +103,27 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
:file_size = 0 ;
:title = "This is a test" ;
data:
- eb_status = 1, 1, 1, 1, 1 ;
+ eb_status = 0, 0, 0, 0, 0 ;
- eb_prop1 = 10, 11, 12, 13, 14 ;
+ eb_prop1 = 0, 0, 0, 0, 0 ;
- ns_status = 1, 1 ;
+ ns_status = 0, 0 ;
- ns_prop1 = 20, 21 ;
+ ns_prop1 = 0, 0 ;
- ss_status = 1, 1, 1, 1, 1 ;
+ ss_status = 0, 0, 0, 0, 0 ;
- ss_prop1 = 30, 31, 32, 33, 34 ;
+ ss_prop1 = 0, 0, 0, 0, 0 ;
coord =
- 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0,
- 3, 6, 0,
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2,
- 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0,
- 0, 6, 2, 0 ;
-
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;
eb_names =
"",
@@ -153,92 +143,97 @@ data:
"",
"" ;
- elem_map = 1, 2, 3, 4, 5 ;
+ coor_names =
+ "",
+ "",
+ "" ;
+
+ elem_map = 0, 0, 0, 0, 0 ;
attrib1 =
- 3.1416 ;
+ 0 ;
attrib_name1 =
"" ;
connect1 =
- 1, 2, 3, 4 ;
+ 0, 0, 0, 0 ;
attrib2 =
- 6.1416 ;
+ 0 ;
attrib_name2 =
"" ;
connect2 =
- 5, 6, 7, 8 ;
+ 0, 0, 0, 0 ;
attrib3 =
- 6.1416 ;
+ 0 ;
attrib_name3 =
"" ;
connect3 =
- 9, 10, 11, 12, 13, 14, 15, 16 ;
+ 0, 0, 0, 0, 0, 0, 0, 0 ;
attrib4 =
- 6.1416 ;
+ 0 ;
attrib_name4 =
"" ;
connect4 =
- 17, 18, 19, 20 ;
+ 0, 0, 0, 0 ;
attrib5 =
- 6.1416 ;
+ 0 ;
attrib_name5 =
"" ;
connect5 =
- 21, 22, 23, 24, 25, 26 ;
+ 0, 0, 0, 0, 0, 0 ;
- eb_prop2 = 10, 20, 30, 40, 50 ;
+ eb_prop2 = _, _, _, _, _ ;
eb_prop3 = _, _, _, _, _ ;
- node_ns1 = 100, 101, 102, 103, 104 ;
+ node_ns1 = 0, 0, 0, 0, 0 ;
- dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+ dist_fact_ns1 = 0, 0, 0, 0, 0 ;
- node_ns2 = 200, 201, 202 ;
+ node_ns2 = 0, 0, 0 ;
- dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+ dist_fact_ns2 = 0, 0, 0 ;
- ns_prop2 = 4, 5 ;
+ ns_prop2 = _, _ ;
- ns_prop3 = 1000, 2000 ;
+ ns_prop3 = 0, 0 ;
- elem_ss1 = 2, 2 ;
+ elem_ss1 = 0, 0 ;
- side_ss1 = 4, 2 ;
+ side_ss1 = 0, 0 ;
- dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+ dist_fact_ss1 = 0, 0, 0, 0 ;
- elem_ss2 = 1, 2 ;
+ elem_ss2 = 0, 0 ;
- side_ss2 = 2, 3 ;
+ side_ss2 = 0, 0 ;
- dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+ dist_fact_ss2 = 0, 0, 0, 0 ;
- elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+ elem_ss3 = 0, 0, 0, 0, 0, 0, 0 ;
- side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+ side_ss3 = 0, 0, 0, 0, 0, 0, 0 ;
- elem_ss4 = 4, 4, 4, 4 ;
+ elem_ss4 = 0, 0, 0, 0 ;
- side_ss4 = 1, 2, 3, 4 ;
+ side_ss4 = 0, 0, 0, 0 ;
- elem_ss5 = 5, 5, 5, 5, 5 ;
+ elem_ss5 = 0, 0, 0, 0, 0 ;
- side_ss5 = 1, 2, 3, 4, 5 ;
+ side_ss5 = 0, 0, 0, 0, 0 ;
- ss_prop2 = 100, 101, _, _, _ ;
+ ss_prop2 = _, _, _, _, _ ;
}
diff --git a/forbind/test/testcpln.f b/forbind/test/testcpln.f
index 921b80f..29b5d8a 100644
--- a/forbind/test/testcpln.f
+++ b/forbind/test/testcpln.f
@@ -24,7 +24,7 @@ c conversion routines
cpu_ws = 8
io_ws = 4
- exoid = exopen ("testcpnl.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ exoid = exopen ("testcp.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
write (iout, '(/"after exopen, error = ",i3)')
1 ierr
diff --git a/forbind/test/testcpnl.dmp b/forbind/test/testcpnl.dmp
index 9dff25e..09c1138 100644
--- a/forbind/test/testcpnl.dmp
+++ b/forbind/test/testcpnl.dmp
@@ -1,4 +1,4 @@
-netcdf testcpnl { // format variant: 64bit
+netcdf testcpnl {
dimensions:
len_string = 33 ;
len_line = 81 ;
@@ -48,10 +48,10 @@ variables:
float coordx(num_nodes) ;
float coordy(num_nodes) ;
float coordz(num_nodes) ;
- char coor_names(num_dim, len_string) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
float attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -105,8 +105,6 @@ variables:
ss_prop2:name = "COLOR" ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 4 ;
:file_size = 1 ;
:title = "This is a test" ;
@@ -133,11 +131,6 @@ data:
coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3,
6, 0, 0, 6, 2, 0 ;
- coor_names =
- "xcoor",
- "ycoor",
- "zcoor" ;
-
eb_names =
"",
"",
@@ -156,6 +149,11 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
elem_map = 1, 2, 3, 4, 5 ;
attrib1 =
diff --git a/forbind/test/testd.dmp b/forbind/test/testd.dmp
index 711b93e..0a30771 100644
--- a/forbind/test/testd.dmp
+++ b/forbind/test/testd.dmp
@@ -38,11 +38,12 @@ variables:
int ss_status(num_side_sets) ;
int ss_prop1(num_side_sets) ;
ss_prop1:name = "ID" ;
- double coord(num_dim, num_nodes) ;
- char coor_names(num_dim, len_string) ;
+ double coordx(num_nodes) ;
+ double coordy(num_nodes) ;
char eb_names(num_el_blk, len_string) ;
char ns_names(num_node_sets, len_string) ;
char ss_names(num_side_sets, len_string) ;
+ char coor_names(num_dim, len_string) ;
int elem_map(num_elem) ;
double attrib1(num_el_in_blk1, num_att_in_blk1) ;
char attrib_name1(num_att_in_blk1, len_string) ;
@@ -80,7 +81,8 @@ variables:
char info_records(num_info, len_line) ;
char name_glo_var(num_glo_var, len_string) ;
double vals_glo_var(time_step, num_glo_var) ;
- double vals_nod_var(time_step, num_nod_var, num_nodes) ;
+ double vals_nod_var1(time_step, num_nodes) ;
+ double vals_nod_var2(time_step, num_nodes) ;
char name_nod_var(num_nod_var, len_string) ;
char name_elem_var(num_elem_var, len_string) ;
double vals_elem_var1eb1(time_step, num_el_in_blk1) ;
@@ -92,10 +94,8 @@ variables:
int elem_var_tab(num_el_blk, num_elem_var) ;
// global attributes:
- :api_version = 4.46f ;
- :version = 3.05f ;
:floating_point_word_size = 8 ;
- :file_size = 0 ;
+ :file_size = 1 ;
:title = "This is a test" ;
data:
@@ -113,13 +113,9 @@ data:
ss_prop1 = 30, 31 ;
- coord =
- 0, 1, 1, 0, 1, 2, 2, 1,
- 0, 0, 1, 1, 0, 0, 1, 1 ;
+ coordx = 0, 1, 1, 0, 1, 2, 2, 1 ;
- coor_names =
- "xcoor",
- "ycoor" ;
+ coordy = 0, 0, 1, 1, 0, 0, 1, 1 ;
eb_names =
"",
@@ -133,6 +129,10 @@ data:
"",
"" ;
+ coor_names =
+ "xcoor",
+ "ycoor" ;
+
elem_map = 1, 2 ;
attrib1 =
@@ -184,7 +184,6 @@ data:
ss_prop2 = 100, 101 ;
qa_records =
- "TESTWTD fortran version",
"testwtd",
"07/07/93",
"15:41:33",
@@ -213,26 +212,28 @@ data:
0.18,
0.2 ;
- vals_nod_var =
+ vals_nod_var1 =
1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08,
- 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08,
1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16,
- 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16,
1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24,
- 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24,
1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32,
- 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4,
- 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4,
1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48,
- 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48,
1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56,
- 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56,
1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64,
- 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64,
1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72,
+ 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 ;
+
+ vals_nod_var2 =
+ 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08,
+ 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16,
+ 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24,
+ 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32,
+ 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4,
+ 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48,
+ 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56,
+ 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64,
2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72,
- 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8,
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8 ;
name_nod_var =
diff --git a/forbind/test/testrd.dmp b/forbind/test/testrd.dmp
index 3dccdde..5ba9438 100644
--- a/forbind/test/testrd.dmp
+++ b/forbind/test/testrd.dmp
@@ -1,8 +1,7 @@
after exopen, error = 0
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
- Model Size 0
+ Model Size 1
after exgini, error = 0
database parameters:
@@ -627,7 +626,6 @@ after exinq, error = 0
after exgqa, error = 0
QA records =
-TESTWT fortran version
testwt
07/07/93
15:41:33
diff --git a/forbind/test/testrd1.dmp b/forbind/test/testrd1.dmp
index 4f0c5b2..3d9ea50 100644
--- a/forbind/test/testrd1.dmp
+++ b/forbind/test/testrd1.dmp
@@ -1,6 +1,5 @@
after exopen, error = 0
-test.exo is an EXODUSII file; version 3.05
I/O word size 4
after exgini, error = 0
@@ -731,7 +730,6 @@ after exinq, error = 0
after exgqa, error = 0
QA records =
-TESTWT1 fortran version
testwt1
03/16/94
15:41:33
diff --git a/forbind/test/testrd_nsid.dmp b/forbind/test/testrd_nsid.dmp
new file mode 100644
index 0000000..f3c59b9
--- /dev/null
+++ b/forbind/test/testrd_nsid.dmp
@@ -0,0 +1,154 @@
+
+after exopen, error = 0
+ I/O word size 4
+ Model Size 1
+
+after exgini, error = 0
+database parameters:
+title = This is a test
+num_dim = 3
+num_nodes = 33
+num_elem = 7
+num_elem_blk = 1
+num_node_sets = 0
+num_side_sets = 0
+
+after exgcor, error = 0
+x coords =
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
+ 2.0
+ 2.0
+ 1.0
+ 0.0
+ 10.0
+ 10.0
+ 1.0
+ 1.0
+ 10.0
+ 10.0
+ 1.0
+ 0.0
+ 1.0
+ 10.0
+ 7.0
+ 3.0
+ 6.0
+ 0.0
+ 3.0
+ 6.0
+ 0.0
+ 2.7
+ 6.0
+ 5.7
+ 3.7
+ 0.0
+ 10.0
+ 10.0
+y coords =
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 10.0
+ 10.0
+ 10.0
+ 10.0
+ 0.0
+ 0.0
+ 0.0
+ 5.0
+ 0.0
+ 0.0
+ 0.0
+ 2.0
+ 2.0
+ 2.0
+ 1.7
+ 1.7
+ 1.7
+ 0.0
+ 0.0
+ 0.0
+ 10.0
+z coords =
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+ 0.0
+-10.0
+-10.0
+ 0.0
+ 0.0
+-10.0
+-10.0
+ 0.0
+ 5.0
+ 2.0
+ 3.0
+ 6.0
+ 0.0
+ 0.0
+ 6.0
+ 2.0
+ 0.0
+ 2.7
+ 3.3
+ 1.7
+ 2.3
+ 0.0
+ 0.0
+ 10.0
+
+after exgcon, error = 0
+x coord name = xcoor
+y coord name = ycoor
+
+after exgmap, error = 0
+elem_map(1) = 1
+elem_map(2) = 2
+elem_map(3) = 3
+elem_map(4) = 4
+elem_map(5) = 5
+elem_map(6) = 6
+elem_map(7) = 7
+
+after exgebi, error = 0
+
+after exgelb, error = 0
+element block id = 10
+element type = nsided
+num_elem_in_block = 7
+num_nodes_per_elem = 37
+num_attr = 0
+
+after exgelc, error = 0
+
+after exgecpp, error = 0
+connect array for elem block 10
+ Element 1, Nodes/Element = 4 -- 1 2 3 4
+ Element 2, Nodes/Element = 4 -- 5 6 7 8
+ Element 3, Nodes/Element = 8 -- 9 10 11 12 13 14 15 16
+ Element 4, Nodes/Element = 4 -- 17 18 19 20
+ Element 5, Nodes/Element = 6 -- 21 22 23 24 25 26
+ Element 6, Nodes/Element = 8 -- 17 18 19 20 27 28 30 29
+ Element 7, Nodes/Element = 3 -- 31 32 33
+
+after exclos, error = 0
diff --git a/forbind/test/testrd_nsid.f b/forbind/test/testrd_nsid.f
new file mode 100644
index 0000000..4a389bf
--- /dev/null
+++ b/forbind/test/testrd_nsid.f
@@ -0,0 +1,181 @@
+ program testrd
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database read routines
+c
+c 09/07/93 V.R. Yarberry - Modified for API 2.00
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, ierr, ioff
+ integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
+ integer num_node_sets
+ integer num_side_sets
+ integer i, j, k, elem_map(100), connect(100), nnpe(10)
+ integer ids(10)
+ integer num_elem_per_set(10), num_nodes_per_set(10)
+ integer num_df_per_set(10)
+ integer num_df_in_set, num_sides_in_set
+ integer df_ind(10),node_ind(10),elem_ind(10),num_qa_rec,num_info
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer truth_tab(3,5)
+ integer num_time_steps
+ integer num_elem_in_block(10), num_nodes_per_elem(10)
+ integer num_attr(10), node_ctr_list(10), node_ctr
+ integer num_nodes_in_set, num_elem_in_set
+ integer df_list_len, list_len, elem_list_len, node_list_len
+ integer node_num, time_step, var_index, beg_time, end_time
+ integer elem_num
+ integer cpu_ws,io_ws, mod_sz
+ integer num_props, prop_value
+
+ real time_value, time_values(100), var_values(100)
+ real x(100), y(100), z(100)
+ real attrib(100), dist_fact(100)
+ real vers, fdum
+
+ character*(MXSTLN) coord_names(3), qa_record(4,2), var_names(3)
+ character*(MXLNLN) inform(3), titl
+ character*(MXSTLN) eltype(10)
+ character cdum*1
+ character*(MXSTLN) prop_names(3)
+ character*(MXSTLN) attrib_names(100)
+
+ data iin /5/, iout /6/
+
+
+c
+c open EXODUS II files
+c
+
+ cpu_ws = 0
+ io_ws = 0
+
+ exoid = exopen ("test-nsided.exo", EXREAD, cpu_ws, io_ws,
+ * vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test-nsided.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size",i2)') io_ws
+
+ mod_sz = exlgmd(exoid)
+ write (iout, '(" Model Size",i2)') mod_sz
+
+c
+c read database parameters
+c
+
+ call exgini (exoid, titl, num_dim, num_nodes, num_elem,
+ 1 num_elem_blk, num_node_sets, num_side_sets, ierr)
+ write (iout, '(/"after exgini, error = ", i3)' ) ierr
+
+ write (iout, '("database parameters:"/
+ 1 "title = ", a81 /
+ 2 "num_dim = ", i3 /
+ 3 "num_nodes = ", i3 /
+ 4 "num_elem = ", i3 /
+ 5 "num_elem_blk = ", i3 /
+ 6 "num_node_sets = ", i3 /
+ 7 "num_side_sets = ", i3)')
+ 8 titl,num_dim, num_nodes, num_elem,
+ 9 num_elem_blk,num_node_sets, num_side_sets
+
+
+c
+c read nodal coordinates values and names from database
+c
+
+ call exgcor (exoid, x, y, z, ierr)
+ write (iout, '(/"after exgcor, error = ", i3)' ) ierr
+
+ write (iout, '("x coords = ")')
+ do 10 i = 1, num_nodes
+ write (iout, '(f5.1)') x(i)
+10 continue
+
+ write (iout, '("y coords = ")')
+ do 20 i = 1, num_nodes
+ write (iout, '(f5.1)') y(i)
+20 continue
+
+ if (num_dim .gt. 2) then
+ write (iout, '("z coords = ")')
+ do 22 i = 1, num_nodes
+ write (iout, '(f5.1)') z(i)
+22 continue
+ endif
+
+ call exgcon (exoid, coord_names, ierr)
+ write (iout, '(/"after exgcon, error = ", i3)' ) ierr
+
+ write (iout, '("x coord name = ", a9)') coord_names(1)
+ write (iout, '("y coord name = ", a9)') coord_names(2)
+
+c
+c read element order map
+c
+
+ call exgmap (exoid, elem_map, ierr)
+ write (iout, '(/"after exgmap, error = ", i3)' ) ierr
+
+ do 30 i = 1, num_elem
+ write (iout, '("elem_map(",i1,") = ", i1)') i, elem_map(i)
+30 continue
+
+c
+c read element block parameters
+c
+c
+ call exgebi (exoid, ids, ierr)
+ write (iout, '(/"after exgebi, error = ", i3)' ) ierr
+
+ do 40 i = 1, num_elem_blk
+
+ call exgelb (exoid, ids(i), eltype(i), num_elem_in_block(i),
+ 1 num_nodes_per_elem(i), num_attr(i), ierr)
+ write (iout, '(/"after exgelb, error = ", i3)' ) ierr
+
+ write (iout, '("element block id = ", i2,/
+ 1 "element type = ", a9,/
+ 2 "num_elem_in_block = ", i2,/
+ 3 "num_nodes_per_elem = ", i2,/
+ 4 "num_attr = ", i2)')
+ 5 ids(i), eltype(i), num_elem_in_block(i),
+ 6 num_nodes_per_elem(i), num_attr(i)
+
+40 continue
+
+c
+c read element connectivity
+c
+
+ do 60 i = 1, num_elem_blk
+
+ call exgelc (exoid, ids(i), connect, ierr)
+ write (iout, '(/"after exgelc, error = ", i3)' ) ierr
+
+ if (eltype(i) .eq. 'nsided' .or. eltype(i) .eq. 'NSIDED') then
+ call exgecpp(exoid, EXEBLK, ids(i), nnpe, ierr)
+ write (iout, '(/"after exgecpp, error = ", i3)' ) ierr
+
+ write (iout, '("connect array for elem block ", i2)') ids(i)
+
+ ioff = 0
+ do j = 1, num_elem_in_block(i)
+ write (iout, 100) j, nnpe(j), (connect(ioff+k),k=1,nnpe(j))
+ ioff = ioff + nnpe(j)
+ end do
+
+ end if
+60 continue
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+ 100 format(' Element ',I3,', Nodes/Element = ',I3,' -- ',20I3)
+ stop
+ end
+
diff --git a/forbind/test/testrdd.dmp b/forbind/test/testrdd.dmp
index afdefb2..be84733 100644
--- a/forbind/test/testrdd.dmp
+++ b/forbind/test/testrdd.dmp
@@ -1,6 +1,5 @@
after exopen, error = 0
-test.exo is an EXODUSII file; version 3.05
I/O word size 8
after exgini, error = 0
@@ -278,7 +277,6 @@ after exinq, error = 0
after exgqa, error = 0
QA records =
-TESTWTD fortran version
testwtd
07/07/93
15:41:33
diff --git a/forbind/test/testwt_nsid.f b/forbind/test/testwt_nsid.f
new file mode 100644
index 0000000..dea7ce7
--- /dev/null
+++ b/forbind/test/testwt_nsid.f
@@ -0,0 +1,375 @@
+ program testwt
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines.
+c
+ include 'exodusII.inc'
+
+ integer iin, iout
+ integer exoid, num_dim,num_nodes,elem_map(5),num_elem,num_elem_blk
+ integer num_elem_in_block(10), num_nodes_per_elem(10),numattr(10)
+ integer num_node_sets, num_side_sets
+ integer i, j, k, m, connect(37), nnpe(10)
+ integer node_list(100), elem_list(100), side_list(100)
+ integer ebids(10),ids(10), num_nodes_per_set(10)
+ integer num_elem_per_set(10), num_df_per_set(10)
+ integer df_ind(10), node_ind(10), elem_ind(10)
+ integer num_qa_rec, num_info
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer truth_tab(3,5)
+ integer whole_time_step, num_time_steps
+ integer cpu_word_size, io_word_size
+ integer prop_array(2)
+
+ real glob_var_vals(100), nodal_var_vals(100)
+ real time_value, elem_var_vals(100)
+ real x(100), y(100), z(100)
+ real attrib(100), dist_fact(100)
+
+ character*(MXSTLN) coord_names(3)
+ character*(MXSTLN) cname
+ character*(MXSTLN) var_names(3)
+ character*(MXSTLN) qa_record(4,2)
+ character*(MXLNLN) inform(3)
+ character*(MXSTLN) prop_names(2)
+ character*(MXSTLN) attrib_names(1)
+
+ data iin /5/, iout /6/
+
+ call exopts (EXABRT, ierr)
+ write (iout,'("after exopts, error = ", i4)') ierr
+ cpu_word_size = 0
+ io_word_size = 0
+c
+c create EXODUS II files
+c
+ exoid = excre ("test-nsided.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test-nsided.exo, id: ", i4)') exoid
+ write (iout,'(" cpu word size: ",i4," io word size: ",i4)')
+ 1 cpu_word_size, io_word_size
+ write (iout,'("after excre, error = ", i4)') ierr
+c
+c initialize file with parameters
+c
+ num_dim = 3
+ num_nodes = 33
+ num_elem = 7
+ num_elem_blk = 1
+ num_node_sets = 0
+ num_side_sets = 0
+
+ call expini (exoid, "This is a test", num_dim, num_nodes,
+ 1 num_elem, num_elem_blk, num_node_sets,
+ 2 num_side_sets, ierr)
+
+ write (iout, '("after expini, error = ", i4)' ) ierr
+
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write nodal coordinates values and names to database
+c
+c Quad #1
+ x(1) = 0.0
+ x(2) = 1.0
+ x(3) = 1.0
+ x(4) = 0.0
+
+ y(1) = 0.0
+ y(2) = 0.0
+ y(3) = 1.0
+ y(4) = 1.0
+
+ z(1) = 0.0
+ z(2) = 0.0
+ z(3) = 0.0
+ z(4) = 0.0
+
+c Quad #2
+ x(5) = 1.0
+ x(6) = 2.0
+ x(7) = 2.0
+ x(8) = 1.0
+
+ y(5) = 0.0
+ y(6) = 0.0
+ y(7) = 1.0
+ y(8) = 1.0
+
+ z(5) = 0.0
+ z(6) = 0.0
+ z(7) = 0.0
+ z(8) = 0.0
+
+c Hex #1
+ x(9) = 0.0
+ x(10) = 10.0
+ x(11) = 10.0
+ x(12) = 1.0
+ x(13) = 1.0
+ x(14) = 10.0
+ x(15) = 10.0
+ x(16) = 1.0
+
+ y(9) = 0.0
+ y(10) = 0.0
+ y(11) = 0.0
+ y(12) = 0.0
+ y(13) = 10.0
+ y(14) = 10.0
+ y(15) = 10.0
+ y(16) = 10.0
+
+ z(9) = 0.0
+ z(10) = 0.0
+ z(11) =-10.0
+ z(12) =-10.0
+ z(13) = 0.0
+ z(14) = 0.0
+ z(15) =-10.0
+ z(16) =-10.0
+
+c Tetra #1
+ x(17) = 0.0
+ x(18) = 1.0
+ x(19) = 10.0
+ x(20) = 7.0
+
+ y(17) = 0.0
+ y(18) = 0.0
+ y(19) = 0.0
+ y(20) = 5.0
+
+ z(17) = 0.0
+ z(18) = 5.0
+ z(19) = 2.0
+ z(20) = 3.0
+
+c Wedge #1
+ x(21) = 3.0
+ x(22) = 6.0
+ x(23) = 0.0
+ x(24) = 3.0
+ x(25) = 6.0
+ x(26) = 0.0
+
+ y(21) = 0.0
+ y(22) = 0.0
+ y(23) = 0.0
+ y(24) = 2.0
+ y(25) = 2.0
+ y(26) = 2.0
+
+ z(21) = 6.0
+ z(22) = 0.0
+ z(23) = 0.0
+ z(24) = 6.0
+ z(25) = 2.0
+ z(26) = 0.0
+
+C Tetra #2
+ x(27) = 2.7
+ x(28) = 6.0
+ x(29) = 5.7
+ x(30) = 3.7
+
+ y(27) = 1.7
+ y(28) = 1.7
+ y(29) = 1.7
+ y(30) = 0.0
+
+ z(27) = 2.7
+ z(28) = 3.3
+ z(29) = 1.7
+ z(30) = 2.3
+
+C 3d Tri
+ x(31) = 0.0
+ x(32) = 10.0
+ x(33) = 10.0
+
+ y(31) = 0.0
+ y(32) = 0.0
+ y(33) = 10.0
+
+ z(31) = 0.0
+ z(32) = 0.0
+ z(33) = 10.0
+
+ call expcor (exoid, x, y, z, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ coord_names(1) = "xcoor"
+ coord_names(2) = "ycoor"
+ coord_names(3) = "zcoor"
+
+ call expcon (exoid, coord_names, ierr)
+ write (iout, '("after expcon, error = ", i4)' ) ierr
+ call exupda(exoid,ierr)
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+
+c
+c write element order map
+c
+
+ do 10 i = 1, num_elem
+ elem_map(i) = i
+10 continue
+
+ call expmap (exoid, elem_map, ierr)
+ write (iout, '("after expmap, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write element block parameters
+c
+
+ num_elem_in_block(1) = 7
+
+ num_nodes_per_elem(1) = 37 ! This is total nodes per block
+
+ ebids(1) = 10
+
+ numattr(1) = 0
+
+ cname = "nsided"
+
+ call expelb (exoid,ebids(1),cname,num_elem_in_block(1),
+ 1 num_nodes_per_elem(1),numattr(1),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write element connectivity
+c
+ connect( 1) = 1
+ connect( 2) = 2
+ connect( 3) = 3
+ connect( 4) = 4
+ nnpe(1) = 4
+
+ connect( 5) = 5
+ connect( 6) = 6
+ connect( 7) = 7
+ connect( 8) = 8
+ nnpe(2) = 4
+
+ connect( 9) = 9
+ connect(10) = 10
+ connect(11) = 11
+ connect(12) = 12
+ connect(13) = 13
+ connect(14) = 14
+ connect(15) = 15
+ connect(16) = 16
+ nnpe(3) = 8
+
+ connect(17) = 17
+ connect(18) = 18
+ connect(19) = 19
+ connect(20) = 20
+ nnpe(4) = 4
+
+ connect(21) = 21
+ connect(22) = 22
+ connect(23) = 23
+ connect(24) = 24
+ connect(25) = 25
+ connect(26) = 26
+ nnpe(5) = 6
+
+ connect(27) = 17
+ connect(28) = 18
+ connect(29) = 19
+ connect(30) = 20
+ connect(31) = 27
+ connect(32) = 28
+ connect(33) = 30
+ connect(34) = 29
+ nnpe(6) = 8
+
+ connect(35) = 31
+ connect(36) = 32
+ connect(37) = 33;
+ nnpe(7) = 3
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expecpp(exoid, EXEBLK, ebids(1), nnpe, ierr)
+ write (iout, '("after expecpp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+c
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "TESTWT fortran version"
+ qa_record(2,1) = "testwt"
+ qa_record(3,1) = "07/07/93"
+ qa_record(4,1) = "15:41:33"
+ qa_record(1,2) = "FASTQ"
+ qa_record(2,2) = "fastq"
+ qa_record(3,2) = "07/07/93"
+ qa_record(4,2) = "16:41:33"
+
+ call expqa (exoid, num_qa_rec, qa_record, ierr)
+ write (iout, '("after expqa, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+
+c
+c write information records
+c
+
+ num_info = 3
+
+ inform(1) = "This is the first information record."
+ inform(2) = "This is the second information record."
+ inform(3) = "This is the third information record."
+
+ call expinf (exoid, num_info, inform, ierr)
+ write (iout, '("after expinf, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ stop
+ end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/exodus.git
More information about the debian-science-commits
mailing list