[exodus] 01/48: Initial checkin of exodusii-4.6
Alastair McKinstry
mckinstry at moszumanska.debian.org
Wed Jul 15 11:35:48 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 753ae2d345d0230b876bf9a1adb1b3df221868ac
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Sat Apr 23 14:41:21 2011 +0100
Initial checkin of exodusii-4.6
---
CMakeLists.txt | 11 +
COPYRIGHT | 32 +
CVS/Entries | 9 +
CVS/Repository | 1 +
CVS/Root | 1 +
DartConfig.cmake | 17 +
Imakefile | 118 +
Makefile.standalone | 243 ++
README | 74 +
cbind/CMakeLists.txt | 204 ++
cbind/CVS/Entries | 4 +
cbind/CVS/Repository | 1 +
cbind/CVS/Root | 1 +
cbind/include/CVS/Entries | 7 +
cbind/include/CVS/Repository | 1 +
cbind/include/CVS/Root | 1 +
cbind/include/Imakefile | 6 +
cbind/include/exodusII.h | 686 ++++++
cbind/include/exodusII_cfg.h.in | 26 +
cbind/include/exodusII_ext.h | 228 ++
cbind/include/exodusII_int.h | 583 +++++
cbind/include/exodusII_test.h | 20 +
cbind/src/CVS/Entries | 153 ++
cbind/src/CVS/Repository | 1 +
cbind/src/CVS/Root | 1 +
cbind/src/Imakefile | 72 +
cbind/src/Makefile.standalone | 41 +
cbind/src/ex_conv.c | 584 +++++
cbind/src/ex_utils.c | 1236 ++++++++++
cbind/src/exclos.c | 125 +
cbind/src/excn2s.c | 1004 ++++++++
cbind/src/excopy.c | 843 +++++++
cbind/src/excre.c | 290 +++
cbind/src/exerr.c | 118 +
cbind/src/exgatm.c | 131 ++
cbind/src/exgatn.c | 210 ++
cbind/src/exgatt.c | 227 ++
cbind/src/exgblk.c | 354 +++
cbind/src/exgcns.c | 96 +
cbind/src/exgcon.c | 152 ++
cbind/src/exgconn.c | 410 ++++
cbind/src/exgcor.c | 261 +++
cbind/src/exgcset.c | 263 +++
cbind/src/exgcss.c | 98 +
cbind/src/exgean.c | 65 +
cbind/src/exgeat.c | 74 +
cbind/src/exgebi.c | 73 +
cbind/src/exgelb.c | 79 +
cbind/src/exgelc.c | 73 +
cbind/src/exgem.c | 72 +
cbind/src/exgenm.c | 152 ++
cbind/src/exgev.c | 83 +
cbind/src/exgevid.c | 62 +
cbind/src/exgevt.c | 81 +
cbind/src/exgfrm.c | 151 ++
cbind/src/exggv.c | 117 +
cbind/src/exggvt.c | 142 ++
cbind/src/exgids.c | 204 ++
cbind/src/exginf.c | 157 ++
cbind/src/exgini.c | 103 +
cbind/src/exginix.c | 203 ++
cbind/src/exgmap.c | 153 ++
cbind/src/exgmp.c | 109 +
cbind/src/exgnam.c | 165 ++
cbind/src/exgnams.c | 184 ++
cbind/src/exgnm.c | 71 +
cbind/src/exgnmap.c | 208 ++
cbind/src/exgnnm.c | 151 ++
cbind/src/exgnp.c | 76 +
cbind/src/exgns.c | 75 +
cbind/src/exgnsd.c | 74 +
cbind/src/exgnsi.c | 72 +
cbind/src/exgnstt.c | 66 +
cbind/src/exgnsv.c | 146 ++
cbind/src/exgnsvid.c | 64 +
cbind/src/exgnv.c | 137 ++
cbind/src/exgnvid.c | 120 +
cbind/src/exgnvt.c | 168 ++
cbind/src/exgnvv.c | 117 +
cbind/src/exgoatt.c | 236 ++
cbind/src/exgoea.c | 67 +
cbind/src/exgotv.c | 198 ++
cbind/src/exgp.c | 231 ++
cbind/src/exgpa.c | 251 ++
cbind/src/exgpem.c | 200 ++
cbind/src/exgpn.c | 135 ++
cbind/src/exgqa.c | 167 ++
cbind/src/exgset.c | 304 +++
cbind/src/exgsetd.c | 248 ++
cbind/src/exgsetp.c | 261 +++
cbind/src/exgsnl.c | 522 +++++
cbind/src/exgsp.c | 78 +
cbind/src/exgss.c | 77 +
cbind/src/exgssc.c | 620 +++++
cbind/src/exgssd.c | 72 +
cbind/src/exgssi.c | 72 +
cbind/src/exgssn.c | 1135 +++++++++
cbind/src/exgsstt.c | 66 +
cbind/src/exgssv.c | 138 ++
cbind/src/exgssvid.c | 64 +
cbind/src/exgtim.c | 114 +
cbind/src/exgtt.c | 250 ++
cbind/src/exgvan.c | 177 ++
cbind/src/exgvar.c | 200 ++
cbind/src/exgvart.c | 387 +++
cbind/src/exgvid.c | 130 ++
cbind/src/exgvnm.c | 202 ++
cbind/src/exgvp.c | 164 ++
cbind/src/exgvtt.c | 70 +
cbind/src/exgvv.c | 104 +
cbind/src/exinq.c | 1144 +++++++++
cbind/src/exopen.c | 195 ++
cbind/src/exopts.c | 91 +
cbind/src/expatn.c | 187 ++
cbind/src/expatt.c | 240 ++
cbind/src/expblk.c | 503 ++++
cbind/src/expcab.c | 648 ++++++
cbind/src/expclb.c | 385 +++
cbind/src/expcns.c | 89 +
cbind/src/expcon.c | 132 ++
cbind/src/expconn.c | 332 +++
cbind/src/expcor.c | 258 ++
cbind/src/expcset.c | 613 +++++
cbind/src/expcss.c | 92 +
cbind/src/expean.c | 66 +
cbind/src/expeat.c | 65 +
cbind/src/expelb.c | 75 +
cbind/src/expelc.c | 166 ++
cbind/src/expem.c | 70 +
cbind/src/expenm.c | 190 ++
cbind/src/expev.c | 310 +++
cbind/src/expfrm.c | 184 ++
cbind/src/expgv.c | 76 +
cbind/src/expinf.c | 194 ++
cbind/src/expini.c | 98 +
cbind/src/expinix.c | 519 +++++
cbind/src/expmap.c | 188 ++
cbind/src/expmp.c | 325 +++
cbind/src/expnam.c | 161 ++
cbind/src/expnams.c | 248 ++
cbind/src/expnm.c | 66 +
cbind/src/expnmap.c | 323 +++
cbind/src/expnnm.c | 190 ++
cbind/src/expnp.c | 76 +
cbind/src/expns.c | 74 +
cbind/src/expnsd.c | 74 +
cbind/src/expnstt.c | 73 +
cbind/src/expnsv.c | 310 +++
cbind/src/expnv.c | 125 +
cbind/src/expnvv.c | 105 +
cbind/src/expoatt.c | 251 ++
cbind/src/expoea.c | 68 +
cbind/src/expp.c | 361 +++
cbind/src/exppa.c | 325 +++
cbind/src/exppem.c | 265 +++
cbind/src/exppn.c | 218 ++
cbind/src/expqa.c | 209 ++
cbind/src/expset.c | 302 +++
cbind/src/expsetd.c | 260 +++
cbind/src/expsetp.c | 473 ++++
cbind/src/expsp.c | 78 +
cbind/src/expss.c | 76 +
cbind/src/expssd.c | 72 +
cbind/src/expsstt.c | 75 +
cbind/src/expssv.c | 318 +++
cbind/src/exptim.c | 112 +
cbind/src/exptt.c | 371 +++
cbind/src/expvan.c | 192 ++
cbind/src/expvar.c | 384 +++
cbind/src/expvnm.c | 177 ++
cbind/src/expvp.c | 384 +++
cbind/src/expvpa.c | 97 +
cbind/src/expvpax.c | 585 +++++
cbind/src/expvpc.c | 75 +
cbind/src/expvtt.c | 77 +
cbind/src/expvv.c | 98 +
cbind/src/exupda.c | 84 +
cbind/test/CMakeLists.txt | 77 +
cbind/test/CVS/Entries | 59 +
cbind/test/CVS/Repository | 1 +
cbind/test/CVS/Root | 1 +
cbind/test/CreateEdgeFace.c | 601 +++++
cbind/test/Imakefile | 88 +
cbind/test/Makefile.standalone | 145 ++
cbind/test/ReadEdgeFace.c | 448 ++++
cbind/test/create_mesh.c | 963 ++++++++
cbind/test/makedmp | 122 +
cbind/test/rd_wt_mesh.c | 1266 ++++++++++
cbind/test/test.dmp | 963 ++++++++
cbind/test/test.exo_c | 40 +
cbind/test/test1.dmp | 708 ++++++
cbind/test/test2-1.dmp | 550 +++++
cbind/test/test2-2.dmp | 550 +++++
cbind/test/test2.dmp | 274 +++
cbind/test/test_clb.dmp | 981 ++++++++
cbind/test/testall | 192 ++
cbind/test/testall.in | 194 ++
cbind/test/testcp.c | 119 +
cbind/test/testcp_dd.dmp | 244 ++
cbind/test/testcp_ds.dmp | 244 ++
cbind/test/testcp_ln.c | 119 +
cbind/test/testcp_nl.c | 119 +
cbind/test/testcp_nl.dmp | 281 +++
cbind/test/testcp_sd.dmp | 278 +++
cbind/test/testcp_ss.dmp | 278 +++
cbind/test/testcpd.c | 119 +
cbind/test/testd.dmp | 550 +++++
cbind/test/testrd.c | 1121 +++++++++
cbind/test/testrd.dmp | 1059 +++++++++
cbind/test/testrd1.c | 1048 +++++++++
cbind/test/testrd1.dmp | 904 +++++++
cbind/test/testrd_nc.c | 894 +++++++
cbind/test/testrd_nc.dmp | 927 ++++++++
cbind/test/testrd_ss.c | 340 +++
cbind/test/testrd_ss.dmp | 525 +++++
cbind/test/testrd_zeroe.dmp | 339 +++
cbind/test/testrd_zeron.dmp | 88 +
cbind/test/testrdd.c | 900 +++++++
cbind/test/testrdd.dmp | 776 +++++++
cbind/test/testrdv.c | 930 ++++++++
cbind/test/testrdv.dmp | 931 ++++++++
cbind/test/testrdwt.c | 457 ++++
cbind/test/testwt-one-attrib.c | 272 +++
cbind/test/testwt-zeroe.c | 474 ++++
cbind/test/testwt-zeroe.dmp | 178 ++
cbind/test/testwt-zeron.c | 444 ++++
cbind/test/testwt-zeron.dmp | 91 +
cbind/test/testwt.c | 1176 ++++++++++
cbind/test/testwt1.c | 935 ++++++++
cbind/test/testwt2.c | 1301 +++++++++++
cbind/test/testwt_clb.c | 1000 ++++++++
cbind/test/testwt_nc.c | 1171 ++++++++++
cbind/test/testwt_nossnsdf.c | 892 +++++++
cbind/test/testwt_ss.c | 835 +++++++
cbind/test/testwt_ss.dmp | 291 +++
cbind/test/testwtbig.c | 777 +++++++
cbind/test/testwtd.c | 788 +++++++
cbind/test/testwtm.c | 1405 +++++++++++
exodusii.dsp | 497 ++++
forbind/CVS/Entries | 3 +
forbind/CVS/Repository | 1 +
forbind/CVS/Root | 1 +
forbind/include/CVS/Entries | 4 +
forbind/include/CVS/Repository | 1 +
forbind/include/CVS/Root | 1 +
forbind/include/Imakefile | 6 +
forbind/include/exodusII.inc | 183 ++
forbind/include/exodusII_int.inc | 167 ++
forbind/src/CVS/Entries | 57 +
forbind/src/CVS/Repository | 1 +
forbind/src/CVS/Root | 1 +
forbind/src/Imakefile | 234 ++
forbind/src/Makefile.standalone | 109 +
forbind/src/addrwrap.F | 3135 +++++++++++++++++++++++++
forbind/src/aix.m4 | 68 +
forbind/src/aix0.inc | 29 +
forbind/src/catamount.m4 | 71 +
forbind/src/common.inc | 153 ++
forbind/src/common.m4 | 79 +
forbind/src/common2.m4 | 79 +
forbind/src/cougar.m4 | 71 +
forbind/src/cray.m4 | 82 +
forbind/src/darwin.m4 | 73 +
forbind/src/excopy_jack.src | 107 +
forbind/src/exgem_jack.src | 141 ++
forbind/src/exgenm_jack.src | 111 +
forbind/src/exgmp_jack.src | 110 +
forbind/src/exgnm_jack.src | 110 +
forbind/src/exgnnm_jack.src | 111 +
forbind/src/exgvnm_jack.src | 155 ++
forbind/src/exo_jack.src | 4785 ++++++++++++++++++++++++++++++++++++++
forbind/src/exodus.hh | 186 ++
forbind/src/expem_jack.src | 140 ++
forbind/src/expenm_jack.src | 109 +
forbind/src/expmp_jack.src | 109 +
forbind/src/expnm_jack.src | 109 +
forbind/src/expnnm_jack.src | 110 +
forbind/src/expvnm_jack.src | 157 ++
forbind/src/fortc | 112 +
forbind/src/fortc1.sed | 95 +
forbind/src/fortc2.sed | 44 +
forbind/src/fortc3.sed | 1 +
forbind/src/fortc3_.sed | 1 +
forbind/src/hp.m4 | 68 +
forbind/src/hpux.m4 | 68 +
forbind/src/hpux0.inc | 34 +
forbind/src/interix.m4 | 73 +
forbind/src/irix.m4 | 73 +
forbind/src/irix0.inc | 25 +
forbind/src/linux.m4 | 72 +
forbind/src/msoft.m4 | 71 +
forbind/src/msoft0.inc | 29 +
forbind/src/osf.m4 | 73 +
forbind/src/osf0.inc | 25 +
forbind/src/paragon.m4 | 71 +
forbind/src/puma.m4 | 71 +
forbind/src/pumagon.m4 | 71 +
forbind/src/sgi.m4 | 73 +
forbind/src/sun.m4 | 67 +
forbind/src/sunos.m4 | 68 +
forbind/src/sunos0.inc | 29 +
forbind/src/ultrix.m4 | 73 +
forbind/src/ultrix0.inc | 25 +
forbind/src/unicos.m4 | 82 +
forbind/src/unicos0.inc | 29 +
forbind/src/vms.m4 | 74 +
forbind/src/vms0.inc | 29 +
forbind/test/CVS/Entries | 33 +
forbind/test/CVS/Repository | 1 +
forbind/test/CVS/Root | 1 +
forbind/test/Imakefile | 70 +
forbind/test/Makefile.standalone | 105 +
forbind/test/makedmp | 104 +
forbind/test/t.f.tmp | 924 ++++++++
forbind/test/test.dmp | 550 +++++
forbind/test/test.exo_f | Bin 0 -> 3844 bytes
forbind/test/test1.dmp | 708 ++++++
forbind/test/test2-1.dmp | 550 +++++
forbind/test/test2-2.dmp | 550 +++++
forbind/test/testall | 110 +
forbind/test/testcp.f | 63 +
forbind/test/testcp_dd.dmp | 139 ++
forbind/test/testcp_ds.dmp | 139 ++
forbind/test/testcp_sd.dmp | 201 ++
forbind/test/testcp_ss.dmp | 244 ++
forbind/test/testcpd.f | 63 +
forbind/test/testcpln.f | 68 +
forbind/test/testcpnl.dmp | 247 ++
forbind/test/testcpnl.f | 68 +
forbind/test/testd.dmp | 322 +++
forbind/test/testrd.dmp | 799 +++++++
forbind/test/testrd.f | 733 ++++++
forbind/test/testrd1.dmp | 919 ++++++++
forbind/test/testrd1.f | 827 +++++++
forbind/test/testrdd.dmp | 411 ++++
forbind/test/testrdd.f | 691 ++++++
forbind/test/testwt.f | 1158 +++++++++
forbind/test/testwt1.f | 997 ++++++++
forbind/test/testwt2.f | 1432 ++++++++++++
forbind/test/testwt3.f | 594 +++++
forbind/test/testwtd.f | 539 +++++
forbind/test/testwtm.f | 946 ++++++++
342 files changed, 97609 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..98d78c6
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,11 @@
+PROJECT(ExodusII)
+
+SET(EXODUSII_VERSION_MAJOR "2")
+SET(EXODUSII_VERSION_MINOR "0")
+SET(EXODUSII_VERSION_PATCH "0")
+SET(EXODUSII_VERSION "${EXODUSII_VERSION_MAJOR}.${EXODUSII_VERSION_MINOR}")
+SET(EXODUSII_VERSION_FULL "${EXODUSII_VERSION}.${EXODUSII_VERSION_PATCH}")
+
+SET(EXODUSII_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}")
+
+SUBDIRS(cbind)
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..f11b681
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,32 @@
+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.
+
diff --git a/CVS/Entries b/CVS/Entries
new file mode 100644
index 0000000..49106cb
--- /dev/null
+++ b/CVS/Entries
@@ -0,0 +1,9 @@
+/CMakeLists.txt/1.1/Sun Nov 26 05:37:17 2006//
+/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//
+/exodusii.dsp/1.1.1.1/Tue Sep 6 15:59:03 2005//
+D/cbind////
+D/forbind////
diff --git a/CVS/Repository b/CVS/Repository
new file mode 100644
index 0000000..f232f5a
--- /dev/null
+++ b/CVS/Repository
@@ -0,0 +1 @@
+exodusii
diff --git a/CVS/Root b/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/DartConfig.cmake b/DartConfig.cmake
new file mode 100644
index 0000000..5264ed8
--- /dev/null
+++ b/DartConfig.cmake
@@ -0,0 +1,17 @@
+# Dashboard is opened for submissions for a 24 hour period starting at
+# the specified NIGHLY_START_TIME. Time is specified in 24 hour format.
+SET (NIGHTLY_START_TIME "21:00:00 EDT")
+
+# Dart server to submit results (used by client)
+SET (DROP_SITE "tigre.ca.sandia.gov")
+SET (DROP_LOCATION "Drop/")
+SET (DROP_SITE_USER "dart")
+SET (DROP_METHOD "scp")
+SET (TRIGGER_SITE "http://${DROP_SITE}/~dart/cgi-bin/Dart-vtkSNL.pl")
+
+# Project Home Page
+SET (PROJECT_URL "http://tigre.ca.sandia.gov/vtkSNL")
+SET (CVS_WEB_URL "http://${DROP_SITE}/vtk/")
+SET (CVS_WEB_CVSROOT "vtkSNL")
+SET (USE_DOXYGEN "On")
+SET (DOXYGEN_URL "http://tigre.ca.sandia.gov/vtkSNL/Documentation/Doxygen/" )
diff --git a/Imakefile b/Imakefile
new file mode 100644
index 0000000..6c93f97
--- /dev/null
+++ b/Imakefile
@@ -0,0 +1,118 @@
+XCOMM Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+XCOMM DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+XCOMM retains certain rights in this software.
+XCOMM
+XCOMM Redistribution and use in source and binary forms, with or without
+XCOMM modification, are permitted provided that the following conditions are
+XCOMM met:
+XCOMM
+XCOMM * Redistributions of source code must retain the above copyright
+XCOMM notice, this list of conditions and the following disclaimer.
+XCOMM
+XCOMM * Redistributions in binary form must reproduce the above
+XCOMM copyright notice, this list of conditions and the following
+XCOMM disclaimer in the documentation and/or other materials provided
+XCOMM with the distribution.
+XCOMM
+XCOMM * Neither the name of Sandia Corporation nor the names of its
+XCOMM contributors may be used to endorse or promote products derived
+XCOMM from this software without specific prior written permission.
+XCOMM
+XCOMM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+XCOMM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+XCOMM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+XCOMM A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+XCOMM OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+XCOMM SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+XCOMM LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+XCOMM DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+XCOMM THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+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
+ * % accmkmf
+ * % make Makefiles
+ * % make
+ *
+ * Building ExodusII libraries for debugging
+ * % accmkmf
+ * % make Makefiles
+ * % make CDEBUGFLAGS=-g
+ *
+ * Building ExodusII libraries on Sandias Teraflop machine
+ * Service Partition
+ * % accmkmf
+ * % make Makefiles
+ * % make all
+ * Service Partition
+ * % accmkmf -D PARALLEL
+ * % make Makefiles
+ * % make all
+ *
+ */
+
+#define IHaveSubdirs
+
+#define PassDebugFlags "CDEBUGFLAGS=$(CDEBUGFLAGS)"
+#define PassCDebugFlags "CDEBUGFLAGS=$(CDEBUGFLAGS)"
+
+#define ExtraOptions "CCOPTIONS=$(CCOPTIONS)"
+
+#ifdef PARALLEL
+CCOPTIONS = ParallelCCOptions
+F77OPTIONS = ParallelF77Options
+LIBDIR = $(PLIBDIR)
+#endif
+
+INCLIST1 = exodusII.h exodusII_int.h exodusII_ext.h
+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)
+#else
+AllTarget(libexoIIv2c.a libexoIIv2for.a)
+#endif
+
+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)
+
+/* Directory for exodusII fortran wrappers */
+NamedTargetSubdirs(libexoIIv2for.a,forbind/src,"making exoIIv2for ",PassDebugFlags ExtraOptions,libexoIIv2for.a)
+
+#if Build64BitAccess == YES
+NamedTargetSubdirs(libexoIIv2for32.a,forbind/src,"making exoIIv2for32 ",PassDebugFlags ExtraOptions,libexoIIv2for32.a)
+#endif
+
+InstallLibrary(exoIIv2c,$(LIBDIR))
+InstallLibrary(exoIIv2for,$(LIBDIR))
+
+#if Build64BitAccess == YES
+InstallLibrary(exoIIv2for32,$(LIBDIR))
+#endif
+
+#if Parallel
+InstallParallelLibrary(exoIIv2c,$(PLIBDIR))
+InstallParallelLibrary(exoIIv2for,$(PLIBDIR))
+
+#if Build64BitAccess == YES
+InstallParallelLibrary(exoIIv2for32,$(PLIBDIR))
+#endif
+
+#endif
+check: test
+test:: libexoIIv2c.a libexoIIv2for.a
+
+NamedMakeSubdirs(test,cbind/test)
+NamedMakeSubdirs(test,forbind/test)
+DependSubdirs($(SUBDIRS))
diff --git a/Makefile.standalone b/Makefile.standalone
new file mode 100644
index 0000000..51aa4cd
--- /dev/null
+++ b/Makefile.standalone
@@ -0,0 +1,243 @@
+# 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.
+#
+
+#========================================================================
+# A platform must define:
+#
+# BITS either 32 or 64 depending on a 32-bit or 64-bit build
+# CC == the C compiler
+# FC == the Fortran compiler
+# CCOPTIONS == non-optimization related flags for C compiling on this platform
+# F77OPTIONS == non-optimization related flags for Fortran compiling on this platform
+# OS_TYPE == See listing in forbind/src/Imakefile
+# RANLIB == ranlib or 'true' if no ranlib
+# AR == command to build an archive library.
+#
+#========================================================================
+
+SYSTEM := $(shell uname)
+
+#========================================================================
+# Linux
+#========================================================================
+ifeq ($(SYSTEM),Linux)
+
+# Default Compiler:
+COMPILER = GNU
+
+BITS = 32
+RANLIB = ranlib
+OS_TYPE = linux
+
+AR = ar -rcv
+
+ifeq ($(COMPILER),Portland)
+CC = pgcc
+FC = pgf77
+CCOPTIONS = -Mframe
+F77OPTIONS = -fast
+endif
+
+ifeq ($(COMPILER),Intel)
+CC = icc
+CCOPTIONS = -Xc
+endif
+
+ifeq ($(COMPILER),GNU)
+CC = gcc
+FC = g77
+CCOPTIONS = -O2 -Wall -Wno-deprecated
+F77OPTIONS = -O2
+endif
+
+endif
+
+#========================================================================
+# SUN
+#========================================================================
+ifeq ($(SYSTEM),SunOS)
+RANLIB = ranlib
+OS_TYPE = sunos
+
+AR = CC -xar -o
+
+ifeq ($(COMPILER),GNU)
+BITS = 32
+CC = gcc
+FC = g77
+CCOPTIONS = -Wall
+else
+BITS = 32
+CC = cc
+FC = f77
+CCOPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -Xc
+F77OPTIONS = -xtarget=ultra2 -xarch=v9 -g -ftrap=common -errtags=INVOKE -C
+endif
+endif
+
+#========================================================================
+# SGI
+#========================================================================
+ifeq ($(SYSTEM),IRIX64)
+BITS = 64
+RANLIB = true
+OS_TYPE = irix
+
+AR = ar -rcv
+CC = cc
+FC = f77
+CCOPTIONS = -64 -LANG:std
+F77OPTIONS = -64
+F77PREC = -DBuild64 -r8 -i8
+endif
+
+#========================================================================
+# IBM
+#========================================================================
+ifeq ($(SYSTEM),AIX)
+BITS = 64
+RANLIB = ranlib
+OS_TYPE = aix
+
+AR = ar -rcv -X64
+CC = xlc
+FC = xlf
+CCOPTIONS = -q64 -w
+F77OPTIONS = -q64 -w
+F77PREC = -WF,-DBuild64 -qintsize=8 -qrealsize=8
+LDFLAGS = -bmaxdata:0x06FFFFFFFFFFFFF8 -bmaxstack:0x10000000
+endif
+
+#========================================================================
+
+#========================================================================
+# TFLOP
+#========================================================================
+ifeq ($(SYSTEM),TFLOP)
+BITS = 32
+RANLIB = ranlib
+OS_TYPE = osf
+
+AR = xar -rcv
+CC = icc
+FC = if77
+CCOPTIONS = -DPUMAGON -cougar
+F77OPTIONS = -cougar
+endif
+
+#========================================================================
+
+#========================================================================
+# OSF (DEC Alpha)
+#========================================================================
+ifeq ($(SYSTEM),OSF1)
+BITS = 32
+RANLIB = ranlib
+OS_TYPE = osf
+
+AR = ar -crsv
+CC = cc
+FC = f77
+CCOPTIONS = -std
+endif
+#========================================================================
+
+#========================================================================
+# Darwin (Apple OSX)
+#========================================================================
+ifeq ($(SYSTEM),Darwin)
+BITS = 32
+RANLIB = ranlib
+OS_TYPE = darwin
+
+AR = ar -crsv
+CC = gcc
+FC = g77
+CCOPTIONS =
+F77OPTIONS =
+endif
+#========================================================================
+
+OPTIMIZE_FLAG = -O2
+STD_DEFINES = -DVERBOSE
+
+CFLAGS = $(OPTIMIZE_FLAG) $(CCOPTIONS) $(STD_DEFINES) $(LOC_EXOII_INC) $(NETCDF_INC)
+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_LIB_DIR = $(ACCESS)/lib
+NETCDF_LIB = -L$(NETCDF_LIB_DIR) -lnetcdf
+
+
+SUBDIRS = cbind/src forbind/src cbind/test forbind/test
+
+all:: libexoIIv2c.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
+
+libexoIIv2for.a::
+ echo "making exoIIv2for in forbind/src"
+ (cd forbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "BITS=$(BITS)" "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "RANLIB=$(RANLIB)" "SYSTEM=$(SYSTEM)" "OS_TYPE=$(OS_TYPE)" libexoIIv2for.a)
+ cp forbind/src/libexoIIv2for.a .
+ $(RANLIB) libexoIIv2for.a
+
+check: test
+test:: libexoIIv2c.a libexoIIv2for.a
+
+test::
+ echo "making test in cbind/test"
+ (cd cbind/test && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" "RANLIB=$(RANLIB)" "NETCDF_LIB=$(NETCDF_LIB)" all)
+
+test::
+ echo "making test in forbind/test"
+ (cd forbind/test && $(MAKE) $(MFLAGS) -f Makefile.standalone "BITS=$(BITS)" "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "LDFLAGS=$(LDFLAGS)" "RANLIB=$(RANLIB)" "NETCDF_LIB=$(NETCDF_LIB)" "SYSTEM=$(SYSTEM)" all)
+
+clean::
+ @for flag in $(MAKEFLAGS) ''; do \
+ case "$$flag" in *=*) ;; *[ik]*) set +e;; esac; done; \
+ for i in $(SUBDIRS) ;\
+ do \
+ if test -d $$i; then \
+ echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
+ (cd $$i && $(MAKE) -f Makefile.standalone $(MFLAGS) clean); \
+ fi; \
+ done
+
diff --git a/README b/README
new file mode 100644
index 0000000..238eb6f
--- /dev/null
+++ b/README
@@ -0,0 +1,74 @@
+The ExodusII library is licensed under the terms of the BSD License.
+
+Legal stuff (copyright, licensing restrictions, etc.) can be found in
+the file COPYRIGHT which contains:
+
+1. The Sandia Corporation Copyright Notice.
+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>.
+Please identify the version of the package.
+
+
+========================================================================
+NETCDF
+
+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".
+
+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:
+
+#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
+above.
+
+========================================================================
diff --git a/cbind/CMakeLists.txt b/cbind/CMakeLists.txt
new file mode 100644
index 0000000..8a57c72
--- /dev/null
+++ b/cbind/CMakeLists.txt
@@ -0,0 +1,204 @@
+INCLUDE(CheckIncludeFile)
+CHECK_INCLUDE_FILE( malloc.h EX_HAVE_MALLOC_H )
+
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/exodusII_cfg.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/include/exodusII_cfg.h
+ @ONLY IMMEDIATE)
+
+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"
+)
+
+SET(cbind_SRCS
+ src/exclos.c
+ src/excn2s.c
+ src/ex_conv.c
+ src/excopy.c
+ src/excre.c
+ src/exerr.c
+ src/exgatm.c
+ src/exgcns.c
+ src/exgcon.c
+ src/exgcor.c
+ src/exgcset.c
+ src/exgcss.c
+ src/exgean.c
+ src/exgatn.c
+ src/exgeat.c
+ src/exgatt.c
+ src/exgebi.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/exgids.c
+ src/exginf.c
+ src/exgini.c
+ src/exginix.c
+ src/exgmap.c
+ src/exgmp.c
+ src/exgnam.c
+ src/exgnams.c
+ src/exgnm.c
+ src/exgnnm.c
+ src/exgnp.c
+ src/exgns.c
+ src/exgnsd.c
+ src/exgnsi.c
+ src/exgnstt.c
+ src/exgnsv.c
+ src/exgnsvid.c
+ src/exgnv.c
+ src/exgnvid.c
+ src/exgnvt.c
+ src/exgnvv.c
+ src/exgoea.c
+ src/exgoatt.c
+ src/exgotv.c
+ src/exgpa.c
+ src/exgp.c
+ src/exgpem.c
+ src/exgpn.c
+ src/exgqa.c
+ src/exgsnl.c
+ src/exgsetp.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
+ src/exgsstt.c
+ src/exgssv.c
+ src/exgssvid.c
+ src/exgtim.c
+ src/exgtt.c
+ src/exgvan.c
+ src/exgvid.c
+ src/exgvnm.c
+ src/exgvp.c
+ src/exgvtt.c
+ src/exgvv.c
+ src/exinq.c
+ src/exopen.c
+ src/exopts.c
+ src/expatn.c
+ src/expatt.c
+ src/expcab.c
+ src/expclb.c
+ src/expcns.c
+ src/expcon.c
+ src/expconn.c
+ src/expcor.c
+ src/expcset.c
+ src/expcss.c
+ src/expean.c
+ src/expeat.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/expinf.c
+ src/expini.c
+ src/expinix.c
+ src/expmap.c
+ src/expmp.c
+ src/expnam.c
+ src/expnams.c
+ src/expnm.c
+ src/expnmap.c
+ src/exgnmap.c
+ src/expnnm.c
+ src/expnp.c
+ src/expns.c
+ src/expnsd.c
+ src/expnstt.c
+ src/expnsv.c
+ src/expnv.c
+ src/expnvv.c
+ src/expoea.c
+ src/expoatt.c
+ src/exppa.c
+ src/expp.c
+ src/exppem.c
+ src/exppn.c
+ src/expqa.c
+ src/expsetp.c
+ src/expset.c
+ src/expsetd.c
+ src/expsp.c
+ src/expss.c
+ src/expssd.c
+ src/expsstt.c
+ src/expssv.c
+ src/exptim.c
+ src/exptt.c
+ src/expvan.c
+ src/expvar.c
+ src/expvnm.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
+)
+
+IF(APPLE)
+ SET_SOURCE_FILES_PROPERTIES(
+ src/ex_utils.c
+ PROPERTIES
+ COMPILE_FLAGS -fno-common)
+ENDIF(APPLE)
+
+ADD_LIBRARY(exoIIc ${cbind_SRCS})
+TARGET_LINK_LIBRARIES(exoIIc NetCDF)
+
+IF(VTK_LIBRARY_PROPERTIES)
+ SET_TARGET_PROPERTIES(exoIIc PROPERTIES ${VTK_LIBRARY_PROPERTIES})
+ENDIF(VTK_LIBRARY_PROPERTIES)
+
+IF(NOT VTK_INSTALL_NO_LIBRARIES)
+ 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)
+ ELSE(VTK_INSTALL_HAS_CMAKE_24)
+ INSTALL_TARGETS(${CMAKE_INSTALL_PREFIX}/lib exoIIc)
+ ENDIF(VTK_INSTALL_HAS_CMAKE_24)
+ENDIF(NOT VTK_INSTALL_NO_LIBRARIES)
+
+IF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+# INSTALL_FILES(${VTK_INSTALL_INCLUDE_DIR}/vtkexodus2 .h
+ENDIF(NOT VTK_INSTALL_NO_DEVELOPMENT)
+
+INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
+
+IF (BUILD_TESTING)
+ ENABLE_TESTING()
+ SUBDIRS(test)
+ENDIF (BUILD_TESTING)
+
diff --git a/cbind/CVS/Entries b/cbind/CVS/Entries
new file mode 100644
index 0000000..ac99b55
--- /dev/null
+++ b/cbind/CVS/Entries
@@ -0,0 +1,4 @@
+/CMakeLists.txt/1.1/Sun Nov 26 05:37:18 2006//
+D/include////
+D/src////
+D/test////
diff --git a/cbind/CVS/Repository b/cbind/CVS/Repository
new file mode 100644
index 0000000..4d19fcc
--- /dev/null
+++ b/cbind/CVS/Repository
@@ -0,0 +1 @@
+exodusii/cbind
diff --git a/cbind/CVS/Root b/cbind/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/cbind/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/cbind/include/CVS/Entries b/cbind/include/CVS/Entries
new file mode 100644
index 0000000..85b4d96
--- /dev/null
+++ b/cbind/include/CVS/Entries
@@ -0,0 +1,7 @@
+/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//
+/exodusII_test.h/1.1/Tue Nov 28 14:01:59 2006//
+D
diff --git a/cbind/include/CVS/Repository b/cbind/include/CVS/Repository
new file mode 100644
index 0000000..5abf188
--- /dev/null
+++ b/cbind/include/CVS/Repository
@@ -0,0 +1 @@
+exodusii/cbind/include
diff --git a/cbind/include/CVS/Root b/cbind/include/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/cbind/include/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/cbind/include/Imakefile b/cbind/include/Imakefile
new file mode 100644
index 0000000..4465fe0
--- /dev/null
+++ b/cbind/include/Imakefile
@@ -0,0 +1,6 @@
+XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
+
+INCLIST=exodusII.h exodusII_int.h exodusII_ext.h
+
+InstallIncludeList(install,$(INCLIST),$(INCDIR))
+
diff --git a/cbind/include/exodusII.h b/cbind/include/exodusII.h
new file mode 100644
index 0000000..a5fa239
--- /dev/null
+++ b/cbind/include/exodusII.h
@@ -0,0 +1,686 @@
+/*
+ * 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.
+ *
+ */
+
+/*****************************************************************************
+ *
+ * exodusII.h - Exodus II include file, for general use
+ *
+ * author - Sandia National Laboratories
+ *
+ * environment - UNIX
+ *
+ * exit conditions -
+ *
+ * revision history -
+ *
+ * $Id: exodusII.h,v 1.4 2006/11/28 14:01:59 gdsjaar Exp $
+ *****************************************************************************/
+
+#include "netcdf.h"
+#include "stddef.h"
+
+#ifndef TRUE
+#define TRUE -1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#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.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * The following are miscellaneous constants used in the EXODUS II API.
+ */
+
+#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 */
+
+#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 */
+
+ /* 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
+#define MAX_LINE_LENGTH 80L
+#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
+
+ /* 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);
+
+ extern int ex_get_var_tab (int exoid,
+ const char *var_type,
+ int num_blk,
+ int num_var,
+ int *var_tab);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ /* ERROR CODE DEFINITIONS AND STORAGE */
+ extern int exerrval; /* shared error return value */
+ extern int exoptval; /* error reporting flag (default is quiet) */
+
+#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 */
+
+#include "exodusII_ext.h"
diff --git a/cbind/include/exodusII_cfg.h.in b/cbind/include/exodusII_cfg.h.in
new file mode 100755
index 0000000..f43f4a6
--- /dev/null
+++ b/cbind/include/exodusII_cfg.h.in
@@ -0,0 +1,26 @@
+#ifndef __exodusII_cfg_h
+#define __exodusII_cfg_h
+
+#define EXODUSII_VERSION_MAJOR @EXODUSII_VERSION_MAJOR@
+#define EXODUSII_VERSION_MINOR @EXODUSII_VERSION_MINOR@
+#define EXODUSII_VERSION_PATCH @EXODUSII_VERSION_PATCH@
+#define EXODUSII_VERSION "@EXODUSII_VERSION_MAJOR at .@EXODUSII_VERSION_MINOR at .@EXODUSII_VERSION_PATCH@"
+
+#if defined(_WIN32) && !defined(WIN32)
+# 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)
+# define EXODUS_EXPORT __declspec( dllexport ) extern
+# else
+# define EXODUS_EXPORT __declspec( dllimport ) extern
+# endif
+#else
+# define EXODUS_EXPORT extern
+#endif
+
+#endif
+
diff --git a/cbind/include/exodusII_ext.h b/cbind/include/exodusII_ext.h
new file mode 100644
index 0000000..3ddee0b
--- /dev/null
+++ b/cbind/include/exodusII_ext.h
@@ -0,0 +1,228 @@
+#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.
+ */
+typedef struct ex_init_params {
+ char title[MAX_LINE_LENGTH + 1];
+ int num_dim;
+ int num_nodes;
+ int num_edge;
+ int num_edge_blk;
+ int num_face;
+ int num_face_blk;
+ int num_elem;
+ int num_elem_blk;
+ int num_node_sets;
+ int num_edge_sets;
+ int num_face_sets;
+ int num_side_sets;
+ int num_elem_sets;
+ int num_node_maps;
+ int num_edge_maps;
+ int num_face_maps;
+ int num_elem_maps;
+} ex_init_params;
+
+typedef struct ex_block_params {
+ 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;
+ char** face_type;
+ 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;
+} ex_block_params;
+
+typedef struct ex_set_specs {
+ int* sets_ids;
+ int* num_entries_per_set;
+ int* num_dist_per_set;
+ int* sets_entry_index;
+ int* sets_dist_index;
+ int* sets_entry_list;
+ int* sets_extra_list;
+ void* sets_dist_fact;
+} ex_set_specs;
+
+typedef struct ex_var_params {
+ int num_glob;
+ int num_node;
+ int num_edge;
+ int* edge_var_tab;
+ int num_face;
+ int* face_var_tab;
+ int num_elem;
+ int* elem_var_tab;
+ int num_nset;
+ int* nset_var_tab;
+ int num_eset;
+ int* eset_var_tab;
+ int num_fset;
+ int* fset_var_tab;
+ int num_sset;
+ int* sset_var_tab;
+ int num_elset;
+ int* elset_var_tab;
+} ex_var_params;
+
+#ifndef EXODUS_EXPORT
+#define EXODUS_EXPORT extern
+#endif /* EXODUS_EXPORT */
+
+/* (MODIFIED) Write Initialization Parameters */
+EXODUS_EXPORT int ex_put_init_ext (int, const ex_init_params*);
+
+/* (MODIFIED) Read Initialization Parameters */
+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*);
+
+/* Read Number Map */
+EXODUS_EXPORT int ex_get_num_map (int, int, int, int*);
+
+/* Write Edge Face or Element Block Parameters */
+EXODUS_EXPORT int ex_put_block (int, int, 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*,
+ int*, int*);
+
+/* Write All Edge Face and Element Block Parameters */
+EXODUS_EXPORT int ex_put_concat_all_blocks(int, const ex_block_params*);
+
+/* Write Edge Face or Element Block Connectivity */
+EXODUS_EXPORT int ex_put_conn (int, int, 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*);
+
+/* Write Edge Face or Element Block Attributes */
+EXODUS_EXPORT int ex_put_attr (int, int, int, const void*);
+
+/* Read Edge Face or Element Block Attributes */
+EXODUS_EXPORT int ex_get_attr (int, int, int, void*);
+
+/* Write One Edge Face or Element Block Attribute */
+EXODUS_EXPORT int ex_put_one_attr (int, int, int, int, const void*);
+
+/* Read One Edge Face or Element Block Attribute */
+EXODUS_EXPORT int ex_get_one_attr (int, int, int, int, void*);
+
+/* Write Edge Face or Element Block Attribute Names */
+EXODUS_EXPORT int ex_put_attr_names (int, int, int, char**);
+
+/* Read Edge Face or Element Block Attribute Names */
+EXODUS_EXPORT int ex_get_attr_names (int, int, int, char**);
+
+/* Write Node Edge Face or Side Set Parameters */
+EXODUS_EXPORT int ex_put_set_param (int, int, int, int, int);
+
+/* Read Node Edge Face or Side Set Parameters */
+EXODUS_EXPORT int ex_get_set_param (int, int, int, int*, int*);
+
+/* Write a Node Edge Face or Side Set */
+EXODUS_EXPORT int ex_put_set (int, int, int, const int*, const int*);
+
+/* Read a Node Edge Face or Side Set */
+EXODUS_EXPORT int ex_get_set (int, int, 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*);
+
+/* Read Node Edge Face or Side Set Distribution Factors */
+EXODUS_EXPORT int ex_get_set_dist_fact (int, int, int, void*);
+
+/* Write Concatenated Node Edge Face or Side Sets */
+EXODUS_EXPORT int ex_put_concat_sets (int, int, const ex_set_specs*);
+
+/* Read Concatenated Node Edge Face or Side Sets */
+EXODUS_EXPORT int ex_get_concat_sets(int, int, 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,
+ const void*);
+
+/* 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*);
+
+/* 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,
+ void*);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __exodus_ext_h */
diff --git a/cbind/include/exodusII_int.h b/cbind/include/exodusII_int.h
new file mode 100644
index 0000000..9ca77c5
--- /dev/null
+++ b/cbind/include/exodusII_int.h
@@ -0,0 +1,583 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+#define EXODUS_II_INT_HDR
+
+#include "netcdf.h"
+
+#ifndef __APPLE__
+#if defined __STDC__ || defined __cplusplus
+#include <stdlib.h>
+#endif
+#endif
+
+#ifdef _MSC_VER
+# pragma warning ( disable : 4127 )
+# pragma warning ( disable : 4706 )
+# pragma warning ( disable : 4701 )
+#endif
+
+#if defined(__BORLANDC__)
+#pragma warn -8004 /* "assigned a value that is never used" */
+#endif
+
+
+#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
+#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
+
+/* Exodus error return codes - function return values: */
+#define EX_FATAL -1 /* fatal error flag def */
+#define EX_NOERR 0 /* no error flag def */
+#define EX_WARN 1 /* warning flag def */
+
+/*
+ * This file contains defined constants that are used internally in the
+ * EXODUS II API.
+ *
+ * The first group of constants refer to netCDF variables, attributes, or
+ * dimensions in which the EXODUS II data are stored. Using the defined
+ * constants will allow the names of the netCDF entities to be changed easily
+ * in the future if needed. The first three letters of the constant identify
+ * the netCDF entity as a variable (VAR), dimension (DIM), or attribute (ATT).
+ *
+ * NOTE: The entity name should not have any blanks in it. Blanks are
+ * technically legal but some netcdf utilities (ncgen in particular)
+ * fail when they encounter a blank in a name.
+ *
+ * DEFINED CONSTANT ENTITY NAME DATA STORED IN ENTITY
+ */
+#define ATT_FILE_TYPE "type" /* obsolete */
+#define ATT_TITLE "title" /* the database title */
+#define ATT_API_VERSION "api_version" /* the EXODUS II api vers # */
+#define ATT_API_VERSION_BLANK "api version" /* the EXODUS II api vers # */
+ /* used for db version 2.01 */
+ /* and earlier */
+#define ATT_VERSION "version" /* the EXODUS II file vers # */
+#define ATT_FILESIZE "file_size" /* 1=large, 0=normal */
+#define ATT_FLT_WORDSIZE "floating_point_word_size"
+ /* word size of floating */
+ /* point numbers in file */
+#define ATT_FLT_WORDSIZE_BLANK "floating point word size"
+ /* word size of floating */
+ /* point numbers in file */
+ /* used for db version 2.01 */
+ /* and earlier */
+#define DIM_NUM_NODES "num_nodes" /* # of nodes */
+#define DIM_NUM_DIM "num_dim" /* # of dimensions; 2- or 3-d*/
+#define DIM_NUM_EDGE "num_edge" /* # of edges (over all blks)*/
+#define DIM_NUM_FACE "num_face" /* # of faces (over all blks)*/
+#define DIM_NUM_ELEM "num_elem" /* # of elements */
+#define DIM_NUM_EL_BLK "num_el_blk" /* # of element blocks */
+#define DIM_NUM_ED_BLK "num_ed_blk" /* # of edge blocks */
+#define DIM_NUM_FA_BLK "num_fa_blk" /* # of face blocks */
+#define VAR_COORD "coord" /* nodal coordinates */
+#define VAR_COORD_X "coordx" /* X-dimension coordinate */
+#define VAR_COORD_Y "coordy" /* Y-dimension coordinate */
+#define VAR_COORD_Z "coordz" /* Z-dimension coordinate */
+#define VAR_NAME_COOR "coor_names" /* names of coordinates */
+#define VAR_NAME_EL_BLK "eb_names" /* names of element blocks */
+#define VAR_NAME_NS "ns_names" /* names of node sets */
+#define VAR_NAME_SS "ss_names" /* names of side sets */
+#define VAR_NAME_EM "emap_names" /* names of element maps */
+#define VAR_NAME_EDM "edmap_names" /* names of edge maps */
+#define VAR_NAME_FAM "famap_names" /* names of face maps */
+#define VAR_NAME_NM "nmap_names" /* names of node maps */
+#define VAR_NAME_ED_BLK "ed_names" /* names of edge blocks */
+#define VAR_NAME_FA_BLK "fa_names" /* names of face blocks */
+#define VAR_NAME_ES "es_names" /* names of edge sets */
+#define VAR_NAME_FS "fs_names" /* names of face sets */
+#define VAR_NAME_ELS "els_names" /* names of element sets */
+#define VAR_STAT_EL_BLK "eb_status" /* element block status */
+#define VAR_STAT_ECONN "econn_status" /* element block edge status */
+#define VAR_STAT_FCONN "fconn_status" /* element block face status */
+#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 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)
+ /* # of elements in element */
+ /* block num */
+#define DIM_NUM_NOD_PER_EL(num) ex_catstr("num_nod_per_el",num)
+ /* # of nodes per element in */
+ /* element block num */
+#define DIM_NUM_ATT_IN_BLK(num) ex_catstr("num_att_in_blk",num)
+ /* # of attributes in element*/
+ /* block num */
+#define DIM_NUM_ED_IN_EBLK(num) ex_catstr("num_ed_in_blk",num)
+ /* # of edges in edge */
+ /* block num */
+#define DIM_NUM_NOD_PER_ED(num) ex_catstr("num_nod_per_ed",num)
+ /* # of nodes per edge in */
+ /* edge block num */
+#define DIM_NUM_EDG_PER_EL(num) ex_catstr("num_edg_per_el",num)
+ /* # of edges per element in */
+ /* element block num */
+#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)
+ /* # of faces in face */
+ /* block num */
+#define DIM_NUM_NOD_PER_FA(num) ex_catstr("num_nod_per_fa",num)
+ /* # of nodes per face in */
+ /* face block num */
+#define DIM_NUM_FAC_PER_EL(num) ex_catstr("num_fac_per_el",num)
+ /* # of faces per element in */
+ /* element block num */
+#define DIM_NUM_ATT_IN_FBLK(num) ex_catstr("num_att_in_fblk",num)
+ /* # of attributes in face */
+ /* block num */
+#define VAR_CONN(num) ex_catstr("connect",num)
+ /* element connectivity for */
+ /* element block num */
+#define VAR_ATTRIB(num) ex_catstr("attrib",num)
+ /* list of attributes for */
+ /* element block num */
+#define VAR_NAME_ATTRIB(num) ex_catstr("attrib_name",num)
+ /* list of attribute names */
+ /* for element block num */
+#define VAR_EB_PROP(num) ex_catstr("eb_prop",num)
+ /* list of the numth property*/
+ /* for all element blocks */
+#define VAR_ECONN(num) ex_catstr("edgconn",num)
+ /* edge connectivity for */
+ /* element block num */
+#define VAR_EBCONN(num) ex_catstr("ebconn",num)
+ /* edge connectivity for */
+ /* edge block num */
+#define VAR_EATTRIB(num) ex_catstr("eattrb",num)
+ /* list of attributes for */
+ /* edge block num */
+#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)
+ /* list of the numth property*/
+ /* for all edge blocks */
+#define VAR_FCONN(num) ex_catstr("facconn",num)
+ /* face connectivity for */
+ /* element block num */
+#define VAR_FBCONN(num) ex_catstr("fbconn",num)
+ /* face connectivity for */
+ /* face block num */
+#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)
+ /* list of the numth property*/
+ /* for all face blocks */
+#define ATT_PROP_NAME "name" /* name attached to element */
+ /* block, node set, side */
+ /* set, element map, or */
+ /* map properties */
+#define VAR_MAP "elem_map" /* element order map */
+ /* obsolete, replaced by */
+ /* VAR_ELEM_MAP(num) */
+#define DIM_NUM_SS "num_side_sets" /* # of side sets */
+#define VAR_SS_STAT "ss_status" /* side set status */
+#define VAR_SS_IDS "ss_prop1" /* side set id properties */
+#define DIM_NUM_SIDE_SS(num) ex_catstr("num_side_ss",num)
+ /* # of sides in side set num*/
+#define DIM_NUM_DF_SS(num) ex_catstr("num_df_ss",num)
+ /* # of distribution factors */
+ /* in side set num */
+/*#define DIM_NUM_NOD_SS(num) ex_catstr("num_nod_ss",num) *** obsolete *** */
+ /* # of nodes in side set num*/
+#define VAR_FACT_SS(num) ex_catstr("dist_fact_ss",num)
+ /* the distribution factors */
+ /* for each node in side */
+ /* set num */
+#define VAR_ELEM_SS(num) ex_catstr("elem_ss",num)
+ /* list of elements in side */
+ /* set num */
+#define VAR_SIDE_SS(num) ex_catstr("side_ss",num)
+ /* list of sides in side set */
+#define VAR_SS_PROP(num) ex_catstr("ss_prop",num)
+ /* list of the numth property*/
+ /* for all side sets */
+#define DIM_NUM_ES "num_edge_sets"/* # of edge sets */
+#define VAR_ES_STAT "es_status" /* edge set status */
+#define VAR_ES_IDS "es_prop1" /* edge set id properties */
+#define DIM_NUM_EDGE_ES(num) ex_catstr("num_edge_es",num)
+ /* # of edges in edge set num*/
+#define DIM_NUM_DF_ES(num) ex_catstr("num_df_es",num)
+ /* # of distribution factors */
+ /* in edge set num */
+/*#define DIM_NUM_NOD_ES(num) ex_catstr("num_nod_es",num) *** obsolete *** */
+ /* # of nodes in edge set num*/
+#define VAR_FACT_ES(num) ex_catstr("dist_fact_es",num)
+ /* the distribution factors */
+ /* for each node in edge */
+ /* set num */
+#define VAR_EDGE_ES(num) ex_catstr("edge_es",num)
+ /* list of edges in edge */
+ /* set num */
+#define VAR_ORNT_ES(num) ex_catstr("ornt_es",num)
+ /* list of orientations in */
+ /* the edge set. */
+#define VAR_ES_PROP(num) ex_catstr("es_prop",num)
+ /* list of the numth property*/
+ /* for all edge sets */
+#define DIM_NUM_FS "num_face_sets"/* # of face sets */
+#define VAR_FS_STAT "fs_status" /* face set status */
+#define VAR_FS_IDS "fs_prop1" /* face set id properties */
+#define DIM_NUM_FACE_FS(num) ex_catstr("num_face_fs",num)
+ /* # of faces in side set num*/
+#define DIM_NUM_DF_FS(num) ex_catstr("num_df_fs",num)
+ /* # of distribution factors */
+ /* in face set num */
+/*#define DIM_NUM_NOD_FS(num) ex_catstr("num_nod_ss",num) *** obsolete *** */
+ /* # of nodes in face set num*/
+#define VAR_FACT_FS(num) ex_catstr("dist_fact_fs",num)
+ /* the distribution factors */
+ /* for each node in face */
+ /* set num */
+#define VAR_FACE_FS(num) ex_catstr("face_fs",num)
+ /* list of elements in face */
+ /* set num */
+#define VAR_ORNT_FS(num) ex_catstr("ornt_fs",num)
+ /* list of sides in side set */
+#define VAR_FS_PROP(num) ex_catstr("fs_prop",num)
+ /* list of the numth property*/
+ /* for all face sets */
+#define DIM_NUM_ELS "num_elem_sets"/* # of elem sets */
+#define DIM_NUM_ELE_ELS(num) ex_catstr("num_ele_els",num)
+ /* # of elements in elem set */
+ /* num */
+#define DIM_NUM_DF_ELS(num) ex_catstr("num_df_els",num)
+ /* # of distribution factors */
+ /* in element set num */
+#define VAR_ELS_STAT "els_status" /* elem set status */
+#define VAR_ELS_IDS "els_prop1" /* elem set id properties */
+#define VAR_ELEM_ELS(num) ex_catstr("elem_els",num)
+ /* list of elements in elem */
+ /* set num */
+#define VAR_FACT_ELS(num) ex_catstr("dist_fact_els",num)
+ /* list of distribution */
+ /* factors in elem set num */
+#define VAR_ELS_PROP(num) ex_catstr("els_prop",num)
+ /* list of the numth property*/
+ /* for all elem sets */
+#define DIM_NUM_NS "num_node_sets"/* # of node sets */
+#define DIM_NUM_NOD_NS(num) ex_catstr("num_nod_ns",num)
+ /* # of nodes in node set */
+ /* num */
+#define DIM_NUM_DF_NS(num) ex_catstr("num_df_ns",num)
+ /* # of distribution factors */
+ /* in node set num */
+#define VAR_NS_STAT "ns_status" /* node set status */
+#define VAR_NS_IDS "ns_prop1" /* node set id properties */
+#define VAR_NODE_NS(num) ex_catstr("node_ns",num)
+ /* list of nodes in node set */
+ /* num */
+#define VAR_FACT_NS(num) ex_catstr("dist_fact_ns",num)
+ /* list of distribution */
+ /* factors in node set num */
+#define VAR_NS_PROP(num) ex_catstr("ns_prop",num)
+ /* list of the numth property*/
+ /* for all node sets */
+#define DIM_NUM_QA "num_qa_rec" /* # of QA records */
+#define VAR_QA_TITLE "qa_records" /* QA records */
+#define DIM_NUM_INFO "num_info" /* # of information records */
+#define VAR_INFO "info_records" /* information records */
+#define VAR_HIS_TIME "time_hist" /* obsolete */
+#define VAR_WHOLE_TIME "time_whole" /* simulation times for whole*/
+ /* time steps */
+#define VAR_ELEM_TAB "elem_var_tab" /* element variable truth */
+ /* table */
+#define VAR_EBLK_TAB "edge_var_tab" /* edge variable truth table */
+#define VAR_FBLK_TAB "face_var_tab" /* face variable truth table */
+#define VAR_ELSET_TAB "elset_var_tab" /* elemset variable truth */
+ /* table */
+#define VAR_SSET_TAB "sset_var_tab" /* sideset variable truth */
+ /* table */
+#define VAR_FSET_TAB "fset_var_tab" /* faceset variable truth */
+ /* table */
+#define VAR_ESET_TAB "eset_var_tab" /* edgeset variable truth */
+ /* table */
+#define VAR_NSET_TAB "nset_var_tab" /* nodeset variable truth */
+ /* table */
+#define DIM_NUM_GLO_VAR "num_glo_var" /* # of global variables */
+#define VAR_NAME_GLO_VAR "name_glo_var" /* names of global variables */
+#define VAR_GLO_VAR "vals_glo_var" /* values of global variables*/
+#define DIM_NUM_NOD_VAR "num_nod_var" /* # of nodal variables */
+#define VAR_NAME_NOD_VAR "name_nod_var" /* names of nodal variables */
+#define VAR_NOD_VAR "vals_nod_var" /* values of nodal variables */
+#define VAR_NOD_VAR_NEW(num) ex_catstr("vals_nod_var",num)
+ /* values of nodal variables */
+#define DIM_NUM_ELE_VAR "num_elem_var" /* # of element variables */
+#define VAR_NAME_ELE_VAR "name_elem_var" /* names of element variables*/
+#define VAR_ELEM_VAR(num1,num2) ex_catstr2("vals_elem_var",num1,"eb",num2)
+ /* values of element variable*/
+ /* num1 in element block */
+ /* num2 */
+#define DIM_NUM_EDG_VAR "num_edge_var" /* # of edge variables */
+#define VAR_NAME_EDG_VAR "name_edge_var" /* names of edge variables */
+#define VAR_EDGE_VAR(num1,num2) ex_catstr2("vals_edge_var",num1,"eb",num2)
+ /* values of edge variable */
+ /* num1 in edge block num2 */
+#define DIM_NUM_FAC_VAR "num_face_var" /* # of face variables */
+#define VAR_NAME_FAC_VAR "name_face_var" /* names of face variables */
+#define VAR_FACE_VAR(num1,num2) ex_catstr2("vals_face_var",num1,"fb",num2)
+ /* values of face variable */
+ /* num1 in face block num2 */
+
+#define DIM_NUM_NSET_VAR "num_nset_var" /* # of nodeset variables */
+#define VAR_NAME_NSET_VAR "name_nset_var" /* names of nodeset variables*/
+#define VAR_NS_VAR(num1,num2) ex_catstr2("vals_nset_var",num1,"ns",num2)
+ /* values of nodeset variable*/
+ /* num1 in nodeset num2 */
+#define DIM_NUM_ESET_VAR "num_eset_var" /* # of edgeset variables */
+#define VAR_NAME_ESET_VAR "name_eset_var" /* names of edgeset variables*/
+#define VAR_ES_VAR(num1,num2) ex_catstr2("vals_eset_var",num1,"es",num2)
+ /* values of edgeset variable*/
+ /* num1 in edgeset num2 */
+#define DIM_NUM_FSET_VAR "num_fset_var" /* # of faceset variables */
+#define VAR_NAME_FSET_VAR "name_fset_var" /* names of faceset variables*/
+#define VAR_FS_VAR(num1,num2) ex_catstr2("vals_fset_var",num1,"fs",num2)
+ /* values of faceset variable*/
+ /* num1 in faceset num2 */
+#define DIM_NUM_SSET_VAR "num_sset_var" /* # of sideset variables */
+#define VAR_NAME_SSET_VAR "name_sset_var" /* names of sideset variables*/
+#define VAR_SS_VAR(num1,num2) ex_catstr2("vals_sset_var",num1,"ss",num2)
+ /* values of sideset variable*/
+ /* num1 in sideset num2 */
+#define DIM_NUM_ELSET_VAR "num_elset_var" /* # of element set variables*/
+#define VAR_NAME_ELSET_VAR "name_elset_var"/* names of elemset variables*/
+#define VAR_ELS_VAR(num1,num2) ex_catstr2("vals_elset_var",num1,"es",num2)
+ /* values of elemset variable*/
+ /* num1 in elemset num2 */
+
+#define DIM_NUM_HIS_VAR "num_his_var" /* obsolete */
+#define VAR_NAME_HIS_VAR "name_his_var" /* obsolete */
+#define VAR_HIS_VAR "vals_his_var" /* obsolete */
+#define DIM_STR "len_string" /* general dimension of */
+ /* length MAX_STR_LENGTH */
+ /* used for name lengths */
+#define DIM_LIN "len_line" /* general dimension of */
+ /* length MAX_LINE_LENGTH */
+ /* used for long strings */
+#define DIM_N4 "four" /* general dimension of */
+ /* length 4 */
+#define DIM_TIME "time_step" /* unlimited (expandable) */
+ /* dimension for time steps*/
+#define DIM_HTIME "hist_time_step"/* obsolete */
+#define VAR_ELEM_NUM_MAP "elem_num_map" /* element numbering map */
+ /* obsolete, replaced by */
+ /* VAR_ELEM_MAP(num) */
+#define VAR_NODE_NUM_MAP "node_num_map" /* node numbering map */
+ /* obsolete, replaced by */
+ /* VAR_NODE_MAP(num) */
+#define DIM_NUM_EM "num_elem_maps" /* # of element maps */
+#define VAR_ELEM_MAP(num) ex_catstr("elem_map",num)
+ /* the numth element map */
+#define VAR_EM_PROP(num) ex_catstr("em_prop",num)
+ /* list of the numth property*/
+ /* for all element maps */
+#define DIM_NUM_EDM "num_edge_maps" /* # of edge maps */
+#define VAR_EDGE_MAP(num) ex_catstr("edge_map",num)
+ /* the numth edge map */
+#define VAR_EDM_PROP(num) ex_catstr("edm_prop",num)
+ /* list of the numth property*/
+ /* for all edge maps */
+#define DIM_NUM_FAM "num_face_maps" /* # of face maps */
+#define VAR_FACE_MAP(num) ex_catstr("face_map",num)
+ /* the numth face map */
+#define VAR_FAM_PROP(num) ex_catstr("fam_prop",num)
+ /* list of the numth property*/
+ /* for all face maps */
+#define DIM_NUM_NM "num_node_maps" /* # of node maps */
+#define VAR_NODE_MAP(num) ex_catstr("node_map",num)
+ /* the numth node map */
+#define VAR_NM_PROP(num) ex_catstr("nm_prop",num)
+ /* 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 */
+/* Internal structure declarations */
+
+struct list_item { /* for use with ex_get_file_item */
+
+ int exo_id;
+ int value;
+ struct list_item* next;
+};
+
+struct obj_stats {
+ int *id_vals;
+ int *stat_vals;
+ long num;
+ int exoid;
+ int valid_ids;
+ int valid_stat;
+ 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);
+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**);
+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);
+#endif
diff --git a/cbind/include/exodusII_test.h b/cbind/include/exodusII_test.h
new file mode 100644
index 0000000..a002203
--- /dev/null
+++ b/cbind/include/exodusII_test.h
@@ -0,0 +1,20 @@
+#ifndef __exodusII_test_h
+#define __exodusII_test_h
+
+#include "exodusII.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ int cCreateEdgeFace( int, char*[] );
+ int cReadEdgeFace( int, char*[] );
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+inline int CreateEdgeFace( int argc, char* argv[] ) { return cCreateEdgeFace( argc, argv ); }
+inline int ReadEdgeFace( int argc, char* argv[] ) { return cReadEdgeFace( argc, argv ); }
+
+#endif /* __exodusII_test_h */
diff --git a/cbind/src/CVS/Entries b/cbind/src/CVS/Entries
new file mode 100644
index 0000000..e7814db
--- /dev/null
+++ b/cbind/src/CVS/Entries
@@ -0,0 +1,153 @@
+/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//
+D
diff --git a/cbind/src/CVS/Repository b/cbind/src/CVS/Repository
new file mode 100644
index 0000000..3e9bf61
--- /dev/null
+++ b/cbind/src/CVS/Repository
@@ -0,0 +1 @@
+exodusii/cbind/src
diff --git a/cbind/src/CVS/Root b/cbind/src/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/cbind/src/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/cbind/src/Imakefile b/cbind/src/Imakefile
new file mode 100644
index 0000000..e51df1a
--- /dev/null
+++ b/cbind/src/Imakefile
@@ -0,0 +1,72 @@
+# 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.
+#
+
+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)
+
+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
+
+OBJS = ${SRCS:.c=.o}
+
+LibraryTargetSubdirsCopy(libexoIIv2c.a,$(OBJS),../../)
+
+DependTarget()
+
diff --git a/cbind/src/Makefile.standalone b/cbind/src/Makefile.standalone
new file mode 100644
index 0000000..25b069b
--- /dev/null
+++ b/cbind/src/Makefile.standalone
@@ -0,0 +1,41 @@
+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
+
+OBJS = ${SRCS:.c=.o}
+
+all:: libexoIIv2c.a
+libexoIIv2c.a: $(OBJS)
+ $(AR) $@ $?
+ $(RANLIB) $@
+ cp libexoIIv2c.a ../../
+
+clean::
+ rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
+
+.SUFFIXES: .c
+.c.o:
+ $(CC) -c $(CFLAGS) $*.c
+
diff --git a/cbind/src/ex_conv.c b/cbind/src/ex_conv.c
new file mode 100644
index 0000000..2edd8e7
--- /dev/null
+++ b/cbind/src/ex_conv.c
@@ -0,0 +1,584 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+typedef int convert_task;
+
+/* 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".
+ *
+ * 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
+ */
+
+#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;
+};
+
+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; \
+ ptr = ptr->next; \
+ } \
+ }
+
+/*............................................................................*/
+/*............................................................................*/
+
+int ex_conv_ini( int exoid,
+ 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) */
+
+ 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);
+ }
+
+/* check to see if requested word sizes are valid */
+
+ if (!*io_wordsize )
+ {
+ if (!file_wordsize )
+ *io_wordsize = NC_FLOAT_WORDSIZE;
+ else
+ *io_wordsize = file_wordsize;
+ }
+ 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 )
+ {
+ *io_wordsize = file_wordsize;
+ sprintf(errmsg,
+ "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);
+ }
+
+ 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;
+ new_file->user_compute_wordsize = *comp_wordsize;
+ 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;
+ 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;
+ 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);
+
+}
+
+/*............................................................................*/
+/*............................................................................*/
+
+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.
+ */
+
+ char errmsg[MAX_ERR_LENGTH];
+ struct file_item* file = file_list;
+ struct file_item* prev = NULL;
+
+ exerrval = 0; /* clear error code */
+ while( file )
+ {
+ if (file->file_id == exoid ) break;
+
+ prev = file;
+ file = file->next;
+ }
+
+ 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;
+ return;
+ }
+
+ if (prev )
+ prev->next = file->next;
+ else
+ 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;
+ }
+}
+
+/*............................................................................*/
+/*............................................................................*/
+
+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.
+ */
+
+ char errmsg[MAX_ERR_LENGTH];
+ struct file_item* file;
+
+ exerrval = 0; /* clear error code */
+ FIND_FILE( file, exoid );
+
+ 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).
+ */
+
+ char errmsg[MAX_ERR_LENGTH];
+ struct file_item* file;
+
+ exerrval = 0; /* clear error code */
+ FIND_FILE( file, exoid );
+
+ 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
new file mode 100644
index 0000000..839ddef
--- /dev/null
+++ b/cbind/src/ex_utils.c
@@ -0,0 +1,1236 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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)
+#include <assert.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.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;
+
+
+/*****************************************************************************
+*
+* utility routines for string conversions
+* ex_catstr - concatenate string/number (where number is converted to ASCII)
+* ex_catstr2 - concatenate string1/number1/string2/number2 "
+*
+* NOTE: these routines reuse the same storage over and over to build
+* concatenated strings, because the strings are just passed to netCDF
+* routines as names used to look up variables. if the strings returned
+* by these routines are needed for any other purpose, they should
+* immediately be copied into other storage.
+*****************************************************************************/
+
+static char ret_string[10*(MAX_VAR_NAME_LENGTH+1)];
+static char* cur_string = &ret_string[0];
+
+char *ex_catstr (const char *string,
+ int num)
+{
+ char* tmp_string = cur_string;
+ cur_string += sprintf (cur_string, "%s%d", string, num) + 1;
+ if ( cur_string - ret_string > 9*(MAX_VAR_NAME_LENGTH+1) )
+ cur_string = ret_string;
+ return (tmp_string);
+}
+
+
+char *ex_catstr2 (const char *string1,
+ int num1,
+ const char *string2,
+ int num2)
+{
+ char* tmp_string = cur_string;
+ cur_string += sprintf (cur_string, "%s%d%s%d", string1, num1, string2, num2) + 1;
+ if ( cur_string - ret_string > 9*(MAX_VAR_NAME_LENGTH+1) )
+ cur_string = ret_string;
+ return (tmp_string);
+}
+
+char* ex_dim_num_entries_in_object( int obj_type,
+ int idx )
+{
+ switch (obj_type) {
+ case EX_EDGE_BLOCK:
+ return DIM_NUM_ED_IN_EBLK(idx);
+ case EX_FACE_BLOCK:
+ return DIM_NUM_FA_IN_FBLK(idx);
+ case EX_ELEM_BLOCK:
+ return DIM_NUM_EL_IN_BLK(idx);
+ case EX_NODE_SET:
+ return DIM_NUM_NOD_NS(idx);
+ case EX_EDGE_SET:
+ return DIM_NUM_EDGE_ES(idx);
+ case EX_FACE_SET:
+ return DIM_NUM_FACE_FS(idx);
+ case EX_SIDE_SET:
+ return DIM_NUM_SIDE_SS(idx);
+ case EX_ELEM_SET:
+ return DIM_NUM_ELE_ELS(idx);
+ default:
+ return 0;
+ }
+}
+
+char* ex_name_var_of_object( int obj_type,
+ int i,
+ int j )
+{
+ switch (obj_type) {
+ case EX_EDGE_BLOCK:
+ return VAR_EDGE_VAR(i,j);
+ case EX_FACE_BLOCK:
+ return VAR_FACE_VAR(i,j);
+ case EX_ELEM_BLOCK:
+ return VAR_ELEM_VAR(i,j);
+ case EX_NODE_SET:
+ return VAR_NS_VAR(i,j);
+ case EX_EDGE_SET:
+ return VAR_ES_VAR(i,j);
+ case EX_FACE_SET:
+ return VAR_FS_VAR(i,j);
+ case EX_SIDE_SET:
+ return VAR_SS_VAR(i,j);
+ case EX_ELEM_SET:
+ return VAR_ELS_VAR(i,j);
+ default:
+ return 0;
+ }
+}
+
+char* ex_name_of_map( int map_type, int map_index )
+{
+ switch (map_type) {
+ case EX_NODE_MAP:
+ return VAR_NODE_MAP(map_index);
+ case EX_EDGE_MAP:
+ return VAR_EDGE_MAP(map_index);
+ case EX_FACE_MAP:
+ return VAR_FACE_MAP(map_index);
+ case EX_ELEM_MAP:
+ return VAR_ELEM_MAP(map_index);
+ default:
+ return 0;
+ }
+}
+
+/*****************************************************************************
+*
+* 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:
+* elem_ss
+* node_ns
+* side_ss
+* int num id value
+*
+* exit conditions -
+* int return index into table (1-based)
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+int ex_id_lkup( int exoid,
+ const char *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;
+
+ static int filled=FALSE;
+ struct obj_stats *tmp_stats;
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ strcpy(idtyp,id_type);
+
+ if (strcmp(idtyp,VAR_ID_EL_BLK) == 0)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ strcpy(id_table, VAR_FAM_PROP(1));
+ strcpy(id_dim, DIM_NUM_FAM);
+ strcpy(stat_table, "");
+ tmp_stats = get_stat_ptr (exoid, &fam);
+ }
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: unsupported id array type %s for file id %d",
+ idtyp, exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ( (tmp_stats->id_vals == NULL) || (!(tmp_stats->valid_ids)) ) {
+
+ /* first time thru or id arrays haven't been completely filled yet */
+
+ /* get size of id array */
+
+ /* First get dimension id of id array */
+ if ((dimid = ncdimid(exoid,id_dim)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate id array dimension in file id %d",
+ exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* Next get value of dimension */
+ if (ncdiminq (exoid,dimid,(char *) 0,&dim_len) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s array length in file id %d",
+ id_table,exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* get variable id of id array */
+ if ((varid = ncvarid (exoid, id_table)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s array in file id %d",
+ id_table, exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* allocate space for id array */
+ if (!(id_vals = malloc((int)dim_len*sizeof(nclong))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s array for file id %d",
+ id_table,exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ 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;
+ sprintf(errmsg,
+ "Error: failed to get %s array from file id %d",
+ id_table,exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ free(id_vals);
+ return (EX_FATAL);
+ }
+
+ /* check if values in stored arrays are filled with non-zeroes */
+ filled = TRUE;
+ 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 */
+ }
+ }
+
+ if (filled) {
+ tmp_stats->valid_ids = TRUE;
+ tmp_stats->num = dim_len;
+ tmp_stats->id_vals = id_vals;
+ }
+
+ } else {
+ id_vals = tmp_stats->id_vals;
+ dim_len = tmp_stats->num;
+ }
+
+ /* 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++)
+ {
+ if (id_vals[i] == num)
+ break; /* found the id requested */
+ }
+ if (i >= dim_len) /* failed to find id number */
+ {
+ if ( !(tmp_stats->valid_ids) ) {
+ free (id_vals);
+ }
+ exerrval = EX_LOOKUPFAIL;
+ return(EX_LOOKUPFAIL); /*if we got here, the id array value doesn't exist */
+ }
+
+ /* Now check status array to see if object is null */
+
+ /* get variable id of status array */
+ if ((varid = ncvarid (exoid, stat_table)) != -1)
+ {
+ /* if status array exists, use it, otherwise assume object exists
+ to be backward compatible */
+
+ if ( (tmp_stats->stat_vals == NULL) || (!(tmp_stats->valid_stat)) ) {
+ /* first time thru or status arrays haven't been filled yet */
+
+ /* allocate space for new status array */
+
+ if (!(stat_vals = malloc((int)dim_len*sizeof(nclong))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s array for file id %d",
+ id_table,exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ 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;
+ free(stat_vals);
+ sprintf(errmsg,
+ "Error: failed to get %s array from file id %d",
+ stat_table,exoid);
+ ex_err("ex_id_lkup",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (tmp_stats->valid_ids) {
+ /* status array is valid only if ids are valid */
+ tmp_stats->valid_stat = TRUE;
+ tmp_stats->stat_vals = stat_vals;
+ }
+
+ } else {
+ stat_vals = tmp_stats->stat_vals;
+ }
+
+ if (stat_vals[i] == 0) /* is this object null? */
+ {
+ exerrval = EX_NULLENTITY;
+ if ( !(tmp_stats->valid_stat) ) {
+ free (stat_vals);
+ }
+ if ( !(tmp_stats->valid_ids) ) {
+ if (id_vals) free (id_vals);
+ }
+ return(-(i+1)); /* return index into id array (1-based) */
+ }
+ }
+ if ( !(tmp_stats->valid_ids) ) {
+ if (id_vals) free (id_vals);
+ if (stat_vals) free (stat_vals);
+ }
+ return(i+1); /* return index into id array (1-based) */
+}
+
+/******************************************************************************
+*
+* get_stat_ptr - returns a pointer to a structure of object ids
+*
+* author - Sandia National Laboratories
+* Larry Schoof
+*
+*
+* environment - UNIX
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+/* 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 *tmp_ptr;
+
+ tmp_ptr = *obj_ptr;
+
+ while (tmp_ptr) {
+ if ( (tmp_ptr)->exoid == exoid) {
+ break;
+ }
+ tmp_ptr = (tmp_ptr)->next;
+ }
+
+ if (!tmp_ptr) { /* exoid not found */
+ tmp_ptr = (struct obj_stats *) calloc (1, sizeof(struct obj_stats));
+ tmp_ptr->exoid = exoid;
+ tmp_ptr->next = *obj_ptr;
+ tmp_ptr->id_vals = 0;
+ tmp_ptr->stat_vals = 0;
+ tmp_ptr->num = 0;
+ tmp_ptr->valid_ids = 0;
+ tmp_ptr->valid_stat = 0;
+ *obj_ptr = tmp_ptr;
+ }
+
+ return (tmp_ptr);
+}
+
+/******************************************************************************
+*
+* rm_stat_ptr - removes a pointer to a structure of object ids
+*
+* author - Sandia National Laboratories
+* Larry Schoof
+*
+*
+* environment - UNIX
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+/* 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)
+
+{
+ struct obj_stats *last_head_list_ptr, *tmp_ptr;
+
+ tmp_ptr = *obj_ptr;
+ last_head_list_ptr = *obj_ptr; /* save last head pointer */
+
+ while (tmp_ptr ) /* Walk linked list of file ids/vals */
+ {
+ if (exoid == tmp_ptr->exoid ) /* linear search for exodus file id */
+ {
+ if (tmp_ptr == *obj_ptr) /* Are we at the head of the list? */
+ *obj_ptr = (*obj_ptr)->next; /* yes, reset ptr to head of list */
+ else /* no, remove this record from chain*/
+ last_head_list_ptr->next=tmp_ptr->next;
+ if (tmp_ptr->id_vals != NULL)
+ free(tmp_ptr->id_vals); /* free up memory */
+ if (tmp_ptr->stat_vals != NULL)
+ free(tmp_ptr->stat_vals);
+ free(tmp_ptr);
+ break; /* Quit if found */
+ }
+ last_head_list_ptr = tmp_ptr; /* save last head pointer */
+ tmp_ptr = tmp_ptr->next; /* Loop back if not */
+ }
+}
+/******************************************************************************
+*
+* 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
+ * 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,
+ * respectively, for each open exodus II file.
+ *
+ * The list structure is used as follows:
+ *
+ * ptr -----------> list item structure
+ * -------------------
+ * exodus file id
+ * item value (int)
+ * ptr to next (NULL if last)
+ *
+ *
+ * NOTE: since netCDF reuses its file ids, and a user may open and close any
+ * number of files in one application, items must be taken out of the
+ * linked lists in each of the above routines. these should be called
+ * after ncclose().
+ */
+
+int ex_inc_file_item( int exoid, /* file id */
+ struct list_item **list_ptr)/* ptr to ptr to list_item */
+
+{
+ struct list_item* tlist_ptr;
+
+
+ /* printf("[f] list: %ld, *list: %ld \n", list_ptr, *list_ptr); */
+ tlist_ptr = *list_ptr; /* use temp list ptr to walk linked list */
+
+ while (tlist_ptr ) /* Walk linked list of file ids/vals */
+ {
+ if (exoid == tlist_ptr->exo_id ) /* linear search for exodus file id */
+ break; /* Quit if found */
+ tlist_ptr = tlist_ptr->next; /* Loop back if not */
+ }
+
+ if (!tlist_ptr ) /* ptr NULL? */
+ { /* yes, new file id */
+ /* allocate space for new structure record */
+ tlist_ptr = (struct list_item*) calloc(1,sizeof(struct list_item));
+ tlist_ptr->exo_id = exoid; /* insert file id */
+ tlist_ptr->next = *list_ptr; /* insert into head of list */
+ *list_ptr = tlist_ptr; /* fix up new head of list */
+ }
+
+/* printf("[f] tlist: %ld *tlist: %ld **tlist: %ld\n",
+ tlist_ptr,*tlist_ptr,(*tlist_ptr)->value, (*tlist_ptr)->next); */
+
+
+ return(tlist_ptr->value++);
+
+}
+
+/*****************************************************************************
+*
+* 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
+ * 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,
+ * respectively, for an open exodus II file.
+ *
+ * The list structure is used as follows:
+ *
+ * ptr -----------> list item structure
+ * -------------------
+ * exodus file id
+ * item value (int)
+ * ptr to next (NULL if last)
+ *
+ *
+ * NOTE: since netCDF reuses its file ids, and a user may open and close any
+ * number of files in one application, items must be taken out of the
+ * linked lists in each of the above routines. these should be called
+ * after ncclose().
+ */
+
+int ex_get_file_item( int exoid, /* file id */
+ struct list_item **list_ptr)/* ptr to ptr to list_item */
+
+{
+ struct list_item* tlist_ptr;
+
+ /* printf("[f] list: %ld, *list: %ld \n", list_ptr, *list_ptr); */
+ tlist_ptr = *list_ptr; /* use temp list ptr to walk linked list */
+
+
+ while (tlist_ptr ) /* Walk linked list of file ids/vals */
+ {
+ if (exoid == tlist_ptr->exo_id ) /* linear search for exodus file id */
+ break; /* Quit if found */
+ tlist_ptr = tlist_ptr->next; /* Loop back if not */
+ }
+
+ if (!tlist_ptr ) /* ptr NULL? */
+ { /* yes, Error: file id not found*/
+ return(-1);
+ }
+
+/* printf("[f] list: %ld *list: %ld **list: %ld\n",
+ list_ptr,*list_ptr,(*list_ptr)->value, (*list_ptr)->next); */
+
+ return(tlist_ptr->value);
+}
+
+/*****************************************************************************
+*
+* 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
+ * each open exodus file.
+ *
+ * The list structure is used as follows:
+ *
+ * ptr -----------> list item structure
+ * -------------------
+ * exodus file id
+ * item value (int)
+ * ptr to next (NULL if last)
+ *
+ *
+ * NOTE: since netCDF reuses its file ids, and a user may open and close any
+ * number of files in one application, items must be taken out of the
+ * linked lists in each of the above routines. these should be called
+ * after ncclose().
+ */
+
+void ex_rm_file_item( int exoid, /* file id */
+ struct list_item **list_ptr)/* ptr to ptr to list_item */
+
+{
+ struct list_item *last_head_list_ptr, *tlist_ptr;
+
+ /* printf("[f] list: %ld, *list: %ld \n", list_ptr, *list_ptr); */
+ tlist_ptr = *list_ptr;
+ last_head_list_ptr = *list_ptr; /* save last head pointer */
+ /* printf("[f] last head list: %ld\n",last_head_list_ptr); */
+
+ while (tlist_ptr ) /* Walk linked list of file ids/vals */
+ {
+ if (exoid == tlist_ptr->exo_id ) /* linear search for exodus file id */
+ {
+ if (tlist_ptr == *list_ptr) /* Are we at the head of the list? */
+ *list_ptr = (*list_ptr)->next; /* yes, reset ptr to head of list */
+ else /* no, remove this record from chain*/
+ last_head_list_ptr->next=tlist_ptr->next;
+ free(tlist_ptr); /* free up memory */
+ break; /* Quit if found */
+ }
+ last_head_list_ptr = tlist_ptr; /* save last head pointer */
+ tlist_ptr = tlist_ptr->next; /* Loop back if not */
+ }
+
+/* printf("[f] list: %ld *list: %ld **list: %ld\n",
+ list_ptr,*list_ptr,(*list_ptr)->value, (*list_ptr)->next); */
+
+}
+
+/*****************************************************************************
+*
+* ex_get_num_props - get number of properties
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+int ex_get_num_props (int exoid, int obj_type)
+{
+ int cntr;
+ char var_name[MAX_VAR_NAME_LENGTH+1];
+ char errmsg[MAX_ERR_LENGTH];
+
+ 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 */
+
+ 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++;
+ }
+}
+int ex_get_cpu_ws(void)
+{
+ return(sizeof(float));
+}
+
+
+/* swap - interchange v[i] and v[j] */
+void ex_swap (int v[], int i, int j)
+{
+ int temp;
+
+ temp = v[i];
+ v[i] = v[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
+ * when a single value is chosen. It performs a quicksort on
+ * intervals down to the EX_QSORT_CUTOFF size and then performs a final
+ * insertion sort on the almost sorted final array. Based on data in
+ * Sedgewick, the EX_QSORT_CUTOFF value should be between 5 and 20.
+ *
+ * See Sedgewick for further details
+ * Define DEBUG_QSORT at the top of this file and recompile to compile
+ * in code that verifies that the array is sorted.
+ */
+
+#define EX_QSORT_CUTOFF 12
+
+int ex_int_median3(int v[], int iv[], int left, int right)
+{
+ int center;
+ center = (left + right) / 2;
+
+ if (v[iv[left]] > v[iv[center]])
+ ex_swap(iv, left, center);
+ if (v[iv[left]] > v[iv[right]])
+ ex_swap(iv, left, right);
+ if (v[iv[center]] > v[iv[right]])
+ ex_swap(iv, center, right);
+
+ ex_swap(iv, center, right-1);
+ return iv[right-1];
+}
+
+void ex_int_iqsort(int v[], int iv[], int left, int right)
+{
+ int pivot;
+ int i, j;
+
+ if (left + EX_QSORT_CUTOFF <= right) {
+ pivot = ex_int_median3(v, iv, left, right);
+ i = left;
+ j = right - 1;
+
+ for ( ; ; ) {
+ while (v[iv[++i]] < v[pivot]);
+ while (v[iv[--j]] > v[pivot]);
+ if (i < j) {
+ ex_swap(iv, i, j);
+ } else {
+ break;
+ }
+ }
+
+ ex_swap(iv, i, right-1);
+ ex_int_iqsort(v, iv, left, i-1);
+ ex_int_iqsort(v, iv, i+1, right);
+ }
+}
+
+void ex_int_iisort(int v[], int iv[], int N)
+{
+ int i,j;
+ int ndx = 0;
+ int small;
+ int tmp;
+
+ small = v[iv[0]];
+ for (i = 1; i < N; i++) {
+ if (v[iv[i]] < small) {
+ small = v[iv[i]];
+ ndx = i;
+ }
+ }
+ /* Put smallest value in slot 0 */
+ ex_swap(iv, 0, ndx);
+
+ for (i=1; i <N; i++) {
+ tmp = iv[i];
+ for (j=i; v[tmp] < v[iv[j-1]]; j--) {
+ iv[j] = iv[j-1];
+ }
+ iv[j] = tmp;
+ }
+}
+
+void ex_iqsort(int v[], int iv[], int N)
+{
+ ex_int_iqsort(v, iv, 0, N-1);
+ ex_int_iisort(v, iv, N);
+
+#if defined(DEBUG_QSORT)
+ fprintf(stderr, "Checking sort of %d values\n", N+1);
+ int i;
+ for (i=1; i < N; i++) {
+ assert(v[iv[i-1]] <= v[iv[i]]);
+ }
+#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
+ * components together) or as a variable per component per
+ * nodal_variable.
+ */
+int ex_large_model(int exoid)
+{
+ if (exoid < 0) {
+ /* If exoid not specified, then query is to see if user specified
+ * the large model via an environment variable
+ */
+ 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");
+ return 0;
+ } else {
+ fprintf(stderr,
+ "EXODUSII: Large model size selected via EXODUS_LARGE_MODEL environment variable\n");
+ return 1;
+ }
+ } else {
+ return EXODUS_DEFAULT_SIZE; /* Specified in exodusII_int.h */
+ }
+
+ } else {
+ /* See if the ATT_FILESIZE attribute is defined in the file */
+ int file_size = 0;
+ if (nc_get_att_int(exoid, NC_GLOBAL, ATT_FILESIZE, &file_size) != NC_NOERR) {
+ /* Variable not found; default is 0 */
+ file_size = 0;
+ }
+ return file_size;
+ }
+}
+
+int ex_get_dimension(int exoid, const char* DIMENSION, const char *label,
+ long *count, const char *routine)
+{
+ char errmsg[MAX_ERR_LENGTH];
+ long dimid;
+
+ *count = 0;
+ if ((dimid = ncdimid (exoid, DIMENSION)) == -1) {
+ if (routine != NULL) {
+ if (ncerr == NC_EBADDIM) {
+ exerrval = ncerr;
+ 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;
+ }
+
+ if (ncdiminq (exoid, dimid, (char *) 0, count) == -1) {
+ if (routine != NULL) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of %s in file id %d",
+ label, exoid);
+ ex_err(routine,errmsg,exerrval);
+ return -1;
+ }
+ }
+ return dimid;
+}
+
+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;
+ int mapid;
+
+ size_t size = 0;
+ /* Get word size (2 = 8-byte reals, 1 = 4-byte reals */
+
+ if (nc_flt_code(exoid) == NC_DOUBLE)
+ iows = 2;
+ else
+ 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);
+ size += iows * ndim * num_nodes;
+
+ /* node maps */
+ mapid = ncvarid(exoid, VAR_NODE_NUM_MAP);
+ if (mapid != -1)
+ size += num_nodes;
+
+ ex_get_dimension(exoid, DIM_NUM_NM, "node maps", &num_map, routine);
+ size += num_map * num_nodes;
+
+ /* Element Data */
+ ex_get_dimension(exoid, DIM_NUM_ELEM, "elements", &num_elem, routine);
+
+ /* Element order map */
+ mapid = ncvarid (exoid, VAR_MAP);
+ if (mapid != -1)
+ size += num_elem;
+
+ mapid = ncvarid (exoid, VAR_ELEM_NUM_MAP);
+ if (mapid != -1)
+ size += num_elem;
+
+ /* Element map(s) */
+ ex_get_dimension(exoid, DIM_NUM_EM, "element maps", &num_map, routine);
+ size += num_map * num_elem;
+
+ /* Element Blocks... */
+ ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks", &num_eblk, routine);
+ if (num_eblk > 0) {
+ /* Allocate storage for element block parameters... */
+ int *ids = malloc(num_eblk * sizeof(int));
+ int i;
+
+ size += 2*num_eblk; /* status + ids */
+
+ ex_get_ids(exoid, EX_ELEM_BLOCK, ids);
+ for (i=0; i < num_eblk; i++) {
+ int num_elem_this_blk = 0;
+ int num_nodes_per_elem = 0;
+ int num_attr = 0;
+ char elem_type[MAX_STR_LENGTH+1];
+ ex_get_elem_block(exoid, ids[i], elem_type, &num_elem_this_blk,
+ &num_nodes_per_elem, &num_attr);
+ size += num_elem_this_blk * num_nodes_per_elem;
+ size += num_elem_this_blk * num_attr * iows;
+ }
+ free(ids);
+ }
+
+ /* Nodesets */
+ ex_get_dimension(exoid, DIM_NUM_NS, "nodesets", &num_nset, routine);
+ if (num_nset > 0) {
+ /* Allocate storage for nodeset parameters... */
+ int *ids = malloc(num_nset * sizeof(int));
+ int i;
+
+ size += 2*num_nset; /* Status + ids */
+ ex_get_ids(exoid, EX_NODE_SET, ids);
+ for (i=0; i < num_nset; i++) {
+ int num_nodes_in_set = 0;
+ int num_df_in_set = 0;
+ ex_get_node_set_param(exoid, ids[i], &num_nodes_in_set, &num_df_in_set);
+ size += num_nodes_in_set;
+ size += num_df_in_set * iows;
+ }
+ free(ids);
+ }
+
+ /* Sidesets */
+ ex_get_dimension(exoid, DIM_NUM_SS, "sidesets", &num_sset, routine);
+ if (num_sset > 0) {
+ /* Allocate storage for sideset parameters... */
+ int *ids = malloc(num_sset * sizeof(int));
+ int i;
+
+ size += 2*num_sset; /* Status + ids */
+ ex_get_ids(exoid, EX_SIDE_SET, ids);
+ for (i=0; i < num_sset; i++) {
+ int num_sides_in_set = 0;
+ int num_df_in_set = 0;
+ ex_get_side_set_param(exoid, ids[i], &num_sides_in_set, &num_df_in_set);
+ size += num_sides_in_set * 2;
+ size += num_df_in_set * iows;
+ }
+ free(ids);
+ }
+
+ if (ex_large_model(exoid) == 0 && size > (1<<29)) {
+
+ fprintf(stderr, "ERROR: Size to store header information exceeds 2GB in file id %d\n File is probably corrupt, rerun with environment variable EXODUS_LARGE_MODEL set.\n", exoid);
+ }
+ return size;
+}
diff --git a/cbind/src/exclos.c b/cbind/src/exclos.c
new file mode 100644
index 0000000..cce4fd9
--- /dev/null
+++ b/cbind/src/exclos.c
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exclos - ex_close
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+*
+* 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 */
+
+/*!
+ * updates and then closes an open EXODUS II file
+ */
+int ex_close (int exoid)
+{
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ if (ncsync (exoid) == -1) {
+ exerrval = ncerr;
+ 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 ) {
+ 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);
+ }
+ else {
+ exerrval = ncerr;
+ sprintf(errmsg, "Error: failed to close file id %d",exoid);
+ ex_err("ex_close",errmsg,ncerr);
+ return(EX_FATAL);
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/excn2s.c b/cbind/src/excn2s.c
new file mode 100644
index 0000000..dc1966e
--- /dev/null
+++ b/cbind/src/excn2s.c
@@ -0,0 +1,1004 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int *num_elem_per_set number of element per set
+* int *num_nodes_per_set number of nodes per set
+* int *side_sets_elem_index index array of elements into elem list
+* int *side_sets_node_index index array of nodes
+* int *side_sets_elem_list array of elements
+* int *side_sets_node_list array of nodes
+*
+* exit conditions -
+* int *side_sets_side_list array of sides/faces
+*
+* revision history -
+*
+* $Id: excn2s.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#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:
+
+ Read elem_block_ids --> elem_blk_id[array]
+
+ Read element block parameters --> elem_blk_parms[array]
+
+ Determine total number of elements in side set by summing num_elem_per_set
+
+ 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)
+ {
+ 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 side set element node[2] == element node[Hex_table[i,1]]
+
+ Jth side = Hex_table[i,2]
+
+ break
+ }
+ Case element type = Wedge
+ {
+ If side set element node[2] == element node[Wedge_table[i,1]]
+
+ Jth side = Wedge_table[i,2]
+
+ break
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+
+
+
+ */
+
+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)
+{
+ int i, j, k, m, 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 *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;
+ 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;
+
+/* node to side translation tables -
+ These tables are used to look up the side number based on the
+ first and second node in the side/face list. The side node order
+ is found in the original Exodus document, SAND87-2997. The element
+ node order is found in the ExodusII document, SAND92-2137. These
+ tables were generated by following the right-hand rule for determining
+ the outward normal. Note: Only the more complex 3-D shapes require
+ these tables, the simple shapes are trivial - the first node found
+ is also the side number.
+*/
+
+ /* 1 2 3 4 node 1 */
+ static int shell_table[2][8] = {
+ {2,4, 3,1, 4,2, 1,3}, /* node 2 */
+ {1,2, 1,2, 1,2, 1,2} /* side # */
+ };
+
+ /* 1 2 3 4 node 1 */
+ static int shell_edge_table[2][8] = {
+ {2,4, 3,1, 4,2, 1,3}, /* node 2 */
+ {3,6, 4,3, 5,4, 6,5} /* side # */
+ };
+
+ /* 1 2 3 node 1 */
+ static int trishell_table[2][6] = {
+ {2,3, 3,1, 1,2}, /* node 2 */
+ {1,2, 1,2, 1,2} /* side # */
+ };
+
+ /* 1 2 3 4 node 1 */
+ static int tetra_table[2][12] = {
+ {2,3,4, 1,3,4, 4,1,2, 1,2,3}, /* node 2 */
+ {1,4,3, 4,2,1, 2,3,4, 1,2,3} /* side # */
+ };
+
+#if 0
+ static int wedge_table[2][18] = {
+ /* 1 2 3 4 5 6 node 1 */
+ {2,4,3, 5,1,3, 6,1,2, 1,6,5, 6,2,4, 4,3,5}, /* node 2 */
+ {1,3,4, 1,4,2, 2,3,4, 1,3,5, 5,2,1, 5,3,2} /* side # */
+ };
+#endif
+
+ static int hex_table[2][24] = {
+ /* 1 2 3 4 5 6 7 8 node 1 */
+ {4,2,5, 1,3,6, 7,4,2, 3,1,8, 6,8,1, 5,2,7, 8,6,3, 7,5,4},/* node 2 */
+ {5,1,4, 5,2,1, 2,3,5, 5,4,3, 6,4,1, 1,2,6, 6,2,3, 3,6,4} /* side # */
+ };
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
+
+/* 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)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of side sets in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (num_side_sets == 0)
+ {
+ sprintf(errmsg,
+ "Warning: no side sets defined in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,EX_WARN);
+ return(EX_WARN);
+ }
+
+ 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_cvt_nodes_to_sides",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get total number of elements in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",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)
+ {
+ sprintf(errmsg,
+ "Error: failed to get dimensionality in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ /* First count up # of elements in the side sets*/
+ for (i=0;i<num_side_sets;i++)
+ tot_num_ss_elem += num_elem_per_set[i];
+
+ /* 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_cvt_nodes_to_sides",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_sets_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))))
+ {
+ free(ss_elem_ndx);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for element block ids for file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_elem_blk_ids(exoid, elem_blk_ids))
+ {
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ sprintf(errmsg,
+ "Error: failed to get element block ids in file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",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);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for element block params for file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ 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,
+ &num_nodes_per_elem,
+ &num_attr)) == -1)
+ {
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ sprintf(errmsg,
+ "Error: failed to get element block %d parameters in file id %d",
+ elem_blk_ids[i], exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,EX_MSG);
+ return(EX_FATAL);
+ }
+
+ elem_blk_parms[i].num_elem_in_blk = num_elem_in_blk;
+ elem_blk_parms[i].num_nodes_per_elem = num_nodes_per_elem;
+ 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';
+
+ if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = CIRCLE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = SPHERE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 5)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 3;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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].num_nodes_per_elem;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ }
+ else if (elem_blk_parms[i].num_nodes_per_elem == 4)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 9)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELL */
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 27)
+ elem_blk_parms[i].num_nodes_per_side = 9;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 8)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 6;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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);
+ 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;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 5)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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);
+ 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;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 2)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 2)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 3;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"NULL",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = '\0';
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 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_blk_id = elem_blk_ids[i]; /* save id */
+ elem_ctr += elem_blk_parms[i].num_elem_in_blk;
+ elem_blk_parms[i].elem_ctr = elem_ctr; /* save elem number max */
+ }
+
+
+ /* Allocate space for the ss element to element block parameter index array */
+ if (!(ss_parm_ndx=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+"Error: failed to allocate space for side set elem parms index for file id %d"
+,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* Allocate space for the ss element to node list index array */
+ if (!(ss_elem_node_ndx=malloc((tot_num_ss_elem+1)*sizeof(int))))
+ {
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+"Error: failed to allocate space for side set elem to node index for file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+/* determine if each side set has uniform element types; this will
+ be used to help determine the stride through the node list
+*/
+
+ /* Allocate space for same element type flag array*/
+ if (!(same_elem_type=malloc(num_side_sets*sizeof(int))))
+ {
+ free(ss_elem_ndx);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for element type flag array for file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ elem_ctr = num_elem_per_set[0];
+ same_elem_type[0] = TRUE;
+ for (i=0,k=0;i<tot_num_ss_elem;i++)
+ {
+ for (j=0; j<num_elem_blks; j++)
+ {
+ if (side_sets_elem_list[i] <= elem_blk_parms[j].elem_ctr) break;
+ }
+
+ if (i==0) {
+ el_type = elem_blk_parms[j].elem_type_val;
+ }
+
+ /* determine which side set this element is in; assign to kth side set */
+ if (i >= elem_ctr) {
+ elem_ctr += num_elem_per_set[++k];
+ el_type = elem_blk_parms[j].elem_type_val;
+ same_elem_type[k] = TRUE;
+ }
+
+ if (el_type != elem_blk_parms[j].elem_type_val) same_elem_type[k] = FALSE;
+
+ }
+
+/* Build side set element to node list index and side set element
+ parameter index.
+*/
+ node_ctr = 0;
+ elem_ctr = num_elem_per_set[0];
+ for (i=0,k=0;i<tot_num_ss_elem;i++)
+ {
+ for (j=0; j<num_elem_blks; j++)
+ {
+ if (side_sets_elem_list[i] <= elem_blk_parms[j].elem_ctr)
+ {
+ ss_parm_ndx[i] = j; /* assign parameter block index */
+ break;
+ }
+ }
+ ss_elem_node_ndx[i] = node_ctr; /* assign node list index */
+
+ /* determine which side set this element is in; assign to kth side set */
+ if (i >= elem_ctr) {
+ /* skip over NULL side sets */
+ while (num_elem_per_set[++k] == 0);
+ elem_ctr += num_elem_per_set[k];
+ }
+
+ /* determine number of nodes per side */
+ if (((num_nodes_per_set[k] % num_elem_per_set[k]) == 0) &&
+ (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;
+ }
+ }
+
+ ss_elem_node_ndx[i] = node_ctr; /* assign node list index */
+ free(same_elem_type);
+
+ /* All setup, ready to go ... */
+
+ elem_ctr=0;
+
+ for (j=0; j < tot_num_ss_elem; j++)
+ {
+
+ if (side_sets_elem_list[ss_elem_ndx[j]] > elem_ctr)
+ {
+ /* release connectivity array space and get next one */
+ if (elem_ctr > 0)
+ free(connect);
+
+ /* Allocate space for the connectivity array for new element block */
+ if (!(connect=
+ malloc(elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_elem_in_blk*
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_nodes_per_elem*
+ sizeof(int))))
+ {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for connectivity array for file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+
+ /* get connectivity array */
+ if (ex_get_elem_conn(
+ exoid,
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ connect) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get connectivity array for elem blk %d for file id %d",
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ elem_ctr = elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_ctr;
+ }
+/* For the first node of each side in side set, using a linear search
+ (of up to num_nodes_per_elem) of the connectivity array,
+ locate the node position in the element. The first node position
+ and the second node position are used with a element type specific
+ table to determine the side. */
+
+ elem_num = side_sets_elem_list[ss_elem_ndx[j]]-1;/* element number 0-based*/
+ /* calculate the relative element number position in it's block*/
+ elem_num_pos = elem_num -
+ (elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_ctr -
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_elem_in_blk);
+ /* calculate the beginning of the node list for this element by
+ 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;
+ for (n=0; n<num_nodes_per_elem; n++)
+ {
+ /* find node in connectivity array that matches first node in side set */
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+n])
+ {
+ switch (elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_type_val)
+ {
+ case CIRCLE:
+ case 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:
+ {
+ /* simple case: 1st node number is same as side # */
+ side_sets_side_list[ss_elem_ndx[j]] = n+1;
+ break;
+ }
+ case TRISHELL:
+ {
+ /* use table to find which node to compare to next */
+ num_node_per_side = ss_elem_node_ndx[ss_elem_ndx[j]+1] -
+ ss_elem_node_ndx[ss_elem_ndx[j]];
+
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (trishell_table[0][2*n]-1)])
+ {
+ /* Assume only front or back, no edges... */
+ side_sets_side_list[ss_elem_ndx[j]] = trishell_table[1][2*n];
+ }
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (trishell_table[0][2*n+1]-1)])
+ {
+ /* Assume only front or back, no edges... */
+ side_sets_side_list[ss_elem_ndx[j]] = trishell_table[1][2*n+1];
+ }
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (trishell_table[0][2*n+2]-1)])
+ {
+ /* Assume only front or back, no edges... */
+ side_sets_side_list[ss_elem_ndx[j]] = trishell_table[1][2*n+2];
+ }
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find TRIANGULAR SHELL element %d, node %d in connectivity array %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ break;
+
+ }
+ case SHELL:
+ {
+ /* use table to find which node to compare to next */
+
+ num_node_per_side = ss_elem_node_ndx[ss_elem_ndx[j]+1] -
+ ss_elem_node_ndx[ss_elem_ndx[j]];
+
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (shell_table[0][2*n]-1)])
+ {
+ if (num_node_per_side >= 4)
+ /* 4- or 8-node side (front or back face) */
+ side_sets_side_list[ss_elem_ndx[j]] = shell_table[1][2*n];
+ else
+ /* 2- or 3-node side (edge of shell) */
+ side_sets_side_list[ss_elem_ndx[j]] = shell_edge_table[1][2*n];
+ }
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (shell_table[0][2*n+1]-1)])
+ {
+ if (num_node_per_side >= 4)
+ /* 4- or 8-node side (front or back face) */
+ side_sets_side_list[ss_elem_ndx[j]] = shell_table[1][2*n+1];
+ else
+ /* 2- or 3-node side (edge of shell) */
+ side_sets_side_list[ss_elem_ndx[j]]=shell_edge_table[1][2*n+1];
+ }
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (shell_table[0][2*n+2]-1)])
+ {
+ if (num_node_per_side >= 4)
+ /* 4- or 8-node side (front or back face) */
+ side_sets_side_list[ss_elem_ndx[j]] = shell_table[1][2*n+2];
+ else
+ /* 2- or 3-node side (edge of shell) */
+ side_sets_side_list[ss_elem_ndx[j]]=shell_edge_table[1][2*n+2];
+ }
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find SHELL element %d, node %d in connectivity array %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ break;
+
+ }
+ case HEX:
+ {
+ /* use table to find which node to compare to next */
+
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (hex_table[0][3*n]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = hex_table[1][3*n];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (hex_table[0][3*n+1]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = hex_table[1][3*n+1];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (hex_table[0][3*n+2]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = hex_table[1][3*n+2];
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find HEX element %d, node %d in connectivity array %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ break;
+ }
+ case TETRA:
+ {
+ /* use table to find which node to compare to next */
+
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (tetra_table[0][3*n]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = tetra_table[1][3*n];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (tetra_table[0][3*n+1]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = tetra_table[1][3*n+1];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (tetra_table[0][3*n+2]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = tetra_table[1][3*n+2];
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find TETRA element %d, node %d in connectivity array %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ break;
+ }
+ case PYRAMID:
+ {
+ /* NOTE: PYRAMID elements in side set node lists are currently not supported */
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "ERROR: unsupported PYRAMID element found in side set node list in file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ case WEDGE:
+ {
+#if 1
+ /* NOTE: WEDGE elements in side set node lists are currently not supported */
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "ERROR: unsupported WEDGE element found in side set node list in file id %d",
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+
+#else
+ /* use wedge_table to find which node to compare to next */
+
+/* This section is commented out because Wedges are no longer supported !!!*/
+
+ if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (wedge_table[0][3*n]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = wedge_table[1][3*n];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (wedge_table[0][3*n+1]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = wedge_table[1][3*n+1];
+ else if (side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1] ==
+ connect[num_nodes_per_elem*(elem_num_pos)+
+ (wedge_table[0][3*n+2]-1)])
+ side_sets_side_list[ss_elem_ndx[j]] = wedge_table[1][3*n+2];
+ else
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find WEDGE element %d, node %d in connectivity array %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]+1],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+ break;
+#endif
+ }
+ default:
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: %s is an unsupported element type",
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_type);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ }
+ break; /* done with this element */
+ }
+ }
+ if (n >= num_nodes_per_elem) /* did we find the node? */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: failed to find element %d, node %d in element block %d for file id %d",
+ side_sets_elem_list[ss_elem_ndx[j]],
+ side_sets_node_list[ss_elem_node_ndx[ss_elem_ndx[j]]],
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_blk_id,
+ exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ return (EX_FATAL);
+ }
+
+ }
+
+ /* All done: release connectivity array space, element block ids array,
+ element block parameters array, and side set element index array */
+ free(connect);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+
+ return (EX_NOERR);
+}
+
diff --git a/cbind/src/excopy.c b/cbind/src/excopy.c
new file mode 100644
index 0000000..df2b660
--- /dev/null
+++ b/cbind/src/excopy.c
@@ -0,0 +1,843 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* excopy - ex_copy
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int in_exoid input exodus file id
+*
+* exit conditions -
+* int out_exoid output exodus file id
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+struct ncdim { /* dimension */
+ char name[MAX_STR_LENGTH];
+ long size;
+};
+
+struct ncvar { /* variable */
+ char name[MAX_STR_LENGTH];
+ nc_type type;
+ int ndims;
+ int dims[MAX_VAR_DIMS];
+ int natts;
+};
+
+struct ncatt { /* attribute */
+ int var;
+ char name[MAX_STR_LENGTH];
+ nc_type type;
+ int 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
+ */
+
+int ex_copy (int in_exoid, int out_exoid)
+{
+ int ndims; /* number of dimensions */
+ int nvars; /* number of variables */
+ int ngatts; /* number of global attributes */
+ int recdimid; /* id of unlimited dimension */
+ int dimid; /* dimension id */
+ int dim_out_id; /* dimension id */
+ int varid; /* variable id */
+ 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];
+ int in_large, out_large;
+
+ extern int ncopts;
+
+ exerrval = 0; /* clear error code */
+
+ /*
+ * Get exodus_large_model setting on both input and output
+ * databases so know how to handle coordinates.
+ */
+ in_large = ex_large_model(in_exoid);
+ out_large = ex_large_model(out_exoid);
+
+ /*
+ * get number of dimensions, number of variables, number of global
+ * atts, and dimension id of unlimited dimension, if any
+ */
+
+ ncinquire(in_exoid, &ndims, &nvars, &ngatts, &recdimid);
+ ncdiminq (in_exoid, recdimid, (char *) 0, &numrec);
+
+ /* put output file into define mode */
+
+ ncredef(out_exoid);
+
+ /* copy global attributes */
+
+ for (i = 0; i < ngatts; i++) {
+
+ ncattname(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){
+
+ /* The "last_written_time" attribute is a special attribute
+ used by the Sierra IO system to determine whether a
+ timestep has been fully written to the database in order to
+ try to detect a database crash that happens in the middle
+ of a database output step. Don't want to copy that attribute.
+ */
+ 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);
+ }
+ }
+ }
+
+ /* copy dimensions */
+
+ /* Get the dimension sizes and names */
+
+ 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 */
+ } /* 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);
+
+ /* we don't want to copy some variables because there is not a
+ * simple way to add to them;
+ * QA records, info records and all results variables (nodal
+ * 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) &&
+ ( strncmp(var.name,"vals_elset_var", 14) != 0) &&
+ ( strncmp(var.name,"vals_sset_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_fset_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_eset_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_nset_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_nod_var", 12) != 0) &&
+ ( strncmp(var.name,"vals_edge_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_face_var", 13) != 0) &&
+ ( strncmp(var.name,"vals_elem_var", 13) != 0) ) {
+
+ if (strncmp(var.name,VAR_COORD,5) == 0) {
+ var_out_id = cpy_coord_def (in_exoid, out_exoid, recdimid, var.name,
+ in_large, out_large);
+ } else {
+ var_out_id = cpy_var_def (in_exoid, out_exoid, recdimid, var.name);
+ }
+
+ /* copy the variable's attributes */
+ (void) cpy_att (in_exoid, out_exoid, varid, var_out_id);
+
+ }
+ }
+
+ /* take the output file out of define mode */
+ ncendef (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);
+
+ /* we don't want to copy some variable values;
+ * QA records and info records shouldn't be copied because there
+ * isn't an easy way to add to them;
+ * the time value array ("time_whole") and any results variables
+ * (nodal, elemental, or global) shouldn't be copied
+ */
+
+ 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)&&
+ ( strncmp(var.name,"vals_eset_var", 13) != 0)&&
+ ( strncmp(var.name,"vals_nset_var", 13) != 0)&&
+ ( strncmp(var.name,"vals_nod_var", 12) != 0) &&
+ ( strncmp(var.name,"vals_edge_var",13) != 0) &&
+ ( strncmp(var.name,"vals_face_var",13) != 0) &&
+ ( strncmp(var.name,"vals_elem_var",13) != 0) &&
+ ( strcmp(var.name,VAR_WHOLE_TIME) != 0) ) {
+
+ if (strncmp(var.name,VAR_COORD,5) == 0) {
+ (void) cpy_coord_val (in_exoid, out_exoid, var.name,
+ in_large, out_large);
+ } else {
+ (void) cpy_var_val (in_exoid, out_exoid, var.name);
+ }
+
+ }
+ }
+
+ /* 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 );
+
+ /* 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 );
+
+ /* 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 );
+
+ return(EX_NOERR);
+}
+
+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
+ int var_in_id: input netCDF input-variable ID
+ int var_out_id: input netCDF output-variable ID
+ */
+{
+ /* Routine to copy all the attributes from the input netCDF
+ file to the output netCDF file. If var_in_id == NC_GLOBAL,
+ then the global attributes are copied. Otherwise the variable's
+ attributes are copied. */
+
+ 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 */
+
+ /* Get the attributes names, types, lengths, and values */
+ 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 */
+
+ 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 in_id: input netCDF input-file ID
+ int out_id: input netCDF output-file ID
+ int rec_dim_id: input input-file record dimension ID
+ char *var_nm: input variable name
+ int in_large: large file setting for input file
+ int out_large: large file setting for output file
+ int cpy_var_def(): output output-file variable ID
+ */
+{
+ const char *routine = NULL;
+ long spatial_dim;
+ int nbr_dim;
+ int temp;
+
+ int dim_out_id[2];
+ int var_out_id = -1;
+
+ /* Handle easiest situation first: in_large matches out_large */
+ if (in_large == out_large) {
+ return cpy_var_def(in_id, out_id, rec_dim_id, 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);
+
+ 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;
+ }
+ }
+
+ /* Get dimid of the num_nodes dimension in output file... */
+ dim_out_id[0]=ncdimid(out_id,DIM_NUM_NODES);
+
+ /* 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);
+ if (spatial_dim == 3)
+ var_out_id=ncvardef(out_id,VAR_COORD_Z,nc_flt_code(out_id),
+ nbr_dim, dim_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;
+
+ /* 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);
+
+ /* 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);
+ }
+ return var_out_id;
+}
+
+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
+ int rec_dim_id: input input-file record dimension ID
+ char *var_nm: input variable name
+ int cpy_var_def(): output output-file variable ID
+ */
+{
+ /* Routine to copy the variable metadata from an input netCDF file
+ * to an output netCDF file.
+ */
+
+ 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;
+
+ /* See if the requested variable is in the input file. */
+ var_in_id=ncvarid(in_id,var_nm);
+
+ /* 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);
+
+ /* Recall:
+ 1. The dimensions must be defined before the variable.
+ 2. The variable must be defined before the attributes. */
+
+ /* Allocate space to hold the dimension IDs */
+ dim_in_id=malloc(nbr_dim*sizeof(int));
+ 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);
+
+ /* Get the dimension sizes and names */
+ for(idx=0;idx<nbr_dim;idx++){
+ char dim_nm[MAX_NC_NAME];
+ long dim_sz;
+
+ ncdiminq(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;
+
+ /* 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 */
+
+ /* Define the variable in the output file */
+
+ /* If variable is float or double, define it according to the EXODUS
+ 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);
+ } else {
+ var_out_id=ncvardef(out_id,var_nm,var_type,nbr_dim,dim_out_id);
+ }
+
+ /* Free the space holding the dimension IDs */
+ (void)free(dim_in_id);
+ (void)free(dim_out_id);
+
+ return var_out_id;
+} /* end cpy_var_def() */
+
+int
+cpy_var_val(int in_id,int out_id,char *var_nm)
+/*
+ int in_id: input netCDF input-file ID
+ int out_id: input netCDF output-file ID
+ char *var_nm: input variable name
+ */
+{
+ /* Routine to copy the variable data from an input netCDF file
+ * to an output netCDF file.
+ */
+
+ int *dim_id;
+ int idx;
+ int nbr_dim;
+ int var_in_id;
+ int var_out_id;
+ long *dim_cnt;
+ long *dim_sz;
+ long *dim_srt;
+ long 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);
+
+ /* Get the number of dimensions for the variable. */
+
+ 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);
+
+ /* Allocate space to hold the dimension IDs */
+ dim_cnt = malloc(nbr_dim*sizeof(long));
+
+ dim_id=malloc(nbr_dim*sizeof(int));
+
+ dim_sz=malloc(nbr_dim*sizeof(long));
+
+ dim_srt=malloc(nbr_dim*sizeof(long));
+
+ /* 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);
+
+ /* Get the dimension sizes and names from the input file */
+ for(idx=0;idx<nbr_dim;idx++){
+ /* NB: For the unlimited dimension, ncdiminq() returns the maximum
+ value used so far in writing data for that dimension.
+ Thus if you read the dimension sizes from the output file, then
+ the ncdiminq() returns dim_sz=0 for the unlimited dimension
+ until a variable has been written with that dimension. This is
+ the reason for always reading the input file for the dimension
+ sizes. */
+
+ ncdiminq(in_id,dim_id[idx],(char *)NULL,dim_cnt+idx);
+
+ /* Initialize the indicial offset and stride arrays */
+ dim_srt[idx]=0L;
+ var_sz*=dim_cnt[idx];
+ } /* end loop over dim */
+
+ /* Allocate enough space to hold the variable */
+ void_ptr=malloc(var_sz*nctypelen(var_type_in));
+
+ /* Get the variable */
+
+ /* if variable is float or double, convert if necessary */
+
+ 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 */
+
+ /* no conversion necessary */
+
+ ncvarput1(out_id,var_out_id,0L,void_ptr);
+
+ }
+
+ } 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 */
+
+ /* no conversion necessary */
+
+ ncvarput(out_id,var_out_id,dim_srt,dim_cnt,void_ptr);
+
+ }
+
+ } /* end if variable is an array */
+
+ /* Free the space that held the dimension IDs */
+ (void)free(dim_cnt);
+ (void)free(dim_id);
+ (void)free(dim_sz);
+ (void)free(dim_srt);
+
+ /* Free the space that held the variable */
+ (void)free(void_ptr);
+
+ return(EX_NOERR);
+
+} /* end cpy_var_val() */
+
+int
+cpy_coord_val(int in_id,int out_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
+ char *var_nm: input variable name
+ */
+{
+ /* Routine to copy the coordinate data from an input netCDF file
+ * to an output netCDF file.
+ */
+
+ const char *routine = NULL;
+ int i;
+ long spatial_dim, num_nodes;
+ long start[2], count[2];
+ nc_type var_type_in, var_type_out;
+
+ void *void_ptr;
+
+ /* Handle easiest situation first: in_large matches out_large */
+ if (in_large == out_large)
+ return cpy_var_val(in_id, out_id, 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);
+
+ 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);
+
+ 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);
+
+ void_ptr=malloc(num_nodes * nctypelen(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 (in_large == 1 && out_large == 0) {
+ /* 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);
+
+ 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);
+
+ void_ptr=malloc(num_nodes * nctypelen(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));
+ }
+ }
+ }
+
+ /* 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 )
+{
+ int i;
+ int number;
+ double fdum;
+ char* cdum = 0;
+
+ ex_inquire (out_exoid, inqcode, &number, &fdum, cdum);
+
+ if (number > 0) {
+ for (i=0; i<number; i++)
+ ex_inc_file_item (out_exoid, ctr_list);
+ }
+}
diff --git a/cbind/src/excre.c b/cbind/src/excre.c
new file mode 100644
index 0000000..323ce05
--- /dev/null
+++ b/cbind/src/excre.c
@@ -0,0 +1,290 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* excre - ex_create
+*
+* entry conditions -
+* input parameters:
+* char* path file name including path
+* int cmode access mode r/w
+* int* comp_ws compute word size
+* int* io_ws storage word size
+*
+* exit conditions -
+* return value exodus file id
+*
+* 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
+ */
+
+int ex_create (const char *path,
+ int cmode,
+ int *comp_ws,
+ int *io_ws)
+{
+ int exoid, time_dim, dims[1];
+ nclong lio_ws;
+ nclong 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;
+#endif /* NC_NETCDF4 */
+
+ exerrval = 0; /* clear error code */
+
+#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;
+ }
+#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));
+
+ if (
+#if defined(NC_NETCDF4)
+ !(mode & NC_NETCDF4) &&
+#endif
+ filesiz == 1) {
+ mode |= NC_64BIT_OFFSET;
+ }
+
+ if (cmode & EX_SHARE) {
+ mode |= NC_SHARE;
+ }
+
+/*
+ * 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 ((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);
+ }
+
+/* turn off automatic filling of netCDF variables
+ */
+
+ if (ncsetfill (exoid, NC_NOFILL) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "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.
+ */
+
+ 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);
+ }
+
+/* put the EXODUS version number, and i/o floating point word size as
+ * netcdf global attributes
+ */
+
+/* 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;
+ sprintf(errmsg,
+ "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 */
+ vers = EX_VERS;
+ if (ncattput (exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "Error: failed to store Exodus II file size attribute in file id %d",
+ exoid);
+ ex_err("ex_create",errmsg, exerrval);
+ return (EX_FATAL);
+ }
+
+ /* define some dimensions and variables
+ */
+
+ /* create string length dimension */
+ if (ncdimdef (exoid, DIM_STR, (MAX_STR_LENGTH+1)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d", exoid);
+ ex_err("ex_create",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (exoid);
+}
diff --git a/cbind/src/exerr.c b/cbind/src/exerr.c
new file mode 100644
index 0000000..3710e03
--- /dev/null
+++ b/cbind/src/exerr.c
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exerr - ex_err
+*
+* author - Sandia National Laboratories
+* Vic Yarberry - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* char* pname procedure name
+* char* err_string error message string
+* int errcode error code
+*
+* exit conditions -
+*
+* 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"
+
+int exerrval = 0; /* clear initial global error code value */
+
+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 */
+{
+ if (errcode == 0) /* zero is no error, ignore and return */
+ return;
+
+ else if (errcode == EX_PRTLASTMSG)
+ {
+ fprintf(stderr, "[%s] %s\n",last_pname,last_errmsg);
+ fprintf(stderr, " exerrval = %d\n",last_errcode);
+ return;
+ }
+
+ else if (exoptval & EX_VERBOSE) /* check see if we really want to hear this */
+ {
+ fprintf(stderr, "[%s] %s\n",pname,err_string);
+ if (exoptval & EX_VERBOSE)
+ fprintf(stderr, " exerrval = %d\n",errcode);
+ switch (errcode)
+ {
+ 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");
+ break;
+ case EX_MSG:
+ break;
+ }
+ }
+ /* save the error message for replays */
+ strcpy(last_errmsg, err_string);
+ strcpy(last_pname, pname);
+ last_errcode = errcode;
+
+ fflush(stderr);
+
+ /* with netCDF 3.4, (fatal) system error codes are > 0;
+ so all EXODUS fatal error codes are > 0 */
+ if ((errcode > 0) && (exoptval & EX_ABORT))
+ exit (errcode);
+}
diff --git a/cbind/src/exgatm.c b/cbind/src/exgatm.c
new file mode 100644
index 0000000..f5e8287
--- /dev/null
+++ b/cbind/src/exgatm.c
@@ -0,0 +1,131 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* float* time_values array of simulation time values
+*
+* revision history -
+*
+* $Id: exgatm.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads all the time values for history or whole 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];
+ 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;
+ sprintf(errmsg,"Error: failed to locate time variable %s in file id %d",
+ var_name,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);
+ }
+
+ if (ncvarget (exoid, varid, start, count,
+ ex_conv_array(exoid,RTN_ADDRESS,time_values,(int)count[0])) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get %s time values from file id %d",
+ var_name,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
new file mode 100644
index 0000000..f31b1b3
--- /dev/null
+++ b/cbind/src/exgatn.c
@@ -0,0 +1,210 @@
+/*
+ * 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_attr_names
+*
+* 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)
+*
+* exit conditions -
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the attribute names for an element block
+ */
+int ex_get_attr_names( int exoid,
+ int obj_type,
+ int obj_id,
+ char **names)
+{
+ int varid, numattrdim, obj_id_ndx;
+ long num_attr, start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+ int i, j;
+ const char* tname;
+ const char* vobjids;
+ 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);
+ }
+ }
+
+
+ switch (obj_type) {
+ case EX_EDGE_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx);
+ vattrbname = VAR_NAME_EATTRIB(obj_id_ndx);
+ break;
+ case EX_FACE_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx);
+ vattrbname = VAR_NAME_FATTRIB(obj_id_ndx);
+ break;
+ case EX_ELEM_BLOCK:
+ dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx);
+ vattrbname = VAR_NAME_ATTRIB(obj_id_ndx);
+ break;
+ }
+/* inquire id's of previously defined dimensions */
+
+ if ((numattrdim = ncdimid(exoid, dnumobjatt)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Warning: no attributes found for %s %d in file id %d",
+ tname,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;
+ sprintf(errmsg,
+ "Error: failed to get number of attributes for block %d in file id %d",
+ obj_id,exoid);
+ ex_err("ex_get_attr_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* 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);
+
+/* read in the attributes */
+
+ if (varid != -1) {
+ /* read the names */
+ for (i=0; i < num_attr; i++) {
+ start[0] = i;
+ start[1] = 0;
+
+ j = 0;
+ ptr = names[i];
+
+ if (ncvarget1 (exoid, varid, start, ptr) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get names for %s %d in file id %d",
+ tname, 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;
+ sprintf(errmsg,
+ "Error: failed to get names for %s %d in file id %d",
+ tname, 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';
+ }
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgatt.c b/cbind/src/exgatt.c
new file mode 100644
index 0000000..e097086
--- /dev/null
+++ b/cbind/src/exgatt.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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int obj_type object type (edge/face/element block)
+* int obj_id object id (edge id, face id, elem id)
+*
+* exit conditions -
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the attributes for an edge, face, or element block
+ */
+
+int ex_get_attr( int exoid,
+ int 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];
+ 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);
+ }
+ }
+
+ switch (obj_type) {
+ 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;
+ sprintf(errmsg,
+ "Warning: no attributes found for 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 */
+ }
+
+ 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_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;
+
+ if (ncvarget (exoid, attrid, start, count,
+ ex_conv_array(exoid,RTN_ADDRESS,attrib,
+ (int)num_attr*num_entries_this_obj)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get attributes for block %d in file id %d",
+ 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/exgblk.c b/cbind/src/exgblk.c
new file mode 100644
index 0000000..17985c5
--- /dev/null
+++ b/cbind/src/exgblk.c
@@ -0,0 +1,354 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgblk - read block parameters
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int idexo exodus file id
+* int blk_type block type (edge,face,element)
+* int blk_id block id
+*
+* exit conditions -
+* char* elem_type element type name
+* int* num_entries_this_blk number of elements in this element block
+* int* num_nodes_per_entry number of nodes per element block
+* 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 $
+*
+*/
+
+#include <string.h>
+#include <stdio.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the parameters used to describe an 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 )
+{
+ 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);
+ }
+
+ 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);
+ }
+ }
+
+ /* 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);
+ }
+
+ 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;
+ }
+
+ 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;
+ }
+
+ 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 ( 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_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 ( 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 (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 (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 (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);
+ }
+
+ /* 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
new file mode 100644
index 0000000..4d15ed0
--- /dev/null
+++ b/cbind/src/exgcns.c
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int* node_set_ids array of node set IDs
+* int* num_nodes_per_set number of nodes for each set
+* int* num_df_per_set number of dist factors for each set
+* int* node_sets_index array of indices into node_set_node_list
+* int* df_sets_index array of indices into node_set_dist_fact
+* int* node_sets_node_list array of nodes for all sets
+* float* node_sets_dist_fact array of distribution factors for sets
+*
+* 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
+ */
+
+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)
+{
+ struct ex_set_specs set_specs;
+
+ set_specs.sets_ids = node_set_ids;
+ set_specs.num_entries_per_set = num_nodes_per_set;
+ set_specs.num_dist_per_set = num_df_per_set;
+ set_specs.sets_entry_index = node_sets_node_index;
+ set_specs.sets_dist_index = node_sets_df_index;
+ set_specs.sets_entry_list = node_sets_node_list;
+ set_specs.sets_extra_list = NULL;
+ set_specs.sets_dist_fact = node_sets_dist_fact;
+
+ return ex_get_concat_sets(exoid, EX_NODE_SET, &set_specs);
+}
diff --git a/cbind/src/exgcon.c b/cbind/src/exgcon.c
new file mode 100644
index 0000000..87d86f7
--- /dev/null
+++ b/cbind/src/exgcon.c
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* char* coord_names[] ptr array of coord names
+*
+* 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
+ */
+
+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,
+ "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);
+ }
+
+
+ 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) == ' ');
+ }
+ *(++ptr) = '\0';
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/exgconn.c b/cbind/src/exgconn.c
new file mode 100644
index 0000000..403bb10
--- /dev/null
+++ b/cbind/src/exgconn.c
@@ -0,0 +1,410 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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:
+* int exoid exodus file id
+* int blk_type block type (edge, face, element)
+* int blk_id block id
+*
+* exit conditions -
+* int* nodeconn nodal connectivity array
+* int* edgeconn edge connectivity array (where applicable)
+* 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"
+#include "exodusII_int.h"
+
+/*
+ * reads the connectivity array for an element block
+ */
+
+int ex_get_conn( int exoid,
+ int blk_type,
+ int blk_id,
+ int* nodeconn,
+ int* edgeconn,
+ int* faceconn )
+{
+ int numblkentriesdim, connid, econnid, fconnid, blk_id_ndx, iresult;
+ 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;
+ char errmsg[MAX_ERR_LENGTH];
+
+ const char* tname;
+ const char* vblkids;
+ const char* dnumblkent;
+ const char* dnumnodent;
+ const char* dnumedgent;
+ const char* dnumfacent;
+ const char* vnodeconn;
+ const char* vedgeconn;
+ const char* vfaceconn;
+
+ /* Should we warn if edgeconn or faceconn are non-NULL?
+ * No, fail silently so the same code can be used to read any type of block info.
+ * 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);
+ 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);
+ 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);
+ ex_err("ex_get_conn",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ 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;
+ vnodeconn = VAR_EBCONN(blk_id_ndx);
+ vedgeconn = 0;
+ 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;
+ vnodeconn = VAR_FBCONN(blk_id_ndx);
+ vedgeconn = 0;
+ 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);
+ vnodeconn = VAR_CONN(blk_id_ndx);
+ vedgeconn = VAR_ECONN(blk_id_ndx);
+ vfaceconn = VAR_FCONN(blk_id_ndx);
+ break;
+ }
+/* 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);
+ }
+
+ if ( dnumedgent ) {
+ num_edges_per_entry = 0;
+ if ((numedgperentdim = ncdimid (exoid, dnumedgent)) == -1) {
+ numedgperentdim = -1;
+ } else {
+ if (ncdiminq (exoid, numedgperentdim, (char *) 0, &num_edges_per_entry) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of edges/entry for %s block %d in file id %d",
+ tname,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) {
+ numfacperentdim = -1;
+ } else {
+ if (ncdiminq (exoid, numfacperentdim, (char *) 0, &num_faces_per_entry) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of faces/entry for %s block %d in file id %d",
+ tname,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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_get_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ if ( edgeconn && (numedgperentdim > 0) && ((econnid = ncvarid (exoid, vedgeconn)) == -1) )
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate edge connectivity array for %s block %d in file id %d",
+ tname,blk_id,exoid);
+ ex_err("ex_get_conn",errmsg, exerrval);
+ return(EX_FATAL);
+ }
+
+ if ( faceconn && (numfacperentdim > 0) && ((fconnid = ncvarid (exoid, vfaceconn)) == -1) )
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate face connectivity array for %s block %d in file id %d",
+ tname,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;
+
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get edge connectivity array for block %d in file id %d",
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get face connectivity array for %s block %d in file id %d",
+ tname,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 (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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get connectivity array for block %d in file id %d",
+ 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
new file mode 100644
index 0000000..126bf9a
--- /dev/null
+++ b/cbind/src/exgcor.c
@@ -0,0 +1,261 @@
+/*
+ * 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_coord
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* float* x_coord X coord array
+* float* y_coord y coord array
+* float* z_coord z coord array
+*
+* revision history -
+*
+* $Id: exgcor.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the coordinates of the nodes
+ * Only fills in the 'non-null' arrays.
+ */
+
+int ex_get_coord (int exoid,
+ void *x_coor,
+ void *y_coor,
+ void *z_coor)
+{
+ int coordid;
+ int coordidx, coordidy, coordidz;
+
+ int numnoddim, ndimdim, i;
+ long num_nod, num_dim, start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0;
+
+ /* 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 (ncdiminq (exoid, numnoddim, (char *) 0, &num_nod) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of nodes in file id %d",
+ exoid);
+ ex_err("ex_get_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_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;
+ 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);
+ }
+
+
+ ex_conv_array( exoid, READ_CONVERT, z_coor, (int)num_nod );
+ }
+ }
+ } 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 (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);
+ }
+ } 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);
+ }
+ } else {
+ coordidz = 0;
+ }
+
+ /* write out the coordinates */
+ for (i=0; i<num_dim; i++)
+ {
+ const void *coor;
+ char *which;
+ int status;
+
+ 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_get_var_float(exoid, coordid,
+ ex_conv_array(exoid,RTN_ADDRESS,
+ coor,(int)num_nod));
+ } else {
+ status = nc_get_var_double(exoid, coordid,
+ ex_conv_array(exoid,RTN_ADDRESS,
+ coor,(int)num_nod));
+ }
+
+ 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 );
+ }
+ }
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgcset.c b/cbind/src/exgcset.c
new file mode 100644
index 0000000..7c2dc6e
--- /dev/null
+++ b/cbind/src/exgcset.c
@@ -0,0 +1,263 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#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.
+ */
+
+int ex_get_concat_sets (int exoid,
+ int 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 */
+
+ /* 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);
+
+}
diff --git a/cbind/src/exgcss.c b/cbind/src/exgcss.c
new file mode 100644
index 0000000..03e3cb9
--- /dev/null
+++ b/cbind/src/exgcss.c
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+#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
+ */
+
+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)
+{
+ struct ex_set_specs set_specs;
+
+ set_specs.sets_ids = side_set_ids;
+ set_specs.num_entries_per_set = num_elem_per_set;
+ set_specs.num_dist_per_set = num_dist_per_set;
+ set_specs.sets_entry_index = side_sets_elem_index;
+ set_specs.sets_dist_index = side_sets_dist_index;
+ set_specs.sets_entry_list = side_sets_elem_list;
+ set_specs.sets_extra_list = side_sets_side_list;
+ set_specs.sets_dist_fact = side_sets_dist_fact;
+
+ return ex_get_concat_sets(exoid, EX_SIDE_SET, &set_specs);
+}
diff --git a/cbind/src/exgean.c b/cbind/src/exgean.c
new file mode 100644
index 0000000..2756c08
--- /dev/null
+++ b/cbind/src/exgean.c
@@ -0,0 +1,65 @@
+/*
+ * 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_elem_attr_names
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int elem_blk_id element block id
+*
+* 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
+ */
+int ex_get_elem_attr_names (int exoid,
+ int elem_blk_id,
+ char **names)
+{
+ return ex_get_attr_names( exoid, EX_ELEM_BLOCK, elem_blk_id, names );
+}
diff --git a/cbind/src/exgeat.c b/cbind/src/exgeat.c
new file mode 100644
index 0000000..360ec49
--- /dev/null
+++ b/cbind/src/exgeat.c
@@ -0,0 +1,74 @@
+/*
+ * 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_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
+* int elem_blk_id element block id
+*
+* 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
+ */
+
+int ex_get_elem_attr (int exoid,
+ int elem_blk_id,
+ void *attrib)
+{
+ return ex_get_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib );
+}
diff --git a/cbind/src/exgebi.c b/cbind/src/exgebi.c
new file mode 100644
index 0000000..f8d832d
--- /dev/null
+++ b/cbind/src/exgebi.c
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int* elem_blk_ids array of element block ids
+*
+* revision history -
+*
+* $Id: exgebi.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the element block ids from the database
+ */
+
+int ex_get_elem_blk_ids (int exoid,
+ int *ids)
+{
+ /* ex_get_elem_blk_ids should be deprecated. */
+ return ex_get_ids( exoid, EX_ELEM_BLOCK, ids );
+}
diff --git a/cbind/src/exgelb.c b/cbind/src/exgelb.c
new file mode 100644
index 0000000..d4e1885
--- /dev/null
+++ b/cbind/src/exgelb.c
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgelb - read element block parameters
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int idexo exodus file id
+* int elem_blk_id element block id
+*
+* exit conditions -
+* char* elem_type element type name
+* int* num_elem_this_blk number of elements in this element block
+* int* num_nodes_per_elem number of nodes per element block
+* int* num_attr number of attributes
+*
+* revision history -
+*
+* $Id: exgelb.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*/
+
+#include <string.h>
+#include <stdio.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the parameters used to describe an element block
+ */
+
+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)
+
+{
+ return ex_get_block( exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type,
+ num_elem_this_blk, num_nodes_per_elem, 0, 0, num_attr );
+}
diff --git a/cbind/src/exgelc.c b/cbind/src/exgelc.c
new file mode 100644
index 0000000..a0e8729
--- /dev/null
+++ b/cbind/src/exgelc.c
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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:
+* int exoid exodus file id
+* int elem_blk_id element block id
+*
+* 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
+ */
+
+int ex_get_elem_conn (int exoid,
+ int elem_blk_id,
+ int *connect)
+{
+ return ex_get_conn( exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0 );
+}
diff --git a/cbind/src/exgem.c b/cbind/src/exgem.c
new file mode 100644
index 0000000..5ac731e
--- /dev/null
+++ b/cbind/src/exgem.c
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgem - ex_get_elem_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id element map id
+*
+* 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
+ */
+
+int ex_get_elem_map (int exoid,
+ int map_id,
+ int *elem_map)
+{
+ return ex_get_num_map( exoid, EX_ELEM_MAP, map_id, elem_map );
+}
diff --git a/cbind/src/exgenm.c b/cbind/src/exgenm.c
new file mode 100644
index 0000000..d6f51ce
--- /dev/null
+++ b/cbind/src/exgenm.c
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int* elem_map element number map array
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the element numbering map from the database; allows element numbers
+ * to be noncontiguous
+ */
+
+int ex_get_elem_num_map (int exoid,
+ 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);
+
+}
diff --git a/cbind/src/exgev.c b/cbind/src/exgev.c
new file mode 100644
index 0000000..eb5591d
--- /dev/null
+++ b/cbind/src/exgev.c
@@ -0,0 +1,83 @@
+/*
+ * 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_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
+* int time_step time step number
+* int elem_var_index element variable index
+* int elem_blk_id element block id
+* int num_elem_this_blk number of elements in this block
+*
+*
+* exit conditions -
+* float* elem_var_vals array of element variable values
+*
+*
+* 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
+ */
+
+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)
+{
+ return ex_get_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/exgevid.c b/cbind/src/exgevid.c
new file mode 100644
index 0000000..3d97409
--- /dev/null
+++ b/cbind/src/exgevid.c
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgevid - ex_get_elem_varid
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* varid variable id array
+*
+* 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
+ */
+
+int ex_get_elem_varid (int exoid,
+ int *varid)
+{
+ return ex_get_varid(exoid, "e", varid);
+}
diff --git a/cbind/src/exgevt.c b/cbind/src/exgevt.c
new file mode 100644
index 0000000..91fb1f0
--- /dev/null
+++ b/cbind/src/exgevt.c
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int elem_var_index element variable index
+* int elem_number element number
+* int beg_time_step time step number
+* int end_time_step time step number
+*
+* exit conditions -
+* float* elem_var_vals array of element variable values
+*
+* revision history -
+* 20061002 - David Thompson - Moved to ex_get_var_time.
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#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
+ */
+
+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)
+{
+ return ex_get_var_time( exoid, EX_ELEM_BLOCK, elem_var_index, elem_number, beg_time_step, end_time_step, elem_var_vals );
+}
diff --git a/cbind/src/exgfrm.c b/cbind/src/exgfrm.c
new file mode 100644
index 0000000..2f35879
--- /dev/null
+++ b/cbind/src/exgfrm.c
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* NOTE:
+* cf_ids, pt_coordinates and tags may all be NULL, otherwise, they
+* must have sufficient memory to store the output data. Two calls
+* to this routine are anticipated (one to get nframes, the second
+* to fill the data. i.e.
+* ex_get_coordinate_frames(exoid,&nframes,0,0,0);
+* ... allocate memory ...
+* ex_get_coordinate_frames(exoid,&nframe,id,coords,tags);
+*
+*
+* output conditions -
+* int* nframes number of coordinate frames in model
+* const int* cf_ids coordinate ids
+* dimension int[nframes]
+* const void* pt_coordinates pointer to coordinates. 9 values per
+* coordinate frame
+* dimension float[9*nframes]
+* const char* tags character tag for each frame.
+* 'r' - rectangular
+* 'c' - cylindrical
+* 's' - spherical
+* dimension char[nframes]
+*
+* returns -
+* EX_NOERR for no error
+* EX_FATAL for fatal errors
+*
+*****************************************************************************/
+
+#include <assert.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/* -------------------- 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)
+{
+ 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 */
+
+ /* get the dimensions */
+ assert( nframes !=NULL );
+ dimid = ncdimid(exoid,NUM_CFRAMES);
+ if ( dimid<0 ){
+ *nframes=0;
+ return EX_NOERR;
+ }
+ ncdiminq(exoid,dimid,(char*)0,&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;
+ sprintf(errmsg,
+ "Error: failed to read number coordinate ids from file id %d",
+ exoid);
+ ex_err((char*)PROCNAME,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ( tags )
+ if ( (varids=ncvarid(exoid,FRAME_TAGS))==-1 ||
+ ncvarget(exoid,varids,&start,&count,tags)== -1 ) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to read number coordinate tags from file id %d",
+ exoid);
+ ex_err((char*)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;
+ sprintf(errmsg,
+ "Error: failed to read number coordinate tags from file id %d",
+ exoid);
+ ex_err((char*)PROCNAME,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ else {
+ pt_c=ex_conv_array( exoid, READ_CONVERT,pt_coordinates,count9);
+ assert(pt_c==0);
+ }
+ }
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exggv.c b/cbind/src/exggv.c
new file mode 100644
index 0000000..a07d637
--- /dev/null
+++ b/cbind/src/exggv.c
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+* int num_glob_vars number of global vars in file
+*
+* exit conditions -
+* float* glob_var_vals array of global variable values
+*
+* revision history -
+*
+* $Id: exggv.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the values of all the global variables for a single time step from
+ * the database; time step numbers are assumed to start at 1
+ */
+
+int ex_get_glob_vars (int exoid,
+ int time_step,
+ int num_glob_vars,
+ void *glob_var_vals)
+{
+ int varid;
+ long 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;
+ sprintf(errmsg,
+ "Warning: failed to locate global variables in file id %d",
+ exoid);
+ ex_err("ex_get_glob_vars",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+
+/* 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;
+ 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
new file mode 100644
index 0000000..0b606f4
--- /dev/null
+++ b/cbind/src/exggvt.c
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int glob_var_index global variable index
+* int beg_time_step starting time step
+* int end_time_step ending time step
+*
+* exit conditions -
+* float* glob_var_vals global variable values
+*
+* revision history -
+*
+* $Id: exggvt.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 global variable through a specified number
+ * of time steps in the database; time step numbers and variable indices
+ * are assumed to start at 1
+ */
+
+int ex_get_glob_var_time (int exoid,
+ int glob_var_index,
+ int beg_time_step,
+ int end_time_step,
+ void *glob_var_vals)
+{
+ int varid;
+ long start[2], count[2];
+ float fdum;
+ char *cdum;
+ 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;
+ sprintf(errmsg,
+ "Error: failed to locate global variables in file id %d",
+ exoid);
+ ex_err("ex_get_glob_var_time",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+/* 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;
+ sprintf(errmsg,
+ "Error: failed to get number of time steps in file id %d",
+ exoid);
+ ex_err("ex_get_glob_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ end_time_step--;
+
+ 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;
+ 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/exgids.c b/cbind/src/exgids.c
new file mode 100644
index 0000000..338e482
--- /dev/null
+++ b/cbind/src/exgids.c
@@ -0,0 +1,204 @@
+/*
+ * 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.
+ *
+ */
+/*
+ * $Id: exgids.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
+ *
+ *****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the element block ids from the database
+ */
+
+int ex_get_ids (int exoid,
+ int obj_type,
+ int *ids)
+{
+ int dimid, varid, iresult;
+ long numobj, start[1], count[1];
+ nclong *longs;
+ 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 */
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid);
+ ex_err("ex_get_ids",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ /* inquire id's of previously defined dimensions and variables */
+
+ if ((dimid = ncdimid (exoid, dimnumobj)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate dimension %s in file id %d",
+ dimnumobj,exoid);
+ ex_err("ex_get_ids",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ncdiminq (exoid, dimid, (char*)0, &numobj) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to return number of %ss in file id %d",
+ tname,exoid);
+ ex_err("ex_get_ids",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ if ((varid = ncvarid (exoid, varidobj)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s ids variable in file id %d",
+ tname,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);
+}
diff --git a/cbind/src/exginf.c b/cbind/src/exginf.c
new file mode 100644
index 0000000..7fd2664
--- /dev/null
+++ b/cbind/src/exginf.c
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* char* info[] ptr array of info records
+*
+* revision history -
+*
+* $Id: exginf.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads information records from the database
+ */
+
+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,
+ "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,
+ "Error: failed to get number of info records in file id %d",
+ 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,
+ "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';
+ }
+
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/exgini.c b/cbind/src/exgini.c
new file mode 100644
index 0000000..81cd99b
--- /dev/null
+++ b/cbind/src/exgini.c
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* char* title title of file
+* int* num_dim number of dimensions (per node)
+* int* num_nodes number of nodes
+* int* num_elem number of elements
+* int* num_elem_blk number of element blocks
+* int* num_node_sets number of node sets
+* int* num_side_sets numver of side sets
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*
+ * reads the initialization parameters from an opened EXODUS II file
+ */
+
+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)
+{
+ ex_init_params info;
+ int errval;
+
+ info.title[0] = '\0';
+ errval = ex_get_init_ext( exoid, &info );
+ if ( errval < 0 )
+ {
+ return errval;
+ }
+
+ *num_dim = info.num_dim;
+ *num_nodes = info.num_nodes;
+ *num_elem = info.num_elem;
+ *num_elem_blk = info.num_elem_blk;
+ *num_node_sets = info.num_node_sets;
+ *num_side_sets = info.num_side_sets;
+ strcpy( title, info.title );
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exginix.c b/cbind/src/exginix.c
new file mode 100644
index 0000000..92f109c
--- /dev/null
+++ b/cbind/src/exginix.c
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* ex_init_params* info parameter information
+*
+* revision history -
+*
+* $Id: exginix.c,v 1.2 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the initialization parameters from an opened EXODUS II file
+ */
+
+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;
+ char errmsg[MAX_ERR_LENGTH];
+ int 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;
+ 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 */
+ if (title_len > MAX_LINE_LENGTH+1) {
+ sprintf(errmsg,
+ "Error: Title is too long (%d characters) in file id %d",
+ title_len-1, exoid);
+ exerrval = -1;
+ 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;
+
+
+ /* 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);
+
+ 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("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);
+
+ /* 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);
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgmap.c b/cbind/src/exgmap.c
new file mode 100644
index 0000000..46d1551
--- /dev/null
+++ b/cbind/src/exgmap.c
@@ -0,0 +1,153 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int* elem_map element order map array
+*
+* revision history -
+*
+* $Id: exgmap.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the element order map from the database
+ */
+
+int ex_get_map (int exoid,
+ 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_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ 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 */
+ for (i=0; i<num_elem; i++)
+ elem_map[i] = i+1;
+
+ return (EX_WARN);
+ }
+
+
+/* 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;
+ sprintf(errmsg,
+ "Error: failed to get element order map in file id %d",
+ exoid);
+ ex_err("ex_get_map",errmsg,exerrval);
+ 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
new file mode 100644
index 0000000..986b97e
--- /dev/null
+++ b/cbind/src/exgmp.c
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgmp - ex_get_map_param
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* num_node_maps number of node maps
+* int* num_elem_maps number of element maps
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the number of node and element maps
+ */
+
+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];
+
+ 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;
+ }
+
+ /* 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,
+ "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);
+}
diff --git a/cbind/src/exgnam.c b/cbind/src/exgnam.c
new file mode 100644
index 0000000..0e70307
--- /dev/null
+++ b/cbind/src/exgnam.c
@@ -0,0 +1,165 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnam - ex_get_name
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* const char *type entity type - M, E, S
+* int entity_id id of entity name to read
+*
+* exit conditions -
+* char* name ptr to name
+*
+* revision history -
+*
+* $Id: exgnam.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the specified entity name from the database
+ */
+
+int ex_get_name (int exoid,
+ int obj_type,
+ int entity_id,
+ char *name)
+{
+ int j, varid, ent_ndx;
+ long num_entity, start[2];
+ char *ptr;
+ char errmsg[MAX_ERR_LENGTH];
+ 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 */
+ 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 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;
+
+ /* read the name */
+ start[0] = ent_ndx-1;
+ start[1] = 0;
+
+ j = 0;
+ ptr = name;
+
+ if (ncvarget1 (exoid, varid, start, ptr) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get entity name for id %d in file id %d",
+ ent_ndx, exoid);
+ ex_err(routine,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 name in file id %d", exoid);
+ ex_err(routine,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ --ptr;
+ if (ptr > name) {
+ while (*(--ptr) == ' '); /* get rid of trailing blanks */
+ }
+ *(++ptr) = '\0';
+ } else {
+ /* Name variable does not exist on the database; probably since this is an
+ * older version of the database. Return an empty array...
+ */
+ name[0] = '\0';
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgnams.c b/cbind/src/exgnams.c
new file mode 100644
index 0000000..53dde0f
--- /dev/null
+++ b/cbind/src/exgnams.c
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnam - ex_get_names
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type,
+*
+* exit conditions -
+* char* names[] ptr array of names
+*
+* revision history -
+*
+* $Id: exgnams.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the entity names from the database
+ */
+
+int ex_get_names (int exoid,
+ int 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";
+
+ exerrval = 0; /* clear error code */
+
+/* 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;
+
+ /* ======== 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;
+
+ /* ======== 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;
+
+ /* 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;
+
+ 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);
+ }
+
+
+ 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);
+}
diff --git a/cbind/src/exgnm.c b/cbind/src/exgnm.c
new file mode 100644
index 0000000..f8c3ac7
--- /dev/null
+++ b/cbind/src/exgnm.c
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnm - ex_get_node_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id node map id
+*
+* exit conditions -
+* int* node_map node map
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the node map with specified ID
+ */
+
+int ex_get_node_map( int exoid,
+ int map_id,
+ int *node_map )
+{
+ return ex_get_num_map( exoid, EX_NODE_MAP, map_id, node_map );
+}
diff --git a/cbind/src/exgnmap.c b/cbind/src/exgnmap.c
new file mode 100644
index 0000000..23f2092
--- /dev/null
+++ b/cbind/src/exgnmap.c
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnm - ex_get_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_type type of map (node, edge, face, element)
+* int map_id map id
+*
+* exit conditions -
+* int* map map
+*
+* revision history -
+* 20060930 - David Thompson - Adapted from ex_get_node_map
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the map with specified ID
+ */
+
+int ex_get_num_map ( int exoid,
+ int map_type,
+ int map_id,
+ int* map )
+{
+ int dimid, var_id, id_ndx, iresult;
+ long num_entries, start[1], count[1];
+ nclong *longs;
+ 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;
+ sprintf( errmsg, "Bad map type (%d) specified", map_type );
+ ex_err( "ex_get_num_map", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ exerrval = 0; /* clear error code */
+
+ /* See if any entries are stored in this file */
+ if ((dimid = ncdimid (exoid, dim_map_size)) == -1)
+ {
+ 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;
+ sprintf(errmsg,
+ "Warning: no %s maps defined in file id %d",
+ tname,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)
+ {
+
+ sprintf(errmsg,
+ "Error: failed to locate %s map id %d in %s in file id %d",
+ tname,map_id,prop_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;
+ sprintf(errmsg,
+ "Error: failed to locate %s map %d in file id %d",
+ tname,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);
+ }
+
+ if (iresult == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get %s map in file id %d",
+ tname,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
new file mode 100644
index 0000000..6ae5122
--- /dev/null
+++ b/cbind/src/exgnnm.c
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int* node_map node numbering map array
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the node numbering map from the database
+ */
+
+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);
+
+}
diff --git a/cbind/src/exgnp.c b/cbind/src/exgnp.c
new file mode 100644
index 0000000..308e2b4
--- /dev/null
+++ b/cbind/src/exgnp.c
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+*
+* exit conditions -
+* int* num_nodes_in_set number of nodes in set
+* int* num_df_in_set number of distribution factors in set
+*
+* 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
+ */
+
+int ex_get_node_set_param (int exoid,
+ int node_set_id,
+ int *num_nodes_in_set,
+ int *num_df_in_set)
+{
+ return ex_get_set_param(exoid, EX_NODE_SET, node_set_id,
+ num_nodes_in_set, num_df_in_set);
+}
diff --git a/cbind/src/exgns.c b/cbind/src/exgns.c
new file mode 100644
index 0000000..652b8c5
--- /dev/null
+++ b/cbind/src/exgns.c
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+*
+* exit conditions -
+* int* node_set_node_list node list array for the node set
+*
+* revision history -
+*
+* $Id: exgns.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the node list for a single node set
+ */
+
+int ex_get_node_set (int exoid,
+ int node_set_id,
+ int *node_set_node_list)
+{
+ return ex_get_set(exoid, EX_NODE_SET, node_set_id, node_set_node_list,
+ NULL);
+}
diff --git a/cbind/src/exgnsd.c b/cbind/src/exgnsd.c
new file mode 100644
index 0000000..1d4b85d
--- /dev/null
+++ b/cbind/src/exgnsd.c
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+*
+* exit conditions -
+* int* node_set_dist_fact node distribution factors for node set
+*
+* 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
+ */
+
+int ex_get_node_set_dist_fact (int exoid,
+ int node_set_id,
+ void *node_set_dist_fact)
+{
+ return ex_get_set_dist_fact(exoid, EX_NODE_SET, node_set_id,
+ node_set_dist_fact);
+}
diff --git a/cbind/src/exgnsi.c b/cbind/src/exgnsi.c
new file mode 100644
index 0000000..bdf6089
--- /dev/null
+++ b/cbind/src/exgnsi.c
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* int node_set_ids array of node set ids
+*
+* revision history -
+*
+* $Id: exgnsi.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the node set ids from the database
+ */
+
+int ex_get_node_set_ids (int exoid,
+ int *ids)
+{
+ return ex_get_ids( exoid, EX_NODE_SET, ids );
+}
diff --git a/cbind/src/exgnstt.c b/cbind/src/exgnstt.c
new file mode 100644
index 0000000..7c53bdf
--- /dev/null
+++ b/cbind/src/exgnstt.c
@@ -0,0 +1,66 @@
+/*
+ * 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_nset_var_tab
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_nodesets number of nodesets
+* int num_nset_var number of nodeset variables
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the EXODUS II nodeset variable truth table from the database
+ */
+
+int ex_get_nset_var_tab (int exoid,
+ int num_nodesets,
+ int num_nset_var,
+ int *nset_var_tab)
+{
+ return ex_get_var_tab(exoid, "M", num_nodesets, num_nset_var, nset_var_tab);
+}
diff --git a/cbind/src/exgnsv.c b/cbind/src/exgnsv.c
new file mode 100644
index 0000000..37e3dec
--- /dev/null
+++ b/cbind/src/exgnsv.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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+* int nset_var_index nodeset variable index
+* int nset_blk_id nodeset id
+* int num_node_this_nset number of nodes in this nodeset
+*
+*
+* exit conditions -
+* float* nset_var_vals array of nodeset variable values
+*
+*
+* 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
+ */
+
+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)
+{
+ 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);
+}
diff --git a/cbind/src/exgnsvid.c b/cbind/src/exgnsvid.c
new file mode 100644
index 0000000..1a2c847
--- /dev/null
+++ b/cbind/src/exgnsvid.c
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnsvid - ex_get_nset_varid
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* varid variable id array
+*
+* revision history -
+*
+* $Id: exgnsvid.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the EXODUS II variable varids from the database
+ */
+
+int ex_get_nset_varid (int exoid,
+ int *varid)
+{
+ return ex_get_varid(exoid, "m", varid);
+}
diff --git a/cbind/src/exgnv.c b/cbind/src/exgnv.c
new file mode 100644
index 0000000..ebd7efb
--- /dev/null
+++ b/cbind/src/exgnv.c
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step whole time step number
+* int nodeal_var_index index of desired nodal variable
+* int num_nodes number of nodal points
+*
+* exit conditions -
+* float* nodal_var_vals array of nodal variable values
+*
+* 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
+ */
+
+int ex_get_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ void *nodal_var_vals)
+{
+ int varid;
+ long start[3], count[3];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire previously defined variable */
+
+ if (ex_large_model(exoid) == 0) {
+ /* read values of the nodal variable */
+ if ((varid = 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_var",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+ start[0] = --time_step;
+ start[1] = --nodal_var_index;
+ start[2] = 0;
+
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = num_nodes;
+
+ } 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;
+ 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] = --time_step;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = num_nodes;
+
+ }
+ if (ncvarget (exoid, varid, start, count,
+ ex_conv_array(exoid,RTN_ADDRESS,nodal_var_vals,num_nodes)) == -1)
+ {
+ exerrval = ncerr;
+ 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/exgnvid.c b/cbind/src/exgnvid.c
new file mode 100644
index 0000000..f7cb35a
--- /dev/null
+++ b/cbind/src/exgnvid.c
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnvid - ex_get_nodal_varid
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * returns the varids for the nodal variables.
+ */
+
+int ex_get_nodal_varid(int exoid, int *varid)
+{
+ int i, dimid, nvarid;
+ long num_vars;
+ char errmsg[MAX_ERR_LENGTH];
+
+ 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);
+ }
+ }
+
+ 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;
+ 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;
+ }
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgnvt.c b/cbind/src/exgnvt.c
new file mode 100644
index 0000000..59be7ff
--- /dev/null
+++ b/cbind/src/exgnvt.c
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int nodal_var_index index of desired nodal variable
+* int node_number number of desired node
+* int beg_time_step starting time step
+* int end_time_step finishing time step
+*
+* exit conditions -
+* float* nodal_var_vals array of nodal variable values
+*
+* revision history -
+*
+* $Id: exgnvt.c,v 1.4 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the values of a nodal variable for a single node through a
+ * specified number of time steps in the database; assume the first time
+ * step, nodal variable index, and node are numbered 1
+ */
+
+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)
+{
+ int varid;
+ long start[3], count[3];
+ float fdum;
+ char *cdum;
+ char errmsg[MAX_ERR_LENGTH];
+
+ /* inquire previously defined variable */
+
+ 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);
+ }
+ }
+
+ end_time_step--;
+
+ if (ex_large_model(exoid) == 0) {
+ /* read values of the nodal variable;
+ * 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;
+ 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;
+
+ 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;
+ 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);
+ }
+
+ /* read values of the nodal variable;
+ * assume node number is 1-based (first node is numbered 1); adjust
+ * so it is 0-based
+ */
+
+ start[0] = --beg_time_step;
+ start[1] = --node_number;
+
+ 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] );
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgnvv.c b/cbind/src/exgnvv.c
new file mode 100644
index 0000000..381c308
--- /dev/null
+++ b/cbind/src/exgnvv.c
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step whole time step number
+* int nodal_var_index index of desired nodal variable
+* int num_nodes number of nodal points
+* int varid id of variable on exodus database
+*
+* exit conditions -
+* float* nodal_var_vals array of nodal variable values
+*
+* revision history -
+*
+* $Id: exgnvv.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
+ */
+
+int ex_get_nodal_varid_var(int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ int varid,
+ void *nodal_var_vals)
+{
+ long start[3], count[3];
+ char errmsg[MAX_ERR_LENGTH];
+ void *array;
+
+ exerrval = 0; /* clear error code */
+
+ /* inquire previously defined variable */
+
+ if (ex_large_model(exoid) == 0) {
+ start[0] = --time_step;
+ start[1] = --nodal_var_index;
+ start[2] = 0;
+
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = num_nodes;
+ } else {
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to get nodal variables in file id %d",
+ exoid);
+ ex_err("ex_get_nodal_varid_var",errmsg,exerrval);
+ 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
new file mode 100644
index 0000000..3e4c09c
--- /dev/null
+++ b/cbind/src/exgoatt.c
@@ -0,0 +1,236 @@
+/*
+ * 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_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)
+*
+* exit conditions -
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the attributes for an edge, face, or element block
+ */
+int ex_get_one_attr( int exoid,
+ int obj_type,
+ int obj_id,
+ int attrib_index,
+ void* attrib )
+
+{
+ int numobjentdim, numattrdim, attrid, obj_id_ndx;
+ long 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);
+ }
+ }
+
+ switch (obj_type) {
+ 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_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;
+ sprintf(errmsg,
+ "Warning: no attributes found for %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 */
+ }
+
+ 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);
+ }
+
+ if (attrib_index < 1 || attrib_index > 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);
+ ex_err("ex_get_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ((attrid = ncvarid (exoid, vattrbname)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate attributes for %s %d in file id %d",
+ tname,obj_id,exoid);
+ ex_err("ex_get_one_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* read in the attributes */
+ start[0] = 0;
+ start[1] = attrib_index-1;
+
+ count[0] = num_entries_this_obj;
+ count[1] = 1;
+
+ 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));
+ } 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));
+ }
+ if (error == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get attribute %d for %s %d in file id %d",
+ attrib_index, tname, 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
new file mode 100644
index 0000000..146a001
--- /dev/null
+++ b/cbind/src/exgoea.c
@@ -0,0 +1,67 @@
+/*
+ * 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_one_elem_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int elem_blk_id element block id
+*
+* exit conditions -
+* 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
+ */
+int ex_get_one_elem_attr (int exoid,
+ int elem_blk_id,
+ int attrib_index,
+ void *attrib)
+
+{
+ return ex_get_one_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib );
+}
diff --git a/cbind/src/exgotv.c b/cbind/src/exgotv.c
new file mode 100644
index 0000000..7272b83
--- /dev/null
+++ b/cbind/src/exgotv.c
@@ -0,0 +1,198 @@
+/*
+ * 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_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
+*
+* revision history -
+*
+* $Id: exgotv.c,v 1.3 2006/11/28 14:02:00 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the EXODUS II specified variable truth vector from the database
+ */
+
+int ex_get_object_truth_vector (int exoid,
+ const char *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 */
+
+ 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);
+ }
+
+ 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);
+
+}
diff --git a/cbind/src/exgp.c b/cbind/src/exgp.c
new file mode 100644
index 0000000..a050c86
--- /dev/null
+++ b/cbind/src/exgp.c
@@ -0,0 +1,231 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* set or side set)
+* int obj_id id of object for which value
+* is desired
+* char* prop_name name of the property for which
+* value is desired
+*
+* exit conditions -
+* int* value returned value of the property
+*
+* revision history -
+*
+* $Id: exgp.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads an object property
+ */
+
+int ex_get_prop (int exoid,
+ int obj_type,
+ int obj_id,
+ const char *prop_name,
+ int *value)
+{
+ int num_props, i, propid;
+ int found = FALSE;
+ long start[1];
+ nclong 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];
+
+ exerrval = 0; /* clear error code */
+
+/* open appropriate variable, depending on obj_type and prop_name */
+
+ 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++)
+ {
+ 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_get_prop",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((propid = ncvarid (exoid, name)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate property array %s in file id %d",
+ name, exoid);
+ ex_err("ex_get_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_get_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (strcmp(tmpstr, prop_name) == 0)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+
+/* if property is not found, return warning */
+
+ if (!found)
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Warning: %s property %s not defined in file id %d",
+ obj_stype, prop_name, exoid);
+ ex_err("ex_get_prop",errmsg,exerrval);
+ return (EX_WARN);
+ }
+
+/* find index into property array using obj_id; read value from property */
+/* 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)
+ {
+ sprintf(errmsg,
+ "Warning: %s id %d is NULL in file id %d",
+ obj_stype, obj_id, exoid);
+ ex_err("ex_get_prop",errmsg,EX_MSG);
+ return (EX_WARN);
+ }
+ else
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate id %d in %s property array in file id %d",
+ obj_id, obj_stype, 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;
+ sprintf(errmsg,
+ "Error: failed to read value in %s property array in file id %d",
+ obj_stype, exoid);
+ ex_err("ex_get_prop",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ *value = l_val;
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgpa.c b/cbind/src/exgpa.c
new file mode 100644
index 0000000..d3bf1c2
--- /dev/null
+++ b/cbind/src/exgpa.c
@@ -0,0 +1,251 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int obj_type type of object (element block, node
+* set or side set)
+* char* prop_name name of the property for which the
+* values will be read
+*
+* exit conditions -
+* int* values returned array of property values
+*
+* revision history -
+*
+* $Id: exgpa.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads an array of object properties
+ */
+
+int ex_get_prop_array (int exoid,
+ int obj_type,
+ const char *prop_name,
+ int *values)
+{
+ int num_props, i, propid, dimid, iresult;
+ 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];
+
+ exerrval = 0; /* clear error code */
+
+/* open appropriate variable, depending on obj_type and prop_name */
+
+ 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_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_get_prop_array",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((propid = ncvarid (exoid, name)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate property array %s in file id %d",
+ name, exoid);
+ ex_err("ex_get_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,
+ "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)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+
+/* 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",
+ obj_type, prop_name, exoid);
+ ex_err("ex_get_prop_array",errmsg,exerrval);
+ 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 */
+
+/* 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;
+ sprintf(errmsg,
+ "Error: failed to read values in %s property array in file id %d",
+ obj_stype, 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
new file mode 100644
index 0000000..e6fa05c
--- /dev/null
+++ b/cbind/src/exgpem.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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int map_id element map id
+* int ent_start first entry in map
+* int ent_count number of entries in map
+*
+* exit conditions -
+* int* elem_map element map
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * 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 dimid, var_id, id_ndx, iresult;
+ long num_elem, start[1], count[1];
+ nclong *longs;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ /* See if file contains any elements...*/
+ if ((dimid = ncdimid (exoid, DIM_NUM_ELEM)) == -1)
+ {
+ return (EX_NOERR);
+ }
+
+ 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_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) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: start count is invalid in file id %d",
+ exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ if (ent_count < 0) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: Invalid count value in file id %d",
+ exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ if (ent_start+ent_count-1 > num_elem) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: start+count-1 is larger than element count in file id %d",
+ exoid);
+ ex_err("ex_get_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+/* first check if any element maps have been defined */
+
+ if ((dimid = ncdimid (exoid, DIM_NUM_EM)) == -1)
+ {
+ exerrval = ncerr;
+ 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);
+ }
+
+/* inquire id's of previously defined dimensions and variables */
+
+ if ((var_id = ncvarid (exoid, VAR_ELEM_MAP(id_ndx))) == -1)
+ {
+ exerrval = ncerr;
+ 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 */
+
+ 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);
+ }
+
+ if (iresult == -1)
+ {
+ exerrval = ncerr;
+ 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);
+
+}
diff --git a/cbind/src/exgpn.c b/cbind/src/exgpn.c
new file mode 100644
index 0000000..94e6ea1
--- /dev/null
+++ b/cbind/src/exgpn.c
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int obj_type type of object; element block, node
+* set, or side set
+*
+* exit conditions -
+* char* prop_names[] ptr array of property names
+*
+* revision history -
+*
+* $Id: exgpn.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the names of the property arrays from the database
+ */
+
+int ex_get_prop_names (int exoid,
+ int 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 */
+
+ num_props = ex_get_num_props (exoid, obj_type);
+
+ 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);
+ }
+
+ 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);
+ }
+
+/* for each property, read the "name" attribute of property array variable */
+
+ 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);
+ }
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/exgqa.c b/cbind/src/exgqa.c
new file mode 100644
index 0000000..b91bceb
--- /dev/null
+++ b/cbind/src/exgqa.c
@@ -0,0 +1,167 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* exit conditions -
+* char* qa_record[8][4] ptr to qa record ptr array
+*
+* revision history -
+*
+* $Id: exgqa.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the QA records from the database
+ */
+
+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];
+
+ exerrval = 0; /* clear error code */
+
+/* inquire previously defined dimensions and variables */
+
+ if ((dimid = ncdimid (exoid, DIM_NUM_QA)) == -1)
+ {
+ exerrval = ncerr;
+ 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,
+ "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';
+ }
+ }
+ }
+
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/exgset.c b/cbind/src/exgset.c
new file mode 100644
index 0000000..df47f9c
--- /dev/null
+++ b/cbind/src/exgset.c
@@ -0,0 +1,304 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int set_type the type of set
+* int set_id set id
+*
+* exit conditions -
+* int* set_entry_list array of entries in set
+* int* set_extra_list array of extras in set
+*
+* revision history -
+*
+* $Id: exgset.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the set entry list and set extra list for a single set
+ */
+
+int ex_get_set (int exoid,
+ int set_type,
+ int set_id,
+ int *set_entry_list,
+ int *set_extra_list)
+{
+
+ 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
+ {
+
+ 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);
+ }
+ }
+
+ /* 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 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);
+ }
+
+ 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 (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);
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/exgsetd.c b/cbind/src/exgsetd.c
new file mode 100644
index 0000000..f1f2a04
--- /dev/null
+++ b/cbind/src/exgsetd.c
@@ -0,0 +1,248 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int set_type type of set
+* int set_id set id
+*
+* exit conditions -
+* float* set_dist_fact array of dist factors for set
+*
+* revision history -
+*
+* $Id: exgsetd.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the distribution factors for a single set
+ */
+
+int ex_get_set_dist_fact (int exoid,
+ int 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;
+
+ 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_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,
+ "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);
+ }
+ }
+
+ /* 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);
+
+}
diff --git a/cbind/src/exgsetp.c b/cbind/src/exgsetp.c
new file mode 100644
index 0000000..7fa7d5c
--- /dev/null
+++ b/cbind/src/exgsetp.c
@@ -0,0 +1,261 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int set_type the type of set
+* int set_id set id
+*
+* exit conditions -
+* int* num_entries_in_set number of entries in the set
+* int* num_dist_fact_in_set number of distribution factors in the
+* set
+*
+* revision history -
+*
+* $Id: exgsetp.c,v 1.2 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the number of entries and the number of distribution factors which
+ * describe a single set
+ */
+
+int ex_get_set_param (int exoid,
+ int 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);
+ }
+ }
+
+ /* 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);
+}
diff --git a/cbind/src/exgsnl.c b/cbind/src/exgsnl.c
new file mode 100644
index 0000000..e6de729
--- /dev/null
+++ b/cbind/src/exgsnl.c
@@ -0,0 +1,522 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int side_set_id side set id
+*
+* exit conditions -
+* int *side_set_node_list_len length of node list
+*
+* revision history -
+*
+* $Id: exgsnl.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#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.
+
+
+
+ */
+
+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 num_side_sets, num_elem_blks, num_df, ndim;
+ int tot_num_elem = 0, tot_num_ss_elem = 0;
+ int *elem_blk_ids;
+ int *ss_elem_ndx;
+ int *side_set_elem_list, *side_set_side_list;
+ 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_nodes_per_side;
+ int num_attr;
+ int elem_ctr;
+ int elem_type_val;
+ } *elem_blk_parms;
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
+
+ *side_set_node_list_len = 0; /* default value */
+/* 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)
+ {
+ sprintf(errmsg,
+ "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);
+ }
+
+ if (num_side_sets == 0)
+ {
+ 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);
+ }
+
+ 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_list_len",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
+ {
+ sprintf(errmsg,
+ "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);
+ }
+
+/* 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 dimensionality in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list_len",errmsg,exerrval);
+ 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_list_len",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (tot_num_ss_elem == 0) /* NULL side set? */
+ return (EX_NOERR); /* return zero */
+
+ /* 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_list_len",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_list_len",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_list_len",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_list_len",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_list_len",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_elem_blk_ids(exoid, elem_blk_ids))
+ {
+ 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_list_len",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_list_len",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ 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,
+ &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_list_len",errmsg,EX_MSG);
+ return(EX_FATAL);
+ }
+
+ elem_blk_parms[i].num_elem_in_blk = num_elem_in_blk;
+ elem_blk_parms[i].num_nodes_per_elem = num_nodes_per_elem;
+ elem_blk_parms[i].num_attr = num_attr;
+ 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';
+
+ if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = CIRCLE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = SPHERE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 5)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 3;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 6;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 4)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 9)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELL */
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 27)
+ elem_blk_parms[i].num_nodes_per_side = 9;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 8)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 6;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 2)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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].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_ctr += elem_blk_parms[i].num_elem_in_blk;
+ elem_blk_parms[i].elem_ctr = elem_ctr; /* save elem number max */
+ }
+
+/* Walk through element list and keep a running count of the node length */
+
+ *side_set_node_list_len = 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; /* stop because we found the parameters for this element */
+ }
+ if (j >= num_elem_blks)
+ {
+ 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_list_len",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+
+ /* 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 &&
+ (side_set_side_list[i] == 4 || side_set_side_list[i] == 5))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 6)
+ *side_set_node_list_len += 3; /* 3 node side */
+ else
+ *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 &&
+ (side_set_side_list[i] < 5))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 5)
+ *side_set_node_list_len += 3; /* 3 node side */
+ else
+ *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 &&
+ (side_set_side_list[i] > 2 ))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 4)
+ *side_set_node_list_len += 2; /* 2 node side */
+ else
+ *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 &&
+ ndim == 3 &&
+ side_set_side_list[i] > 2 )
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 3) /* 3-node TRI */
+ *side_set_node_list_len += 2; /* 2 node side */
+ else /* 6-node TRI */
+ *side_set_node_list_len += 3; /* 3 node side */
+ }
+ else if (elem_blk_parms[j].elem_type_val == UNK)
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: %s in elem block %d is an unsupported element type",
+ elem_blk_parms[i].elem_type, elem_blk_parms[i].elem_blk_id);
+ 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_list_len",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+ else /* all other element types */
+ *side_set_node_list_len += elem_blk_parms[j].num_nodes_per_side;
+ }
+
+ /* All done: release 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);
+
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgsp.c b/cbind/src/exgsp.c
new file mode 100644
index 0000000..116d6f3
--- /dev/null
+++ b/cbind/src/exgsp.c
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the number of sides and the number of distribution factors which
+ * describe a single side set
+ */
+
+int ex_get_side_set_param (int exoid,
+ int side_set_id,
+ int *num_side_in_set,
+ int *num_dist_fact_in_set)
+{
+ return ex_get_set_param(exoid, EX_SIDE_SET, side_set_id,
+ num_side_in_set, num_dist_fact_in_set);
+}
diff --git a/cbind/src/exgss.c b/cbind/src/exgss.c
new file mode 100644
index 0000000..f1c04d9
--- /dev/null
+++ b/cbind/src/exgss.c
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int side_set_id side set id
+*
+* exit conditions -
+* int* side_set_elem_list array of elements in side set
+* int* side_set_side_list array of sides in side set
+*
+* revision history -
+*
+* $Id: exgss.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 element list and side set side list for a single side set
+ */
+
+int ex_get_side_set (int exoid,
+ int side_set_id,
+ int *side_set_elem_list,
+ int *side_set_side_list)
+{
+ return ex_get_set(exoid, EX_SIDE_SET, side_set_id,
+ side_set_elem_list, side_set_side_list);
+}
diff --git a/cbind/src/exgssc.c b/cbind/src/exgssc.c
new file mode 100644
index 0000000..a6cde36
--- /dev/null
+++ b/cbind/src/exgssc.c
@@ -0,0 +1,620 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* 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
+* revision history -
+*
+* $Id: exgssc.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*****************************************************************************/
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/* 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.",\
+ elem_blk_parms[i].elem_type,\
+ elem_blk_parms[i].num_nodes_per_elem);\
+ 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 ii, i, j, m;
+ 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_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;
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
+
+ /* 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)
+ {
+ 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);
+ return(EX_FATAL);
+ }
+
+ if (num_side_sets == 0)
+ {
+ sprintf(errmsg,
+ "Warning: no side sets defined in file id %d",exoid);
+ ex_err("ex_get_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);
+ return(EX_FATAL);
+ }
+
+ if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
+ {
+ 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);
+ 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)
+ {
+ sprintf(errmsg,
+ "Error: failed to get dimensionality in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ 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);
+ }
+
+ if (ex_get_elem_blk_ids(exoid, 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);
+ 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);
+ }
+
+ 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,
+ &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);
+ return(EX_FATAL);
+ }
+
+ elem_blk_parms[i].num_elem_in_blk = num_elem_in_blk;
+ elem_blk_parms[i].num_nodes_per_elem = num_nodes_per_elem;
+ 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';
+
+ if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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].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].num_sides = 4;
+ if (elem_blk_parms[i].num_nodes_per_elem == 4) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ elem_blk_parms[i].num_nodes_per_side[2] = 2;
+ elem_blk_parms[i].num_nodes_per_side[3] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 5) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ elem_blk_parms[i].num_nodes_per_side[2] = 2;
+ elem_blk_parms[i].num_nodes_per_side[3] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 9 ||
+ elem_blk_parms[i].num_nodes_per_elem == 8) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = TRIANGLE;
+ if (ndim == 2) { /* 2d TRIs */
+ elem_blk_parms[i].num_sides = 3;
+ if (elem_blk_parms[i].num_nodes_per_elem == 3) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ elem_blk_parms[i].num_nodes_per_side[2] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 6) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ }
+ } else if (ndim == 3) { /* 3d TRIs -- triangular shell*/
+ elem_blk_parms[i].num_sides = 5; /* 2 Faces and 3 Edges */
+ if (elem_blk_parms[i].num_nodes_per_elem == 3) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ elem_blk_parms[i].num_nodes_per_side[2] = 2;
+ elem_blk_parms[i].num_nodes_per_side[3] = 2;
+ elem_blk_parms[i].num_nodes_per_side[4] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 6) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
+ elem_blk_parms[i].num_nodes_per_side[1] = 6;
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ elem_blk_parms[i].num_nodes_per_side[4] = 3;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = SHELL;
+
+ if (elem_blk_parms[i].num_nodes_per_elem == 2) {/* KLUDGE for 2D Shells*/
+ elem_blk_parms[i].num_sides = 2;
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 4) {
+ elem_blk_parms[i].num_sides = 6; /* 2 Faces, 4 Edges */
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
+ elem_blk_parms[i].num_nodes_per_side[1] = 4;
+ elem_blk_parms[i].num_nodes_per_side[2] = 2;
+ elem_blk_parms[i].num_nodes_per_side[3] = 2;
+ elem_blk_parms[i].num_nodes_per_side[4] = 2;
+ elem_blk_parms[i].num_nodes_per_side[5] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 8 ||
+ elem_blk_parms[i].num_nodes_per_elem == 9) {
+ elem_blk_parms[i].num_sides = 6; /* 2 Faces, 4 Edges */
+ elem_blk_parms[i].num_nodes_per_side[0] =
+ elem_blk_parms[i].num_nodes_per_elem; /* 8 or 9 */
+ elem_blk_parms[i].num_nodes_per_side[1] =
+ elem_blk_parms[i].num_nodes_per_elem; /* 8 or 9 */
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ elem_blk_parms[i].num_nodes_per_side[4] = 3;
+ elem_blk_parms[i].num_nodes_per_side[5] = 3;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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 */
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
+ elem_blk_parms[i].num_nodes_per_side[1] = 4;
+ elem_blk_parms[i].num_nodes_per_side[2] = 4;
+ elem_blk_parms[i].num_nodes_per_side[3] = 4;
+ elem_blk_parms[i].num_nodes_per_side[4] = 4;
+ elem_blk_parms[i].num_nodes_per_side[5] = 4;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 9) { /* 9-node bricks */
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
+ elem_blk_parms[i].num_nodes_per_side[1] = 4;
+ elem_blk_parms[i].num_nodes_per_side[2] = 4;
+ elem_blk_parms[i].num_nodes_per_side[3] = 4;
+ elem_blk_parms[i].num_nodes_per_side[4] = 4;
+ elem_blk_parms[i].num_nodes_per_side[5] = 4;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 12) { /* HEXSHELLS */
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
+ elem_blk_parms[i].num_nodes_per_side[1] = 6;
+ elem_blk_parms[i].num_nodes_per_side[2] = 6;
+ elem_blk_parms[i].num_nodes_per_side[3] = 6;
+ elem_blk_parms[i].num_nodes_per_side[4] = 4;
+ elem_blk_parms[i].num_nodes_per_side[5] = 4;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 20) { /* 20-node bricks */
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
+ elem_blk_parms[i].num_nodes_per_side[1] = 8;
+ elem_blk_parms[i].num_nodes_per_side[2] = 8;
+ elem_blk_parms[i].num_nodes_per_side[3] = 8;
+ elem_blk_parms[i].num_nodes_per_side[4] = 8;
+ elem_blk_parms[i].num_nodes_per_side[5] = 8;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 27) { /* 27-node bricks */
+ elem_blk_parms[i].num_nodes_per_side[0] = 9;
+ elem_blk_parms[i].num_nodes_per_side[1] = 9;
+ elem_blk_parms[i].num_nodes_per_side[2] = 9;
+ elem_blk_parms[i].num_nodes_per_side[3] = 9;
+ elem_blk_parms[i].num_nodes_per_side[4] = 9;
+ elem_blk_parms[i].num_nodes_per_side[5] = 9;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = TETRA;
+ elem_blk_parms[i].num_sides = 4;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 4) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 8) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 4;
+ elem_blk_parms[i].num_nodes_per_side[1] = 4;
+ elem_blk_parms[i].num_nodes_per_side[2] = 4;
+ elem_blk_parms[i].num_nodes_per_side[3] = 4;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 10) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
+ elem_blk_parms[i].num_nodes_per_side[1] = 6;
+ elem_blk_parms[i].num_nodes_per_side[2] = 6;
+ elem_blk_parms[i].num_nodes_per_side[3] = 6;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ elem_blk_parms[i].num_nodes_per_side[1] = 4;
+ elem_blk_parms[i].num_nodes_per_side[2] = 4;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ elem_blk_parms[i].num_nodes_per_side[4] = 3;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 15){
+ elem_blk_parms[i].num_nodes_per_side[0] = 8;
+ elem_blk_parms[i].num_nodes_per_side[1] = 8;
+ elem_blk_parms[i].num_nodes_per_side[2] = 8;
+ elem_blk_parms[i].num_nodes_per_side[3] = 6;
+ elem_blk_parms[i].num_nodes_per_side[4] = 6;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ elem_blk_parms[i].num_nodes_per_side[2] = 3;
+ elem_blk_parms[i].num_nodes_per_side[3] = 3;
+ elem_blk_parms[i].num_nodes_per_side[4] = 4;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 13){
+ elem_blk_parms[i].num_nodes_per_side[0] = 6;
+ elem_blk_parms[i].num_nodes_per_side[1] = 6;
+ elem_blk_parms[i].num_nodes_per_side[2] = 6;
+ elem_blk_parms[i].num_nodes_per_side[3] = 6;
+ elem_blk_parms[i].num_nodes_per_side[4] = 8;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = BEAM;
+ elem_blk_parms[i].num_sides = 2;
+
+ if (elem_blk_parms[i].num_nodes_per_elem == 2) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 3){
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ 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].num_sides = 2;
+
+ if (elem_blk_parms[i].num_nodes_per_elem == 2) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 2;
+ elem_blk_parms[i].num_nodes_per_side[1] = 2;
+ } else if (elem_blk_parms[i].num_nodes_per_elem == 3) {
+ elem_blk_parms[i].num_nodes_per_side[0] = 3;
+ elem_blk_parms[i].num_nodes_per_side[1] = 3;
+ } else {
+ EL_NODE_COUNT_ERROR;
+ }
+ }
+ /* 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].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].num_sides = 0;
+ 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;
+ elem_blk_parms[i].elem_ctr = elem_ctr; /* save elem number max */
+ }
+
+
+ /* Finally... Create the list of node counts for each face in the
+ * side set.
+ */
+
+ 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] = 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);
+ }
+ }
+
+ /* 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);
+
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgssd.c b/cbind/src/exgssd.c
new file mode 100644
index 0000000..e8a930a
--- /dev/null
+++ b/cbind/src/exgssd.c
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int side_set_id side set id
+*
+* exit conditions -
+* float* side_set_dist_fact array of dist factors for side set
+*
+* revision history -
+*
+* $Id: exgssd.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the distribution factors for a single side set
+ */
+
+int ex_get_side_set_dist_fact (int exoid,
+ int side_set_id,
+ void *side_set_dist_fact)
+{
+ return ex_get_set_dist_fact(exoid, EX_SIDE_SET, side_set_id,
+ side_set_dist_fact);
+}
diff --git a/cbind/src/exgssi.c b/cbind/src/exgssi.c
new file mode 100644
index 0000000..f5d9171
--- /dev/null
+++ b/cbind/src/exgssi.c
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* size_set_ids array of side set IDs
+*
+* 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
+ */
+
+int ex_get_side_set_ids (int exoid,
+ int *ids)
+{
+ return ex_get_ids( exoid, EX_SIDE_SET, ids );
+}
diff --git a/cbind/src/exgssn.c b/cbind/src/exgssn.c
new file mode 100644
index 0000000..851be36
--- /dev/null
+++ b/cbind/src/exgssn.c
@@ -0,0 +1,1135 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* 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
+* int *side_set_node_list array of nodes
+*
+* revision history -
+*
+* $Id: exgssn.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#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 a ExodusI style side set node definition.
+ */
+
+int ex_get_side_set_node_list(int exoid,
+ int side_set_id,
+ int *side_set_node_cnt_list,
+ int *side_set_node_list)
+{
+ int i, j, m;
+ 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_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;
+
+/* side to node translation tables -
+ These tables are used to look up the side number based on the
+ first and second node in the side/face list. The side node order
+ is found in the original Exodus document, SAND87-2997. The element
+ node order is found in the ExodusII document, SAND92-2137. These
+ tables were generated by following the right-hand rule for determining
+ the outward normal.
+*/
+ /* triangle */
+ static int tri_table[3][3] = {
+ /* 1 2 3 side */
+ {1,2,4}, {2,3,5}, {3,1,6} /* nodes */
+ };
+
+ /* triangle 3d */
+ static int tri3_table[5][7] = {
+ /* 1 2 side */
+ {1,2,3,4,5,6,7}, {3,2,1,6,5,4,7}, /* nodes */
+ /* 3 4 5 side */
+ {1,2,4,0,0,0,0}, {2,3,5,0,0,0,0}, {3,1,6,0,0,0,0} /* nodes */
+ };
+
+ /* quad */
+ static int quad_table[4][3] = {
+ /* 1 2 3 4 side */
+ {1,2,5}, {2,3,6}, {3,4,7}, {4,1,8} /* nodes */
+ };
+
+ /* shell */
+ static int shell_table[6][8] = {
+ /* 1 2 side */
+ {1,2,3,4,5,6,7,8}, {1,4,3,2,8,7,6,5} , /* nodes */
+ /* 3 4 side */
+ {1,2,5,0,0,0,0,0}, {2,3,6,0,0,0,0,0} , /* nodes */
+ /* 5 6 side */
+ {3,4,7,0,0,0,0,0}, {4,1,8,0,0,0,0,0} /* nodes */
+ };
+
+ /* tetra */
+ static int tetra_table[4][6] = {
+ /* 1 2 3 4 side */
+ {1,2,4,5,9,8}, {2,3,4,6,10,9}, {1,4,3,8,10,7}, {1,3,2,7,6,5} /* nodes */
+ };
+
+ /* wedge */
+ static int wedge_table[5][8] = {
+ /* 1 2 3 side */
+ {1,2,5,4,7,11,13,10}, {2,3,6,5,8,12,14,11}, {1,4,6,3,10,15,12,9},
+ /* 4 5 side */
+ {1,3,2,0,9,8,7,0}, {4,5,6,0,13,14,15,0} /* nodes */
+ };
+
+ /* hex */
+ static int hex_table[6][9] = {
+ /* 1 2 side */
+ {1,2,6,5,9,14,17,13,26}, {2,3,7,6,10,15,18,14,25}, /* nodes */
+ /* 3 4 side */
+ {3,4,8,7,11,16,19,15,27}, {1,5,8,4,13,20,16,12,24}, /* nodes */
+ /* 5 6 side */
+ {1,4,3,2,12,11,10,9,22}, {5,6,7,8,17,18,19,20,23} /* nodes */
+ };
+
+ /* pyramid */
+ static int pyramid_table[5][8] = {
+ /* 1 2 3 side */
+ {1,2,5,0,6,11,10,0}, {2,3,5,0,7,12,11,0}, {3,4,5,0,8,13,12,0}, /* nodes */
+ /* 4 5 side */
+ {1,5,4,0,10,13,9,0}, {1,4,3,2,9,8,7,6} /* nodes */
+ };
+
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
+
+/* 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)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of side sets in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (num_side_sets == 0)
+ {
+ sprintf(errmsg,
+ "Warning: no side sets defined in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list",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_list",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_list",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_list",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ((ex_inquire(exoid, EX_INQ_ELEM, &tot_num_elem, &fdum, cdum)) == -1)
+ {
+ sprintf(errmsg,
+ "Error: failed to get total number of elements in file id %d",exoid);
+ ex_err("ex_get_side_set_node_list",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)
+ {
+ sprintf(errmsg,
+ "Error: failed to get dimensionality in file id %d",exoid);
+ ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval);
+ 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_list",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_list",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_list",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_list",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_list",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_list",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if (ex_get_elem_blk_ids(exoid, 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_list",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_list",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ 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,
+ &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_list",errmsg,EX_MSG);
+ return(EX_FATAL);
+ }
+
+ elem_blk_parms[i].num_elem_in_blk = num_elem_in_blk;
+ elem_blk_parms[i].num_nodes_per_elem = num_nodes_per_elem;
+ 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';
+
+ if (strncmp(elem_blk_parms[i].elem_type,"CIRCLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = CIRCLE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SPHERE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = SPHERE;
+ /* set side set node stride */
+ elem_blk_parms[i].num_nodes_per_side = 1;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"QUAD",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 5)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 3;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TRIANGLE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 6;
+ }
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"SHELL",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 4)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"HEX",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 9) /* 9-node bricks */
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 12) /* HEXSHELLS */
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 27) /* 27-node bricks */
+ elem_blk_parms[i].num_nodes_per_side = 9;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"TETRA",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else if (elem_blk_parms[i].num_nodes_per_elem == 8)
+ elem_blk_parms[i].num_nodes_per_side = 4;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 6;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"WEDGE",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"PYRAMID",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 8;
+ }
+ else if (strncmp(elem_blk_parms[i].elem_type,"BEAM",3) == 0)
+ {
+ elem_blk_parms[i].elem_type_val = 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;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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;
+ /* determine side set node stride */
+ if (elem_blk_parms[i].num_nodes_per_elem == 2)
+ elem_blk_parms[i].num_nodes_per_side = 2;
+ else
+ elem_blk_parms[i].num_nodes_per_side = 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].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_blk_id = elem_blk_ids[i]; /* save id */
+ elem_ctr += elem_blk_parms[i].num_elem_in_blk;
+ elem_blk_parms[i].elem_ctr = elem_ctr; /* save elem number max */
+ }
+
+
+ /* Allocate space for the ss element to element block parameter index array */
+ if (!(ss_parm_ndx=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ free(elem_blk_parms);
+ 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 side set elem parms index for file id %d"
+,
+ exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* Allocate space for the ss element to node list index array */
+ if (!(ss_elem_node_ndx=malloc(tot_num_ss_elem*sizeof(int))))
+ {
+ free(ss_parm_ndx);
+ free(elem_blk_parms);
+ 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 side set elem to node index for file id %d",
+ exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+
+ return (EX_FATAL);
+ }
+
+/* Build side set element to node list index and side set element
+ 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;
+ }
+
+ if (j >= num_elem_blks)
+ {
+ 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(ss_parm_ndx);
+ free(ss_elem_node_ndx);
+ 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_list",errmsg,EX_MSG);
+ return (EX_FATAL);
+ }
+
+ ss_parm_ndx[i] = j; /* assign parameter block index */
+ ss_elem_node_ndx[i] = node_ctr; /* assign node list index */
+
+ /* 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 &&
+ (side_set_side_list[i] == 4 || side_set_side_list[i] == 5))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 6)
+ node_ctr += 3; /* 3 node side */
+ else
+ 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 &&
+ (side_set_side_list[i] < 5))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 5)
+ node_ctr += 3; /* 3 node side */
+ else
+ 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 &&
+ (side_set_side_list[i] > 2 ))
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 4)
+ node_ctr += 2; /* 2 node side */
+ else
+ 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 &&
+ ndim == 3 &&
+ side_set_side_list[i] > 2 )
+ {
+ if (elem_blk_parms[j].num_nodes_per_elem == 3) /* 3-node TRI */
+ node_ctr += 2; /* 2 node side */
+ else /* 6-node TRI */
+ node_ctr += 3; /* 3 node side */
+ }
+ else /* all other element types */
+ node_ctr += elem_blk_parms[j].num_nodes_per_side;
+ }
+
+ /* All setup, ready to go ... */
+
+ elem_ctr=0;
+
+ for (j=0; j < tot_num_ss_elem; j++)
+ {
+
+ if (side_set_elem_list[ss_elem_ndx[j]] > elem_ctr)
+ {
+ /* release connectivity array space and get next one */
+ if (elem_ctr > 0)
+ {
+ free(connect);
+ }
+
+ /* Allocate space for the connectivity array for new element block */
+ if (!(connect=malloc(elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_elem_in_blk*
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_nodes_per_elem*
+ (int)sizeof(int))))
+ {
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for connectivity array for file id %d",
+ exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* get connectivity array */
+ 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);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ sprintf(errmsg,
+ "Error: failed to allocate space for connectivity array for file id %d",
+ exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ 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. */
+
+ 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*/
+
+ elem_num_pos = elem_num -
+ (elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_ctr -
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].num_elem_in_blk);
+
+ /* calculate the beginning of the node list for this element by
+ 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;
+ 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:
+ { /* 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:
+ { /* 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];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 2; /* 2 node object */
+ if (num_nodes_per_elem > 2)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ side_set_node_list[node_pos+2] = connect[connect_offset+2];
+ }
+ break;
+ }
+ case TRIANGLE:
+ {
+ if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid triangle edge number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ if (ndim == 2) /* 2d TRIs */
+ {
+ side_set_node_list[node_pos] =
+ connect[connect_offset+tri_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+tri_table[side_num][1]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 2; /* 2 node object */
+ if (num_nodes_per_elem > 3) /* 6-node TRI */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+tri_table[side_num][2]-1];
+ }
+ }
+ else if (ndim == 3) /* 3d TRIs */
+ {
+ side_set_node_list[node_pos] =
+ connect[connect_offset+tri3_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+tri3_table[side_num][1]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 2; /* 2 node object */
+ if (side_num+1 <= 2) /* 3- or 6-node face */
+ {
+ if (num_nodes_per_elem == 3) /* 3-node face */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+tri3_table[side_num][2]-1];
+ }
+ else /* 6-node face */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 6; /* 6 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+tri3_table[side_num][2]-1];
+ side_set_node_list[node_pos+3] =
+ connect[connect_offset+tri3_table[side_num][3]-1];
+ side_set_node_list[node_pos+4] =
+ connect[connect_offset+tri3_table[side_num][4]-1];
+ side_set_node_list[node_pos+5] =
+ connect[connect_offset+tri3_table[side_num][5]-1];
+ }
+ }
+ else /* 2- or 3-node edge */
+ {
+ if (num_nodes_per_elem > 3) /* 3-node edge */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+tri3_table[side_num][2]-1];
+ }
+ }
+ }
+ break;
+ }
+ case QUAD:
+ {
+ if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid quad edge number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos] =
+ connect[connect_offset+quad_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+quad_table[side_num][1]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 2; /* 2 node object */
+ if (num_nodes_per_elem > 5)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+quad_table[side_num][2]-1];
+ }
+ break;
+ }
+ case SHELL:
+ {
+ if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid shell face number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos] =
+ connect[connect_offset+shell_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+shell_table[side_num][1]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 2; /* 2 node object */
+ if (num_nodes_per_elem > 2) /*** KLUDGE for 2D shells ***/
+ {
+ if (side_num+1 <= 2) /* 4-node face */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 4; /* 4 node object */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+shell_table[side_num][2]-1];
+ side_set_node_list[node_pos+3] =
+ connect[connect_offset+shell_table[side_num][3]-1];
+ }
+ }
+ if (num_nodes_per_elem == 8)
+ {
+ if (side_num+1 <= 2) /* 8-node face */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node object */
+ side_set_node_list[node_pos+4] =
+ connect[connect_offset+shell_table[side_num][4]-1];
+ side_set_node_list[node_pos+5] =
+ connect[connect_offset+shell_table[side_num][5]-1];
+ side_set_node_list[node_pos+6] =
+ connect[connect_offset+shell_table[side_num][6]-1];
+ side_set_node_list[node_pos+7] =
+ connect[connect_offset+shell_table[side_num][7]-1];
+ }
+ else
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node edge */
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+shell_table[side_num][2]-1];
+ }
+ }
+ break;
+ }
+ case TETRA:
+ {
+ if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid tetra face number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos] =
+ connect[connect_offset+tetra_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+tetra_table[side_num][1]-1];
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+tetra_table[side_num][2]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node object */
+ if (num_nodes_per_elem == 8)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 4; /* 4 node object */
+ side_set_node_list[node_pos+3] =
+ connect[connect_offset+tetra_table[side_num][3]-1];
+ }
+ else if (num_nodes_per_elem > 8)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 6; /* 6 node object */
+ side_set_node_list[node_pos+3] =
+ connect[connect_offset+tetra_table[side_num][3]-1];
+ side_set_node_list[node_pos+4] =
+ connect[connect_offset+tetra_table[side_num][4]-1];
+ side_set_node_list[node_pos+5] =
+ connect[connect_offset+tetra_table[side_num][5]-1];
+ }
+ break;
+ }
+ case WEDGE:
+ {
+ if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid wedge face number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][0]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][1]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][2]-1];
+
+ if (wedge_table[side_num][3] == 0) { /* degenerate side? */
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node side */
+ }
+ else
+ {
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][3]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 4; /* 4 node side */
+ }
+
+
+ if (num_nodes_per_elem > 6)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node object */
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][4]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][5]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][6]-1];
+
+ if (wedge_table[side_num][7] == 0) /* degenerate side? */
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 6; /* 6 node side */
+ else
+ {
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+wedge_table[side_num][7]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node side */
+ }
+ }
+ break;
+ }
+ case PYRAMID:
+ {
+ if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid pyramid face number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][0]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][1]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][2]-1];
+
+ if (pyramid_table[side_num][3] == 0) { /* degenerate side? */
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 3; /* 3 node side */
+ }
+ else
+ {
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][3]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 4; /* 4 node side */
+ }
+
+
+ if (num_nodes_per_elem > 5)
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node object */
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][4]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][5]-1];
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][6]-1];
+
+ if (pyramid_table[side_num][7] == 0) /* degenerate side? */
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 6; /* 6 node side */
+ else
+ {
+ side_set_node_list[node_pos++] =
+ connect[connect_offset+pyramid_table[side_num][7]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node side */
+ }
+ }
+ break;
+ }
+ case HEX:
+ {
+ if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: Invalid hex face number %d in file id %d",
+ side_num+1, exoid);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ free(connect);
+ free(elem_blk_parms);
+ free(elem_blk_ids);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(ss_parm_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+ return(EX_FATAL);
+ }
+
+ side_set_node_list[node_pos] =
+ connect[connect_offset+hex_table[side_num][0]-1];
+ side_set_node_list[node_pos+1] =
+ connect[connect_offset+hex_table[side_num][1]-1];
+ side_set_node_list[node_pos+2] =
+ connect[connect_offset+hex_table[side_num][2]-1];
+ side_set_node_list[node_pos+3] =
+ connect[connect_offset+hex_table[side_num][3]-1];
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 4; /* 4 node object */
+ if (num_nodes_per_elem > 12) /* more nodes than HEXSHELL */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 8; /* 8 node object */
+ side_set_node_list[node_pos+4] =
+ connect[connect_offset+hex_table[side_num][4]-1];
+ side_set_node_list[node_pos+5] =
+ connect[connect_offset+hex_table[side_num][5]-1];
+ side_set_node_list[node_pos+6] =
+ connect[connect_offset+hex_table[side_num][6]-1];
+ side_set_node_list[node_pos+7] =
+ connect[connect_offset+hex_table[side_num][7]-1];
+ }
+ if (num_nodes_per_elem == 27) /* 27-node brick */
+ {
+ side_set_node_cnt_list[ss_elem_ndx[j]] = 9; /* 9 node object */
+ side_set_node_list[node_pos+8] =
+ connect[connect_offset+hex_table[side_num][8]-1];
+ }
+ break;
+ }
+ default:
+ {
+ exerrval = EX_BADPARAM;
+ sprintf(errmsg,
+ "Error: %s is an unsupported element type",
+ elem_blk_parms[ss_parm_ndx[ss_elem_ndx[j]]].elem_type);
+ ex_err("ex_get_side_set_node_list",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ }
+ }
+
+
+ /* All done: release connectivity array space, element block ids array,
+ element block parameters array, and side set element index array */
+ free(connect);
+ free(ss_parm_ndx);
+ free(elem_blk_ids);
+ free(elem_blk_parms);
+ free(ss_elem_ndx);
+ free(ss_elem_node_ndx);
+ free(side_set_side_list);
+ free(side_set_elem_list);
+
+ return(EX_NOERR);
+}
diff --git a/cbind/src/exgsstt.c b/cbind/src/exgsstt.c
new file mode 100644
index 0000000..eb93c75
--- /dev/null
+++ b/cbind/src/exgsstt.c
@@ -0,0 +1,66 @@
+/*
+ * 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_sset_var_tab
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_sidesets number of sidesets
+* int num_sset_var number of sideset variables
+*
+* 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
+ */
+
+int ex_get_sset_var_tab (int exoid,
+ int num_sidesets,
+ int num_sset_var,
+ int *sset_var_tab)
+{
+ return ex_get_var_tab(exoid, "S", num_sidesets, num_sset_var, sset_var_tab);
+}
diff --git a/cbind/src/exgssv.c b/cbind/src/exgssv.c
new file mode 100644
index 0000000..f5f143e
--- /dev/null
+++ b/cbind/src/exgssv.c
@@ -0,0 +1,138 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgssv - ex_get_sset_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* int sset_var_index sideset variable index
+* int sset_blk_id sideset id
+* int num_side_this_sset number of sides in this sideset
+*
+*
+* exit conditions -
+* float* sset_var_vals array of sideset variable values
+*
+*
+* revision history -
+*
+* $Id: exgssv.c,v 1.3 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+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)
+{
+ 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);
+}
diff --git a/cbind/src/exgssvid.c b/cbind/src/exgssvid.c
new file mode 100644
index 0000000..20ffa3c
--- /dev/null
+++ b/cbind/src/exgssvid.c
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgnsvid - ex_get_sset_varid
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* varid variable id array
+*
+* revision history -
+*
+* $Id: exgssvid.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 variable varids from the database
+ */
+
+int ex_get_sset_varid (int exoid,
+ int *varid)
+{
+ return ex_get_varid(exoid, "s", varid);
+}
diff --git a/cbind/src/exgtim.c b/cbind/src/exgtim.c
new file mode 100644
index 0000000..8145b25
--- /dev/null
+++ b/cbind/src/exgtim.c
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+*
+* exit conditions -
+* float time_value simulation time at specified step
+*
+* revision history -
+*
+* $Id: exgtim.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the time value for a specified time step;
+ * assume the first time step is 1
+ */
+
+int ex_get_time (int exoid,
+ int time_step,
+ 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);
+
+/* inquire previously defined variable */
+
+ if ((varid = ncvarid (exoid, var_name)) < 0)
+ {
+ exerrval = ncerr;
+ 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 */
+
+ start[0] = --time_step;
+
+ if (ncvarget1 (exoid, varid, start,
+ ex_conv_array(exoid,RTN_ADDRESS,time_value,1)) == -1)
+ {
+ exerrval = ncerr;
+ 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
new file mode 100644
index 0000000..4665361
--- /dev/null
+++ b/cbind/src/exgtt.c
@@ -0,0 +1,250 @@
+/*
+ * 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_var_tab
+*
+* 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 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 $
+*
+*****************************************************************************/
+
+#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_var_tab (int exoid,
+ const char *var_type,
+ int num_blk,
+ 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);
+
+}
diff --git a/cbind/src/exgvan.c b/cbind/src/exgvan.c
new file mode 100644
index 0000000..1ac0677
--- /dev/null
+++ b/cbind/src/exgvan.c
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* char* var_type variable type: G,N, or E
+* int num_vars # of variables to read
+*
+* exit conditions -
+* char* var_names ptr array of variable names
+*
+* revision history -
+*
+* $Id: exgvan.c,v 1.4 2006/11/28 14:02:01 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#include <ctype.h>
+
+/*!
+ * 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 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);
+}
diff --git a/cbind/src/exgvar.c b/cbind/src/exgvar.c
new file mode 100644
index 0000000..71913fa
--- /dev/null
+++ b/cbind/src/exgvar.c
@@ -0,0 +1,200 @@
+/*
+ * 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_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
+* node, edge/face/element block, or
+* node/edge/face/side/element set
+* int var_index variable index
+* int obj_id object id
+* int num_entry_this_obj number of entries in this object
+*
+*
+* exit conditions -
+* float* var_vals array of element variable values
+*
+*
+* 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 $
+*
+*****************************************************************************/
+
+#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
+ */
+
+int ex_get_var( int exoid,
+ int time_step,
+ int 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);
+ }
+
+ 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)
+ {
+ 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);
+ return (EX_WARN);
+ }
+ 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);
+ 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);
+ }
+
+/* read values of element variable */
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = num_entry_this_obj;
+
+ 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);
+ }
+
+
+ ex_conv_array( exoid, READ_CONVERT, var_vals, num_entry_this_obj );
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exgvart.c b/cbind/src/exgvart.c
new file mode 100644
index 0000000..f534f8f
--- /dev/null
+++ b/cbind/src/exgvart.c
@@ -0,0 +1,387 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int var_type variable type global, nodal,
+* edge/face/elem block,
+* node/edge/face/side/elem set
+* int var_index element variable index
+* int id entry number
+* int beg_time_step time step number
+* int end_time_step time step number
+*
+* exit conditions -
+* float* var_vals array of element variable values
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*
+ * reads the values of a variable for a single entry of an object (block or set) through a
+ * specified number of time steps in the database; assume the first
+ * variable index, entry number, and time step are 1
+ */
+
+int ex_get_var_time( int exoid,
+ int 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];
+ float fdum;
+ char *cdum;
+ char errmsg[MAX_ERR_LENGTH];
+ const char* tname;
+ const char* dimnumobj;
+ const char* varobjids;
+ const char* varobstat;
+
+ switch (var_type) {
+ case EX_GLOBAL:
+ return ex_get_glob_var_time( exoid, var_index, beg_time_step, end_time_step, var_vals );
+ 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;
+ default:
+ exerrval = EX_BADPARAM;
+ sprintf( errmsg, "Error: Invalid variable type (%d) specified for file id %d", var_type, exoid );
+ ex_err( "ex_get_var_time", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0; /* initialize even though it is not used */
+
+ /* assume entry number is 1-based (the first entry of an object is 1, not 0);
+ * adjust so it is 0-based
+ */
+ id--;
+
+ /* 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);
+ }
+
+ /* 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 ((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);
+ }
+
+
+ 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);
+ }
+
+ /* allocate space for stat array */
+ if (!(stat_vals = malloc((int)num_obj*sizeof(nclong))))
+ {
+ exerrval = EX_MEMFAIL;
+ free (obj_ids);
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s status array for file id %d",
+ tname,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 */
+ 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
+ * when id_first_i <= id <= id_last_i, where
+ * id_first_i is the entry number of the first entry in
+ * obj_i and id_last_i is the entry number of the last
+ * entry in obj_i
+ */
+
+ i = 0;
+ 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 (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);
+ }
+
+ } /* 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 (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);
+ }
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to locate variable %d for %s %d in file id %d",
+ var_index,tname,obj_ids[i],exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ free(stat_vals);
+ free(obj_ids);
+ return (EX_FATAL);
+ }
+
+ free(stat_vals);
+ 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;
+ sprintf(errmsg,
+ "Error: failed to get maximum time step in file id %d",
+ exoid);
+ ex_err("ex_get_var_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ end_time_step--;
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to get %s variable values in file id %d", tname,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/exgvid.c b/cbind/src/exgvid.c
new file mode 100644
index 0000000..b5891cd
--- /dev/null
+++ b/cbind/src/exgvid.c
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgvid - ex_get_varid
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* varid variable id array
+*
+* revision history -
+*
+* $Id: exgvid.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 variable varids from the database
+ */
+
+int ex_get_varid (int exoid, const char *var_type,
+ int *varid_arr)
+{
+ int varid, dimid, i, j;
+ long num_entity = -1;
+ long num_var = -1;
+ char errmsg[MAX_ERR_LENGTH];
+ const char* routine = "ex_get_elem_varid";
+
+ /*
+ * 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 (*var_type == 'n' || *var_type == 'N') {
+ /* 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);
+ 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);
+ 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);
+ var_name = "vals_sset_var";
+ ent_type = "ss";
+ }
+ 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 (dimid < 0 || varid < 0)
+ 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 */
+ varid_arr[j*num_var+i] = varid;
+ }
+ }
+ return (EX_NOERR);
+}
+
diff --git a/cbind/src/exgvnm.c b/cbind/src/exgvnm.c
new file mode 100644
index 0000000..4ac643f
--- /dev/null
+++ b/cbind/src/exgvnm.c
@@ -0,0 +1,202 @@
+/*
+ * 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_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
+* char* var_type variable type: G,N, or E
+* int var_num variable index to read 1..num_var
+*
+* exit conditions -
+* char* var_name ptr to variable name
+*
+* revision history -
+*
+* $Id: exgvnm.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the name of a particular results variable from the database
+ */
+
+int ex_get_var_name (int exoid,
+ const char *var_type,
+ 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);
+}
diff --git a/cbind/src/exgvp.c b/cbind/src/exgvp.c
new file mode 100644
index 0000000..1871e0d
--- /dev/null
+++ b/cbind/src/exgvp.c
@@ -0,0 +1,164 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* char* var_type variable type G,N, or E
+*
+* exit conditions -
+* int* num_vars number of variables in database
+*
+* revision history -
+*
+* $Id: exgvp.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#include <ctype.h>
+
+/*!
+ * reads the number of global, nodal, or element variables that are
+ * stored in the database
+ */
+
+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);
+}
diff --git a/cbind/src/exgvtt.c b/cbind/src/exgvtt.c
new file mode 100644
index 0000000..3d87f46
--- /dev/null
+++ b/cbind/src/exgvtt.c
@@ -0,0 +1,70 @@
+/*
+ * 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_elem_var_tab
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_elem_blk number of element blocks
+* int num_elem_var number of element variables
+*
+* exit conditions -
+* int* elem_var_tab element variable truth table array
+*
+* revision history -
+*
+* $Id: exgvtt.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the EXODUS II element variable truth table from the database
+ */
+
+int ex_get_elem_var_tab (int exoid,
+ int num_elem_blk,
+ int num_elem_var,
+ int *elem_var_tab)
+{
+ return ex_get_var_tab(exoid, "E", num_elem_blk, num_elem_var, elem_var_tab);
+}
diff --git a/cbind/src/exgvv.c b/cbind/src/exgvv.c
new file mode 100644
index 0000000..5d364a1
--- /dev/null
+++ b/cbind/src/exgvv.c
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exgev - ex_get_varid_var
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* int varid id of variable on exodus database
+* int num_entity number of entities for this variable
+*
+*
+* exit conditions -
+* float* var_vals array of variable values
+*
+*
+* revision history -
+*
+* $Id: exgvv.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * reads the values of a single variable at one time step in the
+ * database; assume the first time index is 1. Access based on the
+ * passed in 'varid'
+ *
+ * NOTE: If used for nodal variables, it must be an ex_large_model == 1
+ */
+
+int ex_get_varid_var(int exoid,
+ int time_step,
+ int varid,
+ int num_entity,
+ void *var_vals)
+{
+ long start[2], count[2];
+ char errmsg[MAX_ERR_LENGTH];
+ void *array;
+
+ exerrval = 0; /* clear error code */
+
+ /* read values of element variable */
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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;
+ 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
new file mode 100644
index 0000000..9ade79a
--- /dev/null
+++ b/cbind/src/exinq.c
@@ -0,0 +1,1144 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int req_info info request code
+*
+* exit conditions -
+* int* ret_int returned integer value
+* float* ret_float returned float value
+* char* ret_char returned character value
+*
+* revision history -
+*
+* $Id: exinq.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.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_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); \
+ }
+
+static void flt_cvt(float *xptr,double x)
+{
+ *xptr = (float)x;
+}
+
+/*!
+ * returns information about the database
+ */
+
+int ex_inquire (int exoid,
+ int req_info,
+ int *ret_int,
+ 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,
+ "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:
+
+ 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.
+ 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:
+
+ 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;
+
+ 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;
+
+ case EX_INQ_EDGE_MAP:
+/* returns the number of edge sets. */
+ 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);
+}
+
+
+
diff --git a/cbind/src/exopen.c b/cbind/src/exopen.c
new file mode 100644
index 0000000..69d9739
--- /dev/null
+++ b/cbind/src/exopen.c
@@ -0,0 +1,195 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int mode access mode w/r
+*
+* exit conditions -
+* int exoid exodus file id
+* int* comp_ws computer word size
+* int* io_ws storage word size
+* float* version EXODUSII interface version number
+*
+* revision history -
+*
+* $Id: exopen.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdio.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+int ex_open (const char *path,
+ int mode,
+ int *comp_ws,
+ int *io_ws,
+ float *version)
+{
+ int exoid;
+ nclong file_wordsize;
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+/* 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 defined(__LIBCATAMOUNT__)
+ if ((exoid = ncopen (path, NC_NOWRITE)) < 0)
+#else
+ if ((exoid = ncopen (path, NC_NOWRITE|NC_SHARE)) < 0)
+#endif
+ {
+ /* NOTE: netCDF returns an id of -1 on an error - but no error code! */
+ if (ncerr == 0)
+ exerrval = EX_FATAL;
+ else
+ exerrval = ncerr;
+ sprintf(errmsg,"Error: failed to open %s read only",path);
+ ex_err("ex_open",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+ }
+
+ else if (mode == EX_WRITE) /* READ/WRITE */
+ {
+#if defined(__LIBCATAMOUNT__)
+ if ((exoid = ncopen (path, NC_WRITE)) < 0)
+#else
+ if ((exoid = ncopen (path, NC_WRITE|NC_SHARE)) < 0)
+#endif
+ {
+ /* NOTE: netCDF returns an id of -1 on an error - but no error code! */
+ if (ncerr == 0)
+ exerrval = EX_FATAL;
+ else
+ exerrval = ncerr;
+ sprintf(errmsg,"Error: failed to open %s write only",path);
+ ex_err("ex_open",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ /* turn off automatic filling of netCDF variables */
+
+ if (ncsetfill (exoid, NC_NOFILL) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to set nofill mode in file id %d",
+ exoid);
+ ex_err("ex_open", errmsg, exerrval);
+ return (EX_FATAL);
+ }
+ }
+ else
+ {
+ exerrval = EX_BADFILEMODE;
+ sprintf(errmsg,"Error: invalid file open mode: %d",mode);
+ ex_err("ex_open",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+/* determine version of EXODUS II file, and the word size of
+ * floating point values stored in the file
+ */
+
+ if (ncattget (exoid, NC_GLOBAL, ATT_VERSION, version) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,"Error: failed to get database version for file id: %d",
+ exoid);
+ ex_err("ex_open",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+/* check ExodusII file version - old version 1.x files are not supported */
+ if (*version < 2.0)
+ {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,"Error: Unsupported file version %.2f in file id: %d",
+ *version, exoid);
+ ex_err("ex_open",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (ncattget (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) == -1)
+ { /* try old (prior to db version 2.02) attribute name */
+ if (ncattget (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) == -1)
+ {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,"Error: failed to get file wordsize from file id: %d",
+ exoid);
+ ex_err("ex_open",errmsg,exerrval);
+ return(exerrval);
+ }
+ }
+
+/* initialize floating point size conversion.
+ */
+
+ if (ex_conv_ini( exoid, comp_ws, io_ws, file_wordsize ) != EX_NOERR ) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: failed to init conversion routines in file id %d",
+ exoid);
+ ex_err("ex_open", errmsg, exerrval);
+ return (EX_FATAL);
+ }
+
+ return (exoid);
+}
diff --git a/cbind/src/exopts.c b/cbind/src/exopts.c
new file mode 100644
index 0000000..d24d3b5
--- /dev/null
+++ b/cbind/src/exopts.c
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exopts - ex_opts
+*
+* author - Sandia National Laboratories
+* Vic Yarberry - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int options error reporting options mask
+*
+* exit conditions -
+* The internal error reporting options mask, exoptval, is set to the passed
+* value - no error checking is done.
+*
+* revision history -
+*
+* $Id: exopts.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/* init exoptval */
+#if defined(VERBOSE)
+int exoptval = EX_VERBOSE; /* loud mode: set EX_VERBOSE */
+#else
+#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*/
+#endif
+#endif
+
+/*!
+ * error reporting options mask
+ */
+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
new file mode 100644
index 0000000..35bccfa
--- /dev/null
+++ b/cbind/src/expatn.c
@@ -0,0 +1,187 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expatn - ex_put_attr_names
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int blk_type block type (edge, face, elem)
+* int blk_id block id
+* char* names ptr to array of attribute names
+
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expatn.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the attribute names for a block
+ */
+int ex_put_attr_names(int exoid,
+ int 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;
+
+ 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;
+ }
+
+ /* Determine index of blk_id in VAR_ID_EL_BLK 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);
+ ex_err("ex_put_attr_names",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, VAR_ID_EL_BLK, exoid);
+ ex_err("ex_put_attr_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+
+ /* inquire id's of previously defined dimensions */
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx));
+ break;
+ case EX_FACE_BLOCK:
+ numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx));
+ break;
+ case EX_ELEM_BLOCK:
+ numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx));
+ break;
+ }
+ if (numattrdim == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: number of attributes not defined for %s block %d in file id %d",
+ tname,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;
+ sprintf(errmsg,
+ "Error: failed to get number of attributes for block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_attr_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ switch (blk_type) {
+ case EX_EDGE_BLOCK:
+ varid = ncvarid (exoid, VAR_NAME_EATTRIB(blk_id_ndx));
+ break;
+ case EX_FACE_BLOCK:
+ varid = ncvarid (exoid, VAR_NAME_FATTRIB(blk_id_ndx));
+ break;
+ case EX_ELEM_BLOCK:
+ varid = ncvarid (exoid, VAR_NAME_ATTRIB(blk_id_ndx));
+ break;
+ }
+ if (varid == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s attribute names for block %d in file id %d",
+ tname,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++) {
+ start[0] = i;
+ start[1] = 0;
+
+ 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 put attribute namess for block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_attr_names",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ }
+ return(EX_NOERR);
+}
diff --git a/cbind/src/expatt.c b/cbind/src/expatt.c
new file mode 100644
index 0000000..a3f8235
--- /dev/null
+++ b/cbind/src/expatt.c
@@ -0,0 +1,240 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expatt - ex_put_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int blk_type block type
+* int blk_id block id
+* float* attrib array of attributes
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expatt.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the attributes for an edge/face/element block
+ */
+
+int ex_put_attr (int exoid,
+ int 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];
+ 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);
+ }
+ }
+
+/* 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));
+ break;
+ case EX_FACE_BLOCK:
+ numentriesbdim = ncdimid (exoid, DIM_NUM_FA_IN_FBLK(blk_id_ndx));
+ break;
+ case EX_ELEM_BLOCK:
+ numentriesbdim = ncdimid (exoid, DIM_NUM_EL_IN_BLK(blk_id_ndx));
+ 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));
+ break;
+ case EX_FACE_BLOCK:
+ numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx));
+ break;
+ case EX_ELEM_BLOCK:
+ numattrdim = ncdimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx));
+ break;
+ }
+ if (numattrdim == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: number of attributes not defined for %s block %d in file id %d",
+ tname, blk_id,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;
+ sprintf(errmsg,
+ "Error: failed to get number of attributes for %s 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:
+ 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;
+ }
+ 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;
+ sprintf(errmsg,
+ "Error: failed to put attributes for %s block %d in file id %d",
+ tname,blk_id,exoid);
+ ex_err("ex_put_attr",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ return(EX_NOERR);
+
+}
diff --git a/cbind/src/expblk.c b/cbind/src/expblk.c
new file mode 100644
index 0000000..5daa6b2
--- /dev/null
+++ b/cbind/src/expblk.c
@@ -0,0 +1,503 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expblk - ex_put_block: write edge, face, or element block parameters
+*
+* entry conditions -
+* input parameters:
+* int idexo exodus file id
+* int blk_type type of block (edge, face, or element)
+* int blk_id block identifer
+* char* entry_descrip string describing shape of entries in the block
+* int num_entries_this_blk number of entries(records) in the block
+* int num_nodes_per_entry number of nodes per block entry
+* int num_edges_per_entry number of edges per block entry
+* int num_faces_per_entry number of faces per block entry
+* int num_attr_per_entry number of attributes per block entry
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the parameters used to describe an element block
+ */
+
+int ex_put_block( int exoid,
+ int blk_type,
+ int blk_id,
+ const char* entry_descrip,
+ 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 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);
+ }
+
+ /* 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);
+}
+
diff --git a/cbind/src/expcab.c b/cbind/src/expcab.c
new file mode 100644
index 0000000..05681d0
--- /dev/null
+++ b/cbind/src/expcab.c
@@ -0,0 +1,648 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expclb - ex_put_concat_all_blocks: write elem, edge, & face block parameters
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* const ex_block_params* bparam block parameters structure
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#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
+ */
+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 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,
+ DIM_NUM_FAM,
+ DIM_NUM_EM,
+ };
+ static const char* dim_size_maps[] = {
+ DIM_NUM_NODES,
+ DIM_NUM_EDGE,
+ DIM_NUM_FACE,
+ DIM_NUM_ELEM,
+ };
+ static const int map_enums[] = {
+ EX_NODE_MAP,
+ EX_EDGE_MAP,
+ EX_FACE_MAP,
+ EX_ELEM_MAP
+ };
+ /* 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--^^ */
+
+ exerrval = 0; /* clear error code */
+
+ cdum = 0;
+
+ /* 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_concat_all_blocks",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ( param->define_maps ) {
+ for ( i = 0; i < num_map_dims; ++i ) {
+ if ( (dimid = ncdimid( exoid, dim_num_maps[i] )) == -1 ) {
+ exerrval = ncerr;
+ 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);
+ }
+ }
+ }
+
+#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); \
+ } \
+ }
+
+ 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);
+ 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);
+ 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);
+
+ 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
+ * ourselves from entering define mode by returning here.
+ */
+ return (EX_NOERR);
+ }
+ /* 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_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 */ \
+ } \
+ }
+
+#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 */ \
+ } \
+ }
+
+
+ /* 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) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of edge blocks (%ld) defined in file id %d",
+ 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 );
+
+ 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);
+ } else {
+ 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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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 */
+ }
+ }
+
+ /* 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) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of face blocks (%ld) defined in file id %d",
+ 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 );
+
+ 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);
+ } else {
+ 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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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 */
+ }
+ }
+
+ /* 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) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of element blocks (%ld) defined in file id %d",
+ 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 );
+
+ 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);
+ } else {
+ 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 */
+ }
+
+ /* 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;
+ sprintf(errmsg,
+ "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 ( 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 */
+ }
+ }
+
+ /* 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;
+ sprintf(errmsg,
+ "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 */
+ }
+
+ EX_PREPARE_CONN( "edge",cur_num_elem_blk,param->elem_blk_id,numelbdim,VAR_ECONN,neledgdim);
+ EX_PREPARE_CONN( "face",cur_num_elem_blk,param->elem_blk_id,numelbdim,VAR_FCONN,nelfacdim);
+ }
+
+ /* 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;
+ 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 );
+ }
+ 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 */
+ }
+ }
+ }
+ }
+#endif /* ^^=new style num map */
+ }
+
+ /* 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_concat_all_blocks",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_all_blocks",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
+
diff --git a/cbind/src/expclb.c b/cbind/src/expclb.c
new file mode 100644
index 0000000..1c8e8e2
--- /dev/null
+++ b/cbind/src/expclb.c
@@ -0,0 +1,385 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expclb - ex_put_concat_elem_block: write element block parameters
+*
+* entry conditions -
+* input parameters:
+* int idexo exodus file id
+* char** elem_type element type string
+* int* num_elem_this_blk number of elements in the element blk
+* int* num_nodes_per_elem number of nodes per element block
+* int* num_attr number of attributes
+* int define_maps if != 0, write maps, else don't
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the parameters used to describe an element block
+ */
+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)
+{
+ int i, varid, dimid, dims[2], strdim, *eb_stat;
+ int iblk;
+ int iresult;
+ long start[2], count[2], num_elem_blk;
+ nclong *lptr;
+ 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 ) {
+ return (EX_NOERR);
+ }
+
+ /* Get number of element blocks defined for this file */
+ if ((ncdiminq (exoid,dimid,cdum,&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_concat_elem_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Fill out the element block status array */
+ if (!(eb_stat = 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",
+ exoid);
+ ex_err("ex_put_concat_elem_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ 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 */
+ else
+ eb_stat[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;
+ sprintf(errmsg,
+ "Error: failed to locate element block status in file id %d",
+ exoid);
+ ex_err("ex_put_concat_elem_block",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] = 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);
+ }
+
+ if (iresult == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to store element block status array to file id %d",
+ exoid);
+ ex_err("ex_put_concat_elem_block",errmsg,exerrval);
+ 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;
+ sprintf(errmsg,
+ "Error: failed to locate element block ids array in file id %d",
+ exoid);
+ ex_err("ex_put_concat_elem_block",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] = num_elem_blk;
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to store element block id array in file id %d",
+ exoid);
+ ex_err("ex_put_concat_elem_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* 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_concat_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_concat_elem_block",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* 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) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of element blocks (%ld) defined in file id %d",
+ num_elem_blk,exoid);
+ ex_err("ex_put_concat_elem_block",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 );
+
+ 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 */
+ sprintf(errmsg,
+ "Error: element block %d already defined in file id %d",
+ elem_blk_id[iblk],exoid);
+ } else {
+ sprintf(errmsg,
+ "Error: failed to define number of elements/block for block %d 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 */
+ }
+
+ if ((nelnoddim = ncdimdef (exoid,
+ DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1),
+ (long)num_nodes_per_elem[iblk])) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of nodes/element 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 */
+ }
+
+ /* 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;
+ sprintf(errmsg,
+ "Error: failed to define number of attributes in 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 */
+ }
+
+ dims[0] = numelbdim;
+ dims[1] = numattrdim;
+
+ if ((ncvardef (exoid, VAR_ATTRIB(cur_num_elem_blk+1),
+ nc_flt_code(exoid), 2, dims)) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "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 */
+ }
+
+ /* Attribute names... */
+ dims[0] = numattrdim;
+ dims[1] = strdim;
+
+ if (ncvardef (exoid, VAR_NAME_ATTRIB(cur_num_elem_blk+1), 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_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 */
+ /* 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_elem_block",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_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_concat_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_concat_elem_block",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
+
diff --git a/cbind/src/expcns.c b/cbind/src/expcns.c
new file mode 100644
index 0000000..6bfd91d
--- /dev/null
+++ b/cbind/src/expcns.c
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expcns - ex_put_concat_node_sets
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int* node_set_ids array of node set ids
+* int* num_nodes_per_set array of number of nodes per set
+* int* num_dist_per_set array of number of dist fact per set
+* ----------pass in NULL for remaining args if just want to set params -------------
+* int* node_sets_node_index array of set indices into node list
+* int* node_sets_df_index array of set indices into dist fact list
+* int* node_set_node_list array of node list #'s for node set
+* void* node_set_dist_fact array of dist factors for node set
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expcns.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+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)
+{
+ struct ex_set_specs set_specs;
+
+ set_specs.sets_ids = node_set_ids;
+ set_specs.num_entries_per_set = num_nodes_per_set;
+ set_specs.num_dist_per_set = num_dist_per_set;
+ set_specs.sets_entry_index = node_sets_node_index;
+ set_specs.sets_dist_index = node_sets_df_index;
+ set_specs.sets_entry_list = node_sets_node_list;
+ set_specs.sets_extra_list = NULL;
+ set_specs.sets_dist_fact = node_sets_dist_fact;
+
+ return ex_put_concat_sets(exoid, EX_NODE_SET, &set_specs);
+}
diff --git a/cbind/src/expcon.c b/cbind/src/expcon.c
new file mode 100644
index 0000000..d548a11
--- /dev/null
+++ b/cbind/src/expcon.c
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* char* coord_names ptr array of coordinate names
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expcon.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+/*!
+ * writes the names of the coordinate arrays to the database
+ */
+
+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 */
+
+/* inquire previously defined dimensions */
+
+ 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);
+ }
+
+ if (ncdiminq (exoid, ndimdim, (char *) 0, &num_dim) == -1)
+ {
+ exerrval = ncerr;
+ 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);
+ }
+
+ if ((varid = ncvarid (exoid, VAR_NAME_COOR)) == -1)
+ {
+ exerrval = ncerr;
+ 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 */
+
+ for (i=0; i<num_dim; i++)
+ {
+ start[0] = i;
+ start[1] = 0;
+
+ count[0] = 1;
+ count[1] = strlen(coord_names[i]) + 1;
+
+ 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);
+ }
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/expconn.c b/cbind/src/expconn.c
new file mode 100644
index 0000000..c3491c4
--- /dev/null
+++ b/cbind/src/expconn.c
@@ -0,0 +1,332 @@
+/*
+ * 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.
+ *
+ */
+/* $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() */
+
+/*!
+ * writes the connectivity array for a block
+ */
+
+int ex_put_conn (int exoid,
+ int 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;
+ 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);
+ 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_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);
+ 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); \
+ }
+
+ 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;
+
+ nedpereldim = ncdimid (exoid, DIM_NUM_EDG_PER_EL(blk_id_ndx));
+ if (nedpereldim == -1 && elem_edge_conn != 0)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: edge connectivity specified but failed to "
+ "locate number of edges/element in block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_conn",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ nfapereldim = ncdimid (exoid, DIM_NUM_FAC_PER_EL(blk_id_ndx));
+ if (nfapereldim == -1 && elem_face_conn != 0)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: face connectivity specified but failed to "
+ "locate number of faces/element in block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_conn",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (ncdiminq (exoid, nedpereldim, NULL, &num_ed_per_elem) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of edges/elem in block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_conn",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if (ncdiminq (exoid, nfapereldim, NULL, &num_fa_per_elem) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of edges/elem in block %d in file id %d",
+ blk_id,exoid);
+ ex_err("ex_put_conn",errmsg,exerrval);
+ return(EX_FATAL);
+ }
+
+ if ( (num_ed_per_elem == 0 && elem_edge_conn != 0) ||
+ (num_ed_per_elem != 0 && elem_edge_conn == 0) )
+ {
+ exerrval = (EX_FATAL);
+ 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 );
+ ex_err("ex_put_conn",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ( (num_fa_per_elem == 0 && elem_face_conn != 0) ||
+ (num_fa_per_elem != 0 && elem_face_conn == 0) )
+ {
+ exerrval = (EX_FATAL);
+ 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 );
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for "
+ "element edge block %d in file id %d",
+ blk_id,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);
+ }
+
+ if ( num_fa_per_elem != 0 ) {
+ connid = ncvarid (exoid, VAR_FCONN(blk_id_ndx));
+ if (connid == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate connectivity array for "
+ "element face block %d in file id %d",
+ blk_id,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);
+ }
+ }
+
+ return (EX_NOERR);
+
+}
diff --git a/cbind/src/expcor.c b/cbind/src/expcor.c
new file mode 100644
index 0000000..43bd1da
--- /dev/null
+++ b/cbind/src/expcor.c
@@ -0,0 +1,258 @@
+/*
+ * 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_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
+* float* x_coord X coord array
+* float* y_coord y coord array
+* float* z_coord z coord array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expcor.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the coordinates of all the nodes in the model
+ * Only writes the 'non-null' arrays.
+ */
+
+int ex_put_coord (int exoid,
+ const void *x_coor,
+ const void *y_coor,
+ const void *z_coor)
+{
+ int coordid;
+ int coordidx, coordidy, coordidz;
+
+ int numnoddim, ndimdim, i;
+ long 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 ((numnoddim = ncdimid (exoid, DIM_NUM_NODES)) == -1)
+ {
+ /* 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 ((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 (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);
+ }
+
+ /* write out the coordinates */
+ if (ex_large_model(exoid) == 0) {
+ if ((coordid = ncvarid (exoid, VAR_COORD)) == -1) {
+ exerrval = ncerr;
+ 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);
+ }
+ }
+ }
+ } 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);
+ }
+
+ 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);
+ }
+ } 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);
+ }
+ } else {
+ coordidz = 0;
+ }
+ /* write out the coordinates */
+ for (i=0; i<num_dim; i++)
+ {
+ const void *coor;
+ char *which;
+ int status;
+
+ 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 (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);
+ }
+ }
+ }
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expcset.c b/cbind/src/expcset.c
new file mode 100644
index 0000000..ba9de06
--- /dev/null
+++ b/cbind/src/expcset.c
@@ -0,0 +1,613 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expcss - ex_put_concat_sets
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int set_type type of set
+* struct ex_set_specs* set_specs set specs structure
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expcset.c,v 1.2 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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.
+ */
+
+int ex_put_concat_sets (int exoid,
+ int set_type,
+ const struct ex_set_specs* set_specs)
+{
+ 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;
+ const int *sets_entry_index = set_specs->sets_entry_index;
+ const int *sets_dist_index = set_specs->sets_dist_index;
+ 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;
+ float fdum;
+ const float *flt_dist_fact;
+ const double *dbl_dist_fact;
+ 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;
+
+ 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;
+ sprintf(errmsg,
+ "Error: no %s sets defined for file id %d", typeName, exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ }
+ else
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s sets defined in file id %d",
+ typeName, 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)
+ {
+ 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_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* Fill out set status array */
+
+ /* First, allocate space for the status list */
+ 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);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ 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
+ set_stat[i] = 1; /* change set status to TRUE */
+ }
+
+ /* Next, get variable id of status array */
+ 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_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 */
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to store %s set status array to file id %d",
+ typeName, 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;
+ sprintf(errmsg,
+ "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)
+ {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of %s sets (%d) defined in file id %d",
+ typeName, 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. */
+
+ cur_num_sets=ex_inc_file_item(exoid, ctr_list_ptr );
+ 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 */
+ 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);
+ 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 */
+
+ 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);
+ }
+ goto error_ret;
+ }
+
+ /* 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);
+ }
+ 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;
+ sprintf(errmsg,
+ "Error: extra 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 extra 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 */
+ }
+ }
+
+/* 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])
+ {
+ 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 */
+
+ }
+ else
+ {
+ if ((dimid = ncdimdef (exoid, numdfptr,
+ (long)num_dist_per_set[i])) == -1)
+ {
+ if (ncerr == NC_ENAMEINUSE)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: %s set df 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 %s set df count for set %d in file id %d",
+ typeName, set_ids[i],exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ }
+ goto error_ret;
+ }
+ }
+
+ /* 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 */
+ }
+ } /* end define dist factors */
+ }
+
+/* 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_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+/* Next, fill out set ids array */
+
+ /* first get id of set ids array variable */
+
+ if ((varid = ncvarid (exoid, idsptr)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s set ids array in file id %d",
+ typeName, exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* then, write out set 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_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;
+ sprintf(errmsg,
+ "Error: failed to store %s set id array in file id %d",
+ typeName, exoid);
+ ex_err("ex_put_concat_sets",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* If the sets_entry_index is passed in as a NULL pointer, then
+ * the user only wants us to define the sets and not populate
+ * the data structures.
+ */
+ if (sets_entry_index == 0)
+ return(EX_NOERR);
+
+ /* Now, use ExodusII call to store sets */
+ 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! */
+
+ /* 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);
+ }
+ }
+ }
+ 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);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expcss.c b/cbind/src/expcss.c
new file mode 100644
index 0000000..fd4b51e
--- /dev/null
+++ b/cbind/src/expcss.c
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expcss - ex_put_concat_side_sets
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* 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
+* ----------pass in NULL for remaining args if just want to set params -------------
+* 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/faces
+* void *side_sets_dist_fact array of distribution factors
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expcss.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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.
+ */
+
+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)
+{
+ struct ex_set_specs set_specs;
+
+ set_specs.sets_ids = side_set_ids;
+ set_specs.num_entries_per_set = num_elem_per_set;
+ set_specs.num_dist_per_set = num_dist_per_set;
+ set_specs.sets_entry_index = side_sets_elem_index;
+ set_specs.sets_dist_index = side_sets_dist_index;
+ set_specs.sets_entry_list = side_sets_elem_list;
+ set_specs.sets_extra_list = side_sets_side_list;
+ set_specs.sets_dist_fact = side_sets_dist_fact;
+
+ return ex_put_concat_sets(exoid, EX_SIDE_SET, &set_specs);
+}
diff --git a/cbind/src/expean.c b/cbind/src/expean.c
new file mode 100644
index 0000000..ad24adf
--- /dev/null
+++ b/cbind/src/expean.c
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expeat - ex_put_elem_attr_names
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int elem_blk_id element block id
+* char* names[] ptr array of attribute names
+
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expean.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the attribute names for an element block
+ */
+int ex_put_elem_attr_names(int exoid,
+ int elem_blk_id,
+ char* names[])
+{
+ return ex_put_attr_names( exoid, EX_ELEM_BLOCK, elem_blk_id, names );
+}
diff --git a/cbind/src/expeat.c b/cbind/src/expeat.c
new file mode 100644
index 0000000..b21f408
--- /dev/null
+++ b/cbind/src/expeat.c
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expeat - ex_put_elem_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int elem_blk_id element block id
+* float* attrib array of attributes
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expeat.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the attributes for an element block
+ */
+
+int ex_put_elem_attr (int exoid,
+ int elem_blk_id,
+ const void *attrib)
+{
+ return ex_put_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib );
+}
diff --git a/cbind/src/expelb.c b/cbind/src/expelb.c
new file mode 100644
index 0000000..78e4468
--- /dev/null
+++ b/cbind/src/expelb.c
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expelb - ex_put_elem_block: write element block parameters
+*
+* entry conditions -
+* input parameters:
+* int idexo exodus file id
+* int elem_blk_id block identifier
+* char* elem_type element type string
+* int num_elem_this_blk number of elements in the element blk
+* int num_nodes_per_elem number of nodes per element block
+* int num_attr_per_elem number of attributes per element
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the parameters used to describe an element block
+ */
+
+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_per_elem)
+{
+ return ex_put_block( exoid, EX_ELEM_BLOCK, elem_blk_id,
+ elem_type, num_elem_this_blk, num_nodes_per_elem,
+ 0 /*num_edge_per_elem*/, 0 /*num_face_per_elem*/, num_attr_per_elem );
+}
diff --git a/cbind/src/expelc.c b/cbind/src/expelc.c
new file mode 100644
index 0000000..b317577
--- /dev/null
+++ b/cbind/src/expelc.c
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ *
+ */
+/* $Id: expelc.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $ */
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes the connectivity array for an element block
+ */
+
+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);
+
+}
diff --git a/cbind/src/expem.c b/cbind/src/expem.c
new file mode 100644
index 0000000..840058a
--- /dev/null
+++ b/cbind/src/expem.c
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expem - ex_put_elem_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id element map id
+* int *elem_map element map
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes an element map; this is a vector of integers of length number
+ * of elements
+ */
+
+int ex_put_elem_map (int exoid,
+ int map_id,
+ const int *elem_map)
+{
+ return ex_put_num_map( exoid, EX_ELEM_MAP, map_id, elem_map );
+}
diff --git a/cbind/src/expenm.c b/cbind/src/expenm.c
new file mode 100644
index 0000000..6f93561
--- /dev/null
+++ b/cbind/src/expenm.c
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* 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 element numbering map to the database; this allows
+ * element numbers to be non-contiguous
+ */
+
+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);
+}
+
diff --git a/cbind/src/expev.c b/cbind/src/expev.c
new file mode 100644
index 0000000..1f102c6
--- /dev/null
+++ b/cbind/src/expev.c
@@ -0,0 +1,310 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expev - ex_put_elem_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* int elem_var_index element variable index
+* int elem_blk_id element block id
+* int num_elem_this_blk number of elements in this block
+*
+* exit conditions -
+*
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expev.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#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
+ */
+
+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)
+{
+ 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);
+}
diff --git a/cbind/src/expfrm.c b/cbind/src/expfrm.c
new file mode 100644
index 0000000..4d8ecba
--- /dev/null
+++ b/cbind/src/expfrm.c
@@ -0,0 +1,184 @@
+/*
+ * 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.
+ *
+ */
+/*!
+*
+* 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
+*
+* returns -
+* EX_NOERR for no error
+* EX_FATAL for fatal errors
+* 1 number frames < 0
+*
+*****************************************************************************/
+
+#include <assert.h>
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/* -------------------- local defines --------------------------- */
+#define PROCNAME "ex_put_coordinate_frames"
+/* -------------------- end of local defines -------------------- */
+int ex_put_coordinate_frames( int exoid, int nframes, const int cf_ids[],
+ void* pt_coordinates, const char* tags)
+{
+ 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;
+ 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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "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;
+ sprintf(errmsg,
+ "Error: failed to complete coordinate frame definition in file id %d",
+ exoid);
+ ex_err(PROCNAME,errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* check variables consistency */
+ exerrval = EX_NOERR;
+ for (i=0;i<nframes;i++)
+ if ( strchr("RrCcSs",tags[i])==0 ){
+ sprintf(errmsg,"Warning: Unrecognized coordinate frame tag: '%c'.",
+ 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;
+ 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);
+ }
+ return (EX_FATAL);
+
+
+}
+
+
diff --git a/cbind/src/expgv.c b/cbind/src/expgv.c
new file mode 100644
index 0000000..21e4a1c
--- /dev/null
+++ b/cbind/src/expgv.c
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+* int num_glob_vars number of global vars in file
+* float* glob_var_vals array of global variable values
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expgv.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+int ex_put_glob_vars (int exoid,
+ int time_step,
+ int num_glob_vars,
+ const void *glob_var_vals)
+{
+ return ex_put_var( exoid, time_step, EX_GLOBAL, 1, 0 /*N/A*/, num_glob_vars, glob_var_vals );
+}
diff --git a/cbind/src/expinf.c b/cbind/src/expinf.c
new file mode 100644
index 0000000..7c131c1
--- /dev/null
+++ b/cbind/src/expinf.c
@@ -0,0 +1,194 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* char* info[] ptr array of info records
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expinf.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes information records to the database
+ */
+
+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 */
+
+/* only do this if there are records */
+
+ if (num_info > 0)
+ {
+/* inquire previously defined dimensions */
+
+ if ((lindim = ncdimid (exoid, DIM_LIN)) == -1)
+ {
+ exerrval = ncerr;
+ 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,
+ "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);
+}
diff --git a/cbind/src/expini.c b/cbind/src/expini.c
new file mode 100644
index 0000000..611a166
--- /dev/null
+++ b/cbind/src/expini.c
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expini - ex_put_init
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* char* title title of file
+* int num_dim number of dimensions (per node)
+* int num_nodes number of nodes
+* int num_elem number of elements
+* int num_elem_blk number of element blocks
+* int num_node_sets number of node sets
+* int num_side_sets number of side sets
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the initialization parameters to the EXODUS II file
+ */
+
+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)
+{
+ ex_init_params par;
+
+ 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 = 0;
+ par.num_face_blk = 0;
+ 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 = num_side_sets;
+ 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;
+
+ return (ex_put_init_ext( exoid, &par ));
+}
diff --git a/cbind/src/expinix.c b/cbind/src/expinix.c
new file mode 100644
index 0000000..847244d
--- /dev/null
+++ b/cbind/src/expinix.c
@@ -0,0 +1,519 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expinix - ex_put_init_ext
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* const ex_init_params* params finite element model parameters
+*
+* exit conditions -
+*
+* 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 <string.h>
+
+/*!
+ * writes the initialization parameters to the EXODUS II file
+ */
+
+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 nmapdim,edmapdim,famapdim,emapdim;
+#if 0
+ /* used for header size calculations which are turned off for now */
+ int header_size, fixed_var_size, iows;
+#endif
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ if ((ncdimid (exoid, DIM_NUM_DIM)) != -1)
+ {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Error: initialization already done for file id %d",exoid);
+ ex_err("ex_put_init_ext",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_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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define model->title attribute to file id %d", exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* ...and some dimensions... */
+
+ if ((numdimdim = ncdimdef (exoid, DIM_NUM_DIM, (long)model->num_dim)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of dimensions in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /*
+ * Need to handle "empty file" that may be the result of a strange
+ * load balance or some other strange run. Note that if num_node
+ * == 0, then model->num_elem must be zero since you cannot have elements
+ * with no nodes. It *is* permissible to have zero elements with
+ * non-zero node count.
+ */
+
+ if (model->num_nodes > 0) {
+ if ((numnoddim = ncdimdef (exoid, DIM_NUM_NODES, (long)model->num_nodes)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of nodes in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (model->num_elem > 0) {
+ if (model->num_nodes <= 0) {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Error: Cannot have non-zero element count if node count is zero.in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if ((ncdimdef (exoid, DIM_NUM_ELEM, (long)model->num_elem)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of elements in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (model->num_edge > 0) {
+ if (model->num_nodes <= 0) {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Error: Cannot have non-zero edge count if node count is zero.in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if ((ncdimdef (exoid, DIM_NUM_EDGE, (long)model->num_edge)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of edges in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (model->num_face > 0) {
+ if (model->num_nodes <= 0) {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Error: Cannot have non-zero face count if node count is zero.in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ if ((ncdimdef (exoid, DIM_NUM_FACE, (long)model->num_face)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of faces 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_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( "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 );
+
+ /*
+ * To reduce the maximum dataset sizes, the storage of the nodal
+ * coordinates and the nodal variables was changed from a single
+ * dataset to a dataset per component or variable. However, we
+ * want to maintain some form of compatability with the old
+ * exodusII version. It is easy to do this on read; however, we
+ * also want to be able to store in the old format using the new
+ * library.
+ *
+ * The mode is set in the ex_create call. The setting can be checked
+ * via the ATT_FILESIZE attribute in the file (1=large,
+ * 0=normal). Also handle old files that do not contain this
+ * attribute.
+ */
+
+ if (model->num_nodes > 0) {
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define node x coordinate array in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (model->num_dim > 1) {
+ if (ncvardef (exoid, VAR_COORD_Y, nc_flt_code(exoid), 1, dim) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define node y coordinate array in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+
+ if (model->num_dim > 2) {
+ if (ncvardef (exoid, VAR_COORD_Z, nc_flt_code(exoid), 1, dim) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define node z coordinate array in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+ } else {
+ /* node coordinate arrays: -- all stored together (old method) */
+
+ dim[0] = numdimdim;
+ dim[1] = numnoddim;
+ if (ncvardef (exoid, VAR_COORD, nc_flt_code(exoid), 2, dim) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define node coordinate array in file id %d",exoid);
+ ex_err("ex_put_init_ext",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_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);
+ EX_WRITE_OBJECT_NAMES("face block", VAR_NAME_FA_BLK,fablkdim,model->num_face_blk);
+ EX_WRITE_OBJECT_NAMES("node set", VAR_NAME_NS, nsetdim, model->num_node_sets);
+ EX_WRITE_OBJECT_NAMES("edge set", VAR_NAME_ES, esetdim, model->num_edge_sets);
+ EX_WRITE_OBJECT_NAMES("face set", VAR_NAME_FS, fsetdim, model->num_face_sets);
+ EX_WRITE_OBJECT_NAMES("side set", VAR_NAME_SS, ssetdim, model->num_side_sets);
+ EX_WRITE_OBJECT_NAMES("element set", VAR_NAME_ELS, elsetdim,model->num_elem_sets);
+ EX_WRITE_OBJECT_NAMES("node map", VAR_NAME_NM, nmapdim, model->num_node_maps);
+ 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);
+
+ /* 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);
+ }
+
+#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;
+ sprintf(errmsg,
+ "Error: failed to complete variable definitions in file id %d",exoid);
+ ex_err("ex_put_init_ext",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+#endif
+ 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_init_ext",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expmap.c b/cbind/src/expmap.c
new file mode 100644
index 0000000..e9018e0
--- /dev/null
+++ b/cbind/src/expmap.c
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int* elem_map element order map array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expmap.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes out the element order map to the database
+ */
+
+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];
+
+ 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_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);
+}
+
diff --git a/cbind/src/expmp.c b/cbind/src/expmp.c
new file mode 100644
index 0000000..6268799
--- /dev/null
+++ b/cbind/src/expmp.c
@@ -0,0 +1,325 @@
+/*
+ * 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_map_param
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_node_maps number of node maps
+* int num_elem_maps number of element maps
+*
+* exit conditions -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * defines the number of node and 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 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) )
+ {
+ exerrval = EX_MSG;
+ sprintf(errmsg,
+ "Error: number of maps already defined for file id %d",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ if ( (num_node_maps > 0) || (num_elem_maps > 0) )
+ {
+
+ /* 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_map_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_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;
+ sprintf(errmsg,
+ "Error: failed to define number of node maps in file id %d",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* node maps id array: */
+ dim[0] = dimid;
+ if ((varid = ncvardef (exoid, VAR_NM_PROP(1), NC_LONG, 1, dim)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to create node maps property array in file id %d",
+ exoid);
+ ex_err("ex_put_map_param",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 node map property name %s in file id %d",
+ "ID",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* Node map names... */
+ dim[0] = dimid;
+ dim[1] = strdim;
+
+ if (ncvardef (exoid, VAR_NAME_NM, NC_CHAR, 2, dim) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define node map name array in file id %d",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* determine number of nodes */
+ if ((dimid = (ncdimid (exoid, DIM_NUM_NODES))) == -1 )
+ {
+ exerrval = ncerr;
+ 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;
+ 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;
+ sprintf(errmsg,
+ "Error: failed to create node map %d in file id %d",
+ i,exoid);
+ ex_err("ex_put_node_map",errmsg,exerrval);
+ }
+ goto error_ret; /* exit define mode and return */
+ }
+ }
+ }
+
+ /* element maps: */
+ if (num_elem_maps > 0)
+ {
+ if ((dimid = ncdimdef (exoid, DIM_NUM_EM, (long)num_elem_maps)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define number of element maps in file id %d",
+ exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* element maps id array: */
+ dim[0] = dimid;
+ if ((varid = ncvardef (exoid, VAR_EM_PROP(1), NC_LONG, 1, dim)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to create element maps property array in file id %d",
+ exoid);
+ ex_err("ex_put_map_param",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 element map property name %s in file id %d",
+ "ID",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* Element map names... */
+ dim[0] = dimid;
+ dim[1] = strdim;
+
+ if (ncvardef (exoid, VAR_NAME_EM, NC_CHAR, 2, dim) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to define element map name array in file id %d",exoid);
+ ex_err("ex_put_map_param",errmsg,exerrval);
+ goto error_ret; /* exit define mode and return */
+ }
+
+ /* 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_elem_map",errmsg,exerrval);
+ 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 (ncerr == NC_ENAMEINUSE)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: element map %d already defined in file id %d",
+ i,exoid);
+ ex_err("ex_put_elem_map",errmsg,exerrval);
+ }
+ else
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to create element map %d in file id %d",
+ i,exoid);
+ ex_err("ex_put_elem_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 variable definitions in file id %d",exoid);
+ ex_err("ex_put_map_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_map_param",errmsg,exerrval);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expnam.c b/cbind/src/expnam.c
new file mode 100644
index 0000000..182fefd
--- /dev/null
+++ b/cbind/src/expnam.c
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnam - ex_put_name
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type object type
+* int entity_id id of entity name to write
+* char* name ptr to entity name
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnam.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the name of the specified entity to the database.
+ */
+
+int ex_put_name (int exoid,
+ int 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";
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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;
+
+ /* write EXODUS entityname */
+ start[0] = ent_ndx-1;
+ start[1] = 0;
+
+ 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);
+}
diff --git a/cbind/src/expnams.c b/cbind/src/expnams.c
new file mode 100644
index 0000000..e405e44
--- /dev/null
+++ b/cbind/src/expnams.c
@@ -0,0 +1,248 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnam - ex_put_names
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type object type
+* char* names ptr array of entity names
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnams.c,v 1.3 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the names of the results variables to the database
+ */
+
+int ex_put_names (int exoid,
+ int 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";
+
+ 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);
+ }
+
+
+ /* 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;
+
+ 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);
+}
diff --git a/cbind/src/expnm.c b/cbind/src/expnm.c
new file mode 100644
index 0000000..4b3e082
--- /dev/null
+++ b/cbind/src/expnm.c
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnm - ex_put_node_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id node map id
+* int *node_map node map
+*
+* exit conditions -
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+
+/*!
+ * writes an node map; this is a vector of integers of length number
+ * of nodes
+ */
+
+int ex_put_node_map (int exoid,
+ int map_id,
+ const int *node_map)
+{
+ return ex_put_num_map( exoid, EX_NODE_MAP, map_id, node_map );
+}
diff --git a/cbind/src/expnmap.c b/cbind/src/expnmap.c
new file mode 100644
index 0000000..6931c53
--- /dev/null
+++ b/cbind/src/expnmap.c
@@ -0,0 +1,323 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expem - ex_put_num_map
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_type type of map (node,edge,face,elem)
+* int map_id id to associate with new map
+* int *map_data map set value array
+*
+* exit conditions -
+*
+* revision history -
+* 20060928 David Thompson - Adapted from ex_put_elem_map
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * 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).
+ */
+
+int ex_put_num_map ( int exoid,
+ int 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 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;
+
+ 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;
+ sprintf( errmsg,
+ "Error: Bad map type (%d) specified for file id %d",
+ map_type, exoid );
+ ex_err( "ex_put_num_map", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+
+/* Make sure the file contains entries */
+ if ((dimid = (ncdimid (exoid, dnumentries))) == -1 )
+ {
+ return (EX_NOERR);
+ }
+
+/* first check if any maps are specified */
+
+ if ((dimid = (ncdimid (exoid, dnummaps))) == -1 )
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: no %s maps specified in file id %d",
+ tname,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);
+ 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);
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of %s maps in file id %d",
+ tname,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)
+ {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: exceeded number of %s maps (%ld) specified in file id %d",
+ tname,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. */
+
+ cur_num_maps = ex_inc_file_item(exoid, map_ctr_list );
+
+/* write out information to previously defined variable */
+
+ /* first get id of variable */
+
+ if ((varid = ncvarid (exoid, vmapids)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate %s map ids in file id %d",
+ tname,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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to get number of %s entries in file id %d",
+ tname,exoid);
+ ex_err("ex_put_num_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ switch ( map_type ) {
+ case EX_NODE_MAP:
+ vmap = VAR_NODE_MAP(cur_num_maps+1);
+ break;
+ case EX_EDGE_MAP:
+ vmap = VAR_EDGE_MAP(cur_num_maps+1);
+ break;
+ case EX_FACE_MAP:
+ vmap = VAR_FACE_MAP(cur_num_maps+1);
+ break;
+ case EX_ELEM_MAP:
+ vmap = VAR_ELEM_MAP(cur_num_maps+1);
+ break;
+ }
+
+/* locate variable array in which to store the map */
+ if ((varid = ncvarid(exoid,vmap)) == -1)
+ {
+#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;
+ 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;
+ 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 */
+ 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 */
+ }
+
+ if ( varid == -1 ) /* we couldn't define variable and have prepared error message. */
+ 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)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to store %s map in file id %d",
+ tname,exoid);
+ ex_err("ex_put_num_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expnnm.c b/cbind/src/expnnm.c
new file mode 100644
index 0000000..5587ffc
--- /dev/null
+++ b/cbind/src/expnnm.c
@@ -0,0 +1,190 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int* node_map node numbering map
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes out the node numbering map to the database; allows node numbers
+ * to be non-contiguous
+ */
+
+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);
+}
+
diff --git a/cbind/src/expnp.c b/cbind/src/expnp.c
new file mode 100644
index 0000000..77fb323
--- /dev/null
+++ b/cbind/src/expnp.c
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+* int num_nodes_in_set number of nodes in set
+* int num_dist_in_set number of distribution factors in set
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnp.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the information which describes a single node set
+ */
+
+int ex_put_node_set_param (int exoid,
+ int node_set_id,
+ 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);
+}
diff --git a/cbind/src/expns.c b/cbind/src/expns.c
new file mode 100644
index 0000000..272395b
--- /dev/null
+++ b/cbind/src/expns.c
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+* int* node_set_node_list node list array for the node set
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expns.c,v 1.4 2006/11/28 14:02:02 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the node list for a single node set
+ */
+
+int ex_put_node_set (int exoid,
+ int node_set_id,
+ const int *node_set_node_list)
+{
+ return ex_put_set(exoid, EX_NODE_SET, node_set_id,
+ node_set_node_list, NULL);
+}
diff --git a/cbind/src/expnsd.c b/cbind/src/expnsd.c
new file mode 100644
index 0000000..5e3f027
--- /dev/null
+++ b/cbind/src/expnsd.c
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int node_set_id node set id
+* void* node_set _dist_fact node distribution factors for node set
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnsd.c,v 1.4 2006/11/28 14:02:05 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the node set distribution factors for a single node set
+ */
+
+int ex_put_node_set_dist_fact (int exoid,
+ int node_set_id,
+ const void *node_set_dist_fact)
+{
+ return ex_put_set_dist_fact(exoid, EX_NODE_SET, node_set_id,
+ node_set_dist_fact);
+}
diff --git a/cbind/src/expnstt.c b/cbind/src/expnstt.c
new file mode 100644
index 0000000..796d1f6
--- /dev/null
+++ b/cbind/src/expnstt.c
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnstt - ex_put_nset_var_tab
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_nset number of nodesets
+* int num_nset_var number of nodeset variables
+* int* nset_var_tab nodeset variable truth table array
+*
+* exit conditions -
+*
+* $Id: expnstt.c,v 1.3 2006/11/28 14:02:05 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the EXODUS II nodeset variable truth table to the database;
+ * also, creates netCDF variables in which to store EXODUS II nodeset
+ * variable values; although this table isn't required (because the
+ * netCDF variables can also be created in ex_put_nset_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 nodeset variable values variables are
+ * defined in ex_put_nset_var
+ */
+
+int ex_put_nset_var_tab (int exoid,
+ int num_nset,
+ int num_nset_var,
+ int *nset_var_tab)
+{
+ return ex_put_var_tab(exoid, "M", num_nset, num_nset_var, nset_var_tab);
+}
diff --git a/cbind/src/expnsv.c b/cbind/src/expnsv.c
new file mode 100644
index 0000000..f5dada6
--- /dev/null
+++ b/cbind/src/expnsv.c
@@ -0,0 +1,310 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expmv - ex_put_nset_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step time step number
+* int nset_var_index nodeset variable index
+* int nset_id nodeset id
+* int num_nodes_this_nset number of nodes in this nodeset
+*
+* exit conditions -
+*
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnsv.c,v 1.3 2006/11/28 14:02:05 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+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)
+{
+ 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);
+}
diff --git a/cbind/src/expnv.c b/cbind/src/expnv.c
new file mode 100644
index 0000000..38b1010
--- /dev/null
+++ b/cbind/src/expnv.c
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnv - ex_put_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 num_nodes number of nodal points
+* float* nodal_var_vals array of nodal variable values
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnv.c,v 1.4 2006/11/28 14:02:05 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#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
+ */
+
+int ex_put_nodal_var (int exoid,
+ int time_step,
+ int nodal_var_index,
+ int num_nodes,
+ const void *nodal_var_vals)
+
+{
+ int varid;
+ long 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;
+ sprintf(errmsg,
+ "Warning: could not find nodal variables in file id %d",
+ exoid);
+ ex_err("ex_put_nodal_var",errmsg,exerrval);
+ return (EX_WARN);
+ }
+ start[0] = --time_step;
+ start[1] = --nodal_var_index;
+ start[2] = 0;
+
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = num_nodes;
+ } 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;
+ 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);
+ return (EX_WARN);
+ }
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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);
+ }
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expnvv.c b/cbind/src/expnvv.c
new file mode 100644
index 0000000..4fc4f9e
--- /dev/null
+++ b/cbind/src/expnvv.c
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnv - ex_put_nodal_varid_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 num_nodes number of nodal points
+* int varid id of variable on exodus database
+* float* nodal_var_vals array of nodal variable values
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnvv.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#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
+ */
+
+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)
+{
+ long start[3], count[3];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ if (ex_large_model(exoid) == 0) {
+ start[0] = --time_step;
+ start[1] = --nodal_var_index;
+ start[2] = 0;
+
+ count[0] = 1;
+ count[1] = 1;
+ count[2] = num_nodes;
+ } else {
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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_varid_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/expoatt.c b/cbind/src/expoatt.c
new file mode 100644
index 0000000..d9b2c91
--- /dev/null
+++ b/cbind/src/expoatt.c
@@ -0,0 +1,251 @@
+/*
+ * 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_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 -
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the specified attribute for a block
+ */
+
+int ex_put_one_attr( int exoid,
+ int 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;
+ 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);
+ }
+ }
+
+ switch (obj_type) {
+ 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)
+ {
+ 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 ((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 (attrib_index < 1 || attrib_index > 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);
+ 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);
+ }
+
+
+ /* write out the attributes */
+
+ start[0] = 0;
+ start[1] = attrib_index-1;
+
+ count[0] = num_entries_this_obj;
+ count[1] = 1;
+
+ 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));
+ } 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));
+ }
+ if (error == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to put attribute %d for %s %d in file id %d",
+ attrib_index, tname, 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
new file mode 100644
index 0000000..ce0d590
--- /dev/null
+++ b/cbind/src/expoea.c
@@ -0,0 +1,68 @@
+/*
+ * 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_one_elem_attr
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int elem_blk_id element block id
+* int attrib_index index of attribute to write
+* float* attrib array of attributes
+*
+* exit conditions -
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the specified attribute for an element block
+ */
+
+int ex_put_one_elem_attr (int exoid,
+ int elem_blk_id,
+ int attrib_index,
+ const void *attrib)
+{
+ return ex_put_one_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib );
+}
diff --git a/cbind/src/expp.c b/cbind/src/expp.c
new file mode 100644
index 0000000..6097d09
--- /dev/null
+++ b/cbind/src/expp.c
@@ -0,0 +1,361 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expp - ex_put_prop: write object property
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type type of object (element block, node
+* set or side set)
+* int obj_id id of object to which property will
+* be assigned
+* char* prop_name name of the property for which the
+* value will be stored
+* int value value of the property
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes an object property
+ */
+
+int ex_put_prop (int exoid,
+ int 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 */
+
+ /* 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);
+ }
+ }
+
+ 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
+ {
+
+ 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] = 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);
+ }
+
+ 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 */
+ {
+ sprintf(errmsg,
+ "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
new file mode 100644
index 0000000..d180310
--- /dev/null
+++ b/cbind/src/exppa.c
@@ -0,0 +1,325 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int obj_type type of object (element block, node
+* set or side set)
+* char* prop_name name of the property for which the
+* values will be stored
+* int* values array of property values
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: exppa.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes an array of object properties
+ */
+
+int ex_put_prop_array (int exoid,
+ int 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,
+ "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 */
+
+ if ((ncattput (exoid, propid, ATT_PROP_NAME, NC_CHAR,
+ strlen(prop_name)+1, 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_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);
+ }
+
+ 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);
+ }
+
+
+ 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 */
+ {
+ sprintf(errmsg,
+ "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
new file mode 100644
index 0000000..d4608f0
--- /dev/null
+++ b/cbind/src/exppem.c
@@ -0,0 +1,265 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int map_id element map id
+* int ent_start first entry in map
+* int ent_count number of entries in map
+* int *elem_map element map
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes an element map; this is a vector of integers of length number
+ * of elements
+ */
+int ex_put_partial_elem_map (int exoid,
+ int map_id,
+ int ent_start,
+ 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 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);
+ }
+
+ /* 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);
+ }
+
+ /* Check for duplicate element map id entry */
+ map_ndx = ex_id_lkup(exoid,VAR_EM_PROP(1),map_id);
+ if (exerrval == EX_LOOKUPFAIL) { /* did not find the element map id */
+ map_exists = 0; /* Map is being defined */
+ map_ndx = -1;
+ } else {
+ map_exists = 1; /* A portion of this map has already been written */
+ }
+
+ 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);
+ }
+
+ /* 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);
+ }
+
+ /* 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 );
+ } 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 (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);
+ }
+
+ /* Check input parameters for a valid range of numbers */
+ if (ent_start <= 0 || ent_start > num_elem) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: start count is invalid in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ if (ent_count < 0) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: Invalid count value in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ if (ent_start+ent_count-1 > num_elem) {
+ exerrval = EX_FATAL;
+ sprintf(errmsg,
+ "Error: start+count-1 is larger than element count in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ /* write out information to previously defined variable */
+
+ /* first get id of variable */
+ if ((varid = ncvarid (exoid, VAR_EM_PROP(1))) == -1) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate element map ids in file id %d",
+ exoid);
+ ex_err("ex_put_partial_elem_map",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+ /* then, write out element map id */
+ 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;
+ 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);
+ }
+
+ 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);
+ }
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exppn.c b/cbind/src/exppn.c
new file mode 100644
index 0000000..24b9bdc
--- /dev/null
+++ b/cbind/src/exppn.c
@@ -0,0 +1,218 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* exppn - ex_put_prop_names: write property arrays names
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int obj_type type of object (element block, node
+* set or side set)
+* int num_props number of properties to be assigned
+* char** prop_names array of num_props names
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: exppn.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*
+ * writes the parameters to set up property name arrays
+ */
+
+int ex_put_prop_names (int exoid,
+ int 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,
+ "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);
+}
diff --git a/cbind/src/expqa.c b/cbind/src/expqa.c
new file mode 100644
index 0000000..b6acf1b
--- /dev/null
+++ b/cbind/src/expqa.c
@@ -0,0 +1,209 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int num_qa_records number of qa records to be written
+* char* qa_record[][4]) qa record array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expqa.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+
+/*!
+ * writes the QA records to the database
+ */
+
+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];
+
+ exerrval = 0; /* clear error code */
+
+/* only do this if there are records */
+
+ if (num_qa_records > 0)
+ {
+/* inquire previously defined dimensions */
+
+ if ((strdim = ncdimid (exoid, DIM_STR)) == -1)
+ {
+ exerrval = ncerr;
+ 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);
+}
diff --git a/cbind/src/expset.c b/cbind/src/expset.c
new file mode 100644
index 0000000..99f09d9
--- /dev/null
+++ b/cbind/src/expset.c
@@ -0,0 +1,302 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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_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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <stdlib.h> /* for free() */
+
+/*!
+ * writes the set entry list and set extra list for a single set
+ */
+
+int ex_put_set (int exoid,
+ int 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);
+ }
+ }
+
+ /* 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);
+
+}
diff --git a/cbind/src/expsetd.c b/cbind/src/expsetd.c
new file mode 100644
index 0000000..1baeebf
--- /dev/null
+++ b/cbind/src/expsetd.c
@@ -0,0 +1,260 @@
+/*
+ * 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_set_dist_fact
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int set_type set type
+* int set_id set id
+* void* set_dist_fact array of dist factors for set
+
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expsetd.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the distribution factors for a single set
+ */
+
+int ex_put_set_dist_fact (int exoid,
+ int 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
+ {
+ 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);
+ }
+ }
+
+ /* 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);
+
+}
diff --git a/cbind/src/expsetp.c b/cbind/src/expsetp.c
new file mode 100644
index 0000000..7defcc7
--- /dev/null
+++ b/cbind/src/expsetp.c
@@ -0,0 +1,473 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int set_type the type of set
+* int set_id set id
+* int num_entries_in_set number of entries in the set
+* int num_dist_fact_in_set number of distribution factors in the
+* set
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expsetp.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the set id and the number of entries
+ * which describe a single set
+ */
+
+int ex_put_set_param (int exoid,
+ int 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;
+
+ /* 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 */
+
+ }
+ }
+
+/* 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);
+}
diff --git a/cbind/src/expsp.c b/cbind/src/expsp.c
new file mode 100644
index 0000000..70a9c5f
--- /dev/null
+++ b/cbind/src/expsp.c
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int side_set_id side set id
+* 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
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expsp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the side set id and the number of sides (edges or faces)
+ * which describe a single side set
+ */
+
+int ex_put_side_set_param (int exoid,
+ int side_set_id,
+ int num_side_in_set,
+ int num_dist_fact_in_set)
+{
+ return ex_put_set_param(exoid, EX_SIDE_SET, side_set_id,
+ num_side_in_set, num_dist_fact_in_set);
+}
diff --git a/cbind/src/expss.c b/cbind/src/expss.c
new file mode 100644
index 0000000..b168609
--- /dev/null
+++ b/cbind/src/expss.c
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int side_set_id side set id
+* int* side_set_elem_list array of elements in side set
+* int* side_set_side_list array of sides in side set
+
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expss.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the side set element list and side set side list for a single side set
+ */
+
+int ex_put_side_set (int exoid,
+ int side_set_id,
+ const int *side_set_elem_list,
+ const int *side_set_side_list)
+{
+ return ex_put_set(exoid, EX_SIDE_SET, side_set_id,
+ side_set_elem_list, side_set_side_list);
+}
diff --git a/cbind/src/expssd.c b/cbind/src/expssd.c
new file mode 100644
index 0000000..b587358
--- /dev/null
+++ b/cbind/src/expssd.c
@@ -0,0 +1,72 @@
+/*
+ * 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_side_set_dist_fact
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int side_set_id side set id
+* void* side_set_dist_fact array of dist factors for side set
+
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expssd.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the distribution factors for a single side set
+ */
+
+int ex_put_side_set_dist_fact (int exoid,
+ int side_set_id,
+ const void *side_set_dist_fact)
+{
+ return ex_put_set_dist_fact(exoid, EX_SIDE_SET, side_set_id,
+ side_set_dist_fact);
+}
diff --git a/cbind/src/expsstt.c b/cbind/src/expsstt.c
new file mode 100644
index 0000000..363495d
--- /dev/null
+++ b/cbind/src/expsstt.c
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expsstt - ex_put_sset_var_tab
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_sset number of sidesets
+* int num_sset_var number of sideset variables
+* int* sset_var_tab sideset variable truth table array
+*
+* exit conditions -
+*
+* $Id: expsstt.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the EXODUS II sideset variable truth table to the database;
+ * also, creates netCDF variables in which to store EXODUS II sideset
+ * variable values; although this table isn't required (because the
+ * netCDF variables can also be created in ex_put_sset_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 sideset variable values variables are
+ * defined in ex_put_sset_var
+ */
+
+int ex_put_sset_var_tab (int exoid,
+ int num_sset,
+ int num_sset_var,
+ int *sset_var_tab)
+{
+ return ex_put_var_tab(exoid, "S", num_sset, num_sset_var, sset_var_tab);
+}
+
diff --git a/cbind/src/expssv.c b/cbind/src/expssv.c
new file mode 100644
index 0000000..393f53f
--- /dev/null
+++ b/cbind/src/expssv.c
@@ -0,0 +1,318 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+* int sset_var_index sideset variable index
+* int sset_id sideset id
+* int num_faces_this_sset number of faces in this sideset
+*
+* exit conditions -
+*
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expssv.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ */
+
+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)
+{
+ 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);
+}
diff --git a/cbind/src/exptim.c b/cbind/src/exptim.c
new file mode 100644
index 0000000..fade82a
--- /dev/null
+++ b/cbind/src/exptim.c
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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
+* int time_step time step number
+* float time_value simulation time at specified step
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: exptim.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <string.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the time value for a whole time step;
+ * assume the first time step is 1
+ */
+
+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);
+
+/* inquire previously defined variable */
+
+ if ((varid = ncvarid (exoid, var_name)) < 0)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate time variable in file id %d", exoid);
+ ex_err("ex_put_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+/* store time value */
+
+ start[0] = --time_step;
+
+ if (ncvarput1 (exoid, varid, start,
+ ex_conv_array(exoid,WRITE_CONVERT,time_value,1)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to store time value in file id %d", exoid);
+ ex_err("ex_put_time",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+
+
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exptt.c b/cbind/src/exptt.c
new file mode 100644
index 0000000..faea8c0
--- /dev/null
+++ b/cbind/src/exptt.c
@@ -0,0 +1,371 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvtt - ex_put_var_tab
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* char* type 'e', 'm', 's' element, nodeset, sideset
+* int num_blk number of blocks
+* int num_var number of variables
+* int* var_tab variable truth table array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: exptt.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * 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
+ * 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
+ */
+
+int ex_put_var_tab (int exoid,
+ const char *var_type,
+ int num_blk,
+ 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);
+}
diff --git a/cbind/src/expvan.c b/cbind/src/expvan.c
new file mode 100644
index 0000000..7bf3880
--- /dev/null
+++ b/cbind/src/expvan.c
@@ -0,0 +1,192 @@
+/*
+ * 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_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
+* char* var_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 -
+*
+* $Id: expvan.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#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
+ */
+
+int ex_put_var_names (int exoid,
+ const char *var_type,
+ 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);
+
+}
diff --git a/cbind/src/expvar.c b/cbind/src/expvar.c
new file mode 100644
index 0000000..b951265
--- /dev/null
+++ b/cbind/src/expvar.c
@@ -0,0 +1,384 @@
+/*
+ * 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 num_entries_this_obj number of entries in this block/set
+*
+* exit conditions -
+*
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expvar.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#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
+ */
+
+int ex_put_var (int exoid,
+ int time_step,
+ int 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;
+ 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); \
+ } \
+ }
+
+ 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);
+
+ return (EX_WARN);
+ }
+ /* inquire previously defined variable */
+
+ if ((varid = ncvarid (exoid, VAR_GLO_VAR)) == -1) {
+ if (ncerr == NC_ENOTVAR) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: no global variables defined in file id %d",
+ exoid);
+ ex_err("ex_put_glob_vars",errmsg,exerrval);
+ } else {
+ exerrval = ncerr;
+ 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_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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ break;
+ default:
+ exerrval = EX_MSG;
+ sprintf( errmsg, "Error: invalid variable type (%d) specified for file id %d",
+ var_type, exoid );
+ ex_err( "ex_put_var", errmsg, exerrval );
+ return (EX_FATAL);
+ }
+/* store element variable values */
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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_entries_this_obj;
+
+ if (ncvarput (exoid, varid, start, count,
+ ex_conv_array(exoid,WRITE_CONVERT,var_vals,
+ num_entries_this_obj)) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to store %s variable %d in file id %d",
+ tname,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);
+ }
+ return (EX_FATAL);
+}
diff --git a/cbind/src/expvnm.c b/cbind/src/expvnm.c
new file mode 100644
index 0000000..8aea166
--- /dev/null
+++ b/cbind/src/expvnm.c
@@ -0,0 +1,177 @@
+/*
+ * 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_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
+* char* var_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 -
+*
+* $Id: expvnm.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+#include <string.h>
+#include <ctype.h>
+
+/*!
+ * writes the name of a particular results variable to the database
+ */
+
+int ex_put_var_name (int exoid,
+ const char *var_type,
+ 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);
+}
diff --git a/cbind/src/expvp.c b/cbind/src/expvp.c
new file mode 100644
index 0000000..8f31439
--- /dev/null
+++ b/cbind/src/expvp.c
@@ -0,0 +1,384 @@
+/*
+ * 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
+*
+* 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
+* char* var_type variable type G,N, or E
+* int* num_vars number of variables in database
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expvp.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#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
+ */
+
+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);
+}
diff --git a/cbind/src/expvpa.c b/cbind/src/expvpa.c
new file mode 100644
index 0000000..be15554
--- /dev/null
+++ b/cbind/src/expvpa.c
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvp - ex_put_all_var_param
+*
+* 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* elem_var_tab element variable truth table array
+* int num_m nodeset variable count
+* int* nset_var_tab nodeset variable truth table array
+* int num_s sideset variable count
+* int* sset_var_tab sideset variable truth table array
+*
+* exit conditions -
+*
+* $Id: expvpa.c,v 1.3 2006/11/28 14:02:06 gdsjaar Exp $
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the number of global, nodal, element, nodeset, and sideset variables
+ * that will be written to the database
+ */
+
+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)
+{
+ ex_var_params vparam;
+
+ vparam.num_glob = num_g;
+ vparam.num_node = num_n;
+ vparam.num_edge = 0;
+ vparam.edge_var_tab = 0;
+ vparam.num_face = 0;
+ vparam.face_var_tab = 0;
+ vparam.num_elem = num_e;
+ vparam.elem_var_tab = elem_var_tab;
+ vparam.num_nset = num_m;
+ vparam.nset_var_tab = nset_var_tab;
+ vparam.num_eset = 0;
+ vparam.eset_var_tab = 0;
+ vparam.num_fset = 0;
+ vparam.fset_var_tab = 0;
+ vparam.num_sset = num_s;
+ vparam.sset_var_tab = sset_var_tab;
+ vparam.num_elset = 0;
+ vparam.elset_var_tab = 0;
+
+ return ex_put_all_var_param_ext( exoid, &vparam );
+}
diff --git a/cbind/src/expvpax.c b/cbind/src/expvpax.c
new file mode 100644
index 0000000..e823339
--- /dev/null
+++ b/cbind/src/expvpax.c
@@ -0,0 +1,585 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvp - ex_put_all_var_param_ext
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* const ex_var_params* vp pointer to variable parameter info
+*
+* exit conditions -
+*
+* $Id: expvpax.c,v 1.2 2006/11/28 14:02:06 gdsjaar Exp $
+*****************************************************************************/
+
+#include <stdlib.h>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#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,
+ 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,
+ int *var_tab, int *status, int *ids, const char *label);
+
+/*!
+ * writes the number of global, nodal, element, nodeset, and sideset variables
+ * that will be written to the database
+ */
+
+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 numelblkdim, numelvardim, numedvardim, numedblkdim,
+ 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;
+
+ int* eblk_ids = 0;
+ int* edblk_ids = 0;
+ int* fablk_ids = 0;
+ int* nset_ids = 0;
+ int* eset_ids = 0;
+ int* fset_ids = 0;
+ 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 dims[3];
+ char errmsg[MAX_ERR_LENGTH];
+ const char* routine = "ex_put_all_var_param_ext";
+
+ exerrval = 0; /* clear error code */
+
+ /* 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_all_var_param_ext",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ if ((num_nod_dim = ncdimid (exoid, DIM_NUM_NODES)) == -1) {
+ if (vp->num_node > 0) {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to locate number of nodes in file id %d",
+ exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ goto error_ret;
+ }
+ }
+
+ /* Check this now so we can use it later without checking for errors */
+ 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_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);
+ EX_GET_IDS_STATUS( "node set",vp->num_nset, DIM_NUM_NS, numnsetdim, num_nset, nset_ids,EX_NODE_SET, VAR_NS_STAT, nset_stat);
+ EX_GET_IDS_STATUS( "edge set",vp->num_eset, DIM_NUM_ES, numesetdim, num_eset, eset_ids,EX_EDGE_SET, VAR_ES_STAT, eset_stat);
+ EX_GET_IDS_STATUS( "face set",vp->num_fset, DIM_NUM_FS, numfsetdim, num_fset, fset_ids,EX_FACE_SET, VAR_FS_STAT, fset_stat);
+ EX_GET_IDS_STATUS( "side set",vp->num_sset, DIM_NUM_SS, numssetdim, num_sset, sset_ids,EX_SIDE_SET, VAR_SS_STAT, sset_stat);
+ 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;
+ }
+ in_define = 1;
+
+ /* define dimensions and variables */
+
+ if (vp->num_glob > 0)
+ {
+ dimid = define_dimension(exoid, DIM_NUM_GLO_VAR, vp->num_glob, "global");
+ if (dimid == -1) goto error_ret;
+
+
+ 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 */
+ }
+ }
+ }
+
+ /* Now define nodal variable name variable */
+ if (define_variable_name_variable(exoid, VAR_NAME_NOD_VAR, dimid, "nodal") == -1)
+ 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); \
+ \
+ /* 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, \
+ "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 */ \
+ } \
+ }
+ 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);
+ EX_DEFINE_VARS(EX_ELEM_BLOCK,"element","element block",vp->num_elem, DIM_NUM_ELE_VAR, numelblkdim,numelvardim,num_elem_blk, eblk_ids,VAR_NAME_ELE_VAR, VAR_ELEM_TAB, eblk_stat,vp->elem_var_tab,eblk_varid);
+ EX_DEFINE_VARS(EX_NODE_SET, "nodeset", "node set",vp->num_nset, DIM_NUM_NSET_VAR, numnsetdim, nsetvardim, num_nset, nset_ids,VAR_NAME_NSET_VAR, VAR_NSET_TAB, nset_stat,vp->nset_var_tab, nset_varid);
+ EX_DEFINE_VARS(EX_EDGE_SET, "edgeset", "edge set",vp->num_eset, DIM_NUM_ESET_VAR, numesetdim, esetvardim, num_eset, eset_ids,VAR_NAME_ESET_VAR, VAR_ESET_TAB, eset_stat,vp->eset_var_tab, eset_varid);
+ EX_DEFINE_VARS(EX_FACE_SET, "faceset", "face set",vp->num_fset, DIM_NUM_FSET_VAR, numfsetdim, fsetvardim, num_fset, fset_ids,VAR_NAME_FSET_VAR, VAR_FSET_TAB, fset_stat,vp->fset_var_tab, fset_varid);
+ EX_DEFINE_VARS(EX_SIDE_SET, "sideset", "side set",vp->num_sset, DIM_NUM_SSET_VAR, numssetdim, ssetvardim, num_sset, sset_ids,VAR_NAME_SSET_VAR, VAR_SSET_TAB, sset_stat,vp->sset_var_tab, sset_varid);
+ EX_DEFINE_VARS(EX_ELEM_SET, "elemset", "element set",vp->num_elset,DIM_NUM_ELSET_VAR,numelsetdim,elsetvardim,num_elset, elset_ids,VAR_NAME_ELSET_VAR,VAR_ELSET_TAB,elset_stat,vp->elset_var_tab,elset_varid);
+
+ /* leave define mode */
+
+ in_define = 0;
+ if (ncendef (exoid) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to complete definition in file id %d",
+ exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ goto error_ret;
+ }
+
+ /* 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 (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 (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 (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 (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 (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 (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 (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;
+ }
+
+ return(EX_NOERR);
+
+ /* Fatal error: exit definition mode and return */
+ error_ret:
+ if (in_define == 1) {
+ if (ncendef (exoid) == -1) /* exit define mode */
+ {
+ sprintf(errmsg,
+ "Error: failed to complete definition for file id %d",
+ exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ }
+ }
+ safe_free(eblk_ids);
+ safe_free(edblk_ids);
+ safe_free(fablk_ids);
+ safe_free(nset_ids);
+ safe_free(eset_ids);
+ safe_free(fset_ids);
+ safe_free(sset_ids);
+ safe_free(elset_ids);
+
+ safe_free(eblk_stat);
+ safe_free(edblk_stat);
+ safe_free(fablk_stat);
+ safe_free(nset_stat);
+ safe_free(eset_stat);
+ safe_free(fset_stat);
+ safe_free(sset_stat);
+ safe_free(elset_stat);
+ return(EX_FATAL);
+}
+
+int define_dimension(int exoid, const char *DIMENSION, int count, const char *label)
+{
+ char errmsg[MAX_ERR_LENGTH];
+ int dimid = 0;
+ if ((dimid = ncdimdef (exoid, DIMENSION, (long)count)) == -1) {
+ if (ncerr == NC_ENAMEINUSE) {
+ exerrval = ncerr;
+ 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;
+}
+
+int define_variable_name_variable(int exoid, const char *VARIABLE, long dimension, const char *label)
+{
+ char errmsg[MAX_ERR_LENGTH];
+ int dims[2];
+ int variable;
+
+ dims[0] = dimension;
+ dims[1] = ncdimid(exoid, DIM_STR); /* Checked earlier, so known to exist */
+
+ if ((variable = ncvardef (exoid, VARIABLE, NC_CHAR, 2, dims)) == -1) {
+ if (ncerr == NC_ENAMEINUSE) {
+ exerrval = ncerr;
+ 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;
+ 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;
+}
+
+nclong *get_status_array(int exoid, long var_count, const char *VARIABLE, const char *label)
+{
+ char errmsg[MAX_ERR_LENGTH];
+ int varid;
+ long start[2], count[2];
+ nclong *stat_vals = NULL;
+
+ if (!(stat_vals = malloc(var_count*sizeof(nclong)))) {
+ exerrval = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate memory for %s status array for file id %d",
+ label, exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ return (NULL);
+ }
+
+ /* get variable id of status array */
+ if ((varid = ncvarid (exoid, VARIABLE)) != -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] = var_count;
+ count[1] = 0;
+
+ if (ncvarget (exoid, varid, start, count, (void *)stat_vals) == -1) {
+ exerrval = ncerr;
+ stat_vals = safe_free(stat_vals);
+ sprintf(errmsg,
+ "Error: failed to get %s status array from file id %d",
+ label, exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ return (NULL);
+ }
+ } else {
+ /* status array doesn't exist (V2.00), dummy one up for later checking */
+ int i;
+ for(i=0; i<var_count; i++)
+ stat_vals[i] = 1;
+ }
+ return stat_vals;
+}
+
+void *safe_free(void *array)
+{
+ if (array != 0) free(array);
+ return 0;
+}
+
+int put_truth_table(int exoid, int num_blk, int num_var, 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;
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to store %s variable truth table in file id %d",
+ label, exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg,exerrval);
+ }
+ 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)
+{
+ char errmsg[MAX_ERR_LENGTH];
+ int k = 0;
+ int i, j;
+ int time_dim;
+ int dims[2];
+ int varid;
+
+ time_dim = ncdimid (exoid, DIM_TIME);
+
+ if (var_tab == NULL) {
+ exerrval = EX_NULLENTITY;
+ sprintf(errmsg,
+ "Error: %s variable truth table is NULL in file id %d", label, exoid);
+ ex_err("ex_put_all_var_param_ext",errmsg, exerrval);
+ return -1;
+ }
+
+ for (i=0; i<num_ent; i++) {
+ for (j=1; j<=num_var; j++) {
+
+ /* 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 */
+ 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;
+ 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;
+ }
+
+ /* 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
+ */
+ 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;
+ 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;
+ }
+ }
+ }
+ } /* if */
+ k++; /* increment truth table pointer */
+ } /* for j */
+ } /* for i */
+ return 0;
+}
diff --git a/cbind/src/expvpc.c b/cbind/src/expvpc.c
new file mode 100644
index 0000000..0d63386
--- /dev/null
+++ b/cbind/src/expvpc.c
@@ -0,0 +1,75 @@
+/*
+ * 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_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* 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>
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+#include <ctype.h>
+/*!
+ * writes the number of global, nodal, and element variables
+ * that will be written to the database
+ */
+
+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)
+{
+ 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
new file mode 100644
index 0000000..623d349
--- /dev/null
+++ b/cbind/src/expvtt.c
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expvtt - ex_put_elem_var_tab
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_elem_blk number of element blocks
+* int num_elem_var number of element variables
+* int* elem_var_tab element variable truth table array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expvtt.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the EXODUS II element variable truth table to the database;
+ * also, creates netCDF variables in which to store EXODUS II element
+ * variable values; although this table isn't required (because the
+ * netCDF variables can also be created in ex_put_elem_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 element variable values variables are
+ * defined in ex_put_elem_var
+ */
+
+int ex_put_elem_var_tab (int exoid,
+ int num_elem_blk,
+ int num_elem_var,
+ int *elem_var_tab)
+{
+ return ex_put_var_tab(exoid, "E", num_elem_blk, num_elem_var, elem_var_tab);
+}
diff --git a/cbind/src/expvv.c b/cbind/src/expvv.c
new file mode 100644
index 0000000..c831bfb
--- /dev/null
+++ b/cbind/src/expvv.c
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* expnv - ex_put_varid_var
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int time_step whole time step number
+* int varid id of variable on exodus database
+* int num_entity number of entities for this variable
+* float* var_vals array of nodal variable values
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expvv.c,v 1.4 2006/11/28 14:02:06 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * writes the values of a single variable at one time step in the
+ * database; assume the first time index is 1. Access based on the
+ * passed in 'varid'
+ *
+ * NOTE: If used for nodal variables, it must be an ex_large_model == 1
+ * \param exoid int exodus file id
+ * \param time_step int whole time step number
+ * \param varid int id of variable on exodus database
+ * \param num_entity int number of entities for this variable
+ * \param var_vals float* array of nodal variable values
+ */
+
+int ex_put_varid_var(int exoid,
+ int time_step,
+ int varid,
+ int num_entity,
+ const void *var_vals)
+{
+ long start[3], count[3];
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ start[0] = --time_step;
+ start[1] = 0;
+
+ 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;
+ sprintf(errmsg,
+ "Error: failed to store variables with varid %d in file id %d",
+ varid, exoid);
+ ex_err("ex_put_varid_var",errmsg,exerrval);
+ return (EX_FATAL);
+ }
+ return (EX_NOERR);
+}
diff --git a/cbind/src/exupda.c b/cbind/src/exupda.c
new file mode 100644
index 0000000..a5dca97
--- /dev/null
+++ b/cbind/src/exupda.c
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+/*!
+ * updates an opened EXODUS II file (or EXODUS II history file)
+ */
+
+int ex_update (int exoid)
+{
+ char errmsg[MAX_ERR_LENGTH];
+
+ exerrval = 0; /* clear error code */
+
+ if (ncsync(exoid) == -1)
+ {
+ exerrval = ncerr;
+ sprintf(errmsg,
+ "Error: failed to update file id %d",
+ 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
new file mode 100644
index 0000000..03ec8fd
--- /dev/null
+++ b/cbind/test/CMakeLists.txt
@@ -0,0 +1,77 @@
+SET( cbind_TEST_SRCS
+ CreateEdgeFace.c
+ ReadEdgeFace.c
+)
+
+# Always report error/warning messages during testing:
+# The ex_opts call precipitates the EXTRA_INCLUDE below.
+SET( CMAKE_TESTDRIVER_BEFORE_TESTMAIN
+ " ex_opts( EX_VERBOSE );\n"
+)
+CREATE_TEST_SOURCELIST( ExoIICTests
+ ExoIICTests.cxx
+ ${cbind_TEST_SRCS}
+ EXTRA_INCLUDE exodusII_test.h
+ )
+
+ADD_EXECUTABLE( ExoIICTests ${ExoIICTests} )
+TARGET_LINK_LIBRARIES( ExoIICTests exoIIc )
+
+SET( TestsToRun ${ExoIICTests} )
+REMOVE( TestsToRun ExoIICTests.cxx )
+
+FOREACH( test ${TestsToRun} )
+ GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
+ ADD_TEST( ${TName} ${EXECUTABLE_OUTPUT_PATH}/ExoIICTests ${TName} )
+ENDFOREACH( test )
+ADD_TEST( CreateEdgeFaceWithConcats ${EXECUTABLE_OUTPUT_PATH}/ExoIICTests CreateEdgeFace -pcab -pcset -pvpax )
+ADD_TEST( ReadEdgeFaceWithConcats ${EXECUTABLE_OUTPUT_PATH}/ExoIICTests ReadEdgeFace )
+
+# ===============================================
+
+SET( cbind_OLDTESTS
+ testwt
+ testwtd
+ testrd
+ testrd1
+ testrdd
+ testwt1
+ testwt2
+ testwtm
+ testwt_ss
+ testwt_nossnsdf
+ testrd_ss
+ testrdwt
+ testcp
+ testcp_ln
+ testcp_nl
+ testcpd
+ testwt_clb
+ testwt_nc
+ testrd_nc
+ testwt-zeroe
+ testwt-zeron
+ testrdv
+ testwt-one-attrib
+ create_mesh
+ rd_wt_mesh
+)
+
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/testall.in
+ ${CMAKE_CURRENT_BINARY_DIR}/testall
+ @ONLY
+)
+
+FOREACH ( testName ${cbind_OLDTESTS} )
+ ADD_EXECUTABLE( ${testName} ${testName}.c )
+ TARGET_LINK_LIBRARIES( ${testName} exoIIc )
+ENDFOREACH ( testName )
+
+#SET( EXECUTABLE_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} )
+ADD_CUSTOM_TARGET( check
+ COMMAND /bin/csh ${CMAKE_CURRENT_BINARY_DIR}/testall
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${cbind_OLDTESTS}
+)
+
diff --git a/cbind/test/CVS/Entries b/cbind/test/CVS/Entries
new file mode 100644
index 0000000..de4f277
--- /dev/null
+++ b/cbind/test/CVS/Entries
@@ -0,0 +1,59 @@
+/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//
+/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//
+/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//
+/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//
+D
diff --git a/cbind/test/CVS/Repository b/cbind/test/CVS/Repository
new file mode 100644
index 0000000..b1f01b6
--- /dev/null
+++ b/cbind/test/CVS/Repository
@@ -0,0 +1 @@
+exodusii/cbind/test
diff --git a/cbind/test/CVS/Root b/cbind/test/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/cbind/test/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/cbind/test/CreateEdgeFace.c b/cbind/test/CreateEdgeFace.c
new file mode 100644
index 0000000..3ed2255
--- /dev/null
+++ b/cbind/test/CreateEdgeFace.c
@@ -0,0 +1,601 @@
+#include "exodusII.h"
+#include <stdio.h>
+#include <string.h>
+
+#define EX_TEST_FILENAME "edgeFace.exo"
+
+/* ======== Coordinates and connectivity ========= */
+double coordsX[] = {
+ 0., 0., 0., 0.,
+ 3., 3., 3., 3.,
+ -3., -3., -3., -3.
+};
+
+double coordsY[] = {
+ -1., 1., 1., -1.,
+ -3., 3., 3., -3.,
+ -3., 3., 3., -3.
+};
+
+double coordsZ[] = {
+ -1., -1., 1., 1.,
+ -3., -3., 3., 3.,
+ -3., -3., 3., 3.
+};
+
+char* coordsNames[] = { "X", "Y", "Z" };
+
+int conn1[] = {
+ 1, 2, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 1, 2, 3, 4
+};
+
+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
+};
+
+int fconn1[] = {
+ 4, 5, 7, 6, 3, 2,
+ 8, 9, 11, 10, 1, 3
+};
+
+int ebconn1[] = {
+ 1, 2,
+ 2, 3,
+ 3, 4,
+ 4, 1,
+ 5, 6,
+ 6, 7,
+ 7, 8,
+ 8, 5,
+ 1, 5,
+ 2, 6,
+ 4, 8,
+ 3, 7,
+ 9, 10,
+ 10, 11,
+ 11, 12,
+ 12, 9,
+ 9, 1,
+ 10, 2,
+ 12, 4,
+ 11, 3
+};
+
+int fbconn1[] = {
+ 12, 11, 10, 9,
+ 5, 6, 7, 8
+};
+
+int fbconn2[] = {
+ 1, 2, 3, 4
+};
+
+int fbconn3[] = {
+ 1, 5, 6, 2,
+ 3, 7, 8, 4,
+ 2, 6, 7, 3,
+ 4, 8, 5, 1,
+ 9, 1, 2, 10,
+ 11, 3, 4, 12,
+ 10, 2, 3, 11,
+ 12, 4, 1, 9
+};
+
+int nmap1[] = {
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+};
+
+int edmap1[] = {
+ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
+};
+
+int famap1[] = {
+ 2, 1, 4, 3, 6, 5, 7, 8, 9, 10, 11
+};
+
+int emap1[] = {
+ 1, 2
+};
+
+char* eblk_names[] = { "Eli WALLACH" };
+char* edblk_names[] = { "Aldo GIUFFRE" };
+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" };
+
+/* ======== Sets ========= */
+int nset_nodes[] = {
+ 5, 6, 9
+};
+
+int eset_edges[] = {
+ 1, 2, 4, 15, 19, 20
+};
+
+int eset_orient[] = {
+ +1, +1, +1, +1, +1, -1
+};
+
+double eset_df[] = {
+ 2., 2., 0.5, 0.5, 1., 1.
+};
+
+int fset_faces[] = {
+ 3, 9
+};
+
+int fset_orient[] = {
+ +1, -1
+};
+
+int sset_elems[] = {
+ 1, 1, 1, 2, 2
+};
+
+int sset_sides[] = {
+ 1, 3, 5, 2, 4
+};
+
+int elset_elems[] = {
+ 1,
+ 2
+};
+
+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" };
+
+/* ======== Attributes ========= */
+char* edge_attr_names1[] = {"Sergio LEONE"};
+
+char* face_attr_names1[] = {"GOOD"};
+char* face_attr_names2[] = {"BAD"};
+char* face_attr_names3[] = {"UGLY"};
+
+char* elem_attr_names1[] = {
+ "SPAGHETTI",
+ "WESTERN"
+};
+
+double edge_attr_values1[] = {
+ 1., 2., 3., 5., 7., 11., 13., 17., 19., 23.,
+ 29., 31., 37., 41., 43., 47., 53., 59., 61., 67.
+};
+
+double face_attr_values1[] = {
+ 71., 73.
+};
+
+double face_attr_values2[] = {
+ 79.
+};
+
+double face_attr_values3[] = {
+ 83., 89., 97., 101., 103., 107., 109., 113.
+};
+
+double elem_attr_values1[] = {
+ 127., 101.,
+ 137., 139.
+};
+
+/* ======== Results variables ========= */
+/* (2 time steps) */
+
+double vals_glo_var[2][2] = {
+ { 36., 37. },
+ { 42., 43. }
+};
+
+double vals_nod_var[2][12] = {
+ { 0.1, 0.8, 0.0, 0.4, 0.3, 0.9, 0.8, 0.5, 0.3, 0.7, 0.4, 0.6 },
+ { 0.7, 0.5, 0.3, 0.5, 0.2, 0.7, 0.9, 0.8, 0.0, 0.2, 0.3, 0.5 }
+} ;
+
+
+double vals_edge_var1eb1[2][20] = {
+ { 20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2., 1. },
+ { 21., 20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2. }
+};
+
+double vals_edge_var2eb1[2][20] = {
+ { 1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2. },
+ { 1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2. }
+};
+
+double vals_face_var1fb1[2][2] = {
+ { 0, 1 },
+ { 2, 0 }
+};
+
+double vals_face_var1fb3[2][8] = {
+ { 1, 0, 2, 0, 3, 0, 4, 0 },
+ { 0, 1, 0, 2, 0, 3, 0, 4 }
+};
+
+double vals_elem_var1eb1[2][2] = {
+ { 8, 8 },
+ { 0, -8 }
+};
+
+double vals_fset_var1fs1[2][2] = {
+ { 1., 3. },
+ { 9., 27. }
+};
+
+#define EXCHECK(funcall,errmsg)\
+ if ( (funcall) < 0 ) \
+ { \
+ fprintf( stderr, errmsg ); \
+ return 1; \
+ }
+
+int ex_have_arg( int argc, char* argv[], const char* aname )
+{
+ int i;
+ for ( i = 0; i < argc; ++i )
+ if ( ! strcmp( argv[i], aname ) )
+ return 1;
+ return 0;
+}
+
+int cCreateEdgeFace( int argc, char* argv[] )
+{
+ int exoid;
+ int appWordSize = 8;
+ int diskWordSize = 8;
+ int concatBlocks = ex_have_arg( argc, argv, "-pcab" );
+ int concatSets = ex_have_arg( argc, argv, "-pcset" );
+ int concatResult = ex_have_arg( argc, argv, "-pvpax" );
+ double t;
+
+ ex_init_params modelParams = {
+ "CreateEdgeFace Test", /* title */
+ 3, /* num_dim */
+ 12, /* num_nodes */
+ 20, /* num_edge */
+ 1, /* num_edge_blk */
+ 11, /* num_face */
+ 3, /* num_face_blk */
+ 2, /* num_elem */
+ 1, /* num_elem_blk */
+ 1, /* num_node_sets */
+ 1, /* num_edge_sets */
+ 1, /* num_face_sets */
+ 1, /* num_side_sets */
+ 2, /* num_elem_sets */
+ 1, /* num_node_map */
+ 1, /* num_edge_map */
+ 1, /* num_face_map */
+ 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 */
+ };
+
+ 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;
+ }
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_init_ext( exoid, &modelParams ),
+ "Unable to initialize database.\n" );
+
+ /* *** NEW API *** */
+ if ( concatBlocks ) {
+ EXCHECK( ex_put_concat_all_blocks( exoid, &blockParams ),
+ "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" );
+ }
+ 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" );
+ }
+ 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" );
+ }
+ }
+
+ EXCHECK( ex_put_coord( exoid, (void*)coordsX, (void*)coordsY, (void*)coordsZ ),
+ "Unable to write coordinates.\n" );
+
+ EXCHECK( ex_put_coord_names( exoid, 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" );
+
+ /* *** 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" );
+ EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, blockParams.face_blk_id[1], fbconn2, 0, 0 ),
+ "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" );
+
+ /* *** 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" );
+
+ /* *** 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" );
+
+ /* =============== Number Maps ================== */
+ /* *** NEW API *** */
+ EXCHECK( ex_put_num_map( exoid, EX_NODE_MAP, 300, nmap1 ), "Unable to write node map.\n" );
+ EXCHECK( ex_put_num_map( exoid, EX_EDGE_MAP, 800, edmap1 ), "Unable to write edge map.\n" );
+ EXCHECK( ex_put_num_map( exoid, EX_FACE_MAP, 900, famap1 ), "Unable to write face map.\n" );
+ 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" );
+
+ /* =============== 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" );
+
+ /* *** 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" );
+
+ /* *** 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" );
+
+ /* =============== 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" );
+
+ /* *** 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" );
+ 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" );
+ 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" );
+
+ /* *** 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" );
+
+ /* =============== 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" );
+
+ 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
+ };
+ 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
+ };
+ 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
+ };
+ 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
+ };
+ 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
+ };
+ EXCHECK( ex_put_concat_sets( exoid, EX_ELEM_SET, &setParams ), "Unable to write element sets.\n" );
+
+ } else {
+ /* *** NEW API *** */
+ EXCHECK( ex_put_set_param( exoid, EX_NODE_SET, 1000, 3, 0 ), "Unable to write node set params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_NODE_SET, 1000, nset_nodes, 0 ), "Unable to write node set.\n" );
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_set_param( exoid, EX_EDGE_SET, 1200, 6, 6 ), "Unable to write edge set params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_EDGE_SET, 1200, eset_edges, eset_orient ), "Unable to write edge set.\n" );
+ EXCHECK( ex_put_set_dist_fact( exoid, EX_EDGE_SET, 1200, eset_df ), "Unable to write edge set dist factors.\n" );
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_set_param( exoid, EX_FACE_SET, 1400, 2, 0 ), "Unable to write face set params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_FACE_SET, 1400, fset_faces, fset_orient ), "Unable to write face set.\n" );
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_set_param( exoid, EX_SIDE_SET, 1600, 5, 0 ), "Unable to write side set params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_SIDE_SET, 1600, sset_elems, sset_sides ), "Unable to write side set.\n" );
+
+ /* *** NEW API *** */
+ EXCHECK( ex_put_set_param( exoid, EX_ELEM_SET, 1800, 1, 0 ), "Unable to write element set 1 params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_ELEM_SET, 1800, elset_elems + 0, 0 ), "Unable to write element set 1.\n" );
+ EXCHECK( ex_put_set_param( exoid, EX_ELEM_SET, 1900, 1, 0 ), "Unable to write element set 2 params.\n" );
+ EXCHECK( ex_put_set( exoid, EX_ELEM_SET, 1900, elset_elems + 1, 0 ), "Unable to write element set 2.\n" );
+ }
+
+ /* =============== Result variable params ========= */
+ /* *** NEW API *** */
+ if ( concatResult ) {
+ EXCHECK( ex_put_all_var_param_ext( exoid, &varParams ),
+ "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" );
+ EXCHECK( ex_put_var_param( exoid, "N", 1 ),
+ "Unable to write nodal result variable parameters.\n" );
+ EXCHECK( ex_put_var_param( exoid, "E", 1 ),
+ "Unable to write element result variable parameters.\n" );
+ EXCHECK( ex_put_var_param( exoid, "L", 2 ),
+ "Unable to write edge result variable parameters.\n" );
+ EXCHECK( ex_put_var_param( exoid, "F", 1 ),
+ "Unable to write face result variable parameters.\n" );
+ EXCHECK( ex_put_var_param( exoid, "A", 1 ),
+ "Unable to write faceset result variable parameters.\n" );
+ }
+
+ /* =============== Result variable names ========== */
+ /* *** NEW API *** */
+ EXCHECK( ex_put_var_name( exoid, "G", 1, "CALIBER" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "g", 2, "GUNPOWDER" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "N", 1, "RHO" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "l", 1, "GAMMA1" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "L", 2, "GAMMA2" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "f", 1, "PHI" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "E", 1, "EPSTRN" ), "Unable to write variable name.\n" );
+ EXCHECK( ex_put_var_name( exoid, "A", 1, "PHI0" ), "Unable to write variable name.\n" );
+
+ /* =============== Result variable values ========= */
+ t = 1.;
+ /* *** NEW API *** */
+ EXCHECK( ex_put_time( exoid, 1, &t ), "Unable to write time value.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_GLOBAL, 1, 0/*N/A*/, 2, vals_glo_var[0] ), "Unable to write global var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[0] ), "Unable to write edge block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0] ), "Unable to write edge block 1 var 2.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[0] ), "Unable to write face block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0] ), "Unable to write face block 3 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0] ), "Unable to write elem block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0] ), "Unable to write face set 1 var 1.\n" );
+
+ t = 2.;
+ EXCHECK( ex_put_time( exoid, 2, &t ), "Unable to write time value.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_GLOBAL, 1, 0/*N/A*/, 2, vals_glo_var[1] ), "Unable to write global var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[1] ), "Unable to write edge block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1] ), "Unable to write edge block 1 var 2.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[1] ), "Unable to write face block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1] ), "Unable to write face block 3 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1] ), "Unable to write elem block 1 var 1.\n" );
+ EXCHECK( ex_put_var( exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1] ), "Unable to write face set 1 var 1.\n" );
+
+ EXCHECK( ex_put_nodal_var( exoid, 1, 1, 12, vals_nod_var[0] ), "Unable to write nodal var 1.\n" );
+ 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" );
+
+ return 0;
+}
+
+int main( int argc, char* argv[] )
+{
+ return cCreateEdgeFace(argc, argv);
+}
diff --git a/cbind/test/Imakefile b/cbind/test/Imakefile
new file mode 100644
index 0000000..6055d14
--- /dev/null
+++ b/cbind/test/Imakefile
@@ -0,0 +1,88 @@
+### 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.
+###
+
+### Imakefile ---
+
+INCLUDES = -I../include
+
+EXOIITEST = -L../.. -lexoIIv2c
+LOCALEXO = ../../libexoIIv2c.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 \
+ CreateEdgeFace ReadEdgeFace
+
+all:: check
+
+NormalProgramTarget(testwt, testwt.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt_clb,testwt_clb.o,$(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwtd, testwtd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrd, testrd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrd1, testrd1.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrdd, testrdd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrdv, testrdv.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt1, testwt1.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt2, testwt2.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwtm, testwtm.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt_ss, testwt_ss.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt_nossnsdf, testwt_nossnsdf.o, $(LOCALEXO), /**/, $(LIBS))
+
+NormalProgramTarget(testrd_ss, testrd_ss.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testrdwt, testrdwt.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testcp, testcp.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testcpd, testcpd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testcp_nl ,testcp_nl.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testcp_ln ,testcp_ln.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(testwt_nc, testwt_nc.o, $(LOCALEXO), /**/, $(LIBS))
+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(create_mesh, create_mesh.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(rd_wt_mesh, rd_wt_mesh.o, $(LOCALEXO), /**/, $(LIBS))
+
+NormalProgramTarget(CreateEdgeFace, CreateEdgeFace.o, $(LOCALEXO), /**/, $(LIBS))
+NormalProgramTarget(ReadEdgeFace, ReadEdgeFace.o, $(LOCALEXO), /**/, $(LIBS))
+
+test: check
+check: $(PROGS)
+ csh -f ./testall
+
+ExtraStuffToClean(*.res)
+ExtraStuffToClean(*.exo)
+ExtraStuffToClean(test.output)
diff --git a/cbind/test/Makefile.standalone b/cbind/test/Makefile.standalone
new file mode 100644
index 0000000..10738bd
--- /dev/null
+++ b/cbind/test/Makefile.standalone
@@ -0,0 +1,145 @@
+# 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.
+#
+
+EXOIITEST = -L../.. -lexoIIv2c
+LOCALEXO = ../../libexoIIv2c.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
+
+all:: check
+
+testwt: testwt.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt.o $(LDFLAGS) $(LIBS)
+
+testwt_clb: testwt_clb.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt_clb.o $(LDFLAGS) $(LIBS)
+
+testwtd: testwtd.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwtd.o $(LDFLAGS) $(LIBS)
+
+testrd: testrd.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd.o $(LDFLAGS) $(LIBS)
+
+testrdv: testrdv.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrdv.o $(LDFLAGS) $(LIBS)
+
+testrd1: testrd1.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd1.o $(LDFLAGS) $(LIBS)
+
+testrdd: testrdd.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrdd.o $(LDFLAGS) $(LIBS)
+
+testwt1: testwt1.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt1.o $(LDFLAGS) $(LIBS)
+
+testwt2: testwt2.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt2.o $(LDFLAGS) $(LIBS)
+
+testwtm: testwtm.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwtm.o $(LDFLAGS) $(LIBS)
+
+testwt_ss: testwt_ss.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt_ss.o $(LDFLAGS) $(LIBS)
+
+testwt_nossnsdf: testwt_nossnsdf.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt_nossnsdf.o $(LDFLAGS) $(LIBS)
+
+testrd_ss: testrd_ss.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd_ss.o $(LDFLAGS) $(LIBS)
+
+testrdwt: testrdwt.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrdwt.o $(LDFLAGS) $(LIBS)
+
+testcp: testcp.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testcp.o $(LDFLAGS) $(LIBS)
+
+testcpd: testcpd.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testcpd.o $(LDFLAGS) $(LIBS)
+
+testwt_nc: testwt_nc.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt_nc.o $(LDFLAGS) $(LIBS)
+
+testrd_nc: testrd_nc.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testrd_nc.o $(LDFLAGS) $(LIBS)
+
+testwt-zeroe: testwt-zeroe.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt-zeroe.o $(LDFLAGS) $(LIBS)
+
+testwt-zeron: testwt-zeron.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt-zeron.o $(LDFLAGS) $(LIBS)
+
+testwt-one-attrib: testwt-one-attrib.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ testwt-one-attrib.o $(LDFLAGS) $(LIBS)
+
+create_mesh: create_mesh.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ create_mesh.o $(LDFLAGS) $(LIBS)
+
+rd_wt_mesh: rd_wt_mesh.o $(LOCALEXO)
+ $(CC) $(CFLAGS) -o $@ rd_wt_mesh.o $(LDFLAGS) $(LIBS)
+
+testcef: CreateEdgeFace.c $(LOCALEXO)
+ $(CC) $(CFLAGS) -DCreateEdgeFace=main -o $@ CreateEdgeFace.c $(LDFLAGS) $(LIBS)
+
+testref: ReadEdgeFace.c $(LOCALEXO)
+ $(CC) $(CFLAGS) -DReadEdgeFace=main -o $@ ReadEdgeFace.c $(LDFLAGS) $(LIBS)
+
+test: check
+check: $(PROGS)
+ csh ./testall
+
+clean::
+ rm -f *.res $(PROGS)
+
+clean::
+ rm -f *.exo
+
+clean::
+ rm -f test.output
+
+clean::
+ rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
+
+# ----------------------------------------------------------------------
+
+.SUFFIXES: .c
+.c.o:
+ $(CC) -c $(CFLAGS) $*.c
+
+# ----------------------------------------------------------------------
+# dependencies generated by makedepend or sfmakedepend
+
diff --git a/cbind/test/ReadEdgeFace.c b/cbind/test/ReadEdgeFace.c
new file mode 100644
index 0000000..90daefe
--- /dev/null
+++ b/cbind/test/ReadEdgeFace.c
@@ -0,0 +1,448 @@
+#include "exodusII.h"
+#include <stdio.h>
+#include <stdlib.h> /* for free() */
+#ifdef EXODUSII_HAVE_MALLOC_H
+# include <malloc.h>
+#endif /* EXODUSII_HAVE_MALLOC_H */
+
+#define EX_TEST_FILENAME "edgeFace.exo"
+
+#define EXCHECK(funcall,errmsg)\
+ if ( (funcall) < 0 ) \
+ { \
+ fprintf( stderr, errmsg ); \
+ return 1; \
+ }
+
+#define EXCHKPI(funcall,errmsg,sucmsg,ival)\
+ if ( (funcall) < 0 ) \
+ { \
+ fprintf( stderr, errmsg ); \
+ return 1; \
+ } else { \
+ fprintf( stdout, sucmsg, ival ); \
+ }
+
+int obj_types[] = {
+ EX_EDGE_BLOCK,
+ EX_FACE_BLOCK,
+ EX_ELEM_BLOCK,
+ EX_NODE_SET,
+ EX_EDGE_SET,
+ EX_FACE_SET,
+ EX_SIDE_SET,
+ EX_ELEM_SET,
+ EX_NODE_MAP,
+ EX_EDGE_MAP,
+ EX_FACE_MAP,
+ EX_ELEM_MAP
+};
+
+int obj_sizes[] = {
+ EX_INQ_EDGE_BLK,
+ EX_INQ_FACE_BLK,
+ EX_INQ_ELEM_BLK,
+ EX_INQ_NODE_SETS,
+ EX_INQ_EDGE_SETS,
+ EX_INQ_FACE_SETS,
+ EX_INQ_SIDE_SETS,
+ EX_INQ_ELEM_SETS,
+ EX_INQ_NODE_MAP,
+ EX_INQ_EDGE_MAP,
+ EX_INQ_FACE_MAP,
+ EX_INQ_ELEM_MAP,
+};
+
+const char* obj_typenames[] = {
+ " Edge block",
+ " Face block",
+ "Element block",
+ " Node set",
+ " Edge set",
+ " Face set",
+ " Side set",
+ " Element set",
+ " Node map",
+ " Edge map",
+ " Face map",
+ " Element map"
+};
+
+const char* obj_typestr[] = {
+ "L",
+ "F",
+ "E",
+ "M",
+ "D",
+ "A",
+ "S",
+ "T",
+ 0, /* maps have no result variables */
+ 0,
+ 0,
+ 0,
+};
+
+int obj_sizeinq[] = {
+ EX_INQ_EDGE,
+ EX_INQ_FACE,
+ EX_INQ_ELEM,
+ EX_INQ_NS_NODE_LEN,
+ EX_INQ_ES_LEN,
+ EX_INQ_FS_LEN,
+ EX_INQ_SS_ELEM_LEN,
+ EX_INQ_ELS_LEN,
+ -1,
+ -1,
+ -1,
+ -1
+};
+
+#define OBJECT_IS_BLOCK(i) ((i>=0)&&(i<3))
+#define OBJECT_IS_SET(i) ((i>2)&&(i<8))
+
+int cReadEdgeFace( int argc, char* argv[] )
+{
+ int exoid;
+ int appWordSize = 8;
+ int diskWordSize = 8;
+ float exoVersion;
+ int itmp[5];
+ int* ids;
+ int nids;
+ int obj;
+ int i, j;
+ int num_timesteps;
+ int ti;
+ char** obj_names;
+ char** var_names;
+ int have_var_names;
+ int num_vars; /* number of variables per object */
+ int num_entries; /* number of values per variable per object */
+ double* entry_vals; /* variable values for each entry of an object */
+ ex_init_params modelParams;
+
+ exoid = ex_open( EX_TEST_FILENAME, EX_READ, &appWordSize, &diskWordSize, &exoVersion );
+ if ( exoid <= 0 )
+ {
+ fprintf( stderr, "Unable to open \"%s\" for reading.\n", EX_TEST_FILENAME );
+ return 1;
+ }
+
+ EXCHECK( ex_get_init_ext( exoid, &modelParams ),
+ "Unable to read database parameters.\n" );
+
+ fprintf( stdout,
+ "Title: <%s>\n"
+ "Dimension: %d\n"
+ "Nodes: %d\n"
+ "Edges: %d\n"
+ "Faces: %d\n"
+ "Elements: %d\n"
+ "Edge Blocks: %d\n"
+ "Face Blocks: %d\n"
+ "Element Blocks: %d\n"
+ "Node Sets: %d\n"
+ "Edge Sets: %d\n"
+ "Face Sets: %d\n"
+ "Side Sets: %d\n"
+ "Element Sets: %d\n"
+ "Node Maps: %d\n"
+ "Edge Maps: %d\n"
+ "Face Maps: %d\n"
+ "Element Maps: %d\n",
+ modelParams.title, modelParams.num_dim,
+ modelParams.num_nodes, modelParams.num_edge, modelParams.num_face, modelParams.num_elem,
+ modelParams.num_edge_blk, modelParams.num_face_blk, modelParams.num_elem_blk,
+ modelParams.num_node_sets, modelParams.num_edge_sets, modelParams.num_face_sets,
+ modelParams.num_side_sets, modelParams.num_elem_sets,
+ modelParams.num_node_maps, modelParams.num_edge_maps, modelParams.num_face_maps,
+ modelParams.num_elem_maps );
+
+ /* *** NEW API *** */
+ EXCHKPI( ex_inquire( exoid, EX_INQ_EDGE, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_EDGE : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_EDGE_BLK, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_EDGE_BLK : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_EDGE_SETS, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_EDGE_SETS : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ES_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ES_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ES_DF_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ES_DF_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_EDGE_PROP, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_EDGE_PROP : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ES_PROP, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ES_PROP : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FACE, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FACE : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FACE_BLK, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FACE_BLK : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FACE_SETS, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FACE_SETS : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FS_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FS_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FS_DF_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FS_DF_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FACE_PROP, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FACE_PROP : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_FS_PROP, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_FS_PROP : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ELEM_SETS, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ELEM_SETS : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ELS_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ELS_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ELS_DF_LEN, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ELS_DF_LEN : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_ELS_PROP, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_ELS_PROP : %d\n", itmp[0] );
+ EXCHKPI( ex_inquire( exoid, EX_INQ_TIME, itmp, 0, 0 ), "Inquire failed.\n", "EX_INQ_TIME : %d\n", itmp[0] );
+ num_timesteps = itmp[0];
+
+ /* *** NEW API *** */
+ for ( i = 0; i < sizeof(obj_types)/sizeof(obj_types[0]); ++i ) {
+ int* truth_tab = 0;
+ have_var_names = 0;
+
+ EXCHECK( ex_inquire( exoid, obj_sizes[i], &nids, 0, 0 ), "Object ID list size could not be determined.\n" );
+
+ if ( ! nids ) {
+ fprintf( stdout, "=== %ss: none\n\n", obj_typenames[i] );
+ continue;
+ } else {
+ fprintf( stdout, "=== %ss: %d\n", obj_typenames[i], nids );
+ }
+
+ ids = (int*) malloc( nids * sizeof(int) );
+ obj_names = (char**) malloc( nids * sizeof(char*) );
+ for ( obj = 0; obj < nids; ++obj )
+ obj_names[obj] = (char*) malloc( (MAX_STR_LENGTH + 1) * sizeof(char) );
+
+ EXCHECK( ex_get_ids( exoid, obj_types[i], ids ), "Could not read object ids.\n" );
+ EXCHECK( ex_get_names( exoid, obj_types[i], obj_names ), "Could not read object ids.\n" );
+
+ if ( (OBJECT_IS_BLOCK(i)) || (OBJECT_IS_SET(i)) ) {
+ int* tp;
+ EXCHECK( ex_get_var_param( exoid, obj_typestr[i], &num_vars ), "Could not read number of variables.\n" );
+
+ if ( num_vars && num_timesteps > 0 ) {
+ truth_tab = (int*) malloc( num_vars * nids * sizeof(int) );
+ EXCHECK( ex_get_var_tab( exoid, obj_typestr[i], nids, num_vars, truth_tab ), "Could not read truth table.\n" );
+ tp = truth_tab;
+ fprintf( stdout, "Truth:" );
+ for ( obj = 0; obj < nids; ++obj ) {
+ for ( j = 0; j < num_vars; ++j, ++tp ) {
+ fprintf( stdout, " %d", *tp );
+ }
+ fprintf( stdout, "\n " );
+ }
+ fprintf( stdout, "\n" );
+
+ var_names = (char**) malloc( num_vars * sizeof(char*) );
+ for ( j = 0; j < num_vars; ++j )
+ var_names[j] = (char*) malloc( (MAX_STR_LENGTH + 1) * sizeof(char) );
+
+ EXCHECK( ex_get_var_names( exoid, obj_typestr[i], num_vars, var_names ), "Could not read variable names.\n" );
+ have_var_names = 1;
+ }
+ }
+
+ if ( ! have_var_names )
+ var_names = 0;
+
+ for ( obj = 0; obj < nids; ++obj ) {
+ if ( obj_names[obj] )
+ fprintf( stdout, "%s %3d (%s): ", obj_typenames[i], ids[obj], obj_names[obj] );
+ else
+ fprintf( stdout, "%s %3d: ", obj_typenames[i], ids[obj] );
+
+ if ( OBJECT_IS_BLOCK(i) ) {
+ int* nconn;
+ int* econn;
+ int* fconn;
+ int ele;
+ int ctr;
+ int num_attrs;
+ if ( obj_types[i] == EX_ELEM_BLOCK ) {
+ EXCHECK( ex_get_block( exoid, obj_types[i], ids[obj], 0, itmp, itmp+1, itmp+2, itmp+3, &num_attrs ),
+ "Could not read block params.\n" );
+ fprintf( stdout, "Entries: %3d Nodes/entry: %d Edges/entry: %d Faces/entry: %d Attributes: %d",
+ itmp[0], itmp[1], itmp[2], itmp[3], num_attrs );
+ } else {
+ EXCHECK( ex_get_block( exoid, obj_types[i], ids[obj], 0, itmp, itmp+1, 0, 0, &num_attrs ),
+ "Could not read block params.\n" );
+ fprintf( stdout, "Entries: %3d Nodes/entry: %d Attributes: %d", itmp[0], itmp[1], num_attrs );
+ itmp[2] = itmp[3] = 0;
+ }
+ fprintf( stdout, "\n " );
+ num_entries = itmp[0];
+ nconn = itmp[1] ? (int*) malloc( itmp[1] * num_entries * sizeof(int) ) : 0;
+ econn = itmp[2] ? (int*) malloc( itmp[2] * num_entries * sizeof(int) ) : 0;
+ fconn = itmp[3] ? (int*) malloc( itmp[3] * num_entries * sizeof(int) ) : 0;
+ EXCHECK( ex_get_conn( exoid, obj_types[i], ids[obj], nconn, econn, fconn ), "Could not read connectivity.\n" );
+ for ( ele = 0; ele < num_entries; ++ele ) {
+ for ( ctr = 0; ctr < itmp[1]; ++ctr ) {
+ fprintf( stdout, " %2d", nconn[ele*itmp[1] + ctr] );
+ }
+ if ( itmp[2] ) {
+ fprintf( stdout, " ++" );
+ for ( ctr = 0; ctr < itmp[2]; ++ctr ) {
+ fprintf( stdout, " %2d", econn[ele*itmp[2] + ctr] );
+ }
+ }
+ if ( itmp[3] ) {
+ fprintf( stdout, " ++" );
+ for ( ctr = 0; ctr < itmp[3]; ++ctr ) {
+ fprintf( stdout, " %2d", fconn[ele*itmp[3] + ctr] );
+ }
+ }
+ fprintf( stdout, "\n " );
+ }
+ if ( nconn ) free( nconn );
+ if ( econn ) free( econn );
+ if ( fconn ) free( fconn );
+
+ if ( num_attrs ) {
+ char** attr_names;
+ double* attr;
+ attr = (double*) malloc( num_entries * num_attrs * sizeof(double) );
+ attr_names = (char**) malloc( num_attrs * sizeof(char*) );
+ for ( j = 0; j < num_attrs; ++j )
+ attr_names[j] = (char*) malloc( (MAX_STR_LENGTH + 1) * sizeof(char) );
+
+ EXCHECK( ex_get_attr_names( exoid, obj_types[i], ids[obj], attr_names ), "Could not read attributes names.\n" );
+ EXCHECK( ex_get_attr( exoid, obj_types[i], ids[obj], attr ), "Could not read attribute values.\n" );
+
+ fprintf( stdout, "\n Attributes:\n ID " );
+ for ( j = 0; j < num_attrs; ++j )
+ fprintf( stdout, " %s", attr_names[j] );
+ fprintf( stdout, "\n" );
+ for ( j = 0; j < num_entries; ++j ) {
+ int k;
+ fprintf( stdout, " %2d ", j + 1 );
+ for ( k = 0; k < num_attrs; ++k ) {
+ fprintf( stdout, " %4.1f", attr[ j * num_attrs + k ] );
+ }
+ fprintf( stdout, "\n" );
+ }
+
+ for ( j = 0; j < num_attrs; ++j )
+ free( attr_names[j] );
+ free( attr_names );
+ free( attr );
+ }
+
+ } else if ( OBJECT_IS_SET(i) ) {
+ int num_df;
+ int* set_entry;
+ int* set_extra;
+ double* set_df;
+ EXCHECK( ex_get_set_param( exoid, obj_types[i], ids[obj], &num_entries, &num_df ), "Could not read set parameters.\n" );
+
+ set_entry = (int*) malloc( num_entries * sizeof(int) );
+ set_extra = ( obj_types[i] != EX_NODE_SET && obj_types[i] != EX_ELEM_SET ) ? (int*) malloc( num_entries * sizeof(int) ) : 0;
+ EXCHECK( ex_get_set( exoid, obj_types[i], ids[obj], set_entry, set_extra ), "Could not read set.\n" );
+ fprintf( stdout, "Entries: %3d Distribution factors: %3d\n", num_entries, num_df );
+ if ( set_extra ) {
+ for ( j = 0; j < num_entries; ++j )
+ fprintf( stdout, " %2d %2d\n", set_entry[j], set_extra[j] );
+ } else {
+ for ( j = 0; j < num_entries; ++j )
+ fprintf( stdout, " %2d\n", set_entry[j] );
+ }
+ free( set_entry );
+ if ( set_extra )
+ free( set_extra );
+
+ set_df = num_df ? (double*) malloc( num_df * sizeof(double) ) : 0;
+ if ( set_df ) {
+ EXCHECK( ex_get_set_dist_fact( exoid, obj_types[i], ids[obj], set_df ), "Could not read set distribution factors.\n" );
+ fprintf( stdout, "\n Distribution factors:\n" );
+ for ( j = 0; j < num_df; ++j )
+ fprintf( stdout, " %4.1f\n", set_df[j] );
+ free( set_df );
+ }
+
+
+ } else { /* object is map */
+ int* map;
+ switch (obj_types[i]) {
+ case EX_NODE_MAP:
+ num_entries = modelParams.num_nodes;
+ break;
+ case EX_EDGE_MAP:
+ num_entries = modelParams.num_edge;
+ break;
+ case EX_FACE_MAP:
+ num_entries = modelParams.num_face;
+ break;
+ case EX_ELEM_MAP:
+ num_entries = modelParams.num_elem;
+ break;
+ }
+ if ( num_entries ) {
+ fprintf( stdout, "Entries: %3d\n :", num_entries );
+ map = (int*) malloc( num_entries * sizeof(int) );
+ EXCHECK( ex_get_num_map( exoid, obj_types[i], ids[obj], map ), "Could not read map.\n" );
+ for ( j = 0; j < num_entries; ++j ) {
+ fprintf( stdout, " %d", map[j] );
+ }
+ } else {
+ fprintf( stdout, "Entries: none" );
+ }
+ }
+ fprintf( stdout, "\n" );
+
+ /* Read results variables */
+ if ( ((OBJECT_IS_BLOCK(i)) || (OBJECT_IS_SET(i))) && num_vars && num_timesteps > 0 ) {
+ /* Print out all the time values to exercise get_var */
+ entry_vals = (double*) malloc( num_entries * sizeof(double) );
+ for ( j = 0; j < num_vars; ++j ) {
+ int k;
+ if ( ! truth_tab[num_vars * obj + j] )
+ continue;
+
+ fprintf( stdout, " Variable: %s", var_names[j] );
+ for ( ti = 1; ti <= num_timesteps; ++ti ) {
+ EXCHECK( ex_get_var( exoid, ti, obj_types[i], 1 + j, ids[obj], num_entries, entry_vals ),
+ "Could not read variable values.\n" );
+
+ fprintf( stdout, "\n @t%d ", ti );
+ for ( k = 0; k < num_entries; ++k ) {
+ fprintf( stdout, " %4.1f", entry_vals[k] );
+ }
+ }
+ fprintf( stdout, "\n" );
+ }
+ fprintf( stdout, "\n" );
+ free( entry_vals );
+ }
+ }
+
+ if ( ((OBJECT_IS_BLOCK(i)) || (OBJECT_IS_SET(i))) && num_vars && num_timesteps > 0 ) {
+ /* Print out one element's time values to exercise get_var_time */
+ entry_vals = (double*) malloc( num_timesteps * sizeof( double ) );
+ EXCHECK( ex_inquire( exoid, obj_sizeinq[i], itmp, 0, 0 ), "Inquire failed.\n" );
+ itmp[1] = 11;
+ while ( itmp[1] > itmp[0] ) itmp[1] /= 2;
+ for ( j = 0; j < num_vars; ++j ) {
+ /* FIXME: This works for the dataset created by CreateEdgeFace, but not for any dataset in general since
+ * NULL truth table entries may mean the referenced elements don't have variable values.
+ */
+ EXCHECK( ex_get_var_time( exoid, obj_types[i], j + 1, itmp[1], 1, num_timesteps, entry_vals ), "Could not read variable over time.\n" );
+ fprintf( stdout, " Variable over time: %s Entry: %3d ", var_names[j], itmp[1] );
+ for ( ti = 1; ti <= num_timesteps; ++ti )
+ fprintf( stdout, " @t%d: %4.1f", ti, entry_vals[ti-1] );
+ fprintf( stdout, "\n" );
+ }
+ free( entry_vals );
+ }
+
+ if ( var_names ) {
+ for ( j = 0; j < num_vars; ++j )
+ free( var_names[j] );
+ free( var_names );
+ }
+ if ( truth_tab )
+ free( truth_tab );
+ free( ids );
+
+ for ( obj = 0; obj < nids; ++obj )
+ free( obj_names[obj] );
+ free( obj_names );
+
+ fprintf( stdout, "\n" );
+ }
+
+ EXCHECK( ex_close( exoid ),
+ "Unable to close database.\n" );
+
+ return 0;
+}
+
+int main( int argc, char* argv[] )
+{
+ return cReadEdgeFace(argc, argv);
+}
diff --git a/cbind/test/create_mesh.c b/cbind/test/create_mesh.c
new file mode 100644
index 0000000..2569388
--- /dev/null
+++ b/cbind/test/create_mesh.c
@@ -0,0 +1,963 @@
+/*
+ * 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.
+ *
+ */
+
+/* $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 "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_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 EXODUSII_FILE_TYPE ".e"
+
+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.
+ */
+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;
+}
+
+/*
+ * Prototypes
+ */
+
+void create_rr_elem_map(
+ int loc_num_elements,
+ int *elem_map,
+ int map_origin,
+ int num_domains,
+ int current_domain
+);
+
+void create_elem_map (
+ int loc_num_elems,
+ int start,
+ int *elem_map,
+ int map_origin
+);
+
+void create_local_connect(
+ int *node_map,
+ int len_node_map,
+ int len_connect,
+ int *domain_connect,
+ int *loc_connect,
+ int map_origin
+);
+
+void extract_connect(
+ int element_offset,
+ int num_elem,
+ int *elem_map,
+ int *connect,
+ int *domain_connect,
+ int map_origin
+);
+
+void make_mesh(
+ float *x,
+ float *y,
+ int *connect,
+ int map_origin,
+ int num_elements
+);
+
+void parse_input(
+ int argc,
+ char *argv[],
+ int *debug,
+ int *map_origin,
+ int *num_elements,
+ int *num_domains,
+ int *num_nodal_fields,
+ int *num_global_fields,
+ int *num_element_fields,
+ int *num_timesteps,
+ char *device_name,
+ char *file_name,
+ int *exodus
+);
+
+void write_exo_mesh(
+ int debug,
+ char *file_name,
+ int map_origin,
+ int num_nodes,
+ int num_elements,
+ int num_domains,
+ int num_nodal_fields,
+ int num_global_fields,
+ int num_element_fields,
+ int num_timesteps,
+ float *x,
+ float *y,
+ int *connect
+);
+
+void create_node_map (int len_map, int len_connect, int *domain_connect, int *node_map,
+ int *loc_num_nodes, int map_origin);
+
+void sort_int(int n, int ra[]);
+
+int bin_search2 (int value, int num, int List[]);
+
+/***********************************************************************
+ *
+ * Main function
+ *
+ ***********************************************************************/
+
+int
+main( int argc, char *argv[] ) {
+ int *connect;
+ int debug = FALSE; /* TRUE, display debug information; FALSE */
+ /* otherwise. */
+ static char device_name[MAX_STRING_LEN];
+ static char file_name[MAX_STRING_LEN] = DEFAULT_FILE_NAME;
+ int exodus = TRUE;
+ int map_origin = DEFAULT_MAP_ORIGIN;
+ int num_domains = DEFAULT_NUM_DOMAINS;
+ int num_elements_1d;
+ int num_elements = DEFAULT_NUM_ELEMENTS;
+ int num_nodal_fields = DEFAULT_NUM_FIELDS;
+ int num_global_fields = DEFAULT_NUM_FIELDS;
+ int num_element_fields = DEFAULT_NUM_FIELDS;
+ int num_timesteps = DEFAULT_NUM_TIMESTEPS;
+ int num_nodes;
+
+ float *x;
+ float *y;
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+ /* Parse Input */
+ parse_input(argc, argv, &debug, &map_origin,
+ &num_elements, &num_domains, &num_nodal_fields,
+ &num_global_fields, &num_element_fields, &num_timesteps,
+ 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 ) );
+
+ make_mesh(x, y, connect, map_origin, num_elements_1d);
+
+ /*
+ * Write Out Mesh
+ */
+
+ if (exodus) {
+ write_exo_mesh(
+ debug,
+ file_name,
+ map_origin,
+ num_nodes,
+ num_elements,
+ num_domains,
+ num_nodal_fields,
+ num_global_fields,
+ num_element_fields,
+ num_timesteps,
+ x,
+ y,
+ connect
+ );
+ }
+
+ free(x);
+ free(y);
+ free(connect);
+ return 0;
+} /* end of main() */
+
+
+/***********************************************************************
+ ***********************************************************************/
+void parse_input(
+ int argc,
+ char *argv[],
+ int *debug,
+ int *map_origin,
+ int *num_elements_1d,
+ int *num_domains,
+ int *num_nodal_fields,
+ int *num_global_fields,
+ int *num_element_fields,
+ int *num_timesteps,
+ char *device_name,
+ char *file_name,
+ int *exodus
+ ) {
+ int arg = 0; /* Argument index. */
+
+ while ( ++arg < argc ) {
+ if ( strcmp( "-c", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_nodal_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-nv", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_nodal_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-gv", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_global_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-ev", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_element_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-t", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_timesteps = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-d", argv[arg] ) == 0 ) {
+ *debug = TRUE;
+ }
+ else if ( strcmp( "-f", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) strcpy( file_name, argv[arg] );
+ }
+ else if ( strcmp( "-m", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *map_origin = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-n", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_elements_1d = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-p", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_domains = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-x", argv[arg] ) == 0 ) {
+ *exodus = TRUE;
+ }
+ else if ( (strcmp( "-h", argv[arg] ) == 0) || (strcmp( "-u", argv[arg] ) == 0) ) {
+ printf( " \n" );
+ printf( "NAME \n" );
+ printf( " \n" );
+ printf( "create_mesh - creates a mesh file for performance benchmarking. \n" );
+ printf( " \n" );
+ printf( "SYNOPSIS \n" );
+ printf( " \n" );
+ printf( "create_mesh [-c fields] [-t timesteps] [-d] [-f file_name] \n" );
+ printf( " [-m map_origin] [-n elements] [-p domains] \n" );
+ printf( " [-nv number] [-ev number] [-gv number] ");
+ printf( " [-r] [-u] [-h] ");
+ printf( "[-x]" );
+ printf( " \n" );
+ printf( " \n" );
+ printf( "DESCRIPTION \n" );
+ printf( " \n" );
+ printf( "This program creates a 2-D mesh for performance benchmarking. \n" );
+ printf( "The EXODUSII II database file(s) created by this \n" );
+ printf( "prrogram is/are read by the rd_wt_mesh program to perform the \n" );
+ printf( "actual benchmark. \n" );
+ printf( " \n" );
+ printf( "OPTIONS \n" );
+ printf( " \n" );
+ printf( "-c fields number of nodal fields. Default: %d \n", DEFAULT_NUM_FIELDS );
+ printf( "-nv fields number of nodal fields. Default: %d \n", DEFAULT_NUM_FIELDS );
+ printf( "-ev fields number of element fields. Default: %d \n", DEFAULT_NUM_FIELDS );
+ printf( "-gv fields number of global fields. Default: %d \n", DEFAULT_NUM_FIELDS );
+ printf( "-t timesteps number of timesteps. Default: %d \n", DEFAULT_NUM_TIMESTEPS);
+ printf( "-d display debug information. \n" );
+ printf( "-f file_name file name prefix for all created files: \n" );
+ printf( " \n" );
+ printf( " 'file_name'_n%s [EXODUSII II file] \n", EXODUSII_FILE_TYPE );
+ printf( " \n" );
+ printf( " where n varies from 0 to number of domains-1. \n" );
+ printf( " Default: %s \n", DEFAULT_FILE_NAME );
+ 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( " 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 );
+ printf( "-u display help/usage information. \n" );
+
+ exit( 0 );
+ }
+ else {
+ fprintf(stderr, "Unknown option: %s\n", argv[arg] );
+ fprintf(stderr, "Enter create_mesh -h for description of valid options.\n" );
+
+ exit( 0 );
+ }
+ }
+
+ return;
+}
+
+/***********************************************************************
+ *
+ * Create the coordinates and connectivity array for the mesh
+ *
+ ***********************************************************************/
+
+void make_mesh(
+ float *x,
+ float *y,
+ int *connect,
+ int map_origin,
+ int num_elements_1d
+) {
+ int i, j, k, base, cnt;
+
+ /* 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;
+ }
+ }
+
+ /* 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;
+ }
+ }
+} /* end of make_mesh() */
+
+/***********************************************************************
+ ***********************************************************************/
+void write_exo_mesh(
+ int debug,
+ char *file_name,
+ int map_origin,
+ int num_nodes,
+ int num_elements,
+ int num_domains,
+ int num_nodal_fields,
+ int num_global_fields,
+ int num_element_fields,
+ int num_timesteps,
+ float *x,
+ float *y,
+ int *connect
+ ) {
+ int CPU_word_size=0;
+ int IO_word_size=4;
+ 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;
+
+ float *z, *loc_xcoords, *loc_ycoords, *globals = NULL;
+
+ char temporary_name[MAX_STRING_LEN];
+ char **var_name;
+
+ accum_num_elements = 0;
+ for (i=0; i<num_domains; i++) {
+
+ /* create the EXODUSII file */
+ get_file_name(file_name, "e", i, num_domains, NULL, temporary_name);
+ exoid = ex_create (temporary_name, EX_CLOBBER, &CPU_word_size, &IO_word_size);
+
+ if (exoid < 0) {
+ fprintf(stderr, "after ex_create, error = %d\n", err);
+ 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));
+ }
+
+ /* 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
+ );
+
+ if ( debug ) {
+ fprintf(stderr, "\n\n\n");
+
+ 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_elem_blk = 1;
+ num_node_sets = 0;
+ num_side_sets = 0;
+
+ err = ex_put_init (exoid, "This is an EXODUSII performance test.", num_dim,
+ loc_num_nodes, loc_num_elements, num_elem_blk,
+ num_node_sets, num_side_sets);
+
+ if (err) {
+ fprintf(stderr, "after ex_put_init, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* 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];
+ }
+
+ 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);
+ }
+
+ err = ex_put_elem_block
+ (exoid, 10, "quad", loc_num_elements, NUM_NODES_PER_ELEM, 0);
+
+ 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 (err) {
+ fprintf(stderr, "after ex_put_elem_conn, error = %d\n", err);
+ ex_close (exoid);
+ 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);
+ }
+
+ 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);
+ }
+
+ /* write out simulated results fields;
+ we'll just write out the x coordinate field 'num_nodal_fields' times */
+ if (loc_num_nodes < loc_num_elements) {
+ fprintf(stderr, "INTERNAL ERROR: Programmer assumed number of nodes > number of elements, but that is not true.\n");
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ if (num_element_fields > 0) {
+ elem_var_tab = malloc(num_element_fields * sizeof(int));
+ for (j = 0; j < num_element_fields; j++)
+ elem_var_tab[j] = 1;
+ } else {
+ elem_var_tab = 0;
+ }
+ err = ex_put_all_var_param(exoid,
+ num_global_fields,
+ num_nodal_fields,
+ num_element_fields,
+ elem_var_tab,
+ 0, 0, 0, 0);
+ if (err) {
+ fprintf(stderr, "after ex_put_all_var_param, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ if (num_nodal_fields > 0) {
+
+ var_name = malloc (num_nodal_fields * sizeof(char *));
+ for (j=0; j<num_nodal_fields; j++) {
+ 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);
+ for (j=0; j<num_nodal_fields; j++) {
+ free(var_name[j]);
+ }
+ free(var_name);
+ }
+
+ if (num_global_fields > 0) {
+ globals = malloc(num_global_fields * sizeof(float));
+ 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);
+ for (j=0; j<num_global_fields; j++) {
+ free(var_name[j]);
+ }
+ free(var_name);
+ }
+
+ if (num_element_fields > 0) {
+ free(elem_var_tab);
+ var_name = malloc (num_element_fields * sizeof(char *));
+ for (j=0; j<num_element_fields; j++) {
+ 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);
+ for (j=0; j<num_element_fields; j++) {
+ free(var_name[j]);
+ }
+ free(var_name);
+ }
+
+ 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;
+ 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);
+ if (err) {
+ fprintf(stderr, "after ex_put_global_var, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ for (j=0; j<num_nodal_fields; j++) {
+ err = ex_put_nodal_var (exoid, t+1, j+1, loc_num_nodes, loc_xcoords);
+ if (err) {
+ fprintf(stderr, "after ex_put_nodal_var, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ for (j=0; j<num_element_fields; j++) {
+ err = ex_put_elem_var (exoid, t+1, j+1, 10, loc_num_elements, loc_xcoords);
+ if (err) {
+ fprintf(stderr, "after ex_put_element_var, error = %d\n", err);
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+ fprintf(stderr, "\n");
+ }
+
+ err = ex_close (exoid);
+
+ if (err) {
+ fprintf(stderr, "after ex_close, error = %d\n", err);
+ exit(-1);
+ }
+ }
+
+ /*
+ * Free Memory
+ */
+
+ free( domain_connect );
+ free( elem_map );
+ free( loc_connect );
+ free( loc_xcoords );
+ free( loc_ycoords );
+ free( node_map );
+ if (num_global_fields > 0)
+ free(globals);
+}
+
+/***********************************************************************
+ *
+ * Create element local/global map
+ *
+ * This puts contiguous groups of elements in each domain. This is
+ * a somewhat reasonable map for a realistic application.
+ *
+ ***********************************************************************/
+void create_elem_map (
+ int loc_num_elems,
+ int elem_num,
+ int *elem_map,
+ int map_origin)
+{
+ int i;
+
+ for (i=0; i<loc_num_elems; i++) {
+ elem_map[i] = map_origin + elem_num++;
+ }
+
+}
+
+/***********************************************************************
+ *
+ * Extract current domain's connectivity, referencing global node ids
+ *
+ * This extracts the "domain connectivity," that is, the connectivity
+ * of the elements in the current domain. The node ids in the domain
+ * connectivity reference global node ids.
+ *
+ ***********************************************************************/
+
+void extract_connect(
+ int element_offset,
+ int num_elem,
+ int *elem_map,
+ int *connect,
+ int *domain_connect,
+ int map_origin
+ ) {
+ int i, j, k, m, offset;
+
+ for (i=element_offset, j=0, m=0; j<num_elem; j++) {
+ if (elem_map[j] == i+map_origin) { /* extract this element */
+ offset = (i * NUM_NODES_PER_ELEM);
+ for (k=offset; k < offset+NUM_NODES_PER_ELEM; k++) {
+ domain_connect[m++] = connect[k];
+ }
+ i++;
+ }
+ }
+}
+
+/***********************************************************************
+ *
+ * The local/global node map is just the current domain's connectivity,
+ * sorted, with duplicate entries removed. This isn't obvious, but
+ * trust me.
+ *
+ ***********************************************************************/
+void create_node_map (int len_map, int len_connect, int *domain_connect, int *node_map,
+ int *loc_num_nodes, int map_origin)
+{
+ int cnt, i;
+
+ *loc_num_nodes = len_connect;
+
+ for (i = 0; i < len_map; i++) {
+ node_map[i] = 0;
+ }
+
+ for (i = 0; i < len_connect; i++) {
+ node_map[domain_connect[i]-map_origin] = 1;
+ }
+
+ cnt = 0;
+ for (i = 0; i < len_map; i++) {
+ if (node_map[i] > 0) {
+ node_map[cnt++] = i+map_origin;
+ }
+ }
+ *loc_num_nodes = cnt;
+}
+
+/***********************************************************************
+ *
+ * Using local/global node map, convert the domain connectivity
+ * (referencing global node ids) to local connectivity (referencing
+ * local node ids).
+ *
+ * This requires inverting the local/global map, a relatively expensive
+ * operation. The procedure is:
+ *
+ * for every entry in the domain connectivity
+ * search the node map until found
+ * set the value of the entry in the local connectivity to
+ * the index of the located value in the node map
+ *
+ ***********************************************************************/
+void create_local_connect(int *node_map,
+ int len_node_map,
+ int len_connect,
+ int *domain_connect,
+ int *loc_connect,
+ int map_origin)
+{
+ int i, index;
+
+ for (i=0; i<len_connect; i++) {
+ index = bin_search2 (domain_connect[i], len_node_map, node_map);
+ if (index != -1) { /* found */
+ loc_connect[i] = index+map_origin;
+ } else {
+ fprintf (stderr, "error creating local connectivity; i = %d\n", i);
+ exit (-1);
+ }
+ }
+}
+
+
+
+/*****************************************************************************
+ *
+ * Numerical Recipies in C source code
+ * modified to have first argument an integer array
+ *
+ * Sorts the array ra[0,..,(n-1)] in ascending numerical order using
+ * heapsort algorithm.
+ *
+ *****************************************************************************/
+
+void sort_int(int n, int ra[])
+
+{
+ int l, j, ir, i;
+ int rra;
+
+ /*
+ * No need to sort if one or fewer items.
+ */
+ if (n <= 1) return;
+
+ l=n >> 1;
+ ir=n-1;
+ for (;;) {
+ if (l > 0)
+ rra=ra[--l];
+ else {
+ rra=ra[ir];
+ ra[ir]=ra[0];
+ if (--ir == 0) {
+ ra[0]=rra;
+ return;
+ }
+ }
+ i=l;
+ j=(l << 1)+1;
+ while (j <= ir) {
+ if (j < ir && ra[j] < ra[j+1]) ++j;
+ if (rra < ra[j]) {
+ ra[i]=ra[j];
+ j += (i=j)+1;
+ }
+ else j=ir+1;
+ }
+ ra[i]=rra;
+ }
+}
+
+
+/*****************************************************************************
+ *
+ * Searches a monotonic list of values for the value, 'value'.
+ * It returns the index (0-based) of the first position found, which
+ * matches 'value'.
+ * The list is assumed to be monotonic, and consist of elements
+ * list[0], ..., list[n-1].
+ * If no position in list matches value, it returns the value -1.
+ *
+ *****************************************************************************/
+
+int bin_search2 (int value, int num, int List[])
+{
+ int top, bottom = 0, middle, g_mid;
+
+ top = num - 1;
+ while (bottom <= top) {
+ middle = (bottom + top) >> 1;
+ g_mid = List[middle];
+ if (value < g_mid)
+ top = middle - 1;
+ else if (value > g_mid)
+ bottom = middle + 1;
+ else
+ return middle; /* found */
+ }
+ return -1;
+} /* bin_search2 */
+
+/*****************************************************************************/
+void get_file_name(const char* base, const char* ext, int rank, int nprocs,
+ const char* other,char *output)
+{
+ int i1, iTemp1;
+ int iMaxDigit=0, iMyDigit=0;
+ char cTemp[128];
+
+ output[0] = '\0';
+ strcpy(output, base);
+ strcat(output, ".");
+ strcat(output, ext);
+ if (other != NULL) {
+ strcat(output, ".");
+ strcat(output, other);
+ }
+ if (nprocs > 1) {
+ /*
+ * Find out the number of digits needed to specify the processor ID.
+ * This allows numbers like 01-99, i.e., prepending zeros to the
+ * name to preserve proper alphabetic sorting of the files.
+ */
+
+ iTemp1 = nprocs;
+ do {
+ iTemp1 /= 10;
+ iMaxDigit++;
+ }
+ while(iTemp1 >= 1);
+
+ iTemp1 = rank;
+ do {
+ iTemp1 /= 10;
+ iMyDigit++;
+ }
+ while(iTemp1 >= 1);
+
+ strcat(output, ".");
+ sprintf(cTemp, "%d", nprocs);
+ strcat(output, cTemp);
+ strcat(output, ".");
+
+ /*
+ * Append the proper number of zeros to the filename.
+ */
+ for(i1=0; i1 < iMaxDigit-iMyDigit; i1++)
+ strcat(output, "0");
+
+ sprintf(cTemp, "%d", rank);
+ strcat(output, cTemp);
+ }
+}
diff --git a/cbind/test/makedmp b/cbind/test/makedmp
new file mode 100644
index 0000000..b95bf86
--- /dev/null
+++ b/cbind/test/makedmp
@@ -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.
+#
+
+# script to save dump files.
+#
+# testwt - single precision write test
+echo "testwt ..."
+echo "begin testwt" > test.output
+testwt >> test.output
+echo "end testwt" >> test.output
+ncdump -d5,5 test.exo > test.dmp
+
+# testrd - single precision read test
+echo "testrd ..."
+testrd > testrd.dmp
+
+# testcp_ss - single-to-single precision copy test
+echo "testcp_ss ..."
+echo "begin testcp_ss" >> test.output
+testcp >> test.output
+echo "end testcp_ss" >> test.output
+ncdump -d5,5 testcp.exo > testcp_ss.dmp
+
+# testcp_sd - single-to-double precision copy test
+echo "testcp_sd ..."
+echo "begin testcp_sd" >> test.output
+testcpd >> test.output
+echo "end testcp_sd" >> test.output
+ncdump -d5,5 testcpd.exo > testcp_sd.dmp
+
+# testwtd - double precision write test
+echo "testwtd ..."
+echo "begin testwtd" >> test.output
+testwtd >> test.output
+echo "end testwtd" >> test.output
+ncdump -d5,5 test.exo > testd.dmp
+
+# testrdd - double precision read test
+echo "testrdd ..."
+testrdd > testrdd.dmp
+
+# testcp_dd - double-to-double precision copy test
+echo "testcp_dd ..."
+echo "begin testcp_dd" >> test.output
+testcpd >> test.output
+echo "end testcp_dd" >> test.output
+ncdump -d5,5 testcpd.exo > testcp_dd.dmp
+
+# testcp_ds - double-to-single precision copy test
+echo "testcp_ds ..."
+echo "begin testcp_ds" >> test.output
+testcp >> test.output
+echo "end testcp_ds" >> test.output
+ncdump -d5,5 testcp.exo > testcp_ds.dmp
+
+# testwt1 - single precision write files with several side sets
+echo "testwt1 ..."
+echo "begin testwt1" >> test.output
+testwt1 >> test.output
+echo "end testwt1" >> test.output
+ncdump -d5,5 test.exo > test1.dmp
+
+# testrd1 - single precision read test of a file with several side sets
+echo "testrd1 ..."
+testrd1 > testrd1.dmp
+
+# testwt_ss - write file to test side sets
+echo "testwt_ss ..."
+echo "begin testwt_ss" >> test.output
+testwt_ss >> test.output
+echo "end testwt_ss" >> test.output
+ncdump -d5,5 test.exo > testwt_ss.dmp
+
+# testrd_ss - read test of a file with several side sets
+echo "testrd_ss ..."
+testrd_ss > testrd_ss.dmp
+
+# testwt2 - single precision write 2 files (simultaneously open) test
+echo "testwt2 ..."
+echo "begin testwt2" >> test.output
+testwt2 >> test.output
+echo "end testwt2" >> test.output
+ncdump -d5,5 test.exo > test2-1.dmp
+ncdump -d5,5 test2.exo > test2-2.dmp
+
+# testrdwt - read from one and write to another (simutaneously open) file
+echo "testrdwt ..."
+echo "begin testrdwt" >> test.output
+testrdwt >> test.output
+echo "end testrdwt" >> test.output
+ncdump -d5,5 test2.exo > test2.dmp
+
diff --git a/cbind/test/rd_wt_mesh.c b/cbind/test/rd_wt_mesh.c
new file mode 100644
index 0000000..5a359fc
--- /dev/null
+++ b/cbind/test/rd_wt_mesh.c
@@ -0,0 +1,1266 @@
+/*
+ * 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.
+ *
+ */
+
+/* $Id: rd_wt_mesh.c,v 1.3 2006/11/28 14:02:07 gdsjaar Exp $ */
+
+#define _FILE_OFFSET_BITS 64
+#define _LARGEFILE_SOURCE
+#define _LARGE_FILES 1
+
+#if defined(__LIBCATAMOUNT__)
+#include <catamount/dclock.h>
+#endif
+
+#ifdef HAVE_PARALLEL
+#include <mpi.h>
+#else
+#include <string.h>
+#include <unistd.h>
+#include <sys/times.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <float.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "exodusII.h"
+
+#define DEFAULT_NUM_FIELDS 0
+#define DEFAULT_FILE_NAME "mesh"
+#define DEFAULT_NUM_ITERATIONS 1
+#define EXODUS_FILE_TYPE "e"
+#define MBYTES (1024*1024)
+#define MAX_STRING_LEN 128
+#define NUM_NODES_PER_ELEM 4
+#define QUIT FALSE
+#define WRITE_FILE_TYPE "new"
+
+/*
+ * Prototypes
+ */
+
+void get_file_name(const char* base, const char* ext, int rank, int nprocs,
+ const char* other,char *output);
+
+int parse_input(
+ int argc,
+ char *argv[],
+ int *exodus,
+ int *close_files,
+ char *file_name,
+ int *num_nodal_fields,
+ int *num_global_fields,
+ int *num_element_fields,
+ int *files_per_domain,
+ int *num_iterations,
+ int *sleep_time
+);
+
+int read_exo_mesh ( char *file_name, int rank, 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 );
+
+int write_exo_mesh ( char *file_name, int rank, 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);
+
+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;
+ }
+#endif
+#else
+ return dclock();
+#endif
+ return t1;
+}
+
+/***********************************************************************
+ *
+ * Main function
+ *
+ ***********************************************************************/
+
+int main( int argc, char **argv )
+{
+ int rank, num_domains;
+ int quit=FALSE;
+ int loc_num_nodes, loc_num_elems;
+ int *loc_connect;
+
+#ifdef HAVE_PARALLEL
+ MPI_Info mpi_info_object = MPI_INFO_NULL; /* Copy of MPI Info object. */
+#endif
+ int *elem_map;
+ int exodus = TRUE; /* TRUE, perform EXODUS benchmark; FALSE don't */
+ int close_files = FALSE;
+ char file_name[MAX_STRING_LEN] = DEFAULT_FILE_NAME; /* Input file name. */
+ /* object, FALSE otherwise. Should always be */
+ /* TRUE in the current implementation. */
+ int num_nodal_fields = DEFAULT_NUM_FIELDS;
+ int num_global_fields = DEFAULT_NUM_FIELDS;
+ int num_element_fields = DEFAULT_NUM_FIELDS;
+ int num_timesteps = 0;
+ int sleep_time = 0;
+ int files_per_domain = 1;
+ int num_iterations = DEFAULT_NUM_ITERATIONS;
+#ifdef HAVE_PARALLEL
+ static const char *hints[] = { /* List of MPI Info hints that if defined in */
+ "cb_buffer_size", /* the environment process 0, will be used to */
+ "cb_nodes", /* set key/value pairs in the MPI */
+ "ind_rd_buffer_size", /* Info object. */
+ "ind_wr_buffer_size",
+ "cb_config_list",
+ "romio_cb_read",
+ "romio_cb_write",
+ "romio_ds_read",
+ "romio_ds_write",
+ "romio_no_indep_rw"
+ };
+ char key_name[MAX_STRING_LEN]; /* MPI Info object key name. */
+ int key; /* MPI Info object key index. */
+ int key_exists; /* TRUE, if the key exists in the MPI Info */
+ const int nhints = 10; /* Number of items in hints list. */
+ int nkeys; /* Number of keys in a MPI Info object. */
+ char value[MAX_STRING_LEN]; /* Value of a key/value pair in a MPI Info */
+#endif
+ /* object. */
+ float *x_coords;
+ float *y_coords;
+#ifdef HAVE_PARALLEL
+ MPI_Info new_mpi_info_object;
+#endif
+
+ /*
+ * Initialize Stuff
+ */
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+#if defined(__LIBCATAMOUNT__)
+ setlinebuf(stderr);
+#endif
+
+#ifdef HAVE_PARALLEL
+ MPI_Init ( &argc, &argv );
+ MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+ MPI_Comm_size( MPI_COMM_WORLD, &num_domains );
+#else
+ rank = 0;
+ num_domains = 1;
+#endif
+ /*
+ * Processor 0: parse the command line arguments.
+ */
+
+ 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);
+ }
+
+
+ /*
+ * Broadcast Input
+ */
+
+#ifdef HAVE_PARALLEL
+ MPI_Bcast ( &quit, 1, MPI_INT, 0, MPI_COMM_WORLD );
+#endif
+
+ if (quit) {
+#ifdef HAVE_PARALLEL
+ MPI_Finalize();
+#endif
+ exit(EXIT_SUCCESS);
+ }
+
+#ifdef HAVE_PARALLEL
+ MPI_Bcast( &exodus, 1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &close_files, 1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( file_name, MAX_STRING_LEN, MPI_CHAR, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &num_nodal_fields, 1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &num_global_fields, 1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &num_element_fields,1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &num_iterations, 1, MPI_INT, 0, MPI_COMM_WORLD );
+ MPI_Bcast( &files_per_domain, 1, MPI_INT, 0, MPI_COMM_WORLD );
+
+ /* env_mpi_hints( nhints, hints ); */
+ {
+ char *env; /* Contents of environmental variable. */
+ int hint; /* ROMIO hint index. */
+ char hint_value[MAX_STRING_LEN]; /* ROMIO hint value. */
+ int rank; /* MPI process rank. */
+
+ MPI_Comm_rank( MPI_COMM_WORLD, &rank );
+ /* The "value" of the hint is obtained from the environment of
+ * processor 0 only. The value is broadcast to the other
+ * processors.
+ */
+ for ( hint = 0; hint < nhints; hint++ ) {
+ if ( rank == 0 ) {
+ env = getenv( hints[hint] );
+ if ( env != NULL )
+ strcpy( hint_value, env );
+ else
+ hint_value[0] = 0;
+ }
+ MPI_Bcast( hint_value, MAX_STRING_LEN, MPI_CHAR, 0, MPI_COMM_WORLD );
+ if ( hint_value[0] ) {
+ if ( mpi_info_object == MPI_INFO_NULL )
+ MPI_Info_create( &mpi_info_object );
+ MPI_Info_set( mpi_info_object, hints[hint], hint_value );
+ }
+ }
+ }
+#endif
+
+ if (rank == 0) {
+ fprintf(stderr, "\nEXODUSII 2-D 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 );
+
+#ifdef HAVE_PARALLEL
+ if ( mpi_info_object != MPI_INFO_NULL ) {
+ fprintf(stderr, " MPI Hint Status\n" );
+
+ MPI_Info_get_nkeys( mpi_info_object, &nkeys );
+
+ for ( key = 0; key < nkeys; key++ ) {
+ MPI_Info_get_nthkey( mpi_info_object, key, key_name );
+ MPI_Info_get ( mpi_info_object, key_name, MAX_STRING_LEN, value, &key_exists );
+
+ fprintf(stderr, " %s\t\t\t%s\n", key_name, value );
+ }
+
+ MPI_Info_free( &mpi_info_object );
+ }
+ else
+ fprintf(stderr, " MPI Hint Status\tMPI_INFO_NULL\n" );
+#endif
+ }
+
+ 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,
+ 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);
+
+ free( elem_map );
+ free( loc_connect );
+ free( node_map );
+ free( x_coords );
+ free( y_coords );
+ }
+}
+#ifdef HAVE_PARALLEL
+ MPI_Finalize();
+#endif
+ return(0);
+}
+
+/***********************************************************************
+ *
+ * Parse Input
+ *
+ ***********************************************************************/
+
+int parse_input (int argc,
+ char *argv[],
+ int *exodus,
+ int *close_files,
+ char *file_name,
+ int *num_nodal_fields,
+ int *num_global_fields,
+ int *num_element_fields,
+ int *files_per_domain,
+ int *num_iterations,
+ int *sleep_time) {
+ int arg = 0; /* Argument index. */
+
+ while ( ++arg < argc ) {
+ if ( strcmp( "-c", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_nodal_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-nv", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_nodal_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-gv", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_global_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-ev", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_element_fields = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-f", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) strcpy( file_name, argv[arg] );
+ }
+ else if ( strcmp( "-M", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *files_per_domain = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-i", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *num_iterations = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-w", argv[arg] ) == 0 ) {
+ if ( ++arg < argc ) *sleep_time = atoi( argv[arg] );
+ }
+ else if ( strcmp( "-x", argv[arg] ) == 0 ) {
+ *exodus = TRUE;
+ }
+ else if ( strcmp( "-C", argv[arg] ) == 0 ) {
+ *close_files = TRUE;
+ }
+ else if ( (strcmp( "-h", argv[arg] ) == 0) || (strcmp( "-u", argv[arg] ) == 0) ) {
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "NAME \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "rd_wt_mesh - reads and writes a mesh in parallel for performance\n" );
+ fprintf(stderr, " benchmarking. \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "SYNOPSIS \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "rd_wt_mesh [-S] [-c fields] [-f file_name] [-h] [-i iterations] \n" );
+ fprintf(stderr, " [-s] [-u] [-x] [-w] \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "DESCRIPTION \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "This program reads and writes a mesh in parallel for performance\n" );
+ fprintf(stderr, "benchmarking. The first Exodus database file read by \n" );
+ fprintf(stderr, "this program is created by create_mesh. Performance summaries \n" );
+ fprintf(stderr, "are written to stdout. \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "OPTIONS \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, "-c fields number of fields. Default: %d \n", DEFAULT_NUM_FIELDS );
+ fprintf(stderr, "-f file_name file name prefix for all read files: \n" );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, " 'file_name'%s.nproc.rank [EXODUS II file] \n", EXODUS_FILE_TYPE );
+ fprintf(stderr, " \n" );
+ fprintf(stderr, " Default: %s \n", DEFAULT_FILE_NAME );
+ fprintf(stderr, "-M files number of files/domain. Default: 1 \n" );
+ fprintf(stderr, "-h display help/usage information \n" );
+ fprintf(stderr, "-i iterations number of iterations. Default: %d \n", DEFAULT_NUM_ITERATIONS );
+ 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);
+ }
+ 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(EXIT_SUCCESS);
+}
+
+/***********************************************************************
+ ***********************************************************************/
+int read_exo_mesh (char *file_name, int rank, 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 )
+
+{
+ int CPU_word_size=4;
+ int IO_word_size=0;
+ int exoid, err, num_dim, 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;
+ double fdum;
+ char *cdum;
+
+ struct stat file_status;
+ double glob_file_size;
+ double glob_raw_data_vol;
+ double raw_data_vol;
+
+ float *z, version;
+ float *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;
+ double cum_raw_read_time=0.0;
+ double total_time, max_total_time=0.0, min_total_time=DBL_MAX;
+ double raw_sleep_time = 0.0;
+ double cum_total_time=0.0;
+
+ char tmp_name[MAX_STRING_LEN], title[MAX_STRING_LEN+1];
+ char type[MAX_STRING_LEN+1];
+
+ for (iter=0; iter<num_iterations; iter++) {
+ /* open the EXODUS file */
+ get_file_name(file_name, EXODUS_FILE_TYPE, rank, num_domains, NULL, tmp_name);
+ exoid = ex_open (tmp_name, EX_READ, &CPU_word_size, &IO_word_size, &version);
+
+ if (exoid < 0) {
+ printf ("after ex_open\n");
+ return( EXIT_FAILURE );
+ }
+
+ raw_read_time = 0.0;
+ raw_data_vol = 0.;
+
+ tstart = my_timer();
+
+
+ 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);
+ }
+
+ len_connect = 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 ) );
+ }
+
+ t_tmp1 = my_timer();
+
+ err = ex_get_coord (exoid, *x_coords, *y_coords, z);
+
+ t_tmp2 = my_timer();
+
+ raw_read_time += t_tmp2-t_tmp1;
+ raw_data_vol += (double)(2 * (*num_nodes) * sizeof(float));
+
+ if (err) {
+ printf ("after ex_get_coord, error = %d\n", err);
+ ex_close (exoid);
+ return (EXIT_FAILURE );
+ }
+
+ err = ex_get_elem_block
+ (exoid, 10, type, num_elems, &num_nodes_per_elem, &num_attrs);
+
+ if (err) {
+ printf ("after ex_get_elem_block, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+
+ t_tmp1 = my_timer();
+
+ err = ex_get_elem_conn (exoid, 10, *connect);
+
+ t_tmp2 = my_timer();
+
+ raw_read_time += t_tmp2-t_tmp1;
+ raw_data_vol += (double)(len_connect * sizeof(int));
+
+ if (err) {
+ printf ("after ex_get_elem_conn, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+
+ /* read element and node maps */
+ t_tmp1 = my_timer();
+
+ err = ex_get_node_num_map (exoid, *node_map);
+
+ t_tmp2 = my_timer();
+
+ 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);
+ t_tmp2 = my_timer();
+
+ 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);
+
+ if (err) {
+ printf ("after ex_get_var_param, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+ *num_nodal_fields = num_vars;
+
+ err = ex_get_var_param (exoid, "g", &num_vars);
+
+ if (err) {
+ printf ("after ex_get_var_param, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+ *num_global_fields = num_vars;
+ if (*num_global_fields > 0) {
+ globals = malloc(*num_global_fields * sizeof(float));
+ }
+
+ err = ex_get_var_param (exoid, "e", &num_vars);
+
+ if (err) {
+ printf ("after ex_get_var_param, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+ *num_element_fields = num_vars;
+
+ /* read number of timesteps */
+ ex_inquire (exoid, EX_INQ_TIME, num_timesteps, &fdum, cdum);
+ if (rank == 0) {
+ fprintf(stderr, " Number of Elements\t\t%8d (per domain)\n", *num_elems );
+ fprintf(stderr, " Number of Nodes\t\t%8d (per domain)\n", *num_nodes );
+ fprintf(stderr, " Number of Global Fields\t%8d\n", *num_global_fields);
+ fprintf(stderr, " Number of Nodal Fields\t%8d\n", *num_nodal_fields);
+ fprintf(stderr, " Number of Element Fields\t%8d\n", *num_element_fields);
+ fprintf(stderr, " Number of Timesteps\t\t%8d\n", *num_timesteps);
+ if (sleep_time > 0) {
+ fprintf(stderr, " Timestep Sleep time\t%8d\n", sleep_time);
+ }
+ }
+
+ if (*num_nodal_fields+ *num_global_fields+ *num_element_fields > 0) {
+ int t;
+
+ if (rank == 0) {
+ fprintf (stderr, "\nReading Timestep: ");
+ }
+ for (t = 0; t < *num_timesteps; t++) {
+ if (sleep_time > 0) {
+ t_tmp1 = my_timer();
+ sleep(sleep_time);
+ t_tmp2 = my_timer();
+ raw_sleep_time += t_tmp2-t_tmp1;
+ }
+ if (rank == 0) {
+ fprintf(stderr," %d,", t+1);
+ }
+
+ 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);
+ t_tmp2 = my_timer();
+
+ raw_read_time += t_tmp2-t_tmp1;
+ raw_data_vol += (double)((*num_nodes) * sizeof(float));
+
+ if (err) {
+ printf ("after ex_get_nodal_var, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+ }
+
+ t_tmp1 = my_timer();
+ err = ex_get_glob_vars (exoid, t+1, *num_global_fields, globals);
+ t_tmp2 = my_timer();
+
+ raw_read_time += t_tmp2-t_tmp1;
+ raw_data_vol += (double)(*num_global_fields * sizeof(float));
+
+ if (err) {
+ printf ("after ex_get_glob_vars, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+
+ 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);
+ t_tmp2 = my_timer();
+
+ raw_read_time += t_tmp2-t_tmp1;
+ raw_data_vol += (double)((*num_elems) * sizeof(float));
+
+ if (err) {
+ printf ("after ex_get_elem_var, error = %d\n", err);
+ ex_close (exoid);
+ return( EXIT_FAILURE );
+ }
+ }
+ }
+
+ if (rank == 0) {
+ fprintf(stderr,"\n");
+ }
+ }
+
+ err = ex_close (exoid);
+ if (err) {
+ printf ("after ex_close, error = %d\n", err);
+ return ( EXIT_FAILURE );
+ }
+ tend = my_timer();
+
+ total_time = tend - tstart - raw_sleep_time;
+ if (total_time > max_total_time) max_total_time = total_time;
+ if (total_time < min_total_time) min_total_time = total_time;
+ cum_total_time += total_time;
+
+ if (raw_read_time > max_raw_read_time) max_raw_read_time = raw_read_time;
+ if (raw_read_time < min_raw_read_time) min_raw_read_time = raw_read_time;
+ cum_raw_read_time += raw_read_time;
+ } /* end of for (iter...) */
+
+#ifdef HAVE_PARALLEL
+ MPI_Allreduce (&raw_data_vol, &glob_raw_data_vol, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_COMM_WORLD);
+#else
+ glob_raw_data_vol = raw_data_vol;
+#endif
+ /*
+ * Get File Sizes
+ *
+ * Note: On ASCI Red, a specialized "stat", named "estat", was added to
+ * accommodate file sizes upto 16GB. 3/27/2002
+ */
+
+ if (stat( tmp_name, &file_status)) {
+ if ( rank == 0 )
+ fprintf ( stderr, "Exodus Read: cannot get %s file size.\n", tmp_name );
+ return( EXIT_FAILURE );
+ }
+ else
+ file_size = (double)file_status.st_size;
+
+#ifdef HAVE_PARALLEL
+ MPI_Allreduce(&file_size,
+ &glob_file_size,
+ 1,
+ MPI_DOUBLE,
+ MPI_SUM,
+ MPI_COMM_WORLD);
+#else
+ glob_file_size = file_size;
+#endif
+
+ if ( rank == 0 ) {
+ fprintf(stderr, " \n" );
+ 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, " \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",
+ min_raw_read_time, max_raw_read_time, cum_raw_read_time / num_iterations );
+ fprintf(stderr, " All Other Read (sec) \t \t \t%8.4g \n",
+ (cum_total_time - cum_raw_read_time) / num_iterations );
+ fprintf(stderr, " Total Read (sec) \t \t \t%8.4g \n",
+ cum_total_time / num_iterations );
+ 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);
+ fprintf(stderr, " Raw + Meta Data Read (MiB/sec)\t \t \t%8.4g \n",
+ glob_file_size / cum_total_time / MBYTES * num_iterations );
+ }
+ if (*num_global_fields > 0)
+ free(globals);
+ return( EXIT_SUCCESS );
+}
+
+/***********************************************************************
+ ***********************************************************************/
+int write_exo_mesh (char *file_name, int rank, 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 )
+
+{
+ 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 iter;
+ int *elem_var_tab;
+ double file_size;
+
+ struct stat file_status;
+ double glob_file_size;
+ double glob_raw_data_vol;
+ double raw_data_vol;
+
+ float *z, *globals = NULL;
+
+ double raw_open_close_time = 0.0;
+ double cum_open_close_time = 0.0;
+ double min_raw_open_close_time = DBL_MAX;
+ double max_raw_open_close_time = 0.0;
+ double tstart, tend, t_tmp1, t_tmp2;
+ double raw_write_time, max_raw_write_time=0.0, min_raw_write_time=DBL_MAX;
+ double cum_raw_write_time=0.0;
+ double total_time, max_total_time=0.0, min_total_time=DBL_MAX;
+ double cum_total_time=0.0;
+ double raw_sleep_time=0.0;
+ double put_time_time=0.0;
+
+ char tmp_name[MAX_STRING_LEN];
+ char base_name[MAX_STRING_LEN];
+ char **gvar_name;
+ char **nvar_name;
+ char **evar_name;
+
+ int *exoid = NULL;
+ exoid = malloc(files_per_domain * sizeof(int));
+
+ raw_open_close_time = 0.0;
+ for (iter=0; iter<num_iterations; iter++) {
+ if (!close_files) {
+ t_tmp1 = my_timer();
+ for (npd = 0; npd < files_per_domain; npd++) {
+ /* create the EXODUS file */
+
+ sprintf(base_name, "%s_%d", file_name, npd);
+ get_file_name(base_name, EXODUS_FILE_TYPE, rank, num_domains, WRITE_FILE_TYPE, tmp_name);
+ exoid[npd] = ex_create (tmp_name, EX_CLOBBER, &CPU_word_size, &IO_word_size);
+
+ if (exoid[npd] < 0) {
+ printf ("after ex_create\n");
+
+ return( EXIT_FAILURE );
+ }
+ }
+ t_tmp2 = my_timer();
+ raw_open_close_time += (t_tmp2 - t_tmp1);
+ }
+ raw_write_time = 0.0;
+ raw_data_vol = 0;
+
+ tstart = my_timer();
+
+ num_dim = 2;
+ num_elem_blk = 1;
+ num_node_sets = 0;
+ num_side_sets = 0;
+
+ for (npd = 0; npd < files_per_domain; npd++) {
+
+ if (close_files) {
+ /* create the EXODUS file */
+ sprintf(base_name, "%s_%d", file_name, npd);
+ get_file_name(base_name, EXODUS_FILE_TYPE, rank, num_domains, WRITE_FILE_TYPE, tmp_name);
+ exoid[npd] = ex_create (tmp_name, EX_CLOBBER, &CPU_word_size, &IO_word_size);
+
+ if (exoid[npd] < 0) {
+ printf ("after ex_create\n");
+ return( EXIT_FAILURE );
+ }
+ }
+ err = ex_put_init (exoid[npd], "This is a EXODUSII performance test.", num_dim,
+ num_nodes, num_elems, num_elem_blk,
+ num_node_sets, num_side_sets);
+
+ if (err) {
+ printf ("after ex_put_init, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE);
+ }
+
+
+#if 1
+ {
+ int ids[1] = {10};
+ int num_elem_per_block[1];
+ char *names[1] = {"quad"};
+ int num_node_per_elem[1];
+ int num_attr_per_block[1];
+ 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);
+ }
+#else
+ err = ex_put_elem_block
+ (exoid[npd], 10, "quad", num_elems, NUM_NODES_PER_ELEM, 0);
+#endif
+ if (err) {
+ printf ("after ex_put_elem_block, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE );
+ }
+
+ t_tmp1 = my_timer();
+ err = ex_put_coord (exoid[npd], x_coords, y_coords, z);
+ t_tmp2 = my_timer();
+
+ raw_write_time += t_tmp2-t_tmp1;
+ raw_data_vol += (2 * num_nodes * sizeof(float));
+
+ if (err) {
+ printf ("after ex_put_coord, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE );
+ }
+
+ t_tmp1 = my_timer();
+ err = ex_put_elem_conn (exoid[npd], 10, connect);
+ t_tmp2 = my_timer();
+
+ raw_write_time += t_tmp2-t_tmp1;
+ raw_data_vol += (num_elems * NUM_NODES_PER_ELEM * sizeof(int));
+
+ if (err) {
+ printf ("after ex_put_elem_conn, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE);
+ }
+
+ /* write out element and node maps */
+ t_tmp1 = my_timer();
+ err = ex_put_node_num_map (exoid[npd], node_map);
+ t_tmp2 = my_timer();
+
+ raw_write_time += t_tmp2-t_tmp1;
+ raw_data_vol += (num_nodes * sizeof(int));
+
+ if (err) {
+ printf ("after ex_put_node_num_map, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE );
+ }
+
+ t_tmp1 = my_timer();
+
+ err = ex_put_elem_num_map (exoid[npd], elem_map);
+
+ t_tmp2 = my_timer();
+
+ raw_write_time += t_tmp2-t_tmp1;
+ raw_data_vol += (num_elems * sizeof(int));
+
+ if (err) {
+ printf ("after ex_put_elem_num_map, error = %d\n", err);
+ ex_close (exoid[npd]);
+
+ return( EXIT_FAILURE );
+ }
+
+ /* write out simulated results fields;
+ we'll just write out the x coordinate field 'num_nodal_fields' times */
+ if (num_element_fields > 0) {
+ if (npd == 0) {
+ elem_var_tab = malloc(num_element_fields * sizeof(int));
+ for (j = 0; j < num_element_fields; j++)
+ elem_var_tab[j] = 1;
+ }
+ } else {
+ elem_var_tab = 0;
+ }
+ err = ex_put_all_var_param(exoid[npd],
+ num_global_fields,
+ num_nodal_fields,
+ num_element_fields,
+ elem_var_tab,
+ 0, 0, 0, 0);
+ if (err) {
+ fprintf(stderr, "after ex_put_all_var_param, error = %d\n", err);
+ ex_close (exoid[npd]);
+ exit(EXIT_FAILURE);
+ }
+
+ if (num_nodal_fields > 0) {
+
+ if (npd == 0) {
+ nvar_name = malloc (num_nodal_fields * sizeof(char *));
+ 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);
+ if (npd == files_per_domain-1) {
+ for (j=0; j<num_nodal_fields; j++) {
+ free(nvar_name[j]);
+ }
+ free(nvar_name);
+ }
+ }
+
+ if (num_global_fields > 0) {
+ if (npd == 0) {
+ globals = malloc(num_global_fields * sizeof(float));
+ 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));
+ sprintf (gvar_name[j], "global_field_%d", j+1);
+ globals[j] = j;
+ }
+ }
+
+ err = ex_put_var_names (exoid[npd], "g", num_global_fields, gvar_name);
+
+ if (npd == files_per_domain-1) {
+ for (j=0; j<num_global_fields; j++) {
+ free(gvar_name[j]);
+ }
+ free(gvar_name);
+ }
+ }
+
+ if (num_element_fields > 0) {
+ if (npd == 0) {
+ evar_name = malloc (num_element_fields * sizeof(char *));
+ for (j=0; j<num_element_fields; j++) {
+ evar_name[j] = malloc ((MAX_STRING_LEN+1) * sizeof (char));
+ sprintf (evar_name[j], "element_field_%d", j+1);
+ }
+ }
+
+ err = ex_put_var_names (exoid[npd], "e", num_element_fields, evar_name);
+
+ if (npd == files_per_domain-1) {
+ free(elem_var_tab);
+ for (j=0; j<num_element_fields; j++) {
+ free(evar_name[j]);
+ }
+ free(evar_name);
+ }
+ }
+ if (close_files) {
+ t_tmp1 = my_timer();
+ ex_close(exoid[npd]);
+ t_tmp2 = my_timer();
+ raw_open_close_time += (t_tmp2 - t_tmp1);
+ }
+ }
+
+ if (num_nodal_fields+num_global_fields+num_element_fields > 0) {
+ if ( rank == 0 ) {
+ fprintf (stderr, "\nWriting Timestep: ");
+ }
+ for (t=0; t<num_timesteps; t++) {
+ for (npd = 0; npd < files_per_domain; npd++) {
+ float time = t;
+
+ if (close_files) {
+ float version;
+ sprintf(base_name, "%s_%d", file_name, npd);
+ t_tmp1 = my_timer();
+ get_file_name(base_name, EXODUS_FILE_TYPE, rank, num_domains, WRITE_FILE_TYPE, tmp_name);
+ exoid[npd] = ex_open(tmp_name, EX_WRITE, &CPU_word_size, &IO_word_size, &version);
+ t_tmp2 = my_timer();
+ raw_open_close_time += (t_tmp2 - t_tmp1);
+ }
+
+ if (sleep_time > 0) {
+ t_tmp1 = my_timer();
+ sleep(sleep_time);
+ t_tmp2 = my_timer();
+ raw_sleep_time += t_tmp2-t_tmp1;
+ }
+ t_tmp1 = my_timer();
+ ex_put_time(exoid[npd], t+1, &time);
+ t_tmp2 = my_timer();
+ put_time_time += t_tmp2-t_tmp1;
+ if ( rank == 0) {
+ if (npd == 0) {
+ fprintf(stderr, " %d", t+1);
+ } else {
+ fprintf(stderr, ".");
+ }
+ }
+ if (num_global_fields > 0) {
+ t_tmp1 = my_timer();
+ err = ex_put_glob_vars (exoid[npd], t+1, 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);
+ }
+ }
+ 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);
+ 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);
+ }
+ }
+ 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);
+ 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);
+ }
+ }
+ if (close_files) {
+ t_tmp1 = my_timer();
+ ex_close(exoid[npd]);
+ t_tmp2 = my_timer();
+ raw_open_close_time += (t_tmp2 - t_tmp1);
+ }
+ }
+ }
+
+ if ( rank == 0 ) {
+ fprintf(stderr, "\n");
+ }
+ }
+ t_tmp1 = my_timer();
+ if (!close_files) {
+ if ( rank == 0 ) {fprintf(stderr, "Closing database...");}
+ for (npd = 0; npd < files_per_domain; npd++) {
+ err = ex_close (exoid[npd]);
+ if (err) {
+ printf ("after ex_close, error = %d\n", err);
+ return( EXIT_FAILURE);
+ }
+ }
+ if ( rank == 0 ) {fprintf(stderr, "\n");}
+ }
+ t_tmp2 = my_timer();
+ raw_open_close_time += (t_tmp2 - t_tmp1);
+
+ if ( rank == 0 ) {
+ fprintf(stderr, "ex_put_time = %5.2f seconds\n",put_time_time);
+ }
+ tend = my_timer();
+
+ total_time = tend - tstart - raw_sleep_time;
+
+ if (total_time > max_total_time) max_total_time = total_time;
+ if (total_time < min_total_time) min_total_time = total_time;
+
+ cum_total_time += total_time;
+
+ if (raw_write_time > max_raw_write_time) max_raw_write_time = raw_write_time;
+ if (raw_write_time < min_raw_write_time) min_raw_write_time = raw_write_time;
+
+ cum_raw_write_time += raw_write_time;
+
+ if (raw_open_close_time > max_raw_open_close_time) max_raw_open_close_time = raw_open_close_time;
+ if (raw_open_close_time < min_raw_open_close_time) min_raw_open_close_time = raw_open_close_time;
+
+ cum_open_close_time += raw_open_close_time;
+
+
+ raw_data_vol += ((double)(num_nodes*num_nodal_fields) +
+ (num_elems * num_element_fields) +
+ (num_global_fields)) * num_timesteps*files_per_domain*sizeof(float);
+
+ } /* end of for (iter...) */
+
+#ifdef HAVE_PARALLEL
+ MPI_Allreduce(
+ &raw_data_vol,
+ &glob_raw_data_vol,
+ 1,
+ MPI_DOUBLE,
+ MPI_SUM,
+ MPI_COMM_WORLD
+ );
+#else
+ glob_raw_data_vol = raw_data_vol;
+#endif
+ /*
+ * Get File Sizes
+ *
+ * Note: On ASCI Red, a specialized "stat", named "estat", was added to
+ * accommodate file sizes upto 16GB. 3/27/2002
+ */
+
+ if ( stat( tmp_name, &file_status ) ) {
+ if ( rank == 0 )
+ fprintf ( stderr, "Exodus Write: cannot get %s file size.\n", tmp_name );
+
+ return( EXIT_FAILURE );
+ }
+ else
+ file_size = (double)file_status.st_size * files_per_domain;
+
+#ifdef HAVE_PARALLEL
+ MPI_Allreduce (&file_size, &glob_file_size, 1, MPI_DOUBLE, MPI_SUM,
+ MPI_COMM_WORLD);
+#else
+ glob_file_size = file_size;
+#endif
+
+ if ( rank == 0 ) {
+ fprintf(stderr, " \n" );
+ 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, " \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",
+ min_raw_write_time, max_raw_write_time, cum_raw_write_time / num_iterations );
+ fprintf(stderr, " All Other Write (sec) \t \t \t%8.4g \n",
+ (cum_total_time - cum_raw_write_time) / num_iterations );
+ fprintf(stderr, " Open/Close Time (sec) \t \t \t%8.4g \n",
+ cum_open_close_time / num_iterations );
+ fprintf(stderr, " Total Write (sec) \t \t \t%8.4g \n",
+ cum_total_time / num_iterations );
+ 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);
+ fprintf(stderr, " Raw + Meta Data Write (MiB/sec) \t \t%8.4g\n",
+ glob_file_size / cum_total_time / MBYTES * num_iterations );
+ }
+ free(exoid);
+ if (num_global_fields > 0)
+ free(globals);
+ return( EXIT_SUCCESS );
+}
+
+/*****************************************************************************/
+void get_file_name(const char* base, const char* ext, int rank, int nprocs,
+ const char* other,char *output)
+{
+ int i1, iTemp1;
+ int iMaxDigit=0, iMyDigit=0;
+ char cTemp[128];
+
+ output[0] = '\0';
+ strcpy(output, base);
+ strcat(output, ".");
+ strcat(output, ext);
+ if (other != NULL) {
+ strcat(output, ".");
+ strcat(output, other);
+ }
+
+ if (nprocs > 1) {
+ /*
+ * Find out the number of digits needed to specify the processor ID.
+ * This allows numbers like 01-99, i.e., prepending zeros to the
+ * name to preserve proper alphabetic sorting of the files.
+ */
+
+ iTemp1 = nprocs;
+ do {
+ iTemp1 /= 10;
+ iMaxDigit++;
+ }
+ while(iTemp1 >= 1);
+
+ iTemp1 = rank;
+ do {
+ iTemp1 /= 10;
+ iMyDigit++;
+ }
+ while(iTemp1 >= 1);
+
+ strcat(output, ".");
+ sprintf(cTemp, "%d", nprocs);
+ strcat(output, cTemp);
+ strcat(output, ".");
+
+ /*
+ * Append the proper number of zeros to the filename.
+ */
+ for(i1=0; i1 < iMaxDigit-iMyDigit; i1++)
+ strcat(output, "0");
+
+ sprintf(cTemp, "%d", rank);
+ strcat(output, cTemp);
+ }
+}
diff --git a/cbind/test/test.dmp b/cbind/test/test.dmp
new file mode 100644
index 0000000..1b77584
--- /dev/null
+++ b/cbind/test/test.dmp
@@ -0,0 +1,963 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 33 ;
+ num_elem = 7 ;
+ num_el_blk = 7 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 8 ;
+ num_side_ss5 = 10 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+ num_nset_var = 3 ;
+ num_sset_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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 node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ char name_sset_var(num_sset_var, len_string) ;
+ 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) ;
+ float vals_sset_var1ss3(time_step, num_side_ss3) ;
+ float vals_sset_var1ss4(time_step, num_side_ss4) ;
+ float vals_sset_var1ss5(time_step, num_side_ss5) ;
+ float vals_sset_var2ss1(time_step, num_side_ss1) ;
+ float vals_sset_var2ss2(time_step, num_side_ss2) ;
+ float vals_sset_var2ss3(time_step, num_side_ss3) ;
+ float vals_sset_var2ss4(time_step, num_side_ss4) ;
+ float vals_sset_var2ss5(time_step, num_side_ss5) ;
+ float vals_sset_var3ss1(time_step, num_side_ss1) ;
+ float vals_sset_var3ss2(time_step, num_side_ss2) ;
+ float vals_sset_var3ss3(time_step, num_side_ss3) ;
+ float vals_sset_var3ss4(time_step, num_side_ss4) ;
+ float vals_sset_var3ss5(time_step, num_side_ss5) ;
+ float vals_nset_var1ns1(time_step, num_nod_ns1) ;
+ float vals_nset_var1ns2(time_step, num_nod_ns2) ;
+ float vals_nset_var2ns1(time_step, num_nod_ns1) ;
+ float vals_nset_var2ns2(time_step, num_nod_ns2) ;
+ float vals_nset_var3ns1(time_step, num_nod_ns1) ;
+ 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 ;
+ :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_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "block_1",
+ "block_2",
+ "block_3",
+ "block_4",
+ "block_5",
+ "block_6",
+ "block_7" ;
+
+ ns_names =
+ "nset_1",
+ "nset_2" ;
+
+ ss_names =
+ "sset_1",
+ "sset_2",
+ "sset_3",
+ "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 ;
+
+ attrib_name7 =
+ "THICKNESS" ;
+
+ connect7 =
+ 31, 32, 33 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4, 6, 6, 6, 6 ;
+
+ side_ss4 = 1, 2, 3, 4, 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5, 7, 7, 7, 7, 7 ;
+
+ side_ss5 = 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT",
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "node_variable_a_very_long_name_0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ name_nset_var =
+ "ns_var0",
+ "ns_var1",
+ "ns_var2" ;
+
+ name_sset_var =
+ "ss_var0",
+ "ss_var1",
+ "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 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ 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 =
+ 6.01, 6.02,
+ 6.02, 6.04,
+ 6.03, 6.06,
+ 6.04, 6.08,
+ 6.05, 6.1,
+ 6.06, 6.12,
+ 6.07, 6.14,
+ 6.08, 6.16,
+ 6.09, 6.18,
+ 6.1, 6.2 ;
+
+ vals_sset_var1ss2 =
+ 7.01, 7.02,
+ 7.02, 7.04,
+ 7.03, 7.06,
+ 7.04, 7.08,
+ 7.05, 7.1,
+ 7.06, 7.12,
+ 7.07, 7.14,
+ 7.08, 7.16,
+ 7.09, 7.18,
+ 7.1, 7.2 ;
+
+ vals_sset_var1ss3 =
+ 8.01, 8.02, 8.03, 8.04, 8.05, 8.06, 8.07,
+ 8.02, 8.04, 8.06, 8.08, 8.1, 8.12, 8.14,
+ 8.03, 8.06, 8.09, 8.12, 8.15, 8.18, 8.21,
+ 8.04, 8.08, 8.12, 8.16, 8.2, 8.24, 8.28,
+ 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35,
+ 8.06, 8.12, 8.18, 8.24, 8.3, 8.36, 8.42,
+ 8.07, 8.14, 8.21, 8.28, 8.35, 8.42, 8.49,
+ 8.08, 8.16, 8.24, 8.32, 8.4, 8.48, 8.56,
+ 8.09, 8.18, 8.27, 8.36, 8.45, 8.54, 8.63,
+ 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7 ;
+
+ vals_sset_var1ss4 =
+ 9.01, 9.02, 9.03, 9.04, 9.05, 9.06, 9.07, 9.08,
+ 9.02, 9.04, 9.06, 9.08, 9.1, 9.12, 9.14, 9.16,
+ 9.03, 9.06, 9.09, 9.12, 9.15, 9.18, 9.21, 9.24,
+ 9.04, 9.08, 9.12, 9.16, 9.2, 9.24, 9.28, 9.32,
+ 9.05, 9.1, 9.15, 9.2, 9.25, 9.3, 9.35, 9.4,
+ 9.06, 9.12, 9.18, 9.24, 9.3, 9.36, 9.42, 9.48,
+ 9.07, 9.14, 9.21, 9.28, 9.35, 9.42, 9.49, 9.56,
+ 9.08, 9.16, 9.24, 9.32, 9.4, 9.48, 9.56, 9.64,
+ 9.09, 9.18, 9.27, 9.36, 9.45, 9.54, 9.63, 9.72,
+ 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7, 9.8 ;
+
+ vals_sset_var1ss5 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07, 10.08, 10.09, 10.1,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14, 10.16, 10.18, 10.2,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21, 10.24, 10.27, 10.3,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28, 10.32, 10.36, 10.4,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35, 10.4, 10.45, 10.5,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42, 10.48, 10.54, 10.6,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49, 10.56, 10.63, 10.7,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56, 10.64, 10.72, 10.8,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63, 10.72, 10.81, 10.9,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11 ;
+
+ vals_sset_var2ss1 =
+ 7.01, 7.02,
+ 7.02, 7.04,
+ 7.03, 7.06,
+ 7.04, 7.08,
+ 7.05, 7.1,
+ 7.06, 7.12,
+ 7.07, 7.14,
+ 7.08, 7.16,
+ 7.09, 7.18,
+ 7.1, 7.2 ;
+
+ vals_sset_var2ss2 =
+ 8.01, 8.02,
+ 8.02, 8.04,
+ 8.03, 8.06,
+ 8.04, 8.08,
+ 8.05, 8.1,
+ 8.06, 8.12,
+ 8.07, 8.14,
+ 8.08, 8.16,
+ 8.09, 8.18,
+ 8.1, 8.2 ;
+
+ vals_sset_var2ss3 =
+ 9.01, 9.02, 9.03, 9.04, 9.05, 9.06, 9.07,
+ 9.02, 9.04, 9.06, 9.08, 9.1, 9.12, 9.14,
+ 9.03, 9.06, 9.09, 9.12, 9.15, 9.18, 9.21,
+ 9.04, 9.08, 9.12, 9.16, 9.2, 9.24, 9.28,
+ 9.05, 9.1, 9.15, 9.2, 9.25, 9.3, 9.35,
+ 9.06, 9.12, 9.18, 9.24, 9.3, 9.36, 9.42,
+ 9.07, 9.14, 9.21, 9.28, 9.35, 9.42, 9.49,
+ 9.08, 9.16, 9.24, 9.32, 9.4, 9.48, 9.56,
+ 9.09, 9.18, 9.27, 9.36, 9.45, 9.54, 9.63,
+ 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7 ;
+
+ vals_sset_var2ss4 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07, 10.08,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14, 10.16,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21, 10.24,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28, 10.32,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35, 10.4,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42, 10.48,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49, 10.56,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56, 10.64,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63, 10.72,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8 ;
+
+ vals_sset_var2ss5 =
+ 11.01, 11.02, 11.03, 11.04, 11.05, 11.06, 11.07, 11.08, 11.09, 11.1,
+ 11.02, 11.04, 11.06, 11.08, 11.1, 11.12, 11.14, 11.16, 11.18, 11.2,
+ 11.03, 11.06, 11.09, 11.12, 11.15, 11.18, 11.21, 11.24, 11.27, 11.3,
+ 11.04, 11.08, 11.12, 11.16, 11.2, 11.24, 11.28, 11.32, 11.36, 11.4,
+ 11.05, 11.1, 11.15, 11.2, 11.25, 11.3, 11.35, 11.4, 11.45, 11.5,
+ 11.06, 11.12, 11.18, 11.24, 11.3, 11.36, 11.42, 11.48, 11.54, 11.6,
+ 11.07, 11.14, 11.21, 11.28, 11.35, 11.42, 11.49, 11.56, 11.63, 11.7,
+ 11.08, 11.16, 11.24, 11.32, 11.4, 11.48, 11.56, 11.64, 11.72, 11.8,
+ 11.09, 11.18, 11.27, 11.36, 11.45, 11.54, 11.63, 11.72, 11.81, 11.9,
+ 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 11.9, 12 ;
+
+ vals_sset_var3ss1 =
+ 8.01, 8.02,
+ 8.02, 8.04,
+ 8.03, 8.06,
+ 8.04, 8.08,
+ 8.05, 8.1,
+ 8.06, 8.12,
+ 8.07, 8.14,
+ 8.08, 8.16,
+ 8.09, 8.18,
+ 8.1, 8.2 ;
+
+ vals_sset_var3ss2 =
+ 9.01, 9.02,
+ 9.02, 9.04,
+ 9.03, 9.06,
+ 9.04, 9.08,
+ 9.05, 9.1,
+ 9.06, 9.12,
+ 9.07, 9.14,
+ 9.08, 9.16,
+ 9.09, 9.18,
+ 9.1, 9.2 ;
+
+ vals_sset_var3ss3 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7 ;
+
+ vals_sset_var3ss4 =
+ 11.01, 11.02, 11.03, 11.04, 11.05, 11.06, 11.07, 11.08,
+ 11.02, 11.04, 11.06, 11.08, 11.1, 11.12, 11.14, 11.16,
+ 11.03, 11.06, 11.09, 11.12, 11.15, 11.18, 11.21, 11.24,
+ 11.04, 11.08, 11.12, 11.16, 11.2, 11.24, 11.28, 11.32,
+ 11.05, 11.1, 11.15, 11.2, 11.25, 11.3, 11.35, 11.4,
+ 11.06, 11.12, 11.18, 11.24, 11.3, 11.36, 11.42, 11.48,
+ 11.07, 11.14, 11.21, 11.28, 11.35, 11.42, 11.49, 11.56,
+ 11.08, 11.16, 11.24, 11.32, 11.4, 11.48, 11.56, 11.64,
+ 11.09, 11.18, 11.27, 11.36, 11.45, 11.54, 11.63, 11.72,
+ 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8 ;
+
+ vals_sset_var3ss5 =
+ 12.01, 12.02, 12.03, 12.04, 12.05, 12.06, 12.07, 12.08, 12.09, 12.1,
+ 12.02, 12.04, 12.06, 12.08, 12.1, 12.12, 12.14, 12.16, 12.18, 12.2,
+ 12.03, 12.06, 12.09, 12.12, 12.15, 12.18, 12.21, 12.24, 12.27, 12.3,
+ 12.04, 12.08, 12.12, 12.16, 12.2, 12.24, 12.28, 12.32, 12.36, 12.4,
+ 12.05, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.4, 12.45, 12.5,
+ 12.06, 12.12, 12.18, 12.24, 12.3, 12.36, 12.42, 12.48, 12.54, 12.6,
+ 12.07, 12.14, 12.21, 12.28, 12.35, 12.42, 12.49, 12.56, 12.63, 12.7,
+ 12.08, 12.16, 12.24, 12.32, 12.4, 12.48, 12.56, 12.64, 12.72, 12.8,
+ 12.09, 12.18, 12.27, 12.36, 12.45, 12.54, 12.63, 12.72, 12.81, 12.9,
+ 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13 ;
+
+ vals_nset_var1ns1 =
+ 8.01, 8.02, 8.03, 8.04, 8.05,
+ 8.02, 8.04, 8.06, 8.08, 8.1,
+ 8.03, 8.06, 8.09, 8.12, 8.15,
+ 8.04, 8.08, 8.12, 8.16, 8.2,
+ 8.05, 8.1, 8.15, 8.2, 8.25,
+ 8.06, 8.12, 8.18, 8.24, 8.3,
+ 8.07, 8.14, 8.21, 8.28, 8.35,
+ 8.08, 8.16, 8.24, 8.32, 8.4,
+ 8.09, 8.18, 8.27, 8.36, 8.45,
+ 8.1, 8.2, 8.3, 8.4, 8.5 ;
+
+ vals_nset_var1ns2 =
+ 9.01, 9.02, 9.03,
+ 9.02, 9.04, 9.06,
+ 9.03, 9.06, 9.09,
+ 9.04, 9.08, 9.12,
+ 9.05, 9.1, 9.15,
+ 9.06, 9.12, 9.18,
+ 9.07, 9.14, 9.21,
+ 9.08, 9.16, 9.24,
+ 9.09, 9.18, 9.27,
+ 9.1, 9.2, 9.3 ;
+
+ vals_nset_var2ns1 =
+ 9.01, 9.02, 9.03, 9.04, 9.05,
+ 9.02, 9.04, 9.06, 9.08, 9.1,
+ 9.03, 9.06, 9.09, 9.12, 9.15,
+ 9.04, 9.08, 9.12, 9.16, 9.2,
+ 9.05, 9.1, 9.15, 9.2, 9.25,
+ 9.06, 9.12, 9.18, 9.24, 9.3,
+ 9.07, 9.14, 9.21, 9.28, 9.35,
+ 9.08, 9.16, 9.24, 9.32, 9.4,
+ 9.09, 9.18, 9.27, 9.36, 9.45,
+ 9.1, 9.2, 9.3, 9.4, 9.5 ;
+
+ vals_nset_var2ns2 =
+ 10.01, 10.02, 10.03,
+ 10.02, 10.04, 10.06,
+ 10.03, 10.06, 10.09,
+ 10.04, 10.08, 10.12,
+ 10.05, 10.1, 10.15,
+ 10.06, 10.12, 10.18,
+ 10.07, 10.14, 10.21,
+ 10.08, 10.16, 10.24,
+ 10.09, 10.18, 10.27,
+ 10.1, 10.2, 10.3 ;
+
+ vals_nset_var3ns1 =
+ 10.01, 10.02, 10.03, 10.04, 10.05,
+ 10.02, 10.04, 10.06, 10.08, 10.1,
+ 10.03, 10.06, 10.09, 10.12, 10.15,
+ 10.04, 10.08, 10.12, 10.16, 10.2,
+ 10.05, 10.1, 10.15, 10.2, 10.25,
+ 10.06, 10.12, 10.18, 10.24, 10.3,
+ 10.07, 10.14, 10.21, 10.28, 10.35,
+ 10.08, 10.16, 10.24, 10.32, 10.4,
+ 10.09, 10.18, 10.27, 10.36, 10.45,
+ 10.1, 10.2, 10.3, 10.4, 10.5 ;
+
+ vals_nset_var3ns2 =
+ 11.01, 11.02, 11.03,
+ 11.02, 11.04, 11.06,
+ 11.03, 11.06, 11.09,
+ 11.04, 11.08, 11.12,
+ 11.05, 11.1, 11.15,
+ 11.06, 11.12, 11.18,
+ 11.07, 11.14, 11.21,
+ 11.08, 11.16, 11.24,
+ 11.09, 11.18, 11.27,
+ 11.1, 11.2, 11.3 ;
+}
diff --git a/cbind/test/test.exo_c b/cbind/test/test.exo_c
new file mode 100644
index 0000000..a1b78ba
--- /dev/null
+++ b/cbind/test/test.exo_c
@@ -0,0 +1,40 @@
+CDF
+
+ time_stepnum_dim num_nodesnum_elem
+num_el_blk
+len_string len_lineQfour
num_node_sets
num_side_setsnum_el_in_blk10num_nod_per_el10num_att_in_blk10num_el_in_blk11num_nod_per_el11num_att_in_blk11
num_nod_ns20
num_nod_ns21
num_el_ss30
num_nod_ss30
+num_qa_recnum_info
num_glo_var
num_nod_var
num_elem_var
typerversion?�G�titleThis is a test
+time_whole
L el_blk_id�
node_set_ids�
side_set_ids �coord@�
+coor_names elem_map $ connect10
+
elem_type quadjunk , connect11
elem_type quadjunk <attrib10
+
Lattrib11
P node_ns20 Tdist_fact_ns20 h node_ns21
|dist_fact_ns21
� elem_ss30 � node_ss30 �dist_fact_ss30 �
+qa_recordsH �
info_records�
+
vals_glo_var
P
name_glo_var
+�
vals_nod_var@
T
name_nod_var
name_elem_var
vals_elem_var1eb10
+
�vals_elem_var2eb10
+
�vals_elem_var3eb10
+
�vals_elem_var1eb11
�vals_elem_var2eb11
�vals_elem_var3eb11
�
elem_var_tab
4
+
?�?�?�@@?�?�?�?�?�xcoorycoor@I�@ć�defgh?�@@@@�@����?���@ff at FffPRONTO2Dpronto2d3/10/9215:41:33FASTQfastq2/10/9211:41:33This is the first information record.This is the second information record.This is the third information record.glo_varsnod_var0nod_var1ele_var0ele_var1ele_var2?�?�?�?�?�?�?�?�@@@@@@@@@@@�@�@�@�@�<#�
+<#�
+?�?�G�?��\?��
+?�
�?�ff?��?���@@��@G�@�@�\@33@�
+@z�@@@�@�@�@�@�<��
+<��
+?�?��\?�
�?��?�=q?���?�\)?��@@G�@�\@�
+@
�@ff@�@��@@@�@�@�@�@�<�<�?�?��
+?��?��?�\)?�33?�
+=?��H@@�@�
+@@�@ ��@
�@
p�@@@�@�@�@�@�=#�
+=#�
+?�?�
�?�=q?�\)?�z�?���?��R?��
+@@�\@
�@�@
+=q@
��@\)@�@@@�@�@�@�@�=L��=L��?�?�ff?���?�33?���?�?�ff?���@@33@ff@ ��@
��@@33@ff@@@�@�@�@�@�=u=u?�?��?�\)?�
+=?��R?�ff?�{?�@@�
+@�@
�@\)@33@
+=@�H@@@�@�@�@�@�=�\)=�\)?�?���?��?��H?��
+?���?�?��R@@z�@��@
p�@�@ff@�H@\)@@@�@�@�@�@�=��
+=��
+?�?�=q?�z�?��R?���?�33?�p�?Ǯ@@
�@
+=q@\)@z�@��@
�R@#�
+@@@�@�@�@�@�=�Q�=�Q�?�?��?�
+>?��\?�{?���?�
�?У�@@@
�@G�@
diff --git a/cbind/test/test1.dmp b/cbind/test/test1.dmp
new file mode 100644
index 0000000..c1e9b5e
--- /dev/null
+++ b/cbind/test/test1.dmp
@@ -0,0 +1,708 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 28 ;
+ num_elem = 8 ;
+ num_el_blk = 7 ;
+ num_node_sets = 2 ;
+ num_side_sets = 5 ;
+ num_node_maps = 1 ;
+ num_elem_maps = 2 ;
+ num_el_in_blk1 = 1 ;
+ num_nod_per_el1 = 4 ;
+ num_att_in_blk1 = 3 ;
+ num_el_in_blk2 = 2 ;
+ num_nod_per_el2 = 4 ;
+ num_att_in_blk2 = 3 ;
+ num_el_in_blk3 = 1 ;
+ num_nod_per_el3 = 8 ;
+ num_att_in_blk3 = 3 ;
+ num_el_in_blk4 = 1 ;
+ num_nod_per_el4 = 4 ;
+ num_att_in_blk4 = 3 ;
+ num_el_in_blk5 = 1 ;
+ num_nod_per_el5 = 1 ;
+ num_att_in_blk5 = 3 ;
+ num_el_in_blk6 = 1 ;
+ num_nod_per_el6 = 1 ;
+ num_att_in_blk6 = 3 ;
+ num_el_in_blk7 = 1 ;
+ num_nod_per_el7 = 6 ;
+ num_att_in_blk7 = 3 ;
+ num_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 2 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, len_string) ;
+ int nm_prop1(num_node_maps) ;
+ nm_prop1:name = "ID" ;
+ char nmap_names(num_node_maps, len_string) ;
+ int node_map1(num_nodes) ;
+ int em_prop1(num_elem_maps) ;
+ em_prop1:name = "ID" ;
+ char emap_names(num_elem_maps, len_string) ;
+ int elem_map1(num_elem) ;
+ int elem_map2(num_elem) ;
+ int em_prop2(num_elem_maps) ;
+ em_prop2:_FillValue = 0 ;
+ em_prop2:name = "ORDER" ;
+ int em_prop3(num_elem_maps) ;
+ em_prop3:_FillValue = 0 ;
+ em_prop3:name = "NUMBER" ;
+ int nm_prop2(num_node_maps) ;
+ nm_prop2:_FillValue = 0 ;
+ nm_prop2:name = "NUMBER" ;
+ 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 = "circle" ;
+ 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 = "sphere" ;
+ 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 = "wedge" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ float vals_elem_var1eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var1eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var1eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var1eb6(time_step, num_el_in_blk6) ;
+ float vals_elem_var1eb7(time_step, num_el_in_blk7) ;
+ float vals_elem_var2eb1(time_step, num_el_in_blk1) ;
+ float vals_elem_var2eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var2eb3(time_step, num_el_in_blk3) ;
+ float vals_elem_var2eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var2eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var2eb6(time_step, num_el_in_blk6) ;
+ float vals_elem_var2eb7(time_step, num_el_in_blk7) ;
+ float vals_elem_var3eb1(time_step, num_el_in_blk1) ;
+ float vals_elem_var3eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var3eb3(time_step, num_el_in_blk3) ;
+ float vals_elem_var3eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var3eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var3eb6(time_step, num_el_in_blk6) ;
+ 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 ;
+ :title = "This is testwt1" ;
+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_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ nm_prop1 = 333 ;
+
+ nmap_names =
+ "Node_Map_111" ;
+
+ node_map1 = 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51,
+ 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84 ;
+
+ em_prop1 = 111, 222 ;
+
+ emap_names =
+ "Element_Map_111",
+ "Element_Map_222" ;
+
+ elem_map1 = 1, 2, 3, 4, 5, 6, 7, 8 ;
+
+ elem_map2 = 2, 4, 6, 8, 10, 12, 14, 16 ;
+
+ em_prop2 = 1, _ ;
+
+ em_prop3 = _, 1 ;
+
+ nm_prop2 = 1 ;
+
+ attrib1 =
+ 1, 2, 3 ;
+
+ attrib_name1 =
+ "",
+ "",
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 1.11, 2.11, 3.11,
+ 1.12, 2.12, 3.12 ;
+
+ attrib_name2 =
+ "",
+ "",
+ "" ;
+
+ connect2 =
+ 1, 2, 3, 4,
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 1.2, 2.2, 3.2 ;
+
+ attrib_name3 =
+ "",
+ "",
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 1.3, 2.3, 3.3 ;
+
+ attrib_name4 =
+ "",
+ "",
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 1.4, 2.4, 3.4 ;
+
+ attrib_name5 =
+ "",
+ "",
+ "" ;
+
+ connect5 =
+ 21 ;
+
+ attrib6 =
+ 1.5, 2.5, 3.5 ;
+
+ attrib_name6 =
+ "",
+ "",
+ "" ;
+
+ connect6 =
+ 22 ;
+
+ attrib7 =
+ 1.6, 2.6, 3.6 ;
+
+ attrib_name7 =
+ "",
+ "",
+ "" ;
+
+ connect7 =
+ 23, 24, 25, 26, 27, 28 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 3, 3 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 3 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 4, 4, 4, 4, 4, 4, 4 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 5, 5, 5, 5 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 6, 7 ;
+
+ side_ss5 = 1, 1 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT1",
+ "testwt1",
+ "03/16/94",
+ "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." ;
+
+ name_glo_var =
+ "glo vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var1eb2 =
+ 5.01, 5.02,
+ 5.02, 5.04,
+ 5.03, 5.06,
+ 5.04, 5.08,
+ 5.05, 5.1,
+ 5.06, 5.12,
+ 5.07, 5.14,
+ 5.08, 5.16,
+ 5.09, 5.18,
+ 5.1, 5.2 ;
+
+ 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_var1eb5 =
+ 8.01,
+ 8.02,
+ 8.03,
+ 8.04,
+ 8.05,
+ 8.06,
+ 8.07,
+ 8.08,
+ 8.09,
+ 8.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_var1eb7 =
+ 10.01,
+ 10.02,
+ 10.03,
+ 10.04,
+ 10.05,
+ 10.06,
+ 10.07,
+ 10.08,
+ 10.09,
+ 10.1 ;
+
+ vals_elem_var2eb1 =
+ 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.02, 6.04,
+ 6.03, 6.06,
+ 6.04, 6.08,
+ 6.05, 6.1,
+ 6.06, 6.12,
+ 6.07, 6.14,
+ 6.08, 6.16,
+ 6.09, 6.18,
+ 6.1, 6.2 ;
+
+ 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_var2eb4 =
+ 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_var2eb6 =
+ 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_var3eb1 =
+ 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.02, 7.04,
+ 7.03, 7.06,
+ 7.04, 7.08,
+ 7.05, 7.1,
+ 7.06, 7.12,
+ 7.07, 7.14,
+ 7.08, 7.16,
+ 7.09, 7.18,
+ 7.1, 7.2 ;
+
+ 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_var3eb4 =
+ 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_var3eb6 =
+ 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 ;
+}
diff --git a/cbind/test/test2-1.dmp b/cbind/test/test2-1.dmp
new file mode 100644
index 0000000..0b3b06d
--- /dev/null
+++ b/cbind/test/test2-1.dmp
@@ -0,0 +1,550 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ 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) ;
+ 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 ;
+ :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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT2",
+ "testwt2",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/cbind/test/test2-2.dmp b/cbind/test/test2-2.dmp
new file mode 100644
index 0000000..9c21cab
--- /dev/null
+++ b/cbind/test/test2-2.dmp
@@ -0,0 +1,550 @@
+netcdf test2 {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ 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) ;
+ 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 ;
+ :title = "This is test 2" ;
+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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 100, 200, 300, 400, 500 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT2",
+ "testwt2",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/cbind/test/test2.dmp b/cbind/test/test2.dmp
new file mode 100644
index 0000000..4d98697
--- /dev/null
+++ b/cbind/test/test2.dmp
@@ -0,0 +1,274 @@
+netcdf test2 {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ 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 ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ int eb_prop2(num_el_blk) ;
+ eb_prop2:_FillValue = 0 ;
+ eb_prop2:name = "ID" ;
+ int eb_prop3(num_el_blk) ;
+ eb_prop3:_FillValue = 0 ;
+ eb_prop3:name = "MATL" ;
+ int eb_prop4(num_el_blk) ;
+ eb_prop4:_FillValue = 0 ;
+ eb_prop4:name = "DENSITY" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "ID" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:_FillValue = 0 ;
+ ns_prop3:name = "FACE" ;
+ int ns_prop4(num_node_sets) ;
+ ns_prop4:_FillValue = 0 ;
+ ns_prop4:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ char qa_records(num_qa_rec, four, len_string) ;
+ char info_records(num_info, len_line) ;
+
+// 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_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 0 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 0 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 0 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 0 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 0 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = _, _, _, _, _ ;
+
+ eb_prop3 = 10, 20, 30, 40, 50 ;
+
+ eb_prop4 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = _, _ ;
+
+ ns_prop3 = 4, 5 ;
+
+ ns_prop4 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT2",
+ "testwt2",
+ "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/cbind/test/test_clb.dmp b/cbind/test/test_clb.dmp
new file mode 100644
index 0000000..d5d42f1
--- /dev/null
+++ b/cbind/test/test_clb.dmp
@@ -0,0 +1,981 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 33 ;
+ num_elem = 7 ;
+ num_el_blk = 7 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 8 ;
+ num_side_ss5 = 10 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+ num_nset_var = 4 ;
+ num_sset_var = 7 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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 = "MATL" ;
+ int eb_prop3(num_el_blk) ;
+ eb_prop3:_FillValue = 0 ;
+ eb_prop3:name = "DENSITY" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ char qa_records(num_qa_rec, four, len_string) ;
+ 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) ;
+ 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) ;
+ 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) ;
+ char name_nset_var(num_nset_var, len_string) ;
+ float vals_nset_var1ns1(time_step, num_nod_ns1) ;
+ float vals_nset_var3ns1(time_step, num_nod_ns1) ;
+ float vals_nset_var1ns2(time_step, num_nod_ns2) ;
+ float vals_nset_var3ns2(time_step, num_nod_ns2) ;
+ int nset_var_tab(num_node_sets, num_nset_var) ;
+ char name_sset_var(num_sset_var, len_string) ;
+ float vals_sset_var2ss1(time_step, num_side_ss1) ;
+ float vals_sset_var4ss1(time_step, num_side_ss1) ;
+ float vals_sset_var6ss1(time_step, num_side_ss1) ;
+ float vals_sset_var1ss2(time_step, num_side_ss2) ;
+ float vals_sset_var3ss2(time_step, num_side_ss2) ;
+ float vals_sset_var5ss2(time_step, num_side_ss2) ;
+ float vals_sset_var7ss2(time_step, num_side_ss2) ;
+ float vals_sset_var2ss3(time_step, num_side_ss3) ;
+ float vals_sset_var4ss3(time_step, num_side_ss3) ;
+ float vals_sset_var6ss3(time_step, num_side_ss3) ;
+ float vals_sset_var1ss4(time_step, num_side_ss4) ;
+ float vals_sset_var3ss4(time_step, num_side_ss4) ;
+ float vals_sset_var5ss4(time_step, num_side_ss4) ;
+ float vals_sset_var7ss4(time_step, num_side_ss4) ;
+ float vals_sset_var2ss5(time_step, num_side_ss5) ;
+ float vals_sset_var4ss5(time_step, num_side_ss5) ;
+ float vals_sset_var6ss5(time_step, num_side_ss5) ;
+ 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 ;
+ :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_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5, 6, 7 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ attrib6 =
+ 6.1416 ;
+
+ attrib_name6 =
+ "" ;
+
+ connect6 =
+ 17, 18, 19, 20, 27, 28, 30, 29 ;
+
+ attrib7 =
+ 6.1416 ;
+
+ attrib_name7 =
+ "" ;
+
+ connect7 =
+ 31, 32, 33 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4, 6, 6, 6, 6 ;
+
+ side_ss4 = 1, 2, 3, 4, 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5, 7, 7, 7, 7, 7 ;
+
+ side_ss5 = 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT",
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "node_variable_a_very_long_name_0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+
+ name_nset_var =
+ "nset_var0",
+ "nset_var1",
+ "nset_var2",
+ "nset_var3" ;
+
+ vals_nset_var1ns1 =
+ 3.01, 3.02, 3.03, 3.04, 3.05,
+ 3.02, 3.04, 3.06, 3.08, 3.1,
+ 3.03, 3.06, 3.09, 3.12, 3.15,
+ 3.04, 3.08, 3.12, 3.16, 3.2,
+ 3.05, 3.1, 3.15, 3.2, 3.25,
+ 3.06, 3.12, 3.18, 3.24, 3.3,
+ 3.07, 3.14, 3.21, 3.28, 3.35,
+ 3.08, 3.16, 3.24, 3.32, 3.4,
+ 3.09, 3.18, 3.27, 3.36, 3.45,
+ 3.1, 3.2, 3.3, 3.4, 3.5 ;
+
+ vals_nset_var3ns1 =
+ 5.01, 5.02, 5.03, 5.04, 5.05,
+ 5.02, 5.04, 5.06, 5.08, 5.1,
+ 5.03, 5.06, 5.09, 5.12, 5.15,
+ 5.04, 5.08, 5.12, 5.16, 5.2,
+ 5.05, 5.1, 5.15, 5.2, 5.25,
+ 5.06, 5.12, 5.18, 5.24, 5.3,
+ 5.07, 5.14, 5.21, 5.28, 5.35,
+ 5.08, 5.16, 5.24, 5.32, 5.4,
+ 5.09, 5.18, 5.27, 5.36, 5.45,
+ 5.1, 5.2, 5.3, 5.4, 5.5 ;
+
+ vals_nset_var1ns2 =
+ 4.01, 4.02, 4.03,
+ 4.02, 4.04, 4.06,
+ 4.03, 4.06, 4.09,
+ 4.04, 4.08, 4.12,
+ 4.05, 4.1, 4.15,
+ 4.06, 4.12, 4.18,
+ 4.07, 4.14, 4.21,
+ 4.08, 4.16, 4.24,
+ 4.09, 4.18, 4.27,
+ 4.1, 4.2, 4.3 ;
+
+ vals_nset_var3ns2 =
+ 6.01, 6.02, 6.03,
+ 6.02, 6.04, 6.06,
+ 6.03, 6.06, 6.09,
+ 6.04, 6.08, 6.12,
+ 6.05, 6.1, 6.15,
+ 6.06, 6.12, 6.18,
+ 6.07, 6.14, 6.21,
+ 6.08, 6.16, 6.24,
+ 6.09, 6.18, 6.27,
+ 6.1, 6.2, 6.3 ;
+
+ nset_var_tab =
+ 1, 0, 1, 0,
+ 1, 0, 1, 0 ;
+
+ name_sset_var =
+ "sset_var0",
+ "sset_var1",
+ "sset_var2",
+ "sset_var3",
+ "sset_var4",
+ "sset_var5",
+ "sset_var6" ;
+
+ vals_sset_var2ss1 =
+ 4.01, 4.02,
+ 4.02, 4.04,
+ 4.03, 4.06,
+ 4.04, 4.08,
+ 4.05, 4.1,
+ 4.06, 4.12,
+ 4.07, 4.14,
+ 4.08, 4.16,
+ 4.09, 4.18,
+ 4.1, 4.2 ;
+
+ vals_sset_var4ss1 =
+ 6.01, 6.02,
+ 6.02, 6.04,
+ 6.03, 6.06,
+ 6.04, 6.08,
+ 6.05, 6.1,
+ 6.06, 6.12,
+ 6.07, 6.14,
+ 6.08, 6.16,
+ 6.09, 6.18,
+ 6.1, 6.2 ;
+
+ vals_sset_var6ss1 =
+ 8.01, 8.02,
+ 8.02, 8.04,
+ 8.03, 8.06,
+ 8.04, 8.08,
+ 8.05, 8.1,
+ 8.06, 8.12,
+ 8.07, 8.14,
+ 8.08, 8.16,
+ 8.09, 8.18,
+ 8.1, 8.2 ;
+
+ vals_sset_var1ss2 =
+ 4.01, 4.02,
+ 4.02, 4.04,
+ 4.03, 4.06,
+ 4.04, 4.08,
+ 4.05, 4.1,
+ 4.06, 4.12,
+ 4.07, 4.14,
+ 4.08, 4.16,
+ 4.09, 4.18,
+ 4.1, 4.2 ;
+
+ vals_sset_var3ss2 =
+ 6.01, 6.02,
+ 6.02, 6.04,
+ 6.03, 6.06,
+ 6.04, 6.08,
+ 6.05, 6.1,
+ 6.06, 6.12,
+ 6.07, 6.14,
+ 6.08, 6.16,
+ 6.09, 6.18,
+ 6.1, 6.2 ;
+
+ vals_sset_var5ss2 =
+ 8.01, 8.02,
+ 8.02, 8.04,
+ 8.03, 8.06,
+ 8.04, 8.08,
+ 8.05, 8.1,
+ 8.06, 8.12,
+ 8.07, 8.14,
+ 8.08, 8.16,
+ 8.09, 8.18,
+ 8.1, 8.2 ;
+
+ vals_sset_var7ss2 =
+ 10.01, 10.02,
+ 10.02, 10.04,
+ 10.03, 10.06,
+ 10.04, 10.08,
+ 10.05, 10.1,
+ 10.06, 10.12,
+ 10.07, 10.14,
+ 10.08, 10.16,
+ 10.09, 10.18,
+ 10.1, 10.2 ;
+
+ vals_sset_var2ss3 =
+ 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 ;
+
+ vals_sset_var4ss3 =
+ 8.01, 8.02, 8.03, 8.04, 8.05, 8.06, 8.07,
+ 8.02, 8.04, 8.06, 8.08, 8.1, 8.12, 8.14,
+ 8.03, 8.06, 8.09, 8.12, 8.15, 8.18, 8.21,
+ 8.04, 8.08, 8.12, 8.16, 8.2, 8.24, 8.28,
+ 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35,
+ 8.06, 8.12, 8.18, 8.24, 8.3, 8.36, 8.42,
+ 8.07, 8.14, 8.21, 8.28, 8.35, 8.42, 8.49,
+ 8.08, 8.16, 8.24, 8.32, 8.4, 8.48, 8.56,
+ 8.09, 8.18, 8.27, 8.36, 8.45, 8.54, 8.63,
+ 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7 ;
+
+ vals_sset_var6ss3 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7 ;
+
+ vals_sset_var1ss4 =
+ 6.01, 6.02, 6.03, 6.04, 6.05, 6.06, 6.07, 6.08,
+ 6.02, 6.04, 6.06, 6.08, 6.1, 6.12, 6.14, 6.16,
+ 6.03, 6.06, 6.09, 6.12, 6.15, 6.18, 6.21, 6.24,
+ 6.04, 6.08, 6.12, 6.16, 6.2, 6.24, 6.28, 6.32,
+ 6.05, 6.1, 6.15, 6.2, 6.25, 6.3, 6.35, 6.4,
+ 6.06, 6.12, 6.18, 6.24, 6.3, 6.36, 6.42, 6.48,
+ 6.07, 6.14, 6.21, 6.28, 6.35, 6.42, 6.49, 6.56,
+ 6.08, 6.16, 6.24, 6.32, 6.4, 6.48, 6.56, 6.64,
+ 6.09, 6.18, 6.27, 6.36, 6.45, 6.54, 6.63, 6.72,
+ 6.1, 6.2, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8 ;
+
+ vals_sset_var3ss4 =
+ 8.01, 8.02, 8.03, 8.04, 8.05, 8.06, 8.07, 8.08,
+ 8.02, 8.04, 8.06, 8.08, 8.1, 8.12, 8.14, 8.16,
+ 8.03, 8.06, 8.09, 8.12, 8.15, 8.18, 8.21, 8.24,
+ 8.04, 8.08, 8.12, 8.16, 8.2, 8.24, 8.28, 8.32,
+ 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35, 8.4,
+ 8.06, 8.12, 8.18, 8.24, 8.3, 8.36, 8.42, 8.48,
+ 8.07, 8.14, 8.21, 8.28, 8.35, 8.42, 8.49, 8.56,
+ 8.08, 8.16, 8.24, 8.32, 8.4, 8.48, 8.56, 8.64,
+ 8.09, 8.18, 8.27, 8.36, 8.45, 8.54, 8.63, 8.72,
+ 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8 ;
+
+ vals_sset_var5ss4 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07, 10.08,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14, 10.16,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21, 10.24,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28, 10.32,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35, 10.4,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42, 10.48,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49, 10.56,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56, 10.64,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63, 10.72,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8 ;
+
+ vals_sset_var7ss4 =
+ 12.01, 12.02, 12.03, 12.04, 12.05, 12.06, 12.07, 12.08,
+ 12.02, 12.04, 12.06, 12.08, 12.1, 12.12, 12.14, 12.16,
+ 12.03, 12.06, 12.09, 12.12, 12.15, 12.18, 12.21, 12.24,
+ 12.04, 12.08, 12.12, 12.16, 12.2, 12.24, 12.28, 12.32,
+ 12.05, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.4,
+ 12.06, 12.12, 12.18, 12.24, 12.3, 12.36, 12.42, 12.48,
+ 12.07, 12.14, 12.21, 12.28, 12.35, 12.42, 12.49, 12.56,
+ 12.08, 12.16, 12.24, 12.32, 12.4, 12.48, 12.56, 12.64,
+ 12.09, 12.18, 12.27, 12.36, 12.45, 12.54, 12.63, 12.72,
+ 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8 ;
+
+ vals_sset_var2ss5 =
+ 8.01, 8.02, 8.03, 8.04, 8.05, 8.06, 8.07, 8.08, 8.09, 8.1,
+ 8.02, 8.04, 8.06, 8.08, 8.1, 8.12, 8.14, 8.16, 8.18, 8.2,
+ 8.03, 8.06, 8.09, 8.12, 8.15, 8.18, 8.21, 8.24, 8.27, 8.3,
+ 8.04, 8.08, 8.12, 8.16, 8.2, 8.24, 8.28, 8.32, 8.36, 8.4,
+ 8.05, 8.1, 8.15, 8.2, 8.25, 8.3, 8.35, 8.4, 8.45, 8.5,
+ 8.06, 8.12, 8.18, 8.24, 8.3, 8.36, 8.42, 8.48, 8.54, 8.6,
+ 8.07, 8.14, 8.21, 8.28, 8.35, 8.42, 8.49, 8.56, 8.63, 8.7,
+ 8.08, 8.16, 8.24, 8.32, 8.4, 8.48, 8.56, 8.64, 8.72, 8.8,
+ 8.09, 8.18, 8.27, 8.36, 8.45, 8.54, 8.63, 8.72, 8.81, 8.9,
+ 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9 ;
+
+ vals_sset_var4ss5 =
+ 10.01, 10.02, 10.03, 10.04, 10.05, 10.06, 10.07, 10.08, 10.09, 10.1,
+ 10.02, 10.04, 10.06, 10.08, 10.1, 10.12, 10.14, 10.16, 10.18, 10.2,
+ 10.03, 10.06, 10.09, 10.12, 10.15, 10.18, 10.21, 10.24, 10.27, 10.3,
+ 10.04, 10.08, 10.12, 10.16, 10.2, 10.24, 10.28, 10.32, 10.36, 10.4,
+ 10.05, 10.1, 10.15, 10.2, 10.25, 10.3, 10.35, 10.4, 10.45, 10.5,
+ 10.06, 10.12, 10.18, 10.24, 10.3, 10.36, 10.42, 10.48, 10.54, 10.6,
+ 10.07, 10.14, 10.21, 10.28, 10.35, 10.42, 10.49, 10.56, 10.63, 10.7,
+ 10.08, 10.16, 10.24, 10.32, 10.4, 10.48, 10.56, 10.64, 10.72, 10.8,
+ 10.09, 10.18, 10.27, 10.36, 10.45, 10.54, 10.63, 10.72, 10.81, 10.9,
+ 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 11 ;
+
+ vals_sset_var6ss5 =
+ 12.01, 12.02, 12.03, 12.04, 12.05, 12.06, 12.07, 12.08, 12.09, 12.1,
+ 12.02, 12.04, 12.06, 12.08, 12.1, 12.12, 12.14, 12.16, 12.18, 12.2,
+ 12.03, 12.06, 12.09, 12.12, 12.15, 12.18, 12.21, 12.24, 12.27, 12.3,
+ 12.04, 12.08, 12.12, 12.16, 12.2, 12.24, 12.28, 12.32, 12.36, 12.4,
+ 12.05, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.4, 12.45, 12.5,
+ 12.06, 12.12, 12.18, 12.24, 12.3, 12.36, 12.42, 12.48, 12.54, 12.6,
+ 12.07, 12.14, 12.21, 12.28, 12.35, 12.42, 12.49, 12.56, 12.63, 12.7,
+ 12.08, 12.16, 12.24, 12.32, 12.4, 12.48, 12.56, 12.64, 12.72, 12.8,
+ 12.09, 12.18, 12.27, 12.36, 12.45, 12.54, 12.63, 12.72, 12.81, 12.9,
+ 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 12.7, 12.8, 12.9, 13 ;
+
+ sset_var_tab =
+ 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0 ;
+}
diff --git a/cbind/test/testall b/cbind/test/testall
new file mode 100644
index 0000000..3ad1b87
--- /dev/null
+++ b/cbind/test/testall
@@ -0,0 +1,192 @@
+# 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.
+#
+
+# script to run all tests and compare them to saved dump files.
+#
+# 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 = ""
+echo "************************************************************************"
+echo "************************************************************************"
+rm -f test.output
+echo "testwt - single precision write test..."
+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
+
+echo "testrd - single precision read test..."
+echo "begin testrd" >> test.output
+${PREFIX} ./testrd | diff - 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
+echo "end testrdv" >> test.output
+
+echo "testcp_ss - single-to-single precision copy test..."
+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
+
+echo "testcp_sd - single-to-double precision copy test..."
+echo "begin testcp_sd" >> test.output
+${PREFIX} ./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
+
+echo "testcp_ln - large model to normal model single precision copy test..."
+echo "begin testcp_ln" >> test.output
+${PREFIX} ./testcp_ln >> test.output
+echo "end testcp_ln" >> test.output
+ncdump -d5,5 testcp.exo | diff - testcp_ss.dmp | tee testcp_ln.res
+
+echo "testwt_clb - single precision write test using concatenated puts..."
+echo "begin testwt_clb" >> test.output
+${PREFIX} ./testwt_clb >> test.output
+echo "end testwt_clb" >> test.output
+ncdump -d5,5 test.exo | diff - test_clb.dmp | tee testwt_clb.res
+
+echo "testwtd - double precision write test..."
+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
+
+echo "testrdd - double precision read test..."
+echo "begin testrdd" >> test.output
+${PREFIX} ./testrdd | diff - 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
+echo "end testcp_dd" >> test.output
+ncdump -d5,5 testcpd.exo | diff - 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
+echo "end testcp_ds" >> test.output
+ncdump -d5,5 testcp.exo | diff - 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
+echo "end testwt1" >> test.output
+ncdump -d5,5 test.exo | diff - 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
+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
+echo "end testwt_ss" >> test.output
+ncdump -d5,5 test.exo | diff - 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
+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
+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
+
+echo "testrdwt - read from one and write to another (simutaneously open) file..."
+echo "begin testrdwt" >> test.output
+${PREFIX} ./testrdwt >> test.output
+echo "end testrdwt" >> test.output
+ncdump -d5,5 test2.exo | diff - 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
+echo "end testwt_nc" >> test.output
+ncdump -d5,5 test.exo | diff - 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
+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
+echo "end testwt-zeron" >> test.output
+ncdump -d5,5 test.exo | diff - 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
+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
+echo "end testwt-zeroe" >> test.output
+ncdump -d5,5 test.exo | diff - 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
+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
+echo "end testwt-one-attrib - read attributes one at a time" >> test.output
+
+echo "************************************************************************"
+echo "************************************************************************"
diff --git a/cbind/test/testall.in b/cbind/test/testall.in
new file mode 100755
index 0000000..42299a2
--- /dev/null
+++ b/cbind/test/testall.in
@@ -0,0 +1,194 @@
+# 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.
+#
+
+# script to run all tests and compare them to saved dump files.
+#
+# 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 = "valgrind --tool=memcheck"
+set PREFIX = ""
+set BINDIR = @EXECUTABLE_OUTPUT_PATH@
+set SRCDIR = @ExodusII_SOURCE_DIR@/cbind/test
+echo "************************************************************************"
+echo "************************************************************************"
+rm -f test.output
+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
+
+echo "testrd - single precision read test..."
+echo "begin testrd" >> test.output
+${PREFIX} ${BINDIR}/testrd | 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
+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
+
+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
+
+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
+
+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
+
+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
+
+echo "testrdd - double precision read test..."
+echo "begin testrdd" >> test.output
+${PREFIX} ${BINDIR}/testrdd | 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
+
+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
+
+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
+
+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
+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} ${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
+
+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
+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
+
+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
+
+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
+
+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
+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
+
+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
+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
+
+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
+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} ${BINDIR}/testwt-one-attrib | tee testrd_zeroe.res
+echo "end testwt-one-attrib - read attributes one at a time" >> test.output
+
+echo "************************************************************************"
+echo "************************************************************************"
diff --git a/cbind/test/testcp.c b/cbind/test/testcp.c
new file mode 100644
index 0000000..a43b420
--- /dev/null
+++ b/cbind/test/testcp.c
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testcp - copy file test.exo created by testwt
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+*
+* exit conditions -
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+
+
+int main (int argc, char **argv)
+{
+ int exoid, exoid1, error, idum;
+ int CPU_word_size,IO_word_size;
+
+ float version;
+
+ char *cdum;
+
+ ex_opts(EX_VERBOSE | EX_ABORT);
+
+/* open EXODUS II files */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use size in file */
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ printf ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ 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);
+
+ CPU_word_size = 8; /* this really shouldn't matter for
+ the copy but tests the conversion
+ routines */
+ IO_word_size = 4;
+
+ exoid1 = ex_create ("testcp.exo", /* filename */
+ EX_CLOBBER, /* OK to overwrite */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size); /* I/O float word size in bytes */
+
+ printf ("\nafter ex_create, exoid = %3d\n",exoid1);
+ if (exoid1 < 0) exit(1);
+
+ printf (" CPU word size %1d\n",CPU_word_size);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+ error = ex_copy (exoid, exoid1);
+ printf ("\nafter ex_copy, error = %3d\n", error);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+
+ error = ex_close (exoid1);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testcp_dd.dmp b/cbind/test/testcp_dd.dmp
new file mode 100644
index 0000000..6b4baac
--- /dev/null
+++ b/cbind/test/testcp_dd.dmp
@@ -0,0 +1,244 @@
+netcdf testcpd {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+
+// global attributes:
+ :api_version = 4.46f ;
+ :version = 3.05f ;
+ :floating_point_word_size = 8 ;
+ :file_size = 0 ;
+ :title = "This is a test" ;
+data:
+
+ eb_status = 1, 1, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/cbind/test/testcp_ds.dmp b/cbind/test/testcp_ds.dmp
new file mode 100644
index 0000000..d7ed671
--- /dev/null
+++ b/cbind/test/testcp_ds.dmp
@@ -0,0 +1,244 @@
+netcdf testcp {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ 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_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/cbind/test/testcp_ln.c b/cbind/test/testcp_ln.c
new file mode 100644
index 0000000..11cadb7
--- /dev/null
+++ b/cbind/test/testcp_ln.c
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testcp_ln - copy file test.exo created by testwt, large_model to normal_model
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+*
+* exit conditions -
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+
+
+int main (int argc, char **argv)
+{
+ int exoid, exoid1, error, idum;
+ int CPU_word_size,IO_word_size;
+
+ float version;
+
+ char *cdum;
+
+ ex_opts(EX_VERBOSE | EX_ABORT);
+
+/* open EXODUS II files */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use size in file */
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ printf ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ 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);
+
+ CPU_word_size = 8; /* this really shouldn't matter for
+ the copy but tests the conversion
+ routines */
+ IO_word_size = 4;
+
+ exoid1 = ex_create ("testcp.exo", /* filename */
+ EX_CLOBBER|EX_NORMAL_MODEL, /* OK to overwrite, normal */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size); /* I/O float word size in bytes */
+
+ printf ("\nafter ex_create, exoid = %3d\n",exoid1);
+ if (exoid1 < 0) exit(1);
+
+ printf (" CPU word size %1d\n",CPU_word_size);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+ error = ex_copy (exoid, exoid1);
+ printf ("\nafter ex_copy, error = %3d\n", error);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+
+ error = ex_close (exoid1);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testcp_nl.c b/cbind/test/testcp_nl.c
new file mode 100644
index 0000000..79d86ce
--- /dev/null
+++ b/cbind/test/testcp_nl.c
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testcp_lrg - copy file test.exo created by testwt, normal_model to large_model
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+*
+* exit conditions -
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+
+
+int main (int argc, char **argv)
+{
+ int exoid, exoid1, error, idum;
+ int CPU_word_size,IO_word_size;
+
+ float version;
+
+ char *cdum;
+
+ ex_opts(EX_VERBOSE | EX_ABORT);
+
+/* open EXODUS II files */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use size in file */
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ printf ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ 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);
+
+ CPU_word_size = 8; /* this really shouldn't matter for
+ the copy but tests the conversion
+ routines */
+ IO_word_size = 4;
+
+ exoid1 = ex_create ("testcp_nl.exo", /* filename */
+ EX_CLOBBER|EX_LARGE_MODEL, /* OK to overwrite, large */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size); /* I/O float word size in bytes */
+
+ printf ("\nafter ex_create, exoid = %3d\n",exoid1);
+ if (exoid1 < 0) exit(1);
+
+ printf (" CPU word size %1d\n",CPU_word_size);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+ error = ex_copy (exoid, exoid1);
+ printf ("\nafter ex_copy, error = %3d\n", error);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+
+ error = ex_close (exoid1);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testcp_nl.dmp b/cbind/test/testcp_nl.dmp
new file mode 100644
index 0000000..7b53bf4
--- /dev/null
+++ b/cbind/test/testcp_nl.dmp
@@ -0,0 +1,281 @@
+netcdf testcp_nl { // format variant: 64bit
+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 = 7 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 8 ;
+ num_side_ss5 = 10 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ int ss_status(num_side_sets) ;
+ int ss_prop1(num_side_sets) ;
+ ss_prop1:name = "ID" ;
+ 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) ;
+ 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 node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ 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" ;
+data:
+
+ eb_status = 1, 1, 1, 1, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ ss_prop1 = 30, 31, 32, 33, 34 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "block_1",
+ "block_2",
+ "block_3",
+ "block_4",
+ "block_5",
+ "block_6",
+ "block_7" ;
+
+ ns_names =
+ "nset_1",
+ "nset_2" ;
+
+ ss_names =
+ "sset_1",
+ "sset_2",
+ "sset_3",
+ "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 ;
+
+ attrib_name7 =
+ "THICKNESS" ;
+
+ connect7 =
+ 31, 32, 33 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4, 6, 6, 6, 6 ;
+
+ side_ss4 = 1, 2, 3, 4, 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5, 7, 7, 7, 7, 7 ;
+
+ side_ss5 = 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/cbind/test/testcp_sd.dmp b/cbind/test/testcp_sd.dmp
new file mode 100644
index 0000000..5dc1f75
--- /dev/null
+++ b/cbind/test/testcp_sd.dmp
@@ -0,0 +1,278 @@
+netcdf testcpd {
+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 = 7 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 8 ;
+ num_side_ss5 = 10 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ double 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 node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+
+// global attributes:
+ :api_version = 4.46f ;
+ :version = 3.05f ;
+ :floating_point_word_size = 8 ;
+ :file_size = 0 ;
+ :title = "This is a test" ;
+data:
+
+ eb_status = 1, 1, 1, 1, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "block_1",
+ "block_2",
+ "block_3",
+ "block_4",
+ "block_5",
+ "block_6",
+ "block_7" ;
+
+ ns_names =
+ "nset_1",
+ "nset_2" ;
+
+ ss_names =
+ "sset_1",
+ "sset_2",
+ "sset_3",
+ "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 ;
+
+ attrib_name7 =
+ "THICKNESS" ;
+
+ connect7 =
+ 31, 32, 33 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4, 6, 6, 6, 6 ;
+
+ side_ss4 = 1, 2, 3, 4, 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5, 7, 7, 7, 7, 7 ;
+
+ side_ss5 = 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/cbind/test/testcp_ss.dmp b/cbind/test/testcp_ss.dmp
new file mode 100644
index 0000000..4523069
--- /dev/null
+++ b/cbind/test/testcp_ss.dmp
@@ -0,0 +1,278 @@
+netcdf testcp {
+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 = 7 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 8 ;
+ num_side_ss5 = 10 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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 node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ 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, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "block_1",
+ "block_2",
+ "block_3",
+ "block_4",
+ "block_5",
+ "block_6",
+ "block_7" ;
+
+ ns_names =
+ "nset_1",
+ "nset_2" ;
+
+ ss_names =
+ "sset_1",
+ "sset_2",
+ "sset_3",
+ "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 ;
+
+ attrib_name7 =
+ "THICKNESS" ;
+
+ connect7 =
+ 31, 32, 33 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4, 6, 6, 6, 6 ;
+
+ side_ss4 = 1, 2, 3, 4, 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5, 7, 7, 7, 7, 7 ;
+
+ side_ss5 = 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/cbind/test/testcpd.c b/cbind/test/testcpd.c
new file mode 100644
index 0000000..37f475f
--- /dev/null
+++ b/cbind/test/testcpd.c
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testcpd - copy file test.exo created by testwtd
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+*
+* exit conditions -
+*
+* revision history -
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+
+
+int main (int argc, char **argv)
+{
+ int exoid, exoid1, error, idum;
+ int CPU_word_size,IO_word_size;
+
+ float version;
+
+ char *cdum;
+
+/* open EXODUS II files */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use size in file */
+
+ ex_opts (EX_VERBOSE | EX_ABORT );
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ printf ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ 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);
+
+ CPU_word_size = 8; /* this shouldn't matter during
+ copying but it tests out the
+ conversion routines */
+ IO_word_size = 8; /* store doubles */
+
+ exoid1 = ex_create ("testcpd.exo", /* filename */
+ EX_CLOBBER, /* OK to overwrite */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size); /* I/O float word size in bytes */
+
+ printf ("\nafter ex_create, exoid = %3d\n",exoid);
+ if (exoid1 < 0) exit(1);
+
+ printf (" CPU word size %1d\n",CPU_word_size);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+ error = ex_copy (exoid, exoid1);
+ printf ("\nafter ex_copy, error = %3d\n", error);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+
+ error = ex_close (exoid1);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testd.dmp b/cbind/test/testd.dmp
new file mode 100644
index 0000000..0952fe1
--- /dev/null
+++ b/cbind/test/testd.dmp
@@ -0,0 +1,550 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ double 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ double vals_glo_var(time_step, num_glo_var) ;
+ double vals_nod_var(time_step, num_nod_var, 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) ;
+ double vals_elem_var2eb1(time_step, num_el_in_blk1) ;
+ double vals_elem_var3eb1(time_step, num_el_in_blk1) ;
+ double vals_elem_var1eb2(time_step, num_el_in_blk2) ;
+ double vals_elem_var2eb2(time_step, num_el_in_blk2) ;
+ double vals_elem_var3eb2(time_step, num_el_in_blk2) ;
+ double vals_elem_var1eb3(time_step, num_el_in_blk3) ;
+ double vals_elem_var2eb3(time_step, num_el_in_blk3) ;
+ double vals_elem_var3eb3(time_step, num_el_in_blk3) ;
+ double vals_elem_var1eb4(time_step, num_el_in_blk4) ;
+ double vals_elem_var2eb4(time_step, num_el_in_blk4) ;
+ double vals_elem_var3eb4(time_step, num_el_in_blk4) ;
+ double vals_elem_var1eb5(time_step, num_el_in_blk5) ;
+ double vals_elem_var2eb5(time_step, num_el_in_blk5) ;
+ double vals_elem_var3eb5(time_step, num_el_in_blk5) ;
+ 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 ;
+ :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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWTD",
+ "testwtd",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/cbind/test/testrd.c b/cbind/test/testrd.c
new file mode 100644
index 0000000..925ab46
--- /dev/null
+++ b/cbind/test/testrd.c
@@ -0,0 +1,1121 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "netcdf.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 *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ 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;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int num_nset_vars, num_sset_vars;
+ int *truth_tab;
+ int num_time_steps;
+ 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 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;
+ int idum;
+
+ float time_value, *time_values, *var_values;
+ float *x, *y, *z;
+ float *attrib, *dist_fact;
+ float version, fdum;
+
+ 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 name[MAX_STR_LENGTH+1];
+ char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
+ char *cdum;
+ 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 */
+ 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 (" 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; */
+
+ /* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+ /* read nodal coordinates values and names from database */
+
+ x = (float *) calloc(num_nodes, sizeof(float));
+ y = (float *) calloc(num_nodes, sizeof(float));
+ if (num_dim >= 3)
+ z = (float *) calloc(num_nodes, sizeof(float));
+ else
+ z = 0;
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ printf ("x coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", x[i]);
+ }
+
+ printf ("y coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", y[i]);
+ }
+
+ if (num_dim >= 3)
+ {
+ printf ("z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", z[i]);
+ }
+ }
+
+ /*
+ 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)
+ 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]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+
+ /* 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]);
+ }
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++) {
+ block_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ 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]);
+ }
+
+ /* 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));
+ }
+
+ 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=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]);
+ }
+ */
+ 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 (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]);
+ }
+
+ if (num_elem_blk > 0) {
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_attr);
+ }
+
+ /* read individual node sets */
+ if (num_node_sets > 0) {
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; i++) {
+ nset_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_names(exoid, EX_NODE_SET, nset_names);
+ printf ("\nafter ex_get_names, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; i++)
+ {
+ ex_get_name(exoid, EX_NODE_SET, ids[i], name);
+ if (strcmp(name, nset_names[i]) != 0) {
+ 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);
+
+ 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);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node set\n", num_props);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+
+ 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);
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+ /* read concatenated node sets; this produces the same information as
+ * the above code which reads individual node sets
+ */
+
+ error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n",error);
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+ num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ node_ind = (int *) calloc(num_node_sets, sizeof(int));
+ df_ind = (int *) calloc(num_node_sets, sizeof(int));
+
+ 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);
+ 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);
+ 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);
+ printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
+
+ printf ("\nconcatenated node set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_nodes_per_set = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
+
+ printf ("node_ind = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
+
+ printf ("node_list = \n");
+ for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (df_ind);
+ free (node_ind);
+ free (num_df_per_set);
+ free (node_list);
+ free (dist_fact);
+ }
+
+ /* read individual side sets */
+
+ if (num_side_sets > 0) {
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; i++) {
+ sset_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_names(exoid, EX_SIDE_SET, sset_names);
+ printf ("\nafter ex_get_names, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; i++)
+ {
+ ex_get_name(exoid, EX_SIDE_SET, ids[i], name);
+ if (strcmp(name, sset_names[i]) != 0) {
+ 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);
+
+ 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);
+ 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));
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+
+ }
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ 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));
+ }
+
+ 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++)
+ 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);
+
+ 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);
+
+ 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
+ */
+
+ /* concatenated side set read */
+
+ if (num_side_sets > 0) {
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+ }
+ }
+ /* end of concatenated side set read */
+
+ /* 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]);
+ }
+
+ /* read global variables parameters and names */
+
+ error = ex_get_var_param (exoid, "g", &num_glo_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_glo_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d global variables; their names are :\n",
+ num_glo_vars);
+ for (i=0; i<num_glo_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read nodal variables parameters and names */
+ num_nod_vars = 0;
+ if (num_nodes > 0) {
+ error = ex_get_var_param (exoid, "n", &num_nod_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_nod_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ 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]);
+ }
+ }
+
+ /* read element variables parameters and names */
+
+ num_ele_vars = 0;
+ if (num_elem > 0) {
+ error = ex_get_var_param (exoid, "e", &num_ele_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_ele_vars; i++)
+ {
+ 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);
+ for (i=0; i<num_ele_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read element variable truth table */
+
+ if (num_ele_vars > 0) {
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
+
+ printf ("This is the element variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_elem_blk*num_ele_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+ }
+ }
+
+ /* read nodeset variables parameters and names */
+
+ num_nset_vars = 0;
+ if (num_node_sets > 0) {
+ error = ex_get_var_param (exoid, "m", &num_nset_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ if (num_nset_vars > 0) {
+ for (i=0; i<num_nset_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "m", num_nset_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d nodeset variables; their names are :\n",
+ num_nset_vars);
+ for (i=0; i<num_nset_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read nodeset variable truth table */
+
+ if (num_nset_vars > 0) {
+ truth_tab = (int *) calloc ((num_node_sets*num_nset_vars), sizeof(int));
+
+ error = ex_get_nset_var_tab (exoid, num_node_sets, num_nset_vars, truth_tab);
+ printf ("\nafter ex_get_nset_var_tab, error = %3d\n", error);
+
+ printf ("This is the nodeset variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_node_sets*num_nset_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+ }
+ }
+ }
+
+ /* read sideset variables parameters and names */
+
+ num_sset_vars = 0;
+ if (num_side_sets > 0) {
+ error = ex_get_var_param (exoid, "s", &num_sset_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ if (num_sset_vars > 0) {
+ for (i=0; i<num_sset_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "s", num_sset_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d sideset variables; their names are :\n",
+ num_sset_vars);
+ for (i=0; i<num_sset_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read sideset variable truth table */
+
+ if (num_sset_vars > 0) {
+ truth_tab = (int *) calloc ((num_side_sets*num_sset_vars), sizeof(int));
+
+ error = ex_get_sset_var_tab (exoid, num_side_sets, num_sset_vars, truth_tab);
+ printf ("\nafter ex_get_sset_var_tab, error = %3d\n", error);
+
+ printf ("This is the sideset variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_side_sets*num_sset_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+ }
+ }
+ }
+
+ /* determine how many time steps are stored */
+
+ error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+ printf ("There are %2d time steps in the database.\n", num_time_steps);
+
+ /* read time value at one time step */
+
+ time_step = 3;
+ error = ex_get_time (exoid, time_step, &time_value);
+ printf ("\nafter ex_get_time, error = %3d\n", error);
+
+ printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
+
+ /* read time values at all time steps */
+
+ time_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_all_times (exoid, time_values);
+ printf ("\nafter ex_get_all_times, error = %3d\n", error);
+
+ printf ("time values at all time steps are:\n");
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
+
+ free (time_values);
+
+ /* read all global variables at one time step */
+
+ var_values = (float *) calloc (num_glo_vars, sizeof(float));
+
+ error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
+ printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
+
+ printf ("global variable values at time step %2d\n", time_step);
+ for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a single global variable through time */
+
+ var_index = 1;
+ beg_time = 1;
+ end_time = -1;
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
+ var_values);
+ printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
+
+ printf ("global variable %2d values through time:\n", var_index);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a nodal variable at one time step */
+
+ if (num_nodes > 0) {
+ var_values = (float *) calloc (num_nodes, sizeof(float));
+
+ error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes,
+ 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);
+ for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a nodal variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ node_num = 1;
+ error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+ }
+ /* read an element variable at one time step */
+
+ if (num_elem_blk > 0) {
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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);
+
+ 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 (num_elem_in_block);
+ free(ids);
+ }
+ /* read an element variable through time */
+
+ if (num_ele_vars > 0) {
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ var_index = 2;
+ elem_num = 2;
+ error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+ }
+
+ /* read a sideset variable at one time step */
+
+ if (num_sset_vars > 0) {
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\n after ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; i++)
+ {
+ 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);
+
+ 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 (num_elem_per_set);
+ free(ids);
+ }
+
+ /* read a nodeset variable at one time step */
+
+ if (num_nset_vars > 0) {
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\n after ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; i++)
+ {
+ 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);
+
+ 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(ids);
+ }
+ if (num_node_sets > 0)
+ free (num_nodes_per_set);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrd.dmp b/cbind/test/testrd.dmp
new file mode 100644
index 0000000..e00bb31
--- /dev/null
+++ b/cbind/test/testrd.dmp
@@ -0,0 +1,1059 @@
+
+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 = 33
+num_elem = 7
+num_elem_blk = 7
+num_node_sets = 2
+num_side_sets = 5
+
+after ex_get_coord, 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 ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+elem_map(0) = 1
+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_names, 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
+name = 'block_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
+name = 'block_2'
+
+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
+name = 'block_3'
+
+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
+name = 'block_4'
+
+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
+name = 'block_5'
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'tetra'
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 1
+name = 'block_6'
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'tri'
+num_elem_in_block = 1
+num_nodes_per_elem = 3
+num_attr = 1
+name = 'block_7'
+
+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
+element block 4, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 40
+element block 5, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 50
+element block 6, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 60
+element block 7, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 70
+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
+element block 6, property( 3): 'DENSITY'= 0
+element block 7, 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_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_conn, error = 0
+connect array for elem block 15
+ 17
+ 18
+ 19
+ 20
+ 27
+ 28
+ 30
+ 29
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 16
+ 31
+ 32
+ 33
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 10 attribute 'THICKNESS' = 3.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 11 attribute 'THICKNESS' = 6.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 12 attribute 'THICKNESS' = 6.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 13 attribute 'THICKNESS' = 6.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 14 attribute 'THICKNESS' = 6.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 15 attribute 'THICKNESS' = 6.1416
+
+ after ex_get_elem_attr, error = 0
+ after ex_get_elem_attr_names, error = 0
+element block 16 attribute 'THICKNESS' = 6.1416
+
+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
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+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
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+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
+ 2
+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
+30.200
+30.300
+
+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
+ 2
+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
+31.200
+31.300
+
+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
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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:
+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
+ 1
+ 2
+ 3
+ 4
+node list for side set 33
+ 17
+ 18
+ 20
+ 18
+ 19
+ 20
+ 17
+ 20
+ 19
+ 17
+ 19
+ 18
+ 17
+ 18
+ 20
+ 27
+ 18
+ 19
+ 20
+ 28
+ 17
+ 20
+ 19
+ 29
+ 17
+ 19
+ 18
+ 30
+no dist factors for side set 33
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+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
+ 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
+ 31
+ 32
+ 33
+ 33
+ 32
+ 31
+ 31
+ 32
+ 32
+ 33
+ 33
+ 31
+no dist factors for side set 34
+
+after ex_inquire, error = 0
+
+There are 2 properties for each side set
+after ex_get_prop_names, error = 0
+side set 1, property( 1): 'ID'= 30
+side set 2, property( 1): 'ID'= 31
+side set 3, property( 1): 'ID'= 32
+side set 4, property( 1): 'ID'= 33
+side set 5, property( 1): 'ID'= 34
+side set 1, property( 2): 'COLOR'= 100
+side set 2, property( 2): 'COLOR'= 101
+side set 3, property( 2): 'COLOR'= 0
+side set 4, property( 2): 'COLOR'= 0
+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 = 29, error = 0
+
+after ex_inquire: EX_INQ_SS_NODE_LEN = 94, error = 0
+
+after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 8
+ 10
+num_dist_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 2
+ 4
+ 11
+ 19
+dist_ind =
+ 0
+ 4
+ 8
+ 8
+ 8
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 6
+ 6
+ 6
+ 6
+ 5
+ 5
+ 5
+ 5
+ 5
+ 7
+ 7
+ 7
+ 7
+ 7
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+ 1
+ 2
+ 3
+ 4
+ 5
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT'
+ 'testwt'
+ '07/07/93'
+ '15:41:33'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'node_variable_a_very_long_name_0'
+ 'nod_var1'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 element variables; their names are :
+ 'ele_var0'
+ 'ele_var1'
+ 'ele_var2'
+
+after ex_get_elem_var_tab, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 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
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+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:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+ after ex_get_elem_blk_ids, error = 0
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+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
+7.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 14 at time step 3
+8.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 15 at time step 3
+9.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 16 at time step 3
+10.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
+
+ 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_sset_var, error = 0
+sideset variable 2 values of sideset 31 at time step 3
+8.030
+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/testrd1.c b/cbind/test/testrd1.c
new file mode 100644
index 0000000..9c4998d
--- /dev/null
+++ b/cbind/test/testrd1.c
@@ -0,0 +1,1048 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testrd1 - read exodus file test.exo created by testwt1
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: testrd1.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.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, num_node_maps, num_elem_maps, error;
+ int i, j, k, node_ctr;
+ int *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids, *node_map;
+ 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;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int num_time_steps;
+ 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 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;
+ int idum;
+
+ float time_value, *time_values, *var_values;
+ float *x, *y, *z;
+ float *attrib, *dist_fact;
+ float version, fdum;
+
+ 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 *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 */
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+ /* Test the NOCLOBBER option to ex_create. Should fail to create file */
+ exoid = ex_create("test.exo",
+ EX_NOCLOBBER,
+ &CPU_word_size,
+ &IO_word_size);
+ printf ("\nafter ex_create (NO_CLOBBER), error = %3d\n", exoid);
+
+ /* open EXODUS II files */
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ printf ("\nafter ex_open\n");
+ if (exoid < 0) exit(1);
+
+ 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_opts (EX_VERBOSE); */
+
+/* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+/* read nodal coordinates values and names from database */
+
+ x = (float *) calloc(num_nodes, sizeof(float));
+ y = (float *) calloc(num_nodes, sizeof(float));
+ if (num_dim >= 3)
+ z = (float *) calloc(num_nodes, sizeof(float));
+ else
+ z = 0;
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ printf ("x coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", x[i]);
+ }
+
+ printf ("y coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", y[i]);
+ }
+
+ if (num_dim >= 3)
+ {
+ printf ("z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", z[i]);
+ }
+ }
+
+/*
+ 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)
+ 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]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+/* read map parameters */
+
+ error = ex_get_map_param (exoid, &num_node_maps, &num_elem_maps);
+ printf ("\nafter ex_get_map_param, error = %3d\n", error);
+
+/* read element maps */
+
+ elem_map = (int *) calloc(num_elem, sizeof(int));
+
+ ids = (int *) calloc(num_elem_maps, sizeof(int));
+
+ error = ex_get_prop_array (exoid, EX_ELEM_MAP, "ID", ids);
+ printf ("\nafter ex_get_prop_array, error = %3d\n", error);
+
+ for (j=0; j<num_elem_maps; j++) {
+ error = ex_get_elem_map (exoid, ids[j], elem_map);
+ printf ("\nafter ex_get_elem_map, error = %3d\n", error);
+
+ printf ("element map id = %2d\n",ids[j]);
+ if (!error) {
+ for (i=0; i<num_elem; i++) {
+ int value;
+ printf ("elem_map(%d) = %d \n", i, elem_map[i]);
+ /* Read element map 1 element at a time... */
+ error = ex_get_partial_elem_map(exoid, ids[j], i+1, 1, &value);
+ if (error != 0 || value != elem_map[i])
+ printf ("invalid value in ex_get_partial_elem_map, map %d, element %d\n", j, i);
+ }
+ }
+ }
+
+ free (elem_map);
+
+/* read element map properties */
+
+ error = ex_inquire (exoid, EX_INQ_EM_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each element map\n", num_props);
+
+ 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_MAP,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_maps; j++)
+ {
+ error = ex_get_prop(exoid, EX_ELEM_MAP, ids[j], prop_names[i],
+ &prop_value);
+ if (error == 0)
+ printf ("element map %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 map names */
+
+ for (i=0; i<num_elem_maps; i++) {
+ map_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_names(exoid,EX_ELEM_MAP,map_names);
+ printf ("after ex_get_names, error = %d\n", error);
+
+ for (j=0; j<num_elem_maps; j++) {
+ printf ("element map %2d, id = %d, name: '%s'\n",
+ j+1, ids[j], map_names[j]);
+ free(map_names[j]);
+ }
+ free(ids);
+
+/* read node maps */
+
+ node_map = (int *) calloc(num_nodes, sizeof(int));
+
+ ids = (int *) calloc(num_node_maps, sizeof(int));
+
+ error = ex_get_prop_array (exoid, EX_NODE_MAP, "ID", ids);
+ printf ("\nafter ex_get_prop_array, error = %3d\n", error);
+
+ for (j=0; j<num_node_maps; j++) {
+ error = ex_get_node_map (exoid, ids[j], node_map);
+ printf ("\nafter ex_get_node_map, error = %3d\n", error);
+
+ printf ("node map id = %2d\n",ids[j]);
+ if (!error)
+ for (i=0; i<num_nodes; i++)
+ printf ("node_map(%d) = %d \n", i, node_map[i]);
+
+ }
+
+ free (node_map);
+
+/* read node map properties */
+
+ error = ex_inquire (exoid, EX_INQ_NM_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node map\n", num_props);
+
+ 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_NODE_MAP,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+ for (i=0; i<num_props; i++)
+ {
+ for (j=0; j<num_node_maps; j++)
+ {
+ error = ex_get_prop(exoid, EX_NODE_MAP, ids[j], prop_names[i],
+ &prop_value);
+ if (error == 0)
+ printf ("node map %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 node map names */
+
+ for (i=0; i<num_node_maps; i++) {
+ map_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+
+ for (j=0; j<num_node_maps; j++) {
+ error = ex_get_name(exoid,EX_NODE_MAP,ids[j], map_names[j]);
+ printf ("after ex_get_name, error = %d\n", error);
+ printf ("node map %2d, id = %d, name: '%s'\n",
+ j+1, ids[j], map_names[j]);
+ free(map_names[j]);
+ }
+ free(ids);
+
+/* read element block parameters */
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; 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]);
+ }
+
+ /* 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));
+ }
+
+ 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=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]);
+ }
+*/
+ free (connect);
+
+ }
+
+/* read element block attributes */
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
+ error = ex_get_elem_attr (exoid, ids[i], attrib);
+ printf ("\nafter ex_get_elem_attr, error = %d\n", error);
+
+ if (error == 0)
+ printf ("element block %d attributes:\n", ids[i]);
+ for (j=0; j<num_attr[i]*num_elem_in_block[i]; j++)
+ printf ("%6.4f\n", attrib[j]);
+ free (attrib);
+ }
+
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_attr);
+
+/* read individual node sets */
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; 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);
+
+ printf ("\nnode set %2d parameters: \n", ids[i]);
+ printf ("num_nodes = %2d\n", num_nodes_in_set);
+
+ 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);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node set\n", num_props);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+
+ 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);
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+
+/* read concatenated node sets; this produces the same information as
+ * the above code which reads individual node sets
+ */
+
+ error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n",error);
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+ num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ node_ind = (int *) calloc(num_node_sets, sizeof(int));
+ df_ind = (int *) calloc(num_node_sets, sizeof(int));
+
+ 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);
+ 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);
+ 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);
+ printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
+
+ printf ("\nconcatenated node set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_nodes_per_set = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
+
+ printf ("node_ind = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
+
+ printf ("node_list = \n");
+ for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_nodes_per_set);
+ free (df_ind);
+ free (node_ind);
+ free (num_df_per_set);
+ free (node_list);
+ free (dist_fact);
+
+
+/* read individual side sets */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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);
+
+ printf ("side set %2d parameters:\n",ids[i]);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
+
+
+ /* 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_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]);
+ }
+
+ 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]);
+ }
+
+ 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];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+ free (node_ctr_list);
+ free (node_list);
+
+ }
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ 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));
+ }
+
+ 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++)
+ 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);
+
+ 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);
+
+ 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
+ */
+
+/* concatenated side set read */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_elem_per_set);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+
+/* end of concatenated side set read */
+
+/* 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]);
+ }
+
+/* read global variables parameters and names */
+
+ error = ex_get_var_param (exoid, "g", &num_glo_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_glo_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_name(exoid, "g", 1, var_names[0]);
+ printf ("\nafter ex_get_var_name, error = %3d\n", error);
+
+ printf ("There are %2d global variables; their names are :\n",
+ num_glo_vars);
+ for (i=0; i<num_glo_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+/* read nodal variables parameters and names */
+
+ error = ex_get_var_param (exoid, "n", &num_nod_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_nod_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ 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]);
+ }
+
+
+/* read element variables parameters and names */
+
+ error = ex_get_var_param (exoid, "e", &num_ele_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_ele_vars; i++)
+ {
+ 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);
+ for (i=0; i<num_ele_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+
+/* read element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
+
+ printf ("This is the element variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_elem_blk*num_ele_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+
+/* determine how many time steps are stored */
+
+ error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+ printf ("There are %2d time steps in the database.\n", num_time_steps);
+
+/* read time value at one time step */
+
+ time_step = 3;
+ error = ex_get_time (exoid, time_step, &time_value);
+ printf ("\nafter ex_get_time, error = %3d\n", error);
+
+ printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
+
+/* read time values at all time steps */
+
+ time_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_all_times (exoid, time_values);
+ printf ("\nafter ex_get_all_times, error = %3d\n", error);
+
+ printf ("time values at all time steps are:\n");
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
+
+ free (time_values);
+
+/* read all global variables at one time step */
+
+ var_values = (float *) calloc (num_glo_vars, sizeof(float));
+
+ error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
+ printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
+
+ printf ("global variable values at time step %2d\n", time_step);
+ for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a single global variable through time */
+
+ var_index = 1;
+ beg_time = 1;
+ end_time = -1;
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
+ var_values);
+ printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
+
+ printf ("global variable %2d values through time:\n", var_index);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable at one time step */
+
+ var_values = (float *) calloc (num_nodes, sizeof(float));
+
+ error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes,
+ 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);
+ for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ node_num = 1;
+ error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read an element variable at one time step */
+
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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);
+
+ 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 (num_elem_in_block);
+ free(ids);
+
+/* read an element variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ var_index = 2;
+ elem_num = 2;
+ error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrd1.dmp b/cbind/test/testrd1.dmp
new file mode 100644
index 0000000..c8ce164
--- /dev/null
+++ b/cbind/test/testrd1.dmp
@@ -0,0 +1,904 @@
+
+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'
+num_dim = 3
+num_nodes = 28
+num_elem = 8
+num_elem_blk = 7
+num_node_sets = 2
+num_side_sets = 5
+
+after ex_get_coord, 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
+100.0
+ 50.0
+ 3.0
+ 6.0
+ 0.0
+ 3.0
+ 6.0
+ 0.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
+100.0
+ 50.0
+ 0.0
+ 0.0
+ 0.0
+ 2.0
+ 2.0
+ 2.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
+ 0.0
+ 20.0
+ 6.0
+ 0.0
+ 0.0
+ 6.0
+ 2.0
+ 0.0
+
+after ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map_param, error = 0
+
+after ex_get_prop_array, error = 0
+
+after ex_get_elem_map, error = 0
+element map id = 111
+elem_map(0) = 1
+elem_map(1) = 2
+elem_map(2) = 3
+elem_map(3) = 4
+elem_map(4) = 5
+elem_map(5) = 6
+elem_map(6) = 7
+elem_map(7) = 8
+
+after ex_get_elem_map, error = 0
+element map id = 222
+elem_map(0) = 2
+elem_map(1) = 4
+elem_map(2) = 6
+elem_map(3) = 8
+elem_map(4) = 10
+elem_map(5) = 12
+elem_map(6) = 14
+elem_map(7) = 16
+
+after ex_inquire, error = 0
+
+There are 3 properties for each element map
+after ex_get_prop_names, error = 0
+element map 1, property( 1): 'ID'= 111
+element map 2, property( 1): 'ID'= 222
+element map 1, property( 2): 'ORDER'= 1
+element map 2, property( 2): 'ORDER'= 0
+element map 1, property( 3): 'NUMBER'= 0
+element map 2, property( 3): 'NUMBER'= 1
+after ex_get_names, error = 0
+element map 1, id = 111, name: 'Element_Map_111'
+element map 2, id = 222, name: 'Element_Map_222'
+
+after ex_get_prop_array, error = 0
+
+after ex_get_node_map, error = 0
+node map id = 333
+node_map(0) = 3
+node_map(1) = 6
+node_map(2) = 9
+node_map(3) = 12
+node_map(4) = 15
+node_map(5) = 18
+node_map(6) = 21
+node_map(7) = 24
+node_map(8) = 27
+node_map(9) = 30
+node_map(10) = 33
+node_map(11) = 36
+node_map(12) = 39
+node_map(13) = 42
+node_map(14) = 45
+node_map(15) = 48
+node_map(16) = 51
+node_map(17) = 54
+node_map(18) = 57
+node_map(19) = 60
+node_map(20) = 63
+node_map(21) = 66
+node_map(22) = 69
+node_map(23) = 72
+node_map(24) = 75
+node_map(25) = 78
+node_map(26) = 81
+node_map(27) = 84
+
+after ex_inquire, error = 0
+
+There are 2 properties for each node map
+after ex_get_prop_names, error = 0
+node map 1, property( 1): 'ID'= 333
+node map 1, property( 2): 'NUMBER'= 1
+after ex_get_name, error = 0
+node map 1, id = 333, name: 'Node_Map_111'
+
+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 = 3
+
+after ex_get_elem_block, error = 0
+element block id = 11
+element type = 'quad'
+num_elem_in_block = 2
+num_nodes_per_elem = 4
+num_attr = 3
+
+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 = 3
+
+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 = 3
+
+after ex_get_elem_block, error = 0
+element block id = 14
+element type = 'circle'
+num_elem_in_block = 1
+num_nodes_per_elem = 1
+num_attr = 3
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'sphere'
+num_elem_in_block = 1
+num_nodes_per_elem = 1
+num_attr = 3
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'wedge'
+num_elem_in_block = 1
+num_nodes_per_elem = 6
+num_attr = 3
+
+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): '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 6, property( 2): 'MATL'= 60
+element block 7, property( 2): 'MATL'= 70
+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
+element block 6, property( 3): 'DENSITY'= 0
+element block 7, 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
+ 1
+ 2
+ 3
+ 4
+
+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
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 15
+ 22
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 16
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+
+after ex_get_elem_attr, error = 0
+element block 10 attributes:
+1.0000
+2.0000
+3.0000
+
+after ex_get_elem_attr, error = 0
+element block 11 attributes:
+1.1100
+2.1100
+3.1100
+1.1200
+2.1200
+3.1200
+
+after ex_get_elem_attr, error = 0
+element block 12 attributes:
+1.2000
+2.2000
+3.2000
+
+after ex_get_elem_attr, error = 0
+element block 13 attributes:
+1.3000
+2.3000
+3.3000
+
+after ex_get_elem_attr, error = 0
+element block 14 attributes:
+1.4000
+2.4000
+3.4000
+
+after ex_get_elem_attr, error = 0
+element block 15 attributes:
+1.5000
+2.5000
+3.5000
+
+after ex_get_elem_attr, error = 0
+element block 16 attributes:
+1.6000
+2.6000
+3.6000
+
+after ex_get_node_set_ids, error = 0
+
+after ex_get_node_set_param, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after ex_get_node_set_param, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after ex_get_side_set_ids, error = 0
+
+after ex_get_side_set_param, error = 0
+side set 30 parameters:
+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
+ 3
+ 3
+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
+30.200
+30.300
+
+after ex_get_side_set_param, error = 0
+side set 31 parameters:
+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
+ 3
+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
+31.200
+31.300
+
+after ex_get_side_set_param, error = 0
+side set 32 parameters:
+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
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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
+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
+ 5
+ 5
+ 5
+ 5
+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
+no dist factors for side set 33
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+num_sides = 2
+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
+ 6
+ 7
+side list for side set 34
+ 1
+ 1
+node list for side set 34
+ 21
+ 22
+no dist factors for side set 34
+
+after ex_inquire, error = 0
+
+There are 2 properties for each side set
+after ex_get_prop_names, error = 0
+side set 1, property( 1): 'ID'= 30
+side set 2, property( 1): 'ID'= 31
+side set 3, property( 1): 'ID'= 32
+side set 4, property( 1): 'ID'= 33
+side set 5, property( 1): 'ID'= 34
+side set 1, property( 2): 'COLOR'= 100
+side set 2, property( 2): 'COLOR'= 101
+side set 3, property( 2): 'COLOR'= 0
+side set 4, property( 2): 'COLOR'= 0
+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 = 17, error = 0
+
+after ex_inquire: EX_INQ_SS_NODE_LEN = 50, error = 0
+
+after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 4
+ 2
+num_dist_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 2
+ 4
+ 11
+ 15
+dist_ind =
+ 0
+ 4
+ 8
+ 8
+ 8
+elem_list =
+ 3
+ 3
+ 1
+ 3
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 5
+ 5
+ 5
+ 5
+ 6
+ 7
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 1
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT1'
+ 'testwt1'
+ '03/16/94'
+ '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
+
+after ex_get_var_name, error = 0
+There are 1 global variables; their names are :
+ 'glo vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'nod_var0'
+ 'nod_var1'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 element variables; their names are :
+ 'ele_var0'
+ 'ele_var1'
+ 'ele_var2'
+
+after ex_get_elem_var_tab, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+1.720
+1.750
+1.780
+1.810
+1.840
+
+after ex_get_nodal_var_time, error = 0
+nodal variable 1 values for node 1 through time:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+ after ex_get_elem_blk_ids, error = 0
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 11 at time step 3
+5.030
+5.060
+
+after ex_get_elem_var, error = -1
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 13 at time step 3
+7.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 14 at time step 3
+8.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 15 at time step 3
+9.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 16 at time step 3
+10.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
+
+after ex_close, error = 0
diff --git a/cbind/test/testrd_nc.c b/cbind/test/testrd_nc.c
new file mode 100644
index 0000000..ddeb8ab
--- /dev/null
+++ b/cbind/test/testrd_nc.c
@@ -0,0 +1,894 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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_nc.c,v 1.4 2006/11/28 14:02:16 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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 *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ 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;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int num_time_steps;
+ 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 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;
+ int idum;
+
+ float time_value, *time_values, *var_values;
+ float *xyz;
+ float *attrib, *dist_fact;
+ float version, fdum;
+
+ 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 *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 */
+ 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 (" 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; */
+
+/* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+/* read nodal coordinates values and names from database */
+
+ xyz = (float *) calloc(num_nodes, sizeof(float));
+
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ error = ex_get_coord (exoid, xyz, NULL, NULL);
+ printf ("x coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", xyz[i]);
+ }
+
+ error = ex_get_coord (exoid, NULL, xyz, NULL);
+ printf ("y coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", xyz[i]);
+ }
+
+ error = ex_get_coord (exoid, NULL, NULL, xyz);
+ if (num_dim >= 3)
+ {
+ printf ("z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", xyz[i]);
+ }
+ }
+
+/*
+ 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 (xyz);
+
+ 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]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+
+/* 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]);
+ }
+
+ free (elem_map);
+
+/* read element block parameters */
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; 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]);
+ }
+
+ /* 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));
+ }
+
+ 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=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]);
+ }
+*/
+ free (connect);
+
+ }
+
+/* read element block attributes */
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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 attributes = %6.4f\n", ids[i], *attrib);
+ free (attrib);
+ }
+
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_attr);
+
+/* read individual node sets */
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; 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);
+
+ printf ("\nnode set %2d parameters: \n", ids[i]);
+ printf ("num_nodes = %2d\n", num_nodes_in_set);
+
+ 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);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node set\n", num_props);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+
+ 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);
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+/* read concatenated node sets; this produces the same information as
+ * the above code which reads individual node sets
+ */
+
+ error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n",error);
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+ num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ node_ind = (int *) calloc(num_node_sets, sizeof(int));
+ df_ind = (int *) calloc(num_node_sets, sizeof(int));
+
+ 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);
+ 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);
+ 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);
+ printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
+
+ printf ("\nconcatenated node set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_nodes_per_set = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
+
+ printf ("node_ind = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
+
+ printf ("node_list = \n");
+ for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_nodes_per_set);
+ free (df_ind);
+ free (node_ind);
+ free (num_df_per_set);
+ free (node_list);
+ free (dist_fact);
+
+
+/* read individual side sets */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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);
+
+ printf ("side set %2d parameters:\n",ids[i]);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
+
+
+ /* 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_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]);
+ }
+
+ 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]);
+ }
+
+ 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];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+
+ }
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ 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));
+ }
+
+ 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++)
+ 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);
+
+ 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);
+
+ 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
+ */
+
+/* concatenated side set read */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_elem_per_set);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+
+/* end of concatenated side set read */
+
+/* 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]);
+ }
+
+/* read global variables parameters and names */
+
+ error = ex_get_var_param (exoid, "g", &num_glo_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_glo_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d global variables; their names are :\n",
+ num_glo_vars);
+ for (i=0; i<num_glo_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+/* read nodal variables parameters and names */
+
+ error = ex_get_var_param (exoid, "n", &num_nod_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_nod_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ 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]);
+ }
+
+
+/* read element variables parameters and names */
+
+ error = ex_get_var_param (exoid, "e", &num_ele_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_ele_vars; i++)
+ {
+ 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);
+ for (i=0; i<num_ele_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+
+/* read element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
+
+ printf ("This is the element variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_elem_blk*num_ele_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+
+/* determine how many time steps are stored */
+
+ error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+ printf ("There are %2d time steps in the database.\n", num_time_steps);
+
+/* read time value at one time step */
+
+ time_step = 3;
+ error = ex_get_time (exoid, time_step, &time_value);
+ printf ("\nafter ex_get_time, error = %3d\n", error);
+
+ printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
+
+/* read time values at all time steps */
+
+ time_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_all_times (exoid, time_values);
+ printf ("\nafter ex_get_all_times, error = %3d\n", error);
+
+ printf ("time values at all time steps are:\n");
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
+
+ free (time_values);
+
+/* read all global variables at one time step */
+
+ var_values = (float *) calloc (num_glo_vars, sizeof(float));
+
+ error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
+ printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
+
+ printf ("global variable values at time step %2d\n", time_step);
+ for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a single global variable through time */
+
+ var_index = 1;
+ beg_time = 1;
+ end_time = -1;
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
+ var_values);
+ printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
+
+ printf ("global variable %2d values through time:\n", var_index);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable at one time step */
+
+ var_values = (float *) calloc (num_nodes, sizeof(float));
+
+ error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes,
+ 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);
+ for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ node_num = 1;
+ error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read an element variable at one time step */
+
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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);
+
+ 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 (num_elem_in_block);
+ free(ids);
+
+/* read an element variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ var_index = 2;
+ elem_num = 2;
+ error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrd_nc.dmp b/cbind/test/testrd_nc.dmp
new file mode 100644
index 0000000..506c17e
--- /dev/null
+++ b/cbind/test/testrd_nc.dmp
@@ -0,0 +1,927 @@
+
+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 = 33
+num_elem = 7
+num_elem_blk = 7
+num_node_sets = 2
+num_side_sets = 5
+
+after ex_get_coord, 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 ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+elem_map(0) = 1
+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_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
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'tetra'
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 1
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'tri'
+num_elem_in_block = 1
+num_nodes_per_elem = 3
+num_attr = 1
+
+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
+element block 4, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 40
+element block 5, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 50
+element block 6, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 60
+element block 7, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 70
+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
+element block 6, property( 3): 'DENSITY'= 0
+element block 7, 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_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_conn, error = 0
+connect array for elem block 15
+ 17
+ 18
+ 19
+ 20
+ 27
+ 28
+ 30
+ 29
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 16
+ 31
+ 32
+ 33
+
+ after ex_get_elem_attr, error = 0
+element block 10 attributes = 3.1416
+
+ after ex_get_elem_attr, error = 0
+element block 11 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 12 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 13 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 14 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 15 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 16 attributes = 6.1416
+
+after ex_get_node_set_ids, error = 0
+
+after ex_get_node_set_param, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after ex_get_node_set_param, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after ex_get_side_set_ids, error = 0
+
+after ex_get_side_set_param, error = 0
+side set 30 parameters:
+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
+ 2
+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
+30.200
+30.300
+
+after ex_get_side_set_param, error = 0
+side set 31 parameters:
+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
+ 2
+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
+31.200
+31.300
+
+after ex_get_side_set_param, error = 0
+side set 32 parameters:
+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
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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 = 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
+ 1
+ 2
+ 3
+ 4
+node list for side set 33
+ 17
+ 18
+ 20
+ 18
+ 19
+ 20
+ 17
+ 20
+ 19
+ 17
+ 19
+ 18
+ 17
+ 18
+ 20
+ 27
+ 18
+ 19
+ 20
+ 28
+ 17
+ 20
+ 19
+ 29
+ 17
+ 19
+ 18
+ 30
+no dist factors for side set 33
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+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
+ 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
+ 31
+ 32
+ 33
+ 33
+ 32
+ 31
+ 31
+ 32
+ 32
+ 33
+ 33
+ 31
+no dist factors for side set 34
+
+after ex_inquire, error = 0
+
+There are 2 properties for each side set
+after ex_get_prop_names, error = 0
+side set 1, property( 1): 'ID'= 30
+side set 2, property( 1): 'ID'= 31
+side set 3, property( 1): 'ID'= 32
+side set 4, property( 1): 'ID'= 33
+side set 5, property( 1): 'ID'= 34
+side set 1, property( 2): 'COLOR'= 100
+side set 2, property( 2): 'COLOR'= 101
+side set 3, property( 2): 'COLOR'= 0
+side set 4, property( 2): 'COLOR'= 0
+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 = 29, error = 0
+
+after ex_inquire: EX_INQ_SS_NODE_LEN = 94, error = 0
+
+after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 8
+ 10
+num_dist_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 2
+ 4
+ 11
+ 19
+dist_ind =
+ 0
+ 4
+ 8
+ 8
+ 8
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 6
+ 6
+ 6
+ 6
+ 5
+ 5
+ 5
+ 5
+ 5
+ 7
+ 7
+ 7
+ 7
+ 7
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+ 1
+ 2
+ 3
+ 4
+ 5
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT'
+ 'testwt'
+ '07/07/93'
+ '15:41:33'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'node_variable_a_very_long_name_0'
+ 'nod_var1'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 element variables; their names are :
+ 'ele_var0'
+ 'ele_var1'
+ 'ele_var2'
+
+after ex_get_elem_var_tab, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+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:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+ after ex_get_elem_blk_ids, error = 0
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+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
+7.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 14 at time step 3
+8.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 15 at time step 3
+9.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 16 at time step 3
+10.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
+
+after ex_close, error = 0
diff --git a/cbind/test/testrd_ss.c b/cbind/test/testrd_ss.c
new file mode 100644
index 0000000..40b6509
--- /dev/null
+++ b/cbind/test/testrd_ss.c
@@ -0,0 +1,340 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testrd_ss - read exodus file test.exo created by testwt_ss
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+*
+* revision history -
+*
+* Original L. A. Schoof
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.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 *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ int *num_elem_per_set;
+ int *num_df_per_set;
+ int *elem_ind, *df_ind;
+ int *num_elem_in_block, *num_nodes_per_elem, *num_attr;
+ int num_elem_in_set;
+ int num_sides_in_set, num_df_in_set;
+ int elem_list_len, node_list_len, df_list_len;
+ int CPU_word_size,IO_word_size;
+ int idum;
+
+ float *dist_fact;
+ float version, fdum;
+
+ char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
+ char *cdum;
+
+ 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 */
+ 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 (" 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; */
+
+/* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+
+/* read element block parameters */
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; 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]);
+ }
+
+/* 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]);
+ }
+ free (connect);
+
+ }
+ free(ids);
+ free(num_elem_in_block);
+ free(num_nodes_per_elem);
+ free(num_attr);
+
+/* read individual side sets */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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);
+
+ printf ("side set %2d parameters:\n",ids[i]);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
+
+
+ /* 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_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]);
+ }
+
+ 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]);
+ }
+
+ node_ctr = 0;
+ printf ("node list for side set %2d\n", ids[i]);
+ for (k=0; k<num_elem_in_set; k++)
+ {
+ printf ("%3d nodes for side %3d\n", node_ctr_list[k], k);
+ for (j=0; j<node_ctr_list[k]; j++)
+ {
+ printf ("%3d\n", node_list[node_ctr+j]);
+ }
+ node_ctr += node_ctr_list[k];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+
+ }
+ free(ids);
+
+ 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_NODE_LEN, &node_list_len, &fdum, cdum);
+ printf ("\nafter ex_inquire: EX_INQ_SS_NODE_LEN = %d, error = %d\n",
+ node_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
+ */
+
+/* concatenated side set read */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_elem_per_set);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+
+/* end of concatenated side set read */
+
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrd_ss.dmp b/cbind/test/testrd_ss.dmp
new file mode 100644
index 0000000..2149fa0
--- /dev/null
+++ b/cbind/test/testrd_ss.dmp
@@ -0,0 +1,525 @@
+
+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 = 33
+num_elem = 8
+num_elem_blk = 8
+num_node_sets = 2
+num_side_sets = 9
+
+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_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
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'tetra'
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 1
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'shell'
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after ex_get_elem_block, error = 0
+element block id = 17
+element type = 'triangle'
+num_elem_in_block = 1
+num_nodes_per_elem = 3
+num_attr = 1
+
+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_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_conn, error = 0
+connect array for elem block 15
+ 17
+ 18
+ 19
+ 20
+ 27
+ 28
+ 30
+ 29
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 16
+ 1
+ 2
+ 3
+ 4
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 17
+ 30
+ 31
+ 32
+
+after ex_get_side_set_ids, error = 0
+
+after ex_get_side_set_param, error = 0
+side set 30 parameters:
+num_sides = 0
+num_dist_factors = 0
+
+after ex_get_side_set, error = 1
+
+after ex_get_side_set_node_list, error = 1
+element list for side set 30
+side list for side set 30
+node list for side set 30
+no dist factors for side set 30
+
+after ex_get_side_set_param, error = 0
+side set 31 parameters:
+num_sides = 0
+num_dist_factors = 0
+
+after ex_get_side_set, error = 1
+
+after ex_get_side_set_node_list, error = 1
+element list for side set 31
+side list for side set 31
+node list for side set 31
+no dist factors for side set 31
+
+after ex_get_side_set_param, error = 0
+side set 32 parameters:
+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 32
+ 2
+ 2
+side list for side set 32
+ 4
+ 2
+node list for side set 32
+ 2 nodes for side 0
+ 8
+ 5
+ 2 nodes for side 1
+ 6
+ 7
+dist factors for side set 32
+30.000
+30.100
+30.200
+30.300
+
+after ex_get_side_set_param, error = 0
+side set 33 parameters:
+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 33
+ 1
+ 2
+side list for side set 33
+ 2
+ 3
+node list for side set 33
+ 2 nodes for side 0
+ 2
+ 3
+ 2 nodes for side 1
+ 7
+ 8
+dist factors for side set 33
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+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 34
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 34
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+node list for side set 34
+ 4 nodes for side 0
+ 9
+ 12
+ 11
+ 10
+ 4 nodes for side 1
+ 11
+ 12
+ 16
+ 15
+ 4 nodes for side 2
+ 11
+ 12
+ 16
+ 15
+ 4 nodes for side 3
+ 10
+ 11
+ 15
+ 14
+ 4 nodes for side 4
+ 9
+ 13
+ 16
+ 12
+ 4 nodes for side 5
+ 9
+ 10
+ 14
+ 13
+ 4 nodes for side 6
+ 13
+ 14
+ 15
+ 16
+no dist factors for side set 34
+
+after ex_get_side_set_param, error = 0
+side set 35 parameters:
+num_sides = 4
+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 35
+ 4
+ 4
+ 4
+ 4
+side list for side set 35
+ 1
+ 2
+ 3
+ 4
+node list for side set 35
+ 3 nodes for side 0
+ 17
+ 18
+ 20
+ 3 nodes for side 1
+ 18
+ 19
+ 20
+ 3 nodes for side 2
+ 17
+ 20
+ 19
+ 3 nodes for side 3
+ 17
+ 19
+ 18
+no dist factors for side set 35
+
+after ex_get_side_set_param, error = 0
+side set 36 parameters:
+num_sides = 2
+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 36
+ 7
+ 7
+side list for side set 36
+ 1
+ 2
+node list for side set 36
+ 4 nodes for side 0
+ 1
+ 2
+ 3
+ 4
+ 4 nodes for side 1
+ 1
+ 4
+ 3
+ 2
+no dist factors for side set 36
+
+after ex_get_side_set_param, error = 0
+side set 37 parameters:
+num_sides = 4
+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 37
+ 7
+ 7
+ 7
+ 7
+side list for side set 37
+ 3
+ 4
+ 5
+ 6
+node list for side set 37
+ 2 nodes for side 0
+ 1
+ 2
+ 2 nodes for side 1
+ 2
+ 3
+ 2 nodes for side 2
+ 3
+ 4
+ 2 nodes for side 3
+ 4
+ 1
+no dist factors for side set 37
+
+after ex_get_side_set_param, error = 0
+side set 38 parameters:
+num_sides = 2
+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 38
+ 8
+ 8
+side list for side set 38
+ 1
+ 2
+node list for side set 38
+ 3 nodes for side 0
+ 30
+ 31
+ 32
+ 3 nodes for side 1
+ 32
+ 31
+ 30
+no dist factors for side set 38
+
+after ex_inquire: EX_INQ_SS_ELEM_LEN = 23, error = 0
+
+after ex_inquire: EX_INQ_SS_NODE_LEN = 70, error = 0
+
+after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+ 35
+ 36
+ 37
+ 38
+num_elem_per_set =
+ 0
+ 0
+ 2
+ 2
+ 7
+ 4
+ 2
+ 4
+ 2
+num_dist_per_set =
+ 0
+ 0
+ 4
+ 4
+ 0
+ 0
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 0
+ 0
+ 2
+ 4
+ 11
+ 15
+ 17
+ 21
+dist_ind =
+ 0
+ 0
+ 0
+ 4
+ 8
+ 8
+ 8
+ 8
+ 8
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 7
+ 7
+ 7
+ 7
+ 7
+ 7
+ 8
+ 8
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 1
+ 2
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_close, error = 0
diff --git a/cbind/test/testrd_zeroe.dmp b/cbind/test/testrd_zeroe.dmp
new file mode 100644
index 0000000..43b7e0d
--- /dev/null
+++ b/cbind/test/testrd_zeroe.dmp
@@ -0,0 +1,339 @@
+
+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 = 33
+num_elem = 0
+num_elem_blk = 0
+num_node_sets = 2
+num_side_sets = 0
+
+after ex_get_coord, 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 ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+
+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 = ''
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after ex_get_node_set_param, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+name = ''
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT'
+ 'testwt'
+ '07/07/93'
+ '15:41:33'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'node_variable_a_very_long_name_0'
+ 'nod_var1'
+
+after ex_get_var_param, error = 0
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+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:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+after ex_close, error = 0
diff --git a/cbind/test/testrd_zeron.dmp b/cbind/test/testrd_zeron.dmp
new file mode 100644
index 0000000..a222a94
--- /dev/null
+++ b/cbind/test/testrd_zeron.dmp
@@ -0,0 +1,88 @@
+
+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_node_sets = 0
+num_side_sets = 0
+
+after ex_get_coord, error = 0
+x coords =
+y coords =
+z coords =
+
+after ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT'
+ 'testwt'
+ '07/07/93'
+ '15:41:33'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_close, error = 0
diff --git a/cbind/test/testrdd.c b/cbind/test/testrdd.c
new file mode 100644
index 0000000..34042eb
--- /dev/null
+++ b/cbind/test/testrdd.c
@@ -0,0 +1,900 @@
+/*
+ * 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.
+ *
+ */
+/******************************************************************************
+* testrdd - read exodus file test.exo created by testwt - double precision
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+*
+* revision history -
+*
+* 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 $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.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 *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ 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;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int num_time_steps;
+ 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 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;
+
+ double time_value, *time_values, *var_values;
+ double *x, *y, *z;
+ double attrib[1], *dist_fact;
+ float version, fdum;
+
+ 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 *prop_names[3];
+
+ cdum = 0;
+
+ CPU_word_size = 8; /* sizeof(double) */
+ 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 */
+ 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 (" CPU word size %1d\n",CPU_word_size);
+ printf (" I/O word size %1d\n",IO_word_size);
+
+ /* ncopts = NC_VERBOSE; */
+
+/* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+/* read nodal coordinates values and names from database */
+
+ x = (double *) calloc(num_nodes, sizeof(double));
+ y = (double *) calloc(num_nodes, sizeof(double));
+ if (num_dim >= 3)
+ z = (double *) calloc(num_nodes, sizeof(double));
+ else
+ z = 0;
+
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ printf ("x coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", x[i]);
+ }
+
+ printf ("y coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", y[i]);
+ }
+
+ if (num_dim >= 3)
+ {
+ printf ("z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", z[i]);
+ }
+ }
+
+
+/*
+ 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)
+ 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]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+
+/* 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]);
+ }
+
+ free (elem_map);
+
+/* read element block parameters */
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; 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]);
+ }
+
+ /* 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));
+ }
+
+ 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=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]);
+ }
+*/
+ free (connect);
+
+ }
+
+/* read element block attributes */
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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 attributes = %10.8f\n", ids[i], *attrib);
+ }
+
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_attr);
+
+/* read individual node sets */
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; 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);
+
+ printf ("\nnode set %2d parameters: \n", ids[i]);
+ printf ("num_nodes = %2d\n", num_nodes_in_set);
+
+ node_list = (int *) calloc(num_nodes_in_set, sizeof(int));
+ dist_fact = (double *) calloc(num_nodes_in_set, sizeof(double));
+
+ 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);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node set\n", num_props);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+ 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);
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+/* read concatenated node sets; this produces the same information as
+ * the above code which reads individual node sets
+ */
+
+ error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n",error);
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+ num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ node_ind = (int *) calloc(num_node_sets, sizeof(int));
+ df_ind = (int *) calloc(num_node_sets, sizeof(int));
+
+ 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);
+
+ 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);
+ dist_fact = (double *) calloc(list_len, sizeof(double));
+
+ error = ex_get_concat_node_sets (exoid,ids,num_nodes_per_set,num_df_per_set,
+ 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");
+
+ printf ("ids = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_nodes_per_set = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
+
+ printf ("node_ind = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
+
+ printf ("node_list = \n");
+ for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_nodes_per_set);
+ free (df_ind);
+ free (node_ind);
+ free (num_df_per_set);
+ free (node_list);
+ free (dist_fact);
+
+
+/* read individual side sets */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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);
+
+ printf ("side set %2d parameters:\n",ids[i]);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
+
+
+ /* 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 = (double *) calloc(num_df_in_set, sizeof(double));
+
+ 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]);
+ }
+
+ 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]);
+ }
+
+ 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];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+ }
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ 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));
+ }
+
+ 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++)
+ 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);
+
+ 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);
+
+ 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
+ */
+
+/* concatenated side set read */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ dist_fact = (double *) calloc(df_list_len, sizeof(double));
+
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_elem_per_set);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+
+/* end of concatenated side set read */
+
+/* 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]);
+ }
+
+
+/* read global variables parameters and names */
+
+ error = ex_get_var_param (exoid, "g", &num_glo_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_glo_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d global variables; their names are :\n",
+ num_glo_vars);
+ for (i=0; i<num_glo_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+
+/* read nodal variables parameters and names */
+
+ error = ex_get_var_param (exoid, "n", &num_nod_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_nod_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ 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]);
+ }
+
+/* read element variables parameters and names */
+
+ error = ex_get_var_param (exoid, "e", &num_ele_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_ele_vars; i++)
+ {
+ 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);
+ for (i=0; i<num_ele_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+
+/* read element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
+
+ printf ("This is the element variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_elem_blk*num_ele_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+
+/* determine how many time steps are stored */
+
+ error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+ printf ("There are %2d time steps in the database.\n", num_time_steps);
+
+/* read time value at one time step */
+
+ time_step = 3;
+ error = ex_get_time (exoid, time_step, &time_value);
+ printf ("\nafter ex_get_time, error = %3d\n", error);
+
+ printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
+
+/* read time values at all time steps */
+
+ time_values = (double *) calloc (num_time_steps, sizeof(double));
+
+ error = ex_get_all_times (exoid, time_values);
+ printf ("\nafter ex_get_all_times, error = %3d\n", error);
+
+ printf ("time values at all time steps are:\n");
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
+
+ free (time_values);
+
+/* read all global variables at one time step */
+
+ var_values = (double *) calloc (num_glo_vars, sizeof(double));
+
+ error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
+ printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
+
+ printf ("global variable values at time step %2d\n", time_step);
+ for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a single global variable through time */
+
+ var_index = 1;
+ beg_time = 1;
+ end_time = -1;
+
+ var_values = (double *) calloc (num_time_steps, sizeof(double));
+
+ error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
+ var_values);
+ printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
+
+ printf ("global variable %2d values through time:\n", var_index);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable at one time step */
+
+ var_values = (double *) calloc (num_nodes, sizeof(double));
+
+ error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes,
+ 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);
+ for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read a nodal variable through time */
+
+ var_values = (double *) calloc (num_time_steps, sizeof(double));
+
+ node_num = 1;
+ error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+/* read an element variable at one time step */
+
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ var_values = (double *) calloc (num_elem_in_block[i], sizeof(double));
+
+ 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]);
+ }
+
+ free (var_values);
+ }
+ free (num_elem_in_block);
+ free(ids);
+
+/* read an element variable through time */
+
+ var_values = (double *) calloc (num_time_steps, sizeof(double));
+
+ var_index = 2;
+ elem_num = 2;
+ error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrdd.dmp b/cbind/test/testrdd.dmp
new file mode 100644
index 0000000..ed2165b
--- /dev/null
+++ b/cbind/test/testrdd.dmp
@@ -0,0 +1,776 @@
+
+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
+database parameters:
+title = 'This is a test'
+num_dim = 3
+num_nodes = 26
+num_elem = 5
+num_elem_blk = 5
+num_node_sets = 2
+num_side_sets = 5
+
+after ex_get_coord, 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
+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
+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
+
+after ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+elem_map(0) = 1
+elem_map(1) = 2
+elem_map(2) = 3
+elem_map(3) = 4
+elem_map(4) = 5
+
+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_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
+
+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 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_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
+
+after ex_get_node_set_ids, error = 0
+
+after ex_get_node_set_param, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after ex_get_node_set_param, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after ex_get_side_set_ids, error = 0
+
+after ex_get_side_set_param, error = 0
+side set 30 parameters:
+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
+ 2
+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
+30.200
+30.300
+
+after ex_get_side_set_param, error = 0
+side set 31 parameters:
+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
+ 2
+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
+31.200
+31.300
+
+after ex_get_side_set_param, error = 0
+side set 32 parameters:
+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
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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
+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
+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
+no dist factors for side set 33
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+num_sides = 5
+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
+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
+no dist factors for side set 34
+
+after ex_inquire, error = 0
+
+There are 2 properties for each side set
+after ex_get_prop_names, error = 0
+side set 1, property( 1): 'ID'= 30
+side set 2, property( 1): 'ID'= 31
+side set 3, property( 1): 'ID'= 32
+side set 4, property( 1): 'ID'= 33
+side set 5, property( 1): 'ID'= 34
+side set 1, property( 2): 'COLOR'= 100
+side set 2, property( 2): 'COLOR'= 101
+side set 3, property( 2): 'COLOR'= 0
+side set 4, property( 2): 'COLOR'= 0
+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_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 4
+ 5
+num_dist_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 2
+ 4
+ 11
+ 15
+dist_ind =
+ 0
+ 4
+ 8
+ 8
+ 8
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 5
+ 5
+ 5
+ 5
+ 5
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWTD'
+ 'testwtd'
+ '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
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'nod_var0'
+ 'nod_var1'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 element variables; their names are :
+ 'ele_var0'
+ 'ele_var1'
+ 'ele_var2'
+
+after ex_get_elem_var_tab, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+1.720
+1.750
+1.780
+
+after ex_get_nodal_var_time, error = 0
+nodal variable 1 values for node 1 through time:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+ after ex_get_elem_blk_ids, error = 0
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+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
+7.030
+
+after ex_get_elem_var, error = 0
+element variable 1 values of element block 14 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
+
+after ex_close, error = 0
diff --git a/cbind/test/testrdv.c b/cbind/test/testrdv.c
new file mode 100644
index 0000000..aec5a3c
--- /dev/null
+++ b/cbind/test/testrdv.c
@@ -0,0 +1,930 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testrd - read exodus file test.exo created by testwt
+* -- use varid routines to read node and element variables.
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: testrdv.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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 *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ 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;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int *node_varid, *elem_varid;
+
+ int num_time_steps;
+ 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 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;
+ int idum;
+
+ float time_value, *time_values, *var_values;
+ float *x, *y, *z;
+ float *attrib, *dist_fact;
+ float version, fdum;
+
+ 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 *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 */
+ 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 (" 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; */
+
+ /* read database parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %3d\n", error);
+
+ printf ("database parameters:\n");
+ printf ("title = '%s'\n",title);
+ printf ("num_dim = %3d\n",num_dim);
+ printf ("num_nodes = %3d\n",num_nodes);
+ printf ("num_elem = %3d\n",num_elem);
+ printf ("num_elem_blk = %3d\n",num_elem_blk);
+ printf ("num_node_sets = %3d\n",num_node_sets);
+ printf ("num_side_sets = %3d\n",num_side_sets);
+
+ /* read nodal coordinates values and names from database */
+
+ x = (float *) calloc(num_nodes, sizeof(float));
+ y = (float *) calloc(num_nodes, sizeof(float));
+ if (num_dim >= 3)
+ z = (float *) calloc(num_nodes, sizeof(float));
+ else
+ z = 0;
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+ printf ("x coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", x[i]);
+ }
+
+ printf ("y coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", y[i]);
+ }
+
+ if (num_dim >= 3)
+ {
+ printf ("z coords = \n");
+ for (i=0; i<num_nodes; i++)
+ {
+ printf ("%5.1f\n", z[i]);
+ }
+ }
+
+ /*
+ 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)
+ 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]);
+
+ for (i=0; i<num_dim; i++)
+ free(coord_names[i]);
+
+
+ /* 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]);
+ }
+
+ 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));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; 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]);
+ }
+
+ /* 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));
+ }
+
+ 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=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]);
+ }
+ */
+ free (connect);
+
+ }
+
+ /* read element block attributes */
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ 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 attributes = %6.4f\n", ids[i], *attrib);
+ free (attrib);
+ }
+
+ if (num_elem_blk > 0) {
+ free (ids);
+ free (num_nodes_per_elem);
+ free (num_attr);
+ }
+
+ /* read individual node sets */
+ if (num_node_sets > 0) {
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; 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);
+
+ printf ("\nnode set %2d parameters: \n", ids[i]);
+ printf ("num_nodes = %2d\n", num_nodes_in_set);
+
+ 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);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+ printf ("\nThere are %2d properties for each node set\n", num_props);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+
+ 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);
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+ /* read concatenated node sets; this produces the same information as
+ * the above code which reads individual node sets
+ */
+
+ error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n",error);
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+ num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
+ node_ind = (int *) calloc(num_node_sets, sizeof(int));
+ df_ind = (int *) calloc(num_node_sets, sizeof(int));
+
+ 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);
+ 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);
+ 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);
+ printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
+
+ printf ("\nconcatenated node set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_nodes_per_set = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
+
+ printf ("node_ind = \n");
+ for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
+
+ printf ("node_list = \n");
+ for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_nodes_per_set);
+ free (df_ind);
+ free (node_ind);
+ free (num_df_per_set);
+ free (node_list);
+ free (dist_fact);
+ }
+
+ /* read individual side sets */
+
+ if (num_side_sets > 0) {
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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);
+
+ printf ("side set %2d parameters:\n",ids[i]);
+ printf ("num_sides = %3d\n",num_sides_in_set);
+ printf ("num_dist_factors = %3d\n", num_df_in_set);
+
+
+ /* 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_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]);
+ }
+
+ 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]);
+ }
+
+ 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];
+ }
+
+ 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]);
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+
+ }
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ 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));
+ }
+
+ 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++)
+ 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);
+
+ 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);
+
+ 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
+ */
+
+ /* concatenated side set read */
+
+ if (num_side_sets > 0) {
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+ num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
+ elem_ind = (int *) calloc(num_side_sets, sizeof(int));
+ df_ind = (int *) calloc(num_side_sets, sizeof(int));
+ elem_list = (int *) calloc(elem_list_len, sizeof(int));
+ side_list = (int *) calloc(elem_list_len, sizeof(int));
+ 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);
+ printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
+
+ printf ("concatenated side set info\n");
+
+ printf ("ids = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
+
+ printf ("num_elem_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
+
+ printf ("num_dist_per_set = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
+
+ printf ("elem_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
+
+ printf ("dist_ind = \n");
+ for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
+
+ printf ("elem_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
+
+ printf ("side_list = \n");
+ for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
+
+ printf ("dist_fact = \n");
+ for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
+
+ free (ids);
+ free (num_elem_per_set);
+ free (num_df_per_set);
+ free (df_ind);
+ free (elem_ind);
+ free (elem_list);
+ free (side_list);
+ free (dist_fact);
+ }
+ }
+ /* end of concatenated side set read */
+
+ /* 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]);
+ }
+
+ /* read global variables parameters and names */
+
+ error = ex_get_var_param (exoid, "g", &num_glo_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_glo_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ printf ("There are %2d global variables; their names are :\n",
+ num_glo_vars);
+ for (i=0; i<num_glo_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read nodal variables parameters and names */
+ num_nod_vars = 0;
+ if (num_nodes > 0) {
+ error = ex_get_var_param (exoid, "n", &num_nod_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_nod_vars; i++)
+ {
+ var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+
+ error = ex_get_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("\nafter ex_get_var_names, error = %3d\n", error);
+
+ 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]);
+ }
+
+ node_varid = calloc(num_nod_vars, sizeof(int));
+ error = ex_get_nodal_varid(exoid, node_varid);
+ printf ("\nafter ex_get_nodal_varid, error = %3d\n", error);
+ }
+
+ /* read element variables parameters and names */
+
+ num_ele_vars = 0;
+ if (num_elem > 0) {
+ error = ex_get_var_param (exoid, "e", &num_ele_vars);
+ printf ("\nafter ex_get_var_param, error = %3d\n", error);
+
+ for (i=0; i<num_ele_vars; i++)
+ {
+ 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);
+ for (i=0; i<num_ele_vars; i++)
+ {
+ printf (" '%s'\n", var_names[i]);
+ free(var_names[i]);
+ }
+
+ /* read element variable truth table */
+
+ if (num_ele_vars > 0) {
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
+
+ printf ("This is the element variable truth table:\n");
+
+ k = 0;
+ for (i=0; i<num_elem_blk*num_ele_vars; i++)
+ {
+ printf ("%2d\n", truth_tab[k++]);
+ }
+ free (truth_tab);
+
+ elem_varid = calloc((num_elem_blk*num_ele_vars), sizeof(int));
+ error = ex_get_elem_varid(exoid, elem_varid);
+ printf ("\nafter ex_get_elem_varid, error = %3d\n", error);
+ }
+ }
+
+ /* determine how many time steps are stored */
+
+ error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %3d\n", error);
+ printf ("There are %2d time steps in the database.\n", num_time_steps);
+
+ /* read time value at one time step */
+
+ time_step = 3;
+ error = ex_get_time (exoid, time_step, &time_value);
+ printf ("\nafter ex_get_time, error = %3d\n", error);
+
+ printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
+
+ /* read time values at all time steps */
+
+ time_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_all_times (exoid, time_values);
+ printf ("\nafter ex_get_all_times, error = %3d\n", error);
+
+ printf ("time values at all time steps are:\n");
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
+
+ free (time_values);
+
+ /* read all global variables at one time step */
+
+ var_values = (float *) calloc (num_glo_vars, sizeof(float));
+
+ error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
+ printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
+
+ printf ("global variable values at time step %2d\n", time_step);
+ for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a single global variable through time */
+
+ var_index = 1;
+ beg_time = 1;
+ end_time = -1;
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time,
+ var_values);
+ printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
+
+ printf ("global variable %2d values through time:\n", var_index);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a nodal variable at one time step */
+
+ if (num_nodes > 0) {
+ var_values = (float *) calloc (num_nodes, sizeof(float));
+
+ error = ex_get_nodal_varid_var(exoid, time_step, var_index, num_nodes,
+ node_varid[var_index-1], 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);
+ for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+
+ /* read a nodal variable through time */
+
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ node_num = 1;
+ error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+ }
+ /* read an element variable at one time step */
+
+ if (num_elem_blk > 0) {
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
+
+ error = ex_get_varid_var(exoid, time_step, elem_varid[i*num_ele_vars+var_index-1],
+ num_elem_in_block[i], var_values);
+ printf ("\nafter ex_get_varid_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]);
+ }
+
+ free (var_values);
+ }
+ free (num_elem_in_block);
+ free(ids);
+ }
+ free(elem_varid);
+ free(node_varid);
+ /* read an element variable through time */
+
+ if (num_ele_vars > 0) {
+ var_values = (float *) calloc (num_time_steps, sizeof(float));
+
+ var_index = 2;
+ elem_num = 2;
+ error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time,
+ 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);
+ for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
+
+ free (var_values);
+ }
+
+ error = ex_close (exoid);
+ printf ("\nafter ex_close, error = %3d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testrdv.dmp b/cbind/test/testrdv.dmp
new file mode 100644
index 0000000..c889ca7
--- /dev/null
+++ b/cbind/test/testrdv.dmp
@@ -0,0 +1,931 @@
+
+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 = 33
+num_elem = 7
+num_elem_blk = 7
+num_node_sets = 2
+num_side_sets = 5
+
+after ex_get_coord, 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 ex_get_coord_names, error = 0
+x coord name = 'xcoor'
+y coord name = 'ycoor'
+
+after ex_get_map, error = 0
+elem_map(0) = 1
+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_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
+
+after ex_get_elem_block, error = 0
+element block id = 15
+element type = 'tetra'
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 1
+
+after ex_get_elem_block, error = 0
+element block id = 16
+element type = 'tri'
+num_elem_in_block = 1
+num_nodes_per_elem = 3
+num_attr = 1
+
+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
+element block 4, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 40
+element block 5, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 50
+element block 6, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 60
+element block 7, property( 2): 'MATERIAL_PROPERTY_LONG_NAME_32CH'= 70
+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
+element block 6, property( 3): 'DENSITY'= 0
+element block 7, 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_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_conn, error = 0
+connect array for elem block 15
+ 17
+ 18
+ 19
+ 20
+ 27
+ 28
+ 30
+ 29
+
+after ex_get_elem_conn, error = 0
+connect array for elem block 16
+ 31
+ 32
+ 33
+
+ after ex_get_elem_attr, error = 0
+element block 10 attributes = 3.1416
+
+ after ex_get_elem_attr, error = 0
+element block 11 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 12 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 13 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 14 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 15 attributes = 6.1416
+
+ after ex_get_elem_attr, error = 0
+element block 16 attributes = 6.1416
+
+after ex_get_node_set_ids, error = 0
+
+after ex_get_node_set_param, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after ex_get_node_set_param, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after ex_get_node_set, error = 0
+
+after ex_get_node_set_dist_fact, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after ex_inquire, error = 0
+
+There are 3 properties for each node set
+after ex_get_prop_names, error = 0
+node set 1, property( 1): 'ID'= 20
+node set 2, property( 1): 'ID'= 21
+node set 1, property( 2): 'FACE'= 4
+node set 2, property( 2): 'FACE'= 5
+node set 1, property( 3): 'VELOCITY'= 1000
+node set 2, property( 3): 'VELOCITY'= 2000
+
+after ex_inquire, error = 0
+
+after ex_inquire: EX_INQ_NS_NODE_LEN = 8, error = 0
+
+after ex_inquire: EX_INQ_NS_DF_LEN = 8, error = 0
+
+after ex_get_concat_node_sets, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 0
+ 5
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after ex_get_side_set_ids, error = 0
+
+after ex_get_side_set_param, error = 0
+side set 30 parameters:
+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
+ 2
+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
+30.200
+30.300
+
+after ex_get_side_set_param, error = 0
+side set 31 parameters:
+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
+ 2
+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
+31.200
+31.300
+
+after ex_get_side_set_param, error = 0
+side set 32 parameters:
+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
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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 = 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
+ 1
+ 2
+ 3
+ 4
+node list for side set 33
+ 17
+ 18
+ 20
+ 18
+ 19
+ 20
+ 17
+ 20
+ 19
+ 17
+ 19
+ 18
+ 17
+ 18
+ 20
+ 27
+ 18
+ 19
+ 20
+ 28
+ 17
+ 20
+ 19
+ 29
+ 17
+ 19
+ 18
+ 30
+no dist factors for side set 33
+
+after ex_get_side_set_param, error = 0
+side set 34 parameters:
+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
+ 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
+ 31
+ 32
+ 33
+ 33
+ 32
+ 31
+ 31
+ 32
+ 32
+ 33
+ 33
+ 31
+no dist factors for side set 34
+
+after ex_inquire, error = 0
+
+There are 2 properties for each side set
+after ex_get_prop_names, error = 0
+side set 1, property( 1): 'ID'= 30
+side set 2, property( 1): 'ID'= 31
+side set 3, property( 1): 'ID'= 32
+side set 4, property( 1): 'ID'= 33
+side set 5, property( 1): 'ID'= 34
+side set 1, property( 2): 'COLOR'= 100
+side set 2, property( 2): 'COLOR'= 101
+side set 3, property( 2): 'COLOR'= 0
+side set 4, property( 2): 'COLOR'= 0
+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 = 29, error = 0
+
+after ex_inquire: EX_INQ_SS_NODE_LEN = 94, error = 0
+
+after ex_inquire: EX_INQ_SS_DF_LEN = 8, error = 0
+
+after ex_get_concat_side_sets, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 8
+ 10
+num_dist_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 0
+ 2
+ 4
+ 11
+ 19
+dist_ind =
+ 0
+ 4
+ 8
+ 8
+ 8
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 6
+ 6
+ 6
+ 6
+ 5
+ 5
+ 5
+ 5
+ 5
+ 7
+ 7
+ 7
+ 7
+ 7
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+ 1
+ 2
+ 3
+ 4
+ 5
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after ex_get_qa, error = 0
+QA records =
+ 'TESTWT'
+ 'testwt'
+ '07/07/93'
+ '15:41:33'
+ ''
+ ''
+ ''
+ ''
+
+after ex_inquire, error = 0
+
+after ex_get_info, error = 0
+info records =
+ 'This is the first information record.'
+ ''
+ ''
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 1 global variables; their names are :
+ 'glo_vars'
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 2 nodal variables; their names are :
+ 'node_variable_a_very_long_name_0'
+ 'nod_var1'
+
+after ex_get_nodal_varid, error = 0
+
+after ex_get_var_param, error = 0
+
+after ex_get_var_names, error = 0
+There are 3 element variables; their names are :
+ 'ele_var0'
+ 'ele_var1'
+ 'ele_var2'
+
+after ex_get_elem_var_tab, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after ex_get_elem_varid, error = 0
+
+after ex_inquire, error = 0
+There are 10 time steps in the database.
+
+after ex_get_time, error = 0
+time value at time step 3 = 0.030
+
+after ex_get_all_times, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after ex_get_glob_vars, error = 0
+global variable values at time step 3
+0.060
+
+after ex_get_glob_var_time, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after ex_get_nodal_var, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+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:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+ after ex_get_elem_blk_ids, error = 0
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 11 at time step 3
+5.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 12 at time step 3
+6.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 13 at time step 3
+7.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 14 at time step 3
+8.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 15 at time step 3
+9.030
+
+after ex_get_varid_var, error = 0
+element variable 1 values of element block 16 at time step 3
+10.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
+
+after ex_close, error = 0
diff --git a/cbind/test/testrdwt.c b/cbind/test/testrdwt.c
new file mode 100644
index 0000000..ec05ca3
--- /dev/null
+++ b/cbind/test/testrdwt.c
@@ -0,0 +1,457 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testrdwt - test reading from one ExodusII file and writing to another
+* ExodusII file open concurrently
+*
+* author - Sandia National Laboratories
+* Larry A. Schoof - Original
+*
+* environment - UNIX
+*
+* entry conditions -
+*
+* exit conditions -
+*
+* revision history -
+*
+* This is a test program for the C binding of the EXODUS II
+* database read and write routines. It tests reading from an open EXODUSII
+* file and writing to another concurrently opened EXODUSII file.
+*
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "exodusII.h"
+#include "netcdf.h"
+int main (int argc, char **argv)
+{
+ int exoid, exoid2, num_dim, num_nodes, num_elem, num_elem_blk;
+ int num_elem_in_block, num_node_sets, num_nodes_per_elem, num_attr;
+ int num_side_sets, error;
+ int i, j;
+ int *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
+ int *ids;
+ int num_nodes_in_set, num_elem_in_set;
+ int num_sides_in_set, num_df_in_set;
+ int num_qa_rec, num_info;
+ int CPU_word_size,IO_word_size;
+ int num_props, prop_value, *prop_values;
+
+ float *x, *y, *z;
+ float *dist_fact;
+ float version, fdum;
+
+ 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;
+
+/* Specify compute and i/o word size */
+
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 4; /* float */
+
+/* open EXODUS II file for reading */
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode */
+ &CPU_word_size, /* CPU float word size in bytes */
+ &IO_word_size, /* I/O float word size in bytes */
+ &version); /* returned version number */
+ printf ("after ex_open for test.exo\n");
+ printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
+
+/* create EXODUS II file for writing */
+
+ exoid2= ex_create ("test2.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 test2.exo, exoid = %d\n", exoid2);
+
+ /* ncopts = NC_VERBOSE; */
+
+/* read initialization parameters */
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ printf ("after ex_get_init, error = %d\n", error);
+
+/* write initialization parameters */
+
+ error = ex_put_init (exoid2, 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);
+
+/* read nodal coordinate values */
+
+ x = (float *) calloc(num_nodes, sizeof(float));
+ y = (float *) calloc(num_nodes, sizeof(float));
+ if (num_dim >= 3)
+ z = (float *) calloc(num_nodes, sizeof(float));
+ else
+ z = 0;
+
+ error = ex_get_coord (exoid, x, y, z);
+ printf ("\nafter ex_get_coord, error = %3d\n", error);
+
+/* write nodal coordinate values */
+
+ error = ex_put_coord (exoid2, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+ free (x);
+ free (y);
+ if (num_dim >= 3)
+ free (z);
+
+/* read nodal coordinate names */
+
+ 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);
+
+/* write nodal coordinate names */
+
+ error = ex_put_coord_names (exoid2, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+ for (i=0; i<num_dim; i++) {
+ free(coord_names[i]);
+ }
+
+/* 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);
+
+/* write element order map */
+
+ error = ex_put_map (exoid2, elem_map);
+ printf ("after ex_put_map, error = %d\n", error);
+
+ free (elem_map);
+
+/* read and write element block parameters and element connectivity */
+
+ ids = (int *) calloc(num_elem_blk, sizeof(int));
+ error = ex_get_elem_blk_ids (exoid, ids);
+ printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ error = ex_get_elem_block (exoid, ids[i], elem_type,
+ &num_elem_in_block,
+ &num_nodes_per_elem, &num_attr);
+ printf ("\nafter ex_get_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid2, ids[i], elem_type, num_elem_in_block,
+ num_nodes_per_elem, num_attr);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ connect = (int *) calloc((num_nodes_per_elem * num_elem_in_block),
+ sizeof(int));
+
+ error = ex_get_elem_conn (exoid, ids[i], connect);
+ printf ("\nafter ex_get_elem_conn, error = %d\n", error);
+
+ error = ex_put_elem_conn (exoid2, ids[i], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ free (connect);
+ }
+
+/* read and write element block properties */
+
+ error = ex_inquire (exoid, EX_INQ_EB_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+
+ 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);
+
+ error = ex_put_prop_names(exoid2,EX_ELEM_BLOCK,num_props,prop_names);
+ printf ("after ex_put_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);
+ printf ("after ex_get_prop, error = %d\n", error);
+
+ if (i>0) { /* first property is the ID which is already stored */
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ids[j], prop_names[i],
+ prop_value);
+ printf ("after ex_put_prop, error = %d\n", error);
+ }
+ }
+ }
+
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+
+
+ free (ids);
+
+/* read and write individual node sets */
+
+ ids = (int *) calloc(num_node_sets, sizeof(int));
+
+ error = ex_get_node_set_ids (exoid, ids);
+ printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_node_sets; 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_put_node_set_param (exoid2, ids[i], num_nodes_in_set,
+ num_df_in_set);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ 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);
+
+ error = ex_put_node_set (exoid2, ids[i], node_list);
+ printf ("after ex_put_node_set, error = %d\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);
+
+ error = ex_put_node_set_dist_fact (exoid2, ids[i], dist_fact);
+ printf ("after ex_put_node_set, error = %d\n", error);
+
+ }
+
+ free (node_list);
+ free (dist_fact);
+ }
+ free(ids);
+
+ /* read node set properties */
+ error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+
+ for (i=0; i<num_props; i++)
+ {
+ prop_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char));
+ }
+ prop_values = (int *) calloc (num_node_sets, sizeof(int));
+
+ error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
+ printf ("after ex_get_prop_names, error = %d\n", error);
+
+ error = ex_put_prop_names(exoid2,EX_NODE_SET,num_props,prop_names);
+ printf ("after ex_put_prop_names, error = %d\n", error);
+
+ for (i=0; i<num_props; i++)
+ {
+ error = ex_get_prop_array(exoid, EX_NODE_SET, prop_names[i],
+ prop_values);
+ printf ("after ex_get_prop_array, error = %d\n", error);
+
+ error = ex_put_prop_array(exoid2, EX_NODE_SET, prop_names[i], prop_values);
+ printf ("after ex_put_prop_array, error = %d\n", error);
+
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free(prop_values);
+
+/* read and write individual side sets */
+
+ ids = (int *) calloc(num_side_sets, sizeof(int));
+
+ error = ex_get_side_set_ids (exoid, ids);
+ printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
+
+ for (i=0; i<num_side_sets; 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_put_side_set_param (exoid2, ids[i], num_sides_in_set,
+ num_df_in_set);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ /* 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_put_side_set (exoid2, ids[i], elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\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);
+
+ error = ex_put_side_set_dist_fact (exoid2, ids[i], dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ }
+
+ free (elem_list);
+ free (side_list);
+ free (node_ctr_list);
+ free (node_list);
+ free (dist_fact);
+
+ }
+
+
+ /* read side set properties */
+ error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
+ printf ("\nafter ex_inquire, error = %d\n", error);
+
+ 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);
+ printf ("after ex_get_prop, error = %d\n", error);
+
+ if (i>0) { /* first property is ID so it is already stored */
+ error = ex_put_prop(exoid2, EX_SIDE_SET, ids[j], prop_names[i],
+ prop_value);
+ printf ("after ex_put_prop, error = %d\n", error);
+ }
+ }
+ }
+ for (i=0; i<num_props; i++)
+ free(prop_names[i]);
+ free (ids);
+
+/* read and write 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);
+
+ error = ex_put_qa (exoid2, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+ for (i=0; i<num_qa_rec; i++) {
+ for (j=0; j<4; j++) {
+ free(qa_record[i][j]);
+ }
+ }
+/* read and write 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);
+
+ error = ex_put_info (exoid2, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+ for (i=0; i<num_info; i++)
+ {
+ free(info[i]);
+ }
+
+/* close the EXODUS files */
+
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ error = ex_close (exoid2);
+ printf ("after ex_close (2), error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwt-one-attrib.c b/cbind/test/testwt-one-attrib.c
new file mode 100644
index 0000000..7a0cda1
--- /dev/null
+++ b/cbind/test/testwt-one-attrib.c
@@ -0,0 +1,272 @@
+#undef NDEBUG
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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], num_attr[10];
+ int num_node_sets, num_side_sets, error;
+ int i, j, *connect;
+ int ebids[10], ids[10];
+ int CPU_word_size,IO_word_size;
+ char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
+
+ float version;
+ float *attrib;
+ float x[100], y[100], z[100];
+ char *coord_names[3];
+
+ 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.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 */
+ /* initialize file with parameters */
+
+ num_dim = 3;
+ num_nodes = 19;
+ num_elem = 12;;
+ num_elem_blk = 1;
+ num_node_sets = 0;
+ num_side_sets = 0;
+
+ error = ex_put_init (exoid, "This is testwt1", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+ assert(error == 0);
+
+ /* write nodal coordinates values and names to database */
+
+ /* Quad #1 */
+ x[0] = 1.0000000E+00;
+ x[1] = 5.0000000E-01;
+ x[2] = 1.0000000E+00;
+ x[3] = 1.0000000E+00;
+ x[4] = 7.5000000E-01;
+ x[5] = 5.0000000E-01;
+ x[6] = 1.0000000E+00;
+ x[7] = 7.5000000E-01;
+ x[8] = 1.0000000E+00;
+ x[9] = 5.0000000E-01;
+ x[10] = 5.0000000E-01;
+ x[11] = 5.0000000E-01;
+ x[12] = 1.0000000E+00;
+ x[13] = 1.0000000E+00;
+ x[14] = 7.5000000E-01;
+ x[15] = 7.5000000E-01;
+ x[16] = 1.0000000E+00;
+ x[17] = 7.5000000E-01;
+ x[18] = 1.0000000E+00;
+
+ y[0] = 5.0000000E-01;
+ y[1] = 1.0000000E+00;
+ y[2] = 1.0000000E+00;
+ y[3] = 7.5000000E-01;
+ y[4] = 1.0000000E+00;
+ y[5] = 5.0000000E-01;
+ y[6] = 5.0000000E-01;
+ y[7] = 5.0000000E-01;
+ y[8] = 5.0000000E-01;
+ y[9] = 1.0000000E+00;
+ y[10] = 7.5000000E-01;
+ y[11] = 1.0000000E+00;
+ y[12] = 1.0000000E+00;
+ y[13] = 7.5000000E-01;
+ y[14] = 1.0000000E+00;
+ y[15] = 7.5000000E-01;
+ y[16] = 1.0000000E+00;
+ y[17] = 1.0000000E+00;
+ y[18] = 7.5000000E-01;
+
+ z[0] = 5.0000000E-01;
+ z[1] = 5.0000000E-01;
+ z[2] = 5.0000000E-01;
+ z[3] = 5.0000000E-01;
+ z[4] = 5.0000000E-01;
+ z[5] = 1.0000000E+00;
+ z[6] = 1.0000000E+00;
+ z[7] = 1.0000000E+00;
+ z[8] = 7.5000000E-01;
+ z[9] = 1.0000000E+00;
+ z[10] = 1.0000000E+00;
+ z[11] = 7.5000000E-01;
+ z[12] = 1.0000000E+00;
+ z[13] = 1.0000000E+00;
+ z[14] = 1.0000000E+00;
+ z[15] = 1.0000000E+00;
+ z[16] = 7.5000000E-01;
+ z[17] = 7.5000000E-01;
+ z[18] = 7.5000000E-01;
+
+ error = ex_put_coord (exoid, x, y, z);
+ assert(error == 0);
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ assert(error == 0);
+
+ /* write element block parameters */
+ num_elem_in_block[0] = 12;
+ num_nodes_per_elem[0] = 4;
+ ebids[0] = 10;
+ num_attr[0] = 3;
+
+ error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
+ num_nodes_per_elem[0], num_attr[0]);
+ assert(error == 0);
+
+ /* write element connectivity */
+ connect = (int *) calloc(num_elem_in_block[0] * num_nodes_per_elem[0], sizeof(int));
+
+ connect[ 0] = 1;
+ connect[ 1] = 4;
+ connect[ 2] = 19;
+ connect[ 3] = 9;
+ connect[ 4] = 4;
+ connect[ 5] = 3;
+ connect[ 6] = 17;
+ connect[ 7] = 19;
+ connect[ 8] = 3;
+ connect[ 9] = 5;
+ connect[10] = 18;
+ connect[11] = 17;
+ connect[12] = 5;
+ connect[13] = 2;
+ connect[14] = 12;
+ connect[15] = 18;
+ connect[16] = 9;
+ connect[17] = 19;
+ connect[18] = 14;
+ connect[19] = 7;
+ connect[20] = 7;
+ connect[21] = 14;
+ connect[22] = 16;
+ connect[23] = 8;
+ connect[24] = 19;
+ connect[25] = 17;
+ connect[26] = 13;
+ connect[27] = 14;
+ connect[28] = 17;
+ connect[29] = 18;
+ connect[30] = 15;
+ connect[31] = 13;
+ connect[32] = 14;
+ connect[33] = 13;
+ connect[34] = 15;
+ connect[35] = 16;
+ connect[36] = 8;
+ connect[37] = 16;
+ connect[38] = 11;
+ connect[39] = 6;
+ connect[40] = 18;
+ connect[41] = 12;
+ connect[42] = 10;
+ connect[43] = 15;
+ connect[44] = 16;
+ connect[45] = 15;
+ connect[46] = 10;
+ connect[47] = 11;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ assert(error == 0);
+ free (connect);
+
+ /* write element block attributes (3 per block) */
+ attrib = (float *) calloc(num_elem_in_block[0] * num_attr[0], sizeof(float));
+
+#if 0
+ {
+ k = 0;
+ for (i=0; i < num_elem_in_block[0]; i++) {
+ for (j = 0; j < num_attr[0]; j++) {
+ attrib[k++] = 10*(i+1) + j+1;
+ }
+ }
+ }
+
+ error = ex_put_elem_attr (exoid, ebids[0], &attrib[0]);
+ assert(error == 0);
+#else
+ {
+ for (j = 0; j < num_attr[0]; j++) {
+ for (i=0; i < num_elem_in_block[0]; i++) {
+ attrib[i] = 10*(i+1) + j+1;
+ }
+ error = ex_put_one_elem_attr (exoid, ebids[0], j+1, &attrib[0]);
+ assert(error == 0);
+ }
+ }
+#endif
+ free(attrib);
+
+ /* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ assert(error == 0);
+
+
+ /* Reopen the file and read the attributes to see if they were written correctly */
+ CPU_word_size = 0; /* sizeof(float) */
+ IO_word_size = 0; /* use what is stored in file */
+
+
+ /* open EXODUS II files */
+
+ exoid = ex_open ("test.exo", /* filename path */
+ EX_READ, /* access mode = READ */
+ &CPU_word_size, /* CPU word size */
+ &IO_word_size, /* IO word size */
+ &version); /* ExodusII library version */
+
+ assert(exoid >= 0);
+ if (exoid < 0) exit(1);
+
+ error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
+ &num_elem_blk, &num_node_sets, &num_side_sets);
+
+ assert(error == 0);
+
+ if (num_elem_blk > 0) {
+ error = ex_get_elem_blk_ids (exoid, ids);
+ assert(error == 0);
+
+ for (i=0; i<num_elem_blk; i++)
+ {
+ error = ex_get_elem_block (exoid, ids[i], elem_type,
+ &(num_elem_in_block[i]),
+ &(num_nodes_per_elem[i]), &(num_attr[i]));
+ assert(error == 0);
+ }
+
+ /* read element block attributes */
+
+ attrib = (float *) calloc(num_elem_in_block[0],sizeof(float));
+ for (j = 0; j < num_attr[0]; j++) {
+ error = ex_get_one_elem_attr (exoid, ids[0], j+1, &attrib[0]);
+ assert(error == 0);
+
+ if (error == 0) {
+ for (i=0; i < num_elem_in_block[0]; i++) {
+ assert(attrib[i] == 10*(i+1) + j+1); }
+ }
+ }
+ free (attrib);
+ }
+ error = ex_close (exoid);
+ assert(error == 0);
+ return 0;
+}
diff --git a/cbind/test/testwt-zeroe.c b/cbind/test/testwt-zeroe.c
new file mode 100644
index 0000000..a499ab4
--- /dev/null
+++ b/cbind/test/testwt-zeroe.c
@@ -0,0 +1,474 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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-zeroe.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+/* #include "netcdf.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];
+ int num_node_sets, num_side_sets, error;
+ int i, j, k, m;
+ int node_list[100];
+ int ebids[10];
+ int num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float x[100], y[100], z[100];
+ float dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 33;
+ num_elem = 0;
+ num_elem_blk = 0;
+ num_node_sets = 2;
+ num_side_sets = 0;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+/* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+/* 3d Tri */
+ x[30] = 0.0; y[30] = 0.0; z[30] = 0.0;
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 individual node sets */
+
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+ 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";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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);
+ }
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+ num_nod_vars = 2;
+ /* 12345678901234567890123456789012 */
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ num_ele_vars = 0;
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* 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);
+ 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++)
+ {
+ 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* 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-zeroe.dmp b/cbind/test/testwt-zeroe.dmp
new file mode 100644
index 0000000..f3271a4
--- /dev/null
+++ b/cbind/test/testwt-zeroe.dmp
@@ -0,0 +1,178 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 33 ;
+ num_node_sets = 2 ;
+ num_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+variables:
+ float time_whole(time_step) ;
+ 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) ;
+ char ns_names(num_node_sets, len_string) ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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 ;
+ :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 ;
+
+ ns_status = 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ qa_records =
+ "TESTWT",
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "node_variable_a_very_long_name_0",
+ "nod_var1" ;
+}
diff --git a/cbind/test/testwt-zeron.c b/cbind/test/testwt-zeron.c
new file mode 100644
index 0000000..4267af6
--- /dev/null
+++ b/cbind/test/testwt-zeron.c
@@ -0,0 +1,444 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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-zeron.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+/* #include "netcdf.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_node_sets, num_side_sets, error;
+ int i, j, *elem_map;
+ int ebids[10];
+ int num_qa_rec, num_info;
+ int num_glo_vars;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ 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 );
+
+/* 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.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 */
+
+ num_dim = 3;
+ num_nodes = 0;
+ num_elem = 0;
+ num_elem_blk = 7;
+ num_node_sets = 0;
+ num_side_sets = 0;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write nodal varcoordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+/* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+/* 3d Tri */
+ x[30] = 0.0; y[30] = 0.0; z[30] = 0.0;
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 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 */
+
+ num_elem_in_block[0] = 0;
+ num_elem_in_block[1] = 0;
+ num_elem_in_block[2] = 0;
+ num_elem_in_block[3] = 0;
+ num_elem_in_block[4] = 0;
+ num_elem_in_block[5] = 0;
+ num_elem_in_block[6] = 0;
+
+ 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);
+
+ 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 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;
+
+
+ qa_record[0][0] = "TESTWT";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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);
+ }
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* 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-zeron.dmp b/cbind/test/testwt-zeron.dmp
new file mode 100644
index 0000000..b7a38ca
--- /dev/null
+++ b/cbind/test/testwt-zeron.dmp
@@ -0,0 +1,91 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_el_blk = 7 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+variables:
+ float time_whole(time_step) ;
+ 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 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 ;
+ :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 = 0, 0, 0, 0, 0, 0, 0 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ eb_prop2 = _, _, _, _, _, _, _ ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ qa_records =
+ "TESTWT",
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+}
diff --git a/cbind/test/testwt.c b/cbind/test/testwt.c
new file mode 100644
index 0000000..6e0fd96
--- /dev/null
+++ b/cbind/test/testwt.c
@@ -0,0 +1,1176 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+/* #include "netcdf.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_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 num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars, num_sset_vars, num_nset_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float *sset_var_vals, *nset_var_vals;
+ float time_value;
+ float x[100], y[100], z[100];
+ 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];
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 33;
+ num_elem = 7;
+ num_elem_blk = 7;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+/* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+/* 3d Tri */
+ x[30] = 0.0; y[30] = 0.0; z[30] = 0.0;
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 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);
+
+ 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);
+
+ 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);
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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_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);
+ }
+
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ 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);
+ }
+
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+ connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+ }
+
+ 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);
+
+ 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 */
+
+
+ num_nodes_in_nset[0] = 5;
+ num_nodes_in_nset[1] = 3;
+
+ nsids[0] = 20;
+ nsids[1] = 21;
+
+ error = ex_put_node_set_param (exoid, nsids[0], 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, nsids[0], node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, nsids[0], dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ error = ex_put_node_set_param (exoid, nsids[1], 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, nsids[1], node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, nsids[1], dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* Write node set names */
+ nset_names[0] = "nset_1";
+ nset_names[1] = "nset_2";
+
+ error = ex_put_names(exoid, EX_NODE_SET, nset_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, nsids[0], "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, nsids[1], "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write individual side sets */
+ num_face_in_sset[0] = 2;
+ num_face_in_sset[1] = 2;
+ num_face_in_sset[2] = 7;
+ num_face_in_sset[3] = 8;
+ num_face_in_sset[4] = 10;
+
+ ssids[0] = 30;
+ ssids[1] = 31;
+ ssids[2] = 32;
+ ssids[3] = 33;
+ ssids[4] = 34;
+
+ /* side set #1 - quad */
+
+ error = ex_put_side_set_param (exoid, ssids[0], 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #2 - quad, spanning 2 elements */
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 8, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+ elem_list[4] = 6; elem_list[5] = 6;
+ elem_list[6] = 6; elem_list[7] = 6;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 1; side_list[5] = 2;
+ side_list[6] = 3; side_list[7] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #5 - wedges and tris */
+
+ error = ex_put_side_set_param (exoid, 34, 10, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5; elem_list[5] = 7;
+ elem_list[6] = 7; elem_list[7] = 7;
+ elem_list[8] = 7; elem_list[9] = 7;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5; side_list[5] = 1;
+ side_list[6] = 2; side_list[7] = 3;
+ side_list[8] = 4; side_list[9] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* Write side set names */
+ sset_names[0] = "sset_1";
+ sset_names[1] = "sset_2";
+ sset_names[2] = "sset_3";
+ sset_names[3] = "sset_4";
+ sset_names[4] = "sset_5";
+
+ error = ex_put_names(exoid, EX_SIDE_SET, sset_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, 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";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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);
+ }
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+ num_nod_vars = 2;
+ /* 12345678901234567890123456789012 */
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ num_nset_vars = 3;
+
+ var_names[0] = "ns_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+ {
+ num_sset_vars = 3;
+
+ var_names[0] = "ss_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+ sset_var_vals = (float *) calloc (10, CPU_word_size);
+ nset_var_vals = (float *) calloc (10, CPU_word_size);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* 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);
+ 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++)
+ {
+ 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+/* 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);
+ printf ("after ex_put_sset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+/* 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);
+ /* 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);
+ printf ("after ex_put_nset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+ free(sset_var_vals);
+ free(nset_var_vals);
+
+
+/* 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/testwt1.c b/cbind/test/testwt1.c
new file mode 100644
index 0000000..38eb0bb
--- /dev/null
+++ b/cbind/test/testwt1.c
@@ -0,0 +1,935 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwt1 - 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: testwt1.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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], num_attr[10];
+ int num_node_sets, num_side_sets, error;
+ int num_node_maps, num_elem_maps;
+ int i, j, k, m, *elem_map, *connect, *node_map;
+ int node_list[100],elem_list[100],side_list[100];
+ int id, ebids[10], ids[10];
+ 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 num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float x[100], y[100], z[100];
+ float attrib[100], dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char *emap_names[2];
+ char *prop_names[2];
+
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 28;
+ num_elem = 8;
+ num_elem_blk = 7;
+ num_node_sets = 2;
+ num_side_sets = 5;
+ /* num_side_sets = 6; Uncomment to test NULL side sets */
+
+ error = ex_put_init (exoid, "This is testwt1", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Circle #1 */
+ x[20] = 100.0; y[20] = 100.0; z[20] = 0.0;
+
+/* Sphere #1 */
+ x[21] = 50.0; y[21] = 50.0; z[21] = 20.0;
+
+/* Wedge #1 */
+ x[22] = 3.0; y[22] = 0.0; z[22] = 6.0;
+ x[23] = 6.0; y[23] = 0.0; z[23] = 0.0;
+ x[24] = 0.0; y[24] = 0.0; z[24] = 0.0;
+ x[25] = 3.0; y[25] = 2.0; z[25] = 6.0;
+ x[26] = 6.0; y[26] = 2.0; z[26] = 2.0;
+ x[27] = 0.0; y[27] = 2.0; z[27] = 0.0;
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+
+/* write node and element map parameters */
+
+ num_node_maps = 1;
+ num_elem_maps = 2;
+
+ error = ex_put_map_param (exoid, num_node_maps, num_elem_maps);
+
+ printf ("after ex_put_map_param, error = %d\n", error);
+
+/* write element map properties */
+
+ prop_names[0] = "ORDER";
+ prop_names[1] = "NUMBER";
+ error = ex_put_prop_names(exoid,EX_ELEM_MAP,2,prop_names);
+ printf ("after ex_put_prop_names, error = %d\n", error);
+
+/* write element order map */
+
+ elem_map = (int *) calloc(num_elem, sizeof(int));
+
+ for (i=1; i<=num_elem; i++)
+ {
+ elem_map[i-1] = i;
+ }
+
+ id = 111;
+ error = ex_put_elem_map (exoid, id, elem_map);
+ printf ("after ex_put_elem_map, error = %d\n", error);
+
+ free (elem_map);
+
+ error = ex_put_prop(exoid, EX_ELEM_MAP, id, "ORDER", 1);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* write element numbering map */
+
+ elem_map = (int *) calloc(num_elem, sizeof(int));
+
+ for (i=1; i<=num_elem; i++)
+ {
+ elem_map[i-1] = i*2;
+ }
+
+ id = 222;
+ /* Output the map 1 element at a time... */
+ for (i=1; i <= num_elem; i++) {
+ error = ex_put_partial_elem_map (exoid, id, i, 1, &elem_map[i-1]);
+ printf ("after ex_put_partial_elem_map, error = %d\n", error);
+ }
+
+ free (elem_map);
+
+ error = ex_put_prop(exoid, EX_ELEM_MAP, id, "NUMBER", 1);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* write element map names */
+ emap_names[0] = "Element_Map_111";
+ emap_names[1] = "Element_Map_222";
+
+ error = ex_put_names(exoid, EX_ELEM_MAP, emap_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+/* write node map properties */
+
+ prop_names[0] = "NUMBER";
+ error = ex_put_prop_names(exoid,EX_NODE_MAP,1,prop_names);
+ printf ("after ex_put_prop_names, error = %d\n", error);
+
+/* write node numbering map */
+
+ node_map = (int *) calloc(num_nodes, sizeof(int));
+
+ for (i=1; i<=num_nodes; i++)
+ {
+ node_map[i-1] = i*3;
+ }
+
+ id = 333;
+ error = ex_put_node_map (exoid, id, node_map);
+ printf ("after ex_put_node_map, error = %d\n", error);
+
+ error = ex_put_name(exoid, EX_NODE_MAP, id, "Node_Map_111");
+ printf ("after ex_put_name, error = %d\n", error);
+
+ free (node_map);
+
+ error = ex_put_prop(exoid, EX_NODE_MAP, id, "NUMBER", 1);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+/* write element block parameters */
+
+ num_elem_in_block[0] = 1; /* element 1: Quad 1 */
+ num_elem_in_block[1] = 2; /* elements 2, 3: Quad 1 & 2 */
+ num_elem_in_block[2] = 1; /* element 4: Hex */
+ num_elem_in_block[3] = 1; /* element 5: Tetra */
+ num_elem_in_block[4] = 1; /* element 6: Circle */
+ num_elem_in_block[5] = 1; /* element 7: Sphere */
+ num_elem_in_block[6] = 1; /* element 8: Wedge */
+
+ 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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 1; /* elements in block #4 are 1-node circles */
+ num_nodes_per_elem[5] = 1; /* elements in block #5 are 1-node spheres */
+ num_nodes_per_elem[6] = 6; /* elements in block #6 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+ ebids[5] = 15;
+ ebids[6] = 16;
+
+ num_attr[0] = 3;
+ num_attr[1] = 3;
+ num_attr[2] = 3;
+ num_attr[3] = 3;
+ num_attr[4] = 3;
+ num_attr[5] = 3;
+ num_attr[6] = 3;
+
+ error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
+ num_nodes_per_elem[0], num_attr[0]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
+ num_nodes_per_elem[1], num_attr[1]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
+ num_nodes_per_elem[2], num_attr[2]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
+ num_nodes_per_elem[3], num_attr[3]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[4], "circle", num_elem_in_block[4],
+ num_nodes_per_elem[4], num_attr[4]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[5], "sphere", num_elem_in_block[5],
+ num_nodes_per_elem[5], num_attr[5]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[6], "wedge", num_elem_in_block[6],
+ num_nodes_per_elem[6], num_attr[6]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[5], "MATL", 60);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[6], "MATL", 70);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+ connect[4] = 5; connect[5] = 6; connect[6] = 7; connect[7] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 22;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 23; connect[1] = 24; connect[2] = 25;
+ connect[3] = 26; connect[4] = 27; connect[5] = 28;
+
+ error = ex_put_elem_conn (exoid, ebids[6], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ free (connect);
+
+
+/* write element block attributes (3 per block) */
+
+ attrib[0] = 1.0; attrib[1] = 2.0; attrib[2] = 3.0;
+ attrib[3] = 1.11; attrib[4] = 2.11; attrib[5] = 3.11;
+ attrib[6] = 1.12; attrib[7] = 2.12; attrib[8] = 3.12;
+ attrib[9] = 1.2; attrib[10] = 2.2; attrib[11] = 3.2;
+ attrib[12] = 1.3; attrib[13] = 2.3; attrib[14] = 3.3;
+ attrib[15] = 1.4; attrib[16] = 2.4; attrib[17] = 3.4;
+ attrib[18] = 1.5; attrib[19] = 2.5; attrib[20] = 3.5;
+ attrib[21] = 1.6; attrib[22] = 2.6; attrib[23] = 3.6;
+
+ error = ex_put_elem_attr (exoid, ebids[0], &attrib[0]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[1], &attrib[3]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], &attrib[9]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], &attrib[12]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], &attrib[15]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[5], &attrib[18]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[6], &attrib[21]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+/* write individual node sets */
+
+ /* COMMENTED OUT ...
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, 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 concatenated node sets; this produces the same information as
+ * the above code which writes individual node sets
+ */
+
+/* THIS SECTION IS NOT COMMENTED OUT */
+
+ ids[0] = 20; ids[1] = 21;
+
+ num_nodes_per_set[0] = 5;
+ num_nodes_per_set[1] = 3;
+ /* num_nodes_per_set[1] = 0; Uncomment to test NULL node sets */
+
+ 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 NOT COMMENTED OUT SECTION */
+
+
+/* write individual side sets */
+
+ /* COMMENTED OUT SECTION ...
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 1;
+
+ node_list[0] = 1; node_list[1] = 2;
+ node_list[2] = 5; node_list[3] = 6;
+
+ side_list[0] = 1; side_list[1] = 1;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ node_list[0] = 6; node_list[1] = 7;
+ node_list[2] = 7; node_list[3] = 8;
+
+ side_list[0] = 3; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ END COMMENTED OUT SECTION */
+
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual side sets
+ */
+
+/* THIS SECTION IS NOT COMMENTED OUT */
+
+ ids[0] = 30;
+ ids[1] = 31;
+ ids[2] = 32;
+ ids[3] = 33;
+ ids[4] = 34;
+ ids[5] = 35;
+
+ /* side set #1 - quad */
+ node_list[0] = 8; node_list[1] = 5;
+ node_list[2] = 6; node_list[3] = 7;
+
+ /* side set #2 - quad/hex, spanning 2 element types */
+ node_list[4] = 2; node_list[5] = 3;
+ node_list[6] = 7; node_list[7] = 8;
+
+ /* side set #3 - hex */
+ 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;
+
+ /* side set #4 - tetras */
+ 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;
+
+ /* side set #5 - circle and sphere */
+ node_list[48] = 21;
+ node_list[49] = 22;
+
+ /* side set #6 - wedges */
+ node_list[50] = 27; node_list[51] = 26;
+ node_list[52] = 23; node_list[53] = 24;
+
+ node_list[54] = 28; node_list[55] = 27;
+ node_list[56] = 24; node_list[57] = 25;
+
+ node_list[58] = 28; node_list[59] = 25;
+ node_list[60] = 23; node_list[61] = 26;
+
+ node_list[62] = 25; node_list[63] = 24;
+ node_list[64] = 23;
+
+ node_list[65] = 26; node_list[66] = 27;
+ node_list[67] = 28;
+
+ node_ind[0] = 0;
+ node_ind[1] = 4;
+ node_ind[2] = 8;
+ node_ind[3] = 36;
+ node_ind[4] = 47;
+ node_ind[5] = 49;
+
+ num_elem_per_set[0] = 2; /* two sides uses 2 elements */
+ num_elem_per_set[1] = 2;
+ num_elem_per_set[2] = 7;
+ num_elem_per_set[3] = 4;
+ num_elem_per_set[4] = 2;
+ num_elem_per_set[5] = 5;
+ /* num_elem_per_set[5] = 0; Uncomment to test NULL side sets */
+
+ 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] = 2;
+ num_nodes_per_set[5] = 18;
+
+ elem_ind[0] = 0;
+ elem_ind[1] = 2;
+ elem_ind[2] = 4;
+ elem_ind[3] = 11;
+ elem_ind[4] = 15;
+ elem_ind[5] = 17;
+
+ elem_list[0] = 3; elem_list[1] = 3; /* side set 1: Quad #2 */
+ elem_list[2] = 1; elem_list[3] = 3; /* side set 2: Quad #1 & #2 */
+ elem_list[4] = 4; elem_list[5] = 4; /* side set 3: Hex */
+ elem_list[6] = 4; elem_list[7] = 4;
+ elem_list[8] = 4; elem_list[9] = 4;
+ elem_list[10] = 4;
+ elem_list[11] = 5; elem_list[12] = 5; /* side set 4: Tetra */
+ elem_list[13] = 5; elem_list[14] = 5;
+ elem_list[15] = 6; elem_list[16] = 7; /* side set 5: Circle & Sphere */
+ elem_list[17] = 8; elem_list[18] = 8; /* side set 6: Wedge */
+ elem_list[19] = 8; elem_list[20] = 8;
+ elem_list[21] = 8;
+
+/* side set 0
+ side_list[0]= 4; side_list[1]= 2;*/
+/* side set 1
+ side_list[2]= 2; side_list[3]= 3; */
+/* side set 2
+ side_list[4]= 5; side_list[5]= 3;
+ side_list[6]= 3; side_list[7]= 2;
+ side_list[8]= 4; side_list[9]= 1;
+ side_list[10]= 6;*/
+/* side set 3
+ side_list[11]= 1; side_list[12]= 2;
+ side_list[13]= 3; side_list[14]= 4; */
+/* side set 4
+ side_list[15] = 1; side_list[16] = 1; */
+/* side set 5
+ side_list[17]= 1; side_list[18]= 2;
+ side_list[19]= 3; side_list[20]= 4;
+ side_list[21]= 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);
+
+ /* for (i=0;i<num_side_sets;i++)
+ {
+ printf("side set %d\n",i);
+ for (j=0;j<num_elem_per_set[i];j++)
+ printf(" side_list[%d]: %d\n",j,side_list[j+elem_ind[i]]);
+ } */
+
+ 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;
+ num_df_per_set[5] = 0;
+
+ df_ind[0] = 0;
+ df_ind[1] = 4;
+
+ /* side set #1 df */
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1;
+ dist_fact[2] = 30.2; dist_fact[3] = 30.3;
+
+ /* side set #2 df */
+ 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);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ /* END COMMENTED OUT SECTION */
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT1";
+ qa_record[0][1] = "testwt1";
+ qa_record[0][2] = "03/16/94";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+
+/* write information records */
+
+ num_info = 3;
+
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_name(exoid, "g", 1, var_names[0]);
+ printf ("after ex_put_var_name, error = %d\n", error);
+
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k] = k+1;
+ k++;
+ }
+ }
+
+ truth_tab[6] = 0;
+
+ /* commented out to test ex_get_elem_var_tab in testrd1
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error); */
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+ }
+
+/* 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]); */
+ }
+ if (k == 1 && j == 2)
+ continue; /* skip element block 3, variable 1 */
+ else
+ {
+ error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
+ num_elem_in_block[j], elem_var_vals);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwt2.c b/cbind/test/testwt2.c
new file mode 100644
index 0000000..79e2b1a
--- /dev/null
+++ b/cbind/test/testwt2.c
@@ -0,0 +1,1301 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwt2 - 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. It tests multiple simultaneous output files.
+*
+* $Id: testwt2.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#define EX_TEST_INDIV_NODESET
+#define EX_TEST_INDIV_SIDESET
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "exodusII.h"
+#include "netcdf.h"
+int main (int argc, char **argv)
+{
+ int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
+ int exoid2, num_dim2, num_nodes2, num_elem2,num_elem_blk2;
+ int num_elem_in_block[10], num_node_sets, num_nodes_per_elem[10];
+ int num_elem_in_block2[10], num_node_sets2, num_nodes_per_elem2[10];
+ int num_side_sets, error;
+ int num_side_sets2;
+ int i, j, k, m;
+ int *elem_map, *connect, node_list[100],elem_list[100],side_list[100];
+ int *elem_map2, *connect2, node_list2[100],elem_list2[100],side_list2[100];
+ int ebids[10];
+ int ebids2[10];
+ int num_qa_rec, num_info;
+ int num_qa_rec2,num_info2;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int num_glo_vars2, num_nod_vars2, num_ele_vars2;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float time_value2;
+ float x[100], y[100], z[100];
+ float attrib[1], dist_fact[100];
+ float attrib2[1], dist_fact2[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char *coord_names2[3], *qa_record2[2][4], *info2[3], *var_names2[3];
+ char *prop_names[2];
+
+ 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 files (a "regular" and a "history") */
+
+ exoid = ex_create ("test.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);
+
+ exoid2= ex_create ("test2.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 test2.exo, exoid = %d\n", exoid2);
+
+ /* ncopts = NC_VERBOSE; */
+
+/* initialize file with parameters */
+
+ num_dim = 3;
+ num_nodes = 26;
+ num_elem = 5;
+ num_elem_blk = 5;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+
+
+/* initialize file 2 with parameters */
+
+ num_dim2 = 3;
+ num_nodes2 = 26;
+ num_elem2 = 5;
+ num_elem_blk2 = 5;
+ num_node_sets2 = 2;
+ num_side_sets2 = 5;
+
+ error = ex_put_init (exoid2, "This is test 2",num_dim2,num_nodes2,num_elem2,
+ num_elem_blk2, num_node_sets2, num_side_sets2);
+
+ printf ("after ex_put_init (2), error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+/* write nodal coordinates values and names to database 2 */
+
+ error = ex_put_coord (exoid2, x, y, z);
+ printf ("after ex_put_coord (2), error = %d\n", error);
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+ coord_names2[0] = "xcoor";
+ coord_names2[1] = "ycoor";
+ coord_names2[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid2, coord_names2);
+ printf ("after ex_put_coord_names (2), error = %d\n", error);
+
+
+/* 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);
+
+ free (elem_map);
+
+ elem_map2= (int *) calloc(num_elem2, sizeof(int));
+
+ for (i=1; i<=num_elem2; i++)
+ {
+ elem_map2[i-1] = i;
+ }
+
+ error = ex_put_map (exoid2, elem_map2);
+ printf ("after ex_put_map (2), error = %d\n", error);
+
+ free (elem_map2);
+
+
+/* write element block parameters */
+
+ 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_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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+
+ num_elem_in_block2[0] = 1;
+ num_elem_in_block2[1] = 1;
+ num_elem_in_block2[2] = 1;
+ num_elem_in_block2[3] = 1;
+ num_elem_in_block2[4] = 1;
+
+ num_nodes_per_elem2[0] = 4; /* elements in block #1 are 4-node quads */
+ num_nodes_per_elem2[1] = 4; /* elements in block #2 are 4-node quads */
+ num_nodes_per_elem2[2] = 8; /* elements in block #3 are 8-node hexes */
+ num_nodes_per_elem2[3] = 4; /* elements in block #3 are 4-node tetras */
+ num_nodes_per_elem2[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids2[0] = 10;
+ ebids2[1] = 11;
+ ebids2[2] = 12;
+ ebids2[3] = 13;
+ ebids2[4] = 14;
+
+
+ error = ex_put_elem_block (exoid2, ebids2[0], "quad", num_elem_in_block2[0],
+ num_nodes_per_elem2[0], 1);
+ printf ("after ex_put_elem_block (2), error = %d\n", error);
+
+ error = ex_put_elem_block (exoid2, ebids2[1], "quad", num_elem_in_block2[1],
+ num_nodes_per_elem2[1], 1);
+ printf ("after ex_put_elem_blocki (2), error = %d\n", error);
+
+ error = ex_put_elem_block (exoid2, ebids2[2], "hex", num_elem_in_block2[2],
+ num_nodes_per_elem2[2], 1);
+ printf ("after ex_put_elem_blocki (2), error = %d\n", error);
+
+ error = ex_put_elem_block (exoid2, ebids2[3], "tetra", num_elem_in_block2[3],
+ num_nodes_per_elem2[3], 1);
+ printf ("after ex_put_elem_block (2), error = %d\n", error);
+
+ error = ex_put_elem_block (exoid2, ebids2[4], "wedge", num_elem_in_block2[4],
+ num_nodes_per_elem2[4], 1);
+ printf ("after ex_put_elem_block (2), error = %d\n", error);
+
+
+/* write element block properties for file 2 */
+
+ prop_names[0] = "MATL";
+ prop_names[1] = "DENSITY";
+ error = ex_put_prop_names(exoid2,EX_ELEM_BLOCK,2,prop_names);
+ printf ("after ex_put_prop_names (2), error = %d\n", error);
+
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[0], "MATL", 100);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[1], "MATL", 200);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[2], "MATL", 300);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[3], "MATL", 400);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+ error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[4], "MATL", 500);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ free (connect);
+
+ connect2 = (int *) calloc(8, sizeof(int));
+ connect2[0] = 1; connect2[1] = 2; connect2[2] = 3; connect2[3] = 4;
+
+ error = ex_put_elem_conn (exoid2, ebids2[0], connect2);
+ printf ("after ex_put_elem_conn (2), error = %d\n", error);
+
+ connect2[0] = 5; connect2[1] = 6; connect2[2] = 7; connect2[3] = 8;
+
+ error = ex_put_elem_conn (exoid2, ebids2[1], connect2);
+ printf ("after ex_put_elem_conn (2), error = %d\n", error);
+
+ connect2[0] = 9; connect2[1] = 10; connect2[2] = 11; connect2[3] = 12;
+ connect2[4] = 13; connect2[5] = 14; connect2[6] = 15; connect2[7] = 16;
+
+ error = ex_put_elem_conn (exoid2, ebids2[2], connect2);
+ printf ("after ex_put_elem_conn (2), error = %d\n", error);
+
+ connect2[0] = 17; connect2[1] = 18; connect2[2] = 19; connect2[3] = 20;
+
+ error = ex_put_elem_conn (exoid2, ebids2[3], connect2);
+ printf ("after ex_put_elem_conn (2), error = %d\n", error);
+
+ connect2[0] = 21; connect2[1] = 22; connect2[2] = 23;
+ connect2[3] = 24; connect2[4] = 25; connect2[5] = 26;
+
+ error = ex_put_elem_conn (exoid2, ebids2[4], connect2);
+ printf ("after ex_put_elem_conn (2), error = %d\n", error);
+
+
+ free (connect2);
+
+
+/* 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);
+
+ attrib[0] = 6.14159;
+ error = ex_put_elem_attr (exoid, ebids[1], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ attrib2[0] = 3.;
+ error = ex_put_elem_attr (exoid2, ebids2[0], attrib2);
+ printf ("after ex_put_elem_attr (2), error = %d\n", error);
+
+ attrib2[0] = 6.;
+ error = ex_put_elem_attr (exoid2, ebids2[1], attrib2);
+ printf ("after ex_put_elem_attr (2), error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid2, ebids2[2], attrib2);
+ printf ("after ex_put_elem_attr (2), error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid2, ebids2[3], attrib2);
+ printf ("after ex_put_elem_attr (2), error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid2, ebids2[4], attrib2);
+ printf ("after ex_put_elem_attr (2), error = %d\n", error);
+
+#ifdef EX_TEST_INDIV_NODESET
+/* write individual node sets */
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set, 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);
+
+/* file 2 */
+ error = ex_put_node_set_param (exoid2, 20, 5, 5);
+ printf ("after ex_put_node_set_param (2), error = %d\n", error);
+
+ node_list2[0] = 100; node_list2[1] = 101; node_list2[2] = 102;
+ node_list2[3] = 103; node_list2[4] = 104;
+
+ dist_fact2[0] = 1.0; dist_fact2[1] = 2.0; dist_fact2[2] = 3.0;
+ dist_fact2[3] = 4.0; dist_fact2[4] = 5.0;
+
+ error = ex_put_node_set (exoid2, 20, node_list2);
+ printf ("after ex_put_node_set (2), error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid2, 20, dist_fact2);
+ printf ("after ex_put_node_set (2), error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid2, 21, 3, 3);
+ printf ("after ex_put_node_set_param (2), error = %d\n", error);
+
+ node_list2[0] = 200; node_list2[1] = 201; node_list2[2] = 202;
+
+ dist_fact2[0] = 1.1; dist_fact2[1] = 2.1; dist_fact2[2] = 3.1;
+
+ error = ex_put_node_set (exoid2, 21, node_list2);
+ printf ("after ex_put_node_set (2), error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid2, 21, dist_fact2);
+ printf ("after ex_put_node_set (2), error = %d\n", error);
+
+ error = ex_put_prop(exoid2, EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+ error = ex_put_prop(exoid2, EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+ prop_array[0] = 1000;
+ prop_array[1] = 2000;
+
+ error = ex_put_prop_array(exoid2, EX_NODE_SET, "VELOCITY", prop_array);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+#else /* EX_TEST_INDIV_NODESET */
+/* write concatenated node sets; this produces the same information as
+ * the above code which writes individual node sets
+ */
+
+ 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);
+
+ ids2[0] = 20; ids2[1] = 21;
+
+ num_nodes_per_set2[0] = 5; num_nodes_per_set2[1] = 3;
+
+ node_ind2[0] = 0; node_ind2[1] = 5;
+
+ node_list2[0] = 100; node_list2[1] = 101; node_list2[2] = 102;
+ node_list2[3] = 103; node_list2[4] = 104;
+ node_list2[5] = 200; node_list2[6] = 201; node_list2[7] = 202;
+
+ num_df_per_set2[0] = 5; num_df_per_set2[1] = 3;
+
+ df_ind2[0] = 0; df_ind2[1] = 5;
+
+ dist_fact2[0] = 1.0; dist_fact2[1] = 2.0; dist_fact2[2] = 3.0;
+ dist_fact2[3] = 4.0; dist_fact2[4] = 5.0;
+ dist_fact2[5] = 1.1; dist_fact2[6] = 2.1; dist_fact2[7] = 3.1;
+
+ error = ex_put_concat_node_sets (exoid2, ids2, num_nodes_per_set2,
+ num_df_per_set2, node_ind2,
+ df_ind2, node_list2, dist_fact2);
+ printf ("after ex_put_concat_node_sets, error = %d\n", error);
+
+
+ error = ex_put_prop(exoid2, EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid2, EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ prop_array2[0] = 1000;
+ prop_array2[1] = 2000;
+
+ error = ex_put_prop_array(exoid2, EX_NODE_SET, "VELOCITY", prop_array2);
+ printf ("after ex_put_prop_array, error = %d\n", error);
+#endif /* EX_TEST_INDIV_NODESET */
+
+#ifdef EX_TEST_INDIV_SIDESET
+/* 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);
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoid, 34, 5, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+/* file 2 */
+ error = ex_put_side_set_param (exoid2, 30, 2, 4);
+ printf ("after ex_put_side_set_param (2), error = %d\n", error);
+
+ elem_list2[0] = 2; elem_list2[1] = 2;
+
+ side_list2[0] = 4; side_list2[1] = 2;
+
+ dist_fact2[0] = 30.0; dist_fact2[1] = 30.1; dist_fact2[2] = 30.2;
+ dist_fact2[3] = 30.3;
+
+ error = ex_put_side_set (exoid2, 30, elem_list2, side_list2);
+ printf ("after ex_put_side_set (2), error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid2, 30, dist_fact2);
+ printf ("after ex_put_side_set_dist_fact (2), error = %d\n", error);
+
+
+ error = ex_put_side_set_param (exoid2, 31, 2, 4);
+ printf ("after ex_put_side_set_param (2), error = %d\n", error);
+
+ elem_list2[0] = 1; elem_list2[1] = 2;
+
+ side_list2[0] = 2; side_list2[1] = 3;
+
+ dist_fact2[0] = 31.0; dist_fact2[1] = 31.1; dist_fact2[2] = 31.2;
+ dist_fact2[3] = 31.3;
+
+ error = ex_put_side_set (exoid2, 31, elem_list2, side_list2);
+ printf ("after ex_put_side_set (2), error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid2, 31, dist_fact2);
+ printf ("after ex_put_side_set_dist_fact (2), error = %d\n", error);
+
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid2, 32, 7, 0);
+ printf ("after ex_put_side_set_param (2), error = %d\n", error);
+
+ elem_list2[0] = 3; elem_list2[1] = 3;
+ elem_list2[2] = 3; elem_list2[3] = 3;
+ elem_list2[4] = 3; elem_list2[5] = 3;
+ elem_list2[6] = 3;
+
+ side_list2[0] = 5; side_list2[1] = 3;
+ side_list2[2] = 3; side_list2[3] = 2;
+ side_list2[4] = 4; side_list2[5] = 1;
+ side_list2[6] = 6;
+
+ error = ex_put_side_set (exoid2, 32, elem_list2, side_list2);
+ printf ("after ex_put_side_set (2), error = %d\n", error);
+
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid2, 33, 4, 0);
+ printf ("after ex_put_side_set_param (2), error = %d\n", error);
+
+ elem_list2[0] = 4; elem_list2[1] = 4;
+ elem_list2[2] = 4; elem_list2[3] = 4;
+
+ side_list2[0] = 1; side_list2[1] = 2;
+ side_list2[2] = 3; side_list2[3] = 4;
+
+ error = ex_put_side_set (exoid2, 33, elem_list2, side_list2);
+ printf ("after ex_put_side_set (2), error = %d\n", error);
+
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoid2, 34, 5, 0);
+ printf ("after ex_put_side_set_param (2), error = %d\n", error);
+
+ elem_list2[0] = 5; elem_list2[1] = 5;
+ elem_list2[2] = 5; elem_list2[3] = 5;
+ elem_list2[4] = 5;
+
+ side_list2[0] = 1; side_list2[1] = 2;
+ side_list2[2] = 3; side_list2[3] = 4;
+ side_list2[4] = 5;
+
+ error = ex_put_side_set (exoid2, 34, elem_list2, side_list2);
+ printf ("after ex_put_side_set (2), error = %d\n", error);
+
+#else /* EX_TEST_INDIV_SIDESET */
+
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual 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);
+
+/* file 2 */
+
+ ids2[0] = 30;
+ ids2[1] = 31;
+ ids2[2] = 32;
+ ids2[3] = 33;
+ ids2[4] = 34;
+
+ node_list2[0] = 8; node_list2[1] = 5;
+ node_list2[2] = 6; node_list2[3] = 7;
+
+ node_list2[4] = 2; node_list2[5] = 3;
+ node_list2[6] = 7; node_list2[7] = 8;
+
+ node_list2[8] = 9; node_list2[9] = 12;
+ node_list2[10] = 11; node_list2[11] = 10;
+
+ node_list2[12] = 11; node_list2[13] = 12;
+ node_list2[14] = 16; node_list2[15] = 15;
+
+ node_list2[16] = 16; node_list2[17] = 15;
+ node_list2[18] = 11; node_list2[19] = 12;
+
+ node_list2[20] = 10; node_list2[21] = 11;
+ node_list2[22] = 15; node_list2[23] = 14;
+
+ node_list2[24] = 13; node_list2[25] = 16;
+ node_list2[26] = 12; node_list2[27] = 9;
+
+ node_list2[28] = 14; node_list2[29] = 13;
+ node_list2[30] = 9; node_list2[31] = 10;
+
+ node_list2[32] = 16; node_list2[33] = 13;
+ node_list2[34] = 14; node_list2[35] = 15;
+
+ node_list2[36] = 17; node_list2[37] = 18;
+ node_list2[38] = 20;
+
+ node_list2[39] = 18; node_list2[40] = 19;
+ node_list2[41] = 20;
+
+ node_list2[42] = 20; node_list2[43] = 19;
+ node_list2[44] = 17;
+
+ node_list2[45] = 19; node_list2[46] = 18;
+ node_list2[47] = 17;
+
+ node_list2[48] = 25; node_list2[49] = 24;
+ node_list2[50] = 21; node_list2[51] = 22;
+
+ node_list2[52] = 26; node_list2[53] = 25;
+ node_list2[54] = 22; node_list2[55] = 23;
+
+ node_list2[56] = 26; node_list2[57] = 23;
+ node_list2[58] = 21; node_list2[59] = 24;
+
+ node_list2[60] = 23; node_list2[61] = 22;
+ node_list2[62] = 21;
+
+ node_list2[63] = 24; node_list2[64] = 25;
+ node_list2[65] = 26;
+
+ node_ind2[0] = 0;
+ node_ind2[1] = 4;
+ node_ind2[2] = 8;
+ node_ind2[3] = 36;
+ node_ind2[4] = 47;
+
+ num_elem_per_set2[0] = 2;
+ num_elem_per_set2[1] = 2;
+ num_elem_per_set2[2] = 7;
+ num_elem_per_set2[3] = 4;
+ num_elem_per_set2[4] = 5;
+
+ num_nodes_per_set2[0] = 4;
+ num_nodes_per_set2[1] = 4;
+ num_nodes_per_set2[2] = 28;
+ num_nodes_per_set2[3] = 12;
+ num_nodes_per_set2[4] = 18;
+
+ elem_ind2[0] = 0;
+ elem_ind2[1] = 2;
+ elem_ind2[2] = 4;
+ elem_ind2[3] = 11;
+ elem_ind2[4] = 15;
+
+ elem_list2[0] = 2; elem_list2[1] = 2;
+ elem_list2[2] = 1; elem_list2[3] = 2;
+ elem_list2[4] = 3; elem_list2[5] = 3;
+ elem_list2[6] = 3; elem_list2[7] = 3;
+ elem_list2[8] = 3; elem_list2[9] = 3;
+ elem_list2[10] = 3; elem_list2[11] = 4;
+ elem_list2[12] = 4; elem_list2[13] = 4;
+ elem_list2[14] = 4; elem_list2[15] = 5;
+ elem_list2[16] = 5; elem_list2[17] = 5;
+ elem_list2[18] = 5; elem_list2[19] = 5;
+
+ error = ex_cvt_nodes_to_sides(exoid,
+ num_elem_per_set2,
+ num_nodes_per_set2,
+ elem_ind2,
+ node_ind2,
+ elem_list2,
+ node_list2,
+ side_list2);
+ printf ("after ex_cvt_nodes_to_sides (2), error = %d\n", error);
+
+ num_df_per_set2[0] = 4;
+ num_df_per_set2[1] = 4;
+ num_df_per_set2[2] = 0;
+ num_df_per_set2[3] = 0;
+ num_df_per_set2[4] = 0;
+
+ df_ind2[0] = 0;
+ df_ind2[1] = 4;
+
+ dist_fact2[0] = 30.0; dist_fact2[1] = 30.1;
+ dist_fact2[2] = 30.2; dist_fact2[3] = 30.3;
+
+ dist_fact2[4] = 31.0; dist_fact2[5] = 31.1;
+ dist_fact2[6] = 31.2; dist_fact2[7] = 31.3;
+
+ error = ex_put_concat_side_sets (exoid2, ids2, num_elem_per_set2,
+ num_df_per_set2, elem_ind2, df_ind2,
+ elem_list2, side_list2, dist_fact2);
+ printf ("after ex_put_concat_side_sets (2), error = %d\n", error);
+
+
+#endif /* EX_TEST_INDIV_SIDESET */
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid2, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+ error = ex_put_prop(exoid2, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop (2), error = %d\n", error);
+
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT2";
+ qa_record[0][1] = "testwt2";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+ num_qa_rec2 = 2;
+
+ qa_record2[0][0] = "TESTWT2";
+ qa_record2[0][1] = "testwt2";
+ qa_record2[0][2] = "07/07/93";
+ qa_record2[0][3] = "15:41:33";
+ qa_record2[1][0] = "FASTQ";
+ qa_record2[1][1] = "fastq";
+ qa_record2[1][2] = "07/07/93";
+ qa_record2[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid2, num_qa_rec2, qa_record2);
+ printf ("after ex_put_qa (2), error = %d\n", error);
+
+
+/* write information records */
+
+ num_info = 3;
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+ num_info2 = 3;
+
+ info2[0] = "This is the first information record.";
+ info2[1] = "This is the second information record.";
+ info2[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid2, num_info2, info2);
+ printf ("after ex_put_info (2), error = %d\n", error);
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_glo_vars2 = 1;
+
+ var_names2[0] = "glo_vars";
+
+ error = ex_put_var_param (exoid2, "g", num_glo_vars2);
+ printf ("after ex_put_var_param (2), error = %d\n", error);
+ error = ex_put_var_names (exoid2, "g", num_glo_vars2, var_names2);
+ printf ("after ex_put_var_names (2), error = %d\n", error);
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_nod_vars2 = 2;
+
+ var_names2[0] = "nod_var0";
+ var_names2[1] = "nod_var1";
+
+ error = ex_put_var_param (exoid2, "n", num_nod_vars2);
+ printf ("after ex_put_var_param (2), error = %d\n", error);
+ error = ex_put_var_names (exoid2, "n", num_nod_vars2, var_names2);
+ printf ("after ex_put_var_names (2), error = %d\n", error);
+
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars2 = 3;
+
+ var_names2[0] = "ele_var20";
+ var_names2[1] = "ele_var21";
+ var_names2[2] = "ele_var22";
+
+ error = ex_put_var_param (exoid2, "e", num_ele_vars2);
+ printf ("after ex_put_var_param (2), error = %d\n", error);
+ error = ex_put_var_names (exoid2, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names (2), error = %d\n", error);
+
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ error = ex_put_elem_var_tab (exoid2, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab (2), error = %d\n", error);
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays hist_var_vals, glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ glob_var_vals = (float *) calloc (num_glo_vars, sizeof(CPU_word_size));
+ nodal_var_vals = (float *) calloc (num_nodes, sizeof(CPU_word_size));
+ elem_var_vals = (float *) calloc (4, sizeof(CPU_word_size));
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+ time_value2 = (float)(i+1)/100.;
+
+/* write time value to regular file */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ error = ex_put_time (exoid2, whole_time_step, &time_value2);
+ printf ("after ex_put_time (2), error = %d\n", error);
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ error = ex_put_glob_vars (exoid2, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars (2), error = %d\n", error);
+
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+
+ error = ex_put_nodal_var (exoid2, whole_time_step, k, num_nodes,
+ nodal_var_vals);
+ printf ("after ex_put_nodal_var (2), error = %d\n", error);
+ }
+
+/* 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+
+ error = ex_put_elem_var (exoid2, whole_time_step, k, ebids[j],
+ num_elem_in_block[j], elem_var_vals);
+ printf ("after ex_put_elem_var (2), error = %d\n", error);
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ error = ex_update (exoid2);
+ printf ("after ex_update (2), error = %d\n", error);
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ error = ex_close (exoid2);
+ printf ("after ex_close (2), error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwt_clb.c b/cbind/test/testwt_clb.c
new file mode 100644
index 0000000..fea9b0d
--- /dev/null
+++ b/cbind/test/testwt_clb.c
@@ -0,0 +1,1000 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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_clb.c,v 1.4 2006/11/28 14:02:17 gdsjaar Exp $
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.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_node_sets, num_side_sets, error;
+ int i, j, k, kk, m, *elem_map, *connect;
+ int node_list[100],elem_list[100],side_list[100];
+ int ebids[10], ssids[10], nsids[10], nattr[10];
+ int num_nodes_per_set[10], num_elem_per_set[10];
+ int num_df_per_set[10];
+ int num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars, num_nset_vars, num_sset_vars;
+ int *truth_tab, *nset_tab, *sset_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals, *nset_var_vals, *sset_var_vals;
+ float time_value;
+ float x[100], y[100], z[100];
+ float attrib[1], dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[7];
+ char *prop_names[2];
+ char *eb_type[10];
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 33;
+ num_elem = 7;
+ num_elem_blk = 7;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write nodal coordinates values and names to database */
+
+ /* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+ /* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+ /* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+ /* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+ /* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+ /* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+ /* 3d Tri */
+ x[30] = 0.0; y[30] = 0.0; z[30] = 0.0;
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 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 */
+
+ 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;
+
+ nattr[0] = nattr[1] = nattr[2] = nattr[3] = 1;
+ nattr[4] = nattr[5] = nattr[6] = 1;
+
+ eb_type[0] = "quad";
+ eb_type[1] = "quad";
+ eb_type[2] = "hex";
+ eb_type[3] = "tetra";
+ eb_type[4] = "wedge";
+ eb_type[5] = "tetra";
+ eb_type[6] = "tri";
+
+ error = ex_put_concat_elem_block (exoid, ebids, eb_type,
+ num_elem_in_block, num_nodes_per_elem,
+ nattr, 0);
+ printf ("after ex_put_concat_elem_block, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ 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);
+ }
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ 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[1], "MATL", 20);
+ 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[2], "MATL", 30);
+ 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[3], "MATL", 40);
+ 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[4], "MATL", 50);
+ 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[5], "MATL", 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], "MATL", 70);
+ printf ("after ex_put_prop, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ 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);
+ }
+
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+ connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write individual node sets */
+
+
+ nsids[0] = 20; nsids[1] = 21;
+ num_nodes_per_set[0] = 5; num_nodes_per_set[1] = 3;
+ num_df_per_set[0] = 5; num_df_per_set[1] = 3;
+
+ error = ex_put_concat_node_sets (exoid, nsids, num_nodes_per_set,
+ num_df_per_set, 0, 0, 0, 0);
+
+ printf ("after ex_put_concat_node_sets, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* Define the sideset params at one time, then write individually */
+ ssids[0] = 30;
+ ssids[1] = 31;
+ ssids[2] = 32;
+ ssids[3] = 33;
+ ssids[4] = 34;
+
+ num_elem_per_set[0] = 2;
+ num_elem_per_set[1] = 2;
+ num_elem_per_set[2] = 7;
+ num_elem_per_set[3] = 8;
+ num_elem_per_set[4] = 10;
+
+ 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;
+
+ error = ex_put_concat_side_sets (exoid, ssids, num_elem_per_set,
+ num_df_per_set, 0, 0, 0, 0, 0);
+ printf ("after ex_put_concat_side_sets, error = %d\n", error);
+
+ /* write individual side sets */
+
+ /* side set #1 - quad */
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #2 - quad, spanning 2 elements */
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #3 - hex */
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #4 - tetras */
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+ elem_list[4] = 6; elem_list[5] = 6;
+ elem_list[6] = 6; elem_list[7] = 6;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 1; side_list[5] = 2;
+ side_list[6] = 3; side_list[7] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #5 - wedges and tris */
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5; elem_list[5] = 7;
+ elem_list[6] = 7; elem_list[7] = 7;
+ elem_list[8] = 7; elem_list[9] = 7;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5; side_list[5] = 1;
+ side_list[6] = 2; side_list[7] = 3;
+ side_list[8] = 4; side_list[9] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, 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";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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);
+ }
+
+
+
+ /* write results variables parameters and names */
+ num_glo_vars = 1;
+ num_nod_vars = 2;
+ num_ele_vars = 3;
+ num_nset_vars = 4;
+ num_sset_vars = 7;
+
+ truth_tab = (int *) calloc ((num_elem_blk * num_ele_vars), sizeof(int));
+ nset_tab = (int *) calloc ((num_node_sets * num_nset_vars), sizeof(int));
+ sset_tab = (int *) calloc ((num_side_sets * num_sset_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++) {
+ for (j=0; j<num_ele_vars; j++) {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ k = 0;
+ for (i=0; i<num_node_sets; i++) {
+ for (j=0; j<num_nset_vars; j++) {
+ if (k%2 == 0)
+ nset_tab[k++] = 1;
+ else
+ nset_tab[k++] = 0;
+ }
+ }
+
+ k = 0;
+ for (i=0; i<num_side_sets; i++) {
+ for (j=0; j<num_sset_vars; j++) {
+ if (k%2 == 0)
+ sset_tab[k++] = 0;
+ else
+ sset_tab[k++] = 1;
+ }
+ }
+
+ ex_put_all_var_param(exoid, num_glo_vars, num_nod_vars, num_ele_vars, truth_tab,
+ num_nset_vars, nset_tab, num_sset_vars, sset_tab);
+ printf ("after ex_put_all_var_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (truth_tab);
+ free (nset_tab);
+ free (sset_tab);
+
+ var_names[0] = "glo_vars";
+ error = ex_put_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* 12345678901234567890123456789012 */
+ var_names[0] = "node_variable_a_very_long_name_0";
+ var_names[1] = "nod_var1";
+ error = ex_put_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+ var_names[0] = "ele_var0";
+ var_names[1] = "ele_var1";
+ var_names[2] = "ele_var2";
+ error = ex_put_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ var_names[0] = "nset_var0";
+ var_names[1] = "nset_var1";
+ var_names[2] = "nset_var2";
+ var_names[3] = "nset_var3";
+ error = ex_put_var_names (exoid, "m", num_nset_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ var_names[0] = "sset_var0";
+ var_names[1] = "sset_var1";
+ var_names[2] = "sset_var2";
+ var_names[3] = "sset_var3";
+ var_names[4] = "sset_var4";
+ var_names[5] = "sset_var5";
+ var_names[6] = "sset_var6";
+ error = ex_put_var_names (exoid, "s", num_sset_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+ nset_var_vals = (float *) calloc (5, CPU_word_size);
+ sset_var_vals = (float *) calloc (10, CPU_word_size);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+ /* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* write global variables */
+
+ for (j=0; j<num_glo_vars; j++) {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* 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);
+ 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++) {
+ elem_var_vals[m] = (float)(k+1) + (float)(j+2) +
+ ((float)(m+1)*time_value);
+ }
+ error = ex_put_elem_var (exoid, whole_time_step, 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);
+ exit(-1);
+ }
+ }
+ }
+
+ /* write nodeset variables */
+
+ kk = 0;
+ for (j=0; j<num_node_sets; j++) {
+ for (k=0; k<num_nset_vars; k++) {
+ if (kk++ % 2 == 0) {
+ for (m=0; m<num_nodes_per_set[j]; m++) {
+ nset_var_vals[m] = (float)(k+1) + (float)(j+2) +
+ ((float)(m+1)*time_value);
+ }
+ error = ex_put_nset_var (exoid, whole_time_step, k+1, nsids[j],
+ num_nodes_per_set[j], nset_var_vals);
+ printf ("after ex_put_nset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+ }
+
+ /* write sideset variables */
+
+ kk = 0;
+ for (j=0; j<num_side_sets; j++) {
+ for (k=0; k<num_sset_vars; k++) {
+ if (kk++ % 2 != 0) {
+ for (m=0; m<num_elem_per_set[j]; m++) {
+ sset_var_vals[m] = (float)(k+1) + (float)(j+2) +
+ ((float)(m+1)*time_value);
+ }
+ error = ex_put_sset_var (exoid, whole_time_step, k+1, ssids[j],
+ num_elem_per_set[j], sset_var_vals);
+ printf ("after ex_put_sset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+ }
+
+ whole_time_step++;
+
+ /* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+ free(nset_var_vals);
+ free(sset_var_vals);
+
+ /* 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_nc.c b/cbind/test/testwt_nc.c
new file mode 100644
index 0000000..bdbf958
--- /dev/null
+++ b/cbind/test/testwt_nc.c
@@ -0,0 +1,1171 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* 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 $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+/* #include "netcdf.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_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 num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars, num_sset_vars, num_nset_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float *sset_var_vals, *nset_var_vals;
+ float time_value;
+ float x[100], y[100], z[100];
+ 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];
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 33;
+ num_elem = 7;
+ num_elem_blk = 7;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+/* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+/* 3d Tri */
+ x[30] = 0.0; y[30] = 0.0; z[30] = 0.0;
+ 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);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 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);
+
+ 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);
+
+ 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);
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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);
+ }
+
+ 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_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);
+ }
+
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ 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);
+ }
+
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+ connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+
+ 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 */
+
+
+ num_nodes_in_nset[0] = 5;
+ num_nodes_in_nset[1] = 3;
+
+ nsids[0] = 20;
+ nsids[1] = 21;
+
+ error = ex_put_node_set_param (exoid, nsids[0], 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, nsids[0], node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, nsids[0], dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ error = ex_put_node_set_param (exoid, nsids[1], 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, nsids[1], node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_node_set_dist_fact (exoid, nsids[1], dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* Write node set names */
+ nset_names[0] = "nset_1";
+ nset_names[1] = "nset_2";
+
+ error = ex_put_names(exoid, EX_NODE_SET, nset_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, nsids[0], "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_NODE_SET, nsids[1], "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write individual side sets */
+ num_face_in_sset[0] = 2;
+ num_face_in_sset[1] = 2;
+ num_face_in_sset[2] = 7;
+ num_face_in_sset[3] = 8;
+ num_face_in_sset[4] = 10;
+
+ ssids[0] = 30;
+ ssids[1] = 31;
+ ssids[2] = 32;
+ ssids[3] = 33;
+ ssids[4] = 34;
+
+ /* side set #1 - quad */
+
+ error = ex_put_side_set_param (exoid, ssids[0], 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #2 - quad, spanning 2 elements */
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 8, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+ elem_list[4] = 6; elem_list[5] = 6;
+ elem_list[6] = 6; elem_list[7] = 6;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 1; side_list[5] = 2;
+ side_list[6] = 3; side_list[7] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ /* side set #5 - wedges and tris */
+
+ error = ex_put_side_set_param (exoid, 34, 10, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5; elem_list[5] = 7;
+ elem_list[6] = 7; elem_list[7] = 7;
+ elem_list[8] = 7; elem_list[9] = 7;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5; side_list[5] = 1;
+ side_list[6] = 2; side_list[7] = 3;
+ side_list[8] = 4; side_list[9] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ /* Write side set names */
+ sset_names[0] = "sset_1";
+ sset_names[1] = "sset_2";
+ sset_names[2] = "sset_3";
+ sset_names[3] = "sset_4";
+ sset_names[4] = "sset_5";
+
+ error = ex_put_names(exoid, EX_SIDE_SET, sset_names);
+ printf ("after ex_put_names, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, 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";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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);
+ }
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+
+ num_nod_vars = 2;
+ /* 12345678901234567890123456789012 */
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ {
+ num_nset_vars = 3;
+
+ var_names[0] = "ns_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+ {
+ num_sset_vars = 3;
+
+ var_names[0] = "ss_var0";
+ 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);
+ 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);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+ sset_var_vals = (float *) calloc (10, CPU_word_size);
+ nset_var_vals = (float *) calloc (10, CPU_word_size);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* 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);
+ 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++)
+ {
+ 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+/* 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);
+ printf ("after ex_put_sset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+/* 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);
+ /* 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);
+ printf ("after ex_put_nset_var, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+ free(sset_var_vals);
+ free(nset_var_vals);
+
+
+/* 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_nossnsdf.c b/cbind/test/testwt_nossnsdf.c
new file mode 100644
index 0000000..ad35871
--- /dev/null
+++ b/cbind/test/testwt_nossnsdf.c
@@ -0,0 +1,892 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwt1 - 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_nossnsdf.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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], num_attr[10];
+ int num_node_sets, num_side_sets, error;
+ int i, j, k, m, *elem_map, *connect, *node_map;
+ int node_list[100],elem_list[100],side_list[100];
+ int ebids[10], ids[10];
+ 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 num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float x[100], y[100], z[100], *dummy;
+ float attrib[100], dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char *prop_names[2];
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+ dummy = 0; /* assign this so the Cray compiler doesn't complain */
+
+/* Specify compute and i/o word size */
+
+ CPU_word_size = 0; /* float or double */
+ IO_word_size = 0; /* use system default (4 bytes) */
+
+/* create EXODUS II file */
+
+ exoid = ex_create ("test.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 */
+
+ num_dim = 3;
+ num_nodes = 28;
+ num_elem = 8;
+ num_elem_blk = 7;
+ num_node_sets = 2;
+ num_side_sets = 5;
+ /* num_side_sets = 6; Uncomment to test NULL side sets */
+
+ error = ex_put_init (exoid, "This is testwt1", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Circle #1 */
+ x[20] = 100.0; y[20] = 100.0; z[20] = 0.0;
+
+/* Sphere #1 */
+ x[21] = 50.0; y[21] = 50.0; z[21] = 20.0;
+
+/* Wedge #1 */
+ x[22] = 3.0; y[22] = 0.0; z[22] = 6.0;
+ x[23] = 6.0; y[23] = 0.0; z[23] = 0.0;
+ x[24] = 0.0; y[24] = 0.0; z[24] = 0.0;
+ x[25] = 3.0; y[25] = 2.0; z[25] = 6.0;
+ x[26] = 6.0; y[26] = 2.0; z[26] = 2.0;
+ x[27] = 0.0; y[27] = 2.0; z[27] = 0.0;
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+
+/* 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);
+
+ free (elem_map);
+
+/* write element numbering map */
+
+ elem_map = (int *) calloc(num_elem, sizeof(int));
+
+ for (i=1; i<=num_elem; i++)
+ {
+ elem_map[i-1] = i*2;
+ }
+
+ error = ex_put_elem_num_map (exoid, elem_map);
+ printf ("after ex_put_elem_num_map, error = %d\n", error);
+
+ free (elem_map);
+
+
+/* write node numbering map */
+
+ node_map = (int *) calloc(num_nodes, sizeof(int));
+
+ for (i=1; i<=num_nodes; i++)
+ {
+ node_map[i-1] = i*3;
+ }
+
+ error = ex_put_node_num_map (exoid, node_map);
+ printf ("after ex_put_node_num_map, error = %d\n", error);
+
+ free (node_map);
+
+
+/* write element block parameters */
+
+ num_elem_in_block[0] = 1; /* element 1: Quad 1 */
+ num_elem_in_block[1] = 2; /* elements 2, 3: Quad 1 & 2 */
+ num_elem_in_block[2] = 1; /* element 4: Hex */
+ num_elem_in_block[3] = 1; /* element 5: Tetra */
+ num_elem_in_block[4] = 1; /* element 6: Circle */
+ num_elem_in_block[5] = 1; /* element 7: Sphere */
+ num_elem_in_block[6] = 1; /* element 8: Wedge */
+
+ 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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 1; /* elements in block #4 are 1-node circles */
+ num_nodes_per_elem[5] = 1; /* elements in block #5 are 1-node spheres */
+ num_nodes_per_elem[6] = 6; /* elements in block #6 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+ ebids[5] = 15;
+ ebids[6] = 16;
+
+ num_attr[0] = 3;
+ num_attr[1] = 3;
+ num_attr[2] = 3;
+ num_attr[3] = 3;
+ num_attr[4] = 3;
+ num_attr[5] = 3;
+ num_attr[6] = 3;
+
+ error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
+ num_nodes_per_elem[0], num_attr[0]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
+ num_nodes_per_elem[1], num_attr[1]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
+ num_nodes_per_elem[2], num_attr[2]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
+ num_nodes_per_elem[3], num_attr[3]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[4], "circle", num_elem_in_block[4],
+ num_nodes_per_elem[4], num_attr[4]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[5], "sphere", num_elem_in_block[5],
+ num_nodes_per_elem[5], num_attr[5]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ error = ex_put_elem_block (exoid, ebids[6], "wedge", num_elem_in_block[6],
+ num_nodes_per_elem[6], num_attr[6]);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[5], "MATL", 60);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[6], "MATL", 70);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+ connect[4] = 5; connect[5] = 6; connect[6] = 7; connect[7] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 22;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 23; connect[1] = 24; connect[2] = 25;
+ connect[3] = 26; connect[4] = 27; connect[5] = 28;
+
+ error = ex_put_elem_conn (exoid, ebids[6], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ free (connect);
+
+
+/* write element block attributes (3 per block) */
+
+ attrib[0] = 1.0; attrib[1] = 2.0; attrib[2] = 3.0;
+ attrib[3] = 1.11; attrib[4] = 2.11; attrib[5] = 3.11;
+ attrib[6] = 1.12; attrib[7] = 2.12; attrib[8] = 3.12;
+ attrib[9] = 1.2; attrib[10] = 2.2; attrib[11] = 3.2;
+ attrib[12] = 1.3; attrib[13] = 2.3; attrib[14] = 3.3;
+ attrib[15] = 1.4; attrib[16] = 2.4; attrib[17] = 3.4;
+ attrib[18] = 1.5; attrib[19] = 2.5; attrib[20] = 3.5;
+ attrib[21] = 1.6; attrib[22] = 2.6; attrib[23] = 3.6;
+
+ error = ex_put_elem_attr (exoid, ebids[0], &attrib[0]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[1], &attrib[3]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], &attrib[9]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], &attrib[12]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], &attrib[15]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[5], &attrib[18]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[6], &attrib[21]);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+/* write individual node sets */
+
+ /* COMMENTED OUT ...
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, 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 concatenated node sets; this produces the same information as
+ * the above code which writes individual node sets
+ */
+
+/* THIS SECTION IS NOT COMMENTED OUT */
+
+ ids[0] = 20; ids[1] = 21;
+
+ num_nodes_per_set[0] = 5;
+ num_nodes_per_set[1] = 3;
+ /* num_nodes_per_set[1] = 0; Uncomment to test NULL node sets */
+
+ 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 NOT COMMENTED OUT SECTION */
+
+
+/* write individual side sets */
+
+ /* COMMENTED OUT SECTION ...
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 1;
+
+ node_list[0] = 1; node_list[1] = 2;
+ node_list[2] = 5; node_list[3] = 6;
+
+ side_list[0] = 1; side_list[1] = 1;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ node_list[0] = 6; node_list[1] = 7;
+ node_list[2] = 7; node_list[3] = 8;
+
+ side_list[0] = 3; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ END COMMENTED OUT SECTION */
+
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual side sets
+ */
+
+/* THIS SECTION IS NOT COMMENTED OUT */
+
+ ids[0] = 30;
+ ids[1] = 31;
+ ids[2] = 32;
+ ids[3] = 33;
+ ids[4] = 34;
+ ids[5] = 35;
+
+ /* side set #1 - quad */
+ node_list[0] = 8; node_list[1] = 5;
+ node_list[2] = 6; node_list[3] = 7;
+
+ /* side set #2 - quad/hex, spanning 2 element types */
+ node_list[4] = 2; node_list[5] = 3;
+ node_list[6] = 7; node_list[7] = 8;
+
+ /* side set #3 - hex */
+ 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;
+
+ /* side set #4 - tetras */
+ 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;
+
+ /* side set #5 - circle and sphere */
+ node_list[48] = 21;
+ node_list[49] = 22;
+
+ /* side set #6 - wedges */
+ node_list[50] = 27; node_list[51] = 26;
+ node_list[52] = 23; node_list[53] = 24;
+
+ node_list[54] = 28; node_list[55] = 27;
+ node_list[56] = 24; node_list[57] = 25;
+
+ node_list[58] = 28; node_list[59] = 25;
+ node_list[60] = 23; node_list[61] = 26;
+
+ node_list[62] = 25; node_list[63] = 24;
+ node_list[64] = 23;
+
+ node_list[65] = 26; node_list[66] = 27;
+ node_list[67] = 28;
+
+ node_ind[0] = 0;
+ node_ind[1] = 4;
+ node_ind[2] = 8;
+ node_ind[3] = 36;
+ node_ind[4] = 47;
+ node_ind[5] = 49;
+
+ num_elem_per_set[0] = 2; /* two sides uses 2 elements */
+ num_elem_per_set[1] = 2;
+ num_elem_per_set[2] = 7;
+ num_elem_per_set[3] = 4;
+ num_elem_per_set[4] = 2;
+ num_elem_per_set[5] = 5;
+ /* num_elem_per_set[5] = 0; Uncomment to test NULL side sets */
+
+ 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] = 2;
+ num_nodes_per_set[5] = 18;
+
+ elem_ind[0] = 0;
+ elem_ind[1] = 2;
+ elem_ind[2] = 4;
+ elem_ind[3] = 11;
+ elem_ind[4] = 15;
+ elem_ind[5] = 17;
+
+ elem_list[0] = 3; elem_list[1] = 3; /* side set 1: Quad #2 */
+ elem_list[2] = 1; elem_list[3] = 3; /* side set 2: Quad #1 & #2 */
+ elem_list[4] = 4; elem_list[5] = 4; /* side set 3: Hex */
+ elem_list[6] = 4; elem_list[7] = 4;
+ elem_list[8] = 4; elem_list[9] = 4;
+ elem_list[10] = 4;
+ elem_list[11] = 5; elem_list[12] = 5; /* side set 4: Tetra */
+ elem_list[13] = 5; elem_list[14] = 5;
+ elem_list[15] = 6; elem_list[16] = 7; /* side set 5: Circle & Sphere */
+ elem_list[17] = 8; elem_list[18] = 8; /* side set 6: Wedge */
+ elem_list[19] = 8; elem_list[20] = 8;
+ elem_list[21] = 8;
+
+#if 0
+ /* side set 0 */
+ side_list[0]= 4; side_list[1]= 2;
+ /* side set 1 */
+ side_list[2]= 2; side_list[3]= 3;
+ /* side set 2 */
+ side_list[4]= 5; side_list[5]= 3;
+ side_list[6]= 3; side_list[7]= 2;
+ side_list[8]= 4; side_list[9]= 1;
+ side_list[10]= 6;
+ /* side set 3 */
+ side_list[11]= 1; side_list[12]= 2;
+ side_list[13]= 3; side_list[14]= 4;
+ /* side set 4 */
+ side_list[15] = 1; side_list[16] = 1;
+ /* side set 5 */
+ side_list[17]= 1; side_list[18]= 2;
+ side_list[19]= 3; side_list[20]= 4;
+ side_list[21]= 5;
+#endif
+
+ 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);
+
+#if 0
+ for (i=0;i<num_side_sets;i++)
+ {
+ printf("side set %d\n",i);
+ for (j=0;j<num_elem_per_set[i];j++)
+ printf(" side_list[%d]: %d\n",j,side_list[j+elem_ind[i]]);
+ }
+#endif
+
+ 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;
+ num_df_per_set[5] = 0;
+
+ df_ind[0] = 0;
+ df_ind[1] = 4;
+
+ /* side set #1 df */
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1;
+ dist_fact[2] = 30.2; dist_fact[3] = 30.3;
+
+ /* side set #2 df */
+ 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);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ /* END COMMENTED OUT SECTION */
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT1";
+ qa_record[0][1] = "testwt1";
+ qa_record[0][2] = "03/16/94";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+
+/* write information records */
+
+ num_info = 3;
+
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_name(exoid, "g", 1, var_names[0]);
+ printf ("after ex_put_var_name, error = %d\n", error);
+
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k] = k+1;
+ k++;
+ }
+ }
+
+ truth_tab[6] = 0;
+
+ /* commented out to test ex_get_elem_var_tab in testrd1
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error); */
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+ }
+
+/* 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]); */
+ }
+ if (k == 1 && j == 2)
+ continue; /* skip element block 3, variable 1 */
+ else
+ {
+ error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
+ num_elem_in_block[j], elem_var_vals);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwt_ss.c b/cbind/test/testwt_ss.c
new file mode 100644
index 0000000..4edf631
--- /dev/null
+++ b/cbind/test/testwt_ss.c
@@ -0,0 +1,835 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwt_ss - 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.
+*
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+/* #include "netcdf.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_node_sets, num_side_sets, error;
+ int *connect;
+ int node_list[100],elem_list[100],side_list[100];
+ int ebids[10], ids[10];
+ 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 num_qa_rec, num_info;
+ int CPU_word_size,IO_word_size;
+
+ float x[100], y[100], z[100];
+ float dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3];
+
+ 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.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 */
+
+ num_dim = 3;
+ num_nodes = 33;
+ num_elem = 8;
+ num_elem_blk = 8;
+ num_node_sets = 2;
+ num_side_sets = 9;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+/* Tetra #2 */
+ x[26] = 2.7; y[26] = 1.7; z[26] = 2.7;
+ x[27] = 6.0; y[27] = 1.7; z[27] = 3.3;
+ x[28] = 5.7; y[28] = 1.7; z[28] = 1.7;
+ x[29] = 3.7; y[29] = 0.0; z[29] = 2.3;
+
+/* TriShell #1 */
+ x[30] = 2.7; y[30] = 1.7; z[30] = 2.7;
+ x[31] = 6.0; y[31] = 1.7; z[31] = 3.3;
+ x[32] = 5.7; y[32] = 1.7; z[32] = 1.7;
+
+ 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] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ 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 element block parameters */
+
+ 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_elem_in_block[7] = 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] = 4; /* elements in block #7 are 4-node shells */
+ num_nodes_per_elem[7] = 3; /* elements in block #8 are 3-node shells */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+ ebids[5] = 15;
+ ebids[6] = 16;
+ ebids[7] = 17;
+
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_elem_block (exoid, ebids[6], "shell", 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);
+ }
+
+ error = ex_put_elem_block (exoid, ebids[7], "triangle",
+ num_elem_in_block[7], num_nodes_per_elem[7], 1);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ 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);
+ }
+
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+ connect[4] = 27; connect[5] = 28; connect[6] = 30; connect[7] = 29;
+
+ error = ex_put_elem_conn (exoid, ebids[5], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[6], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ connect[0] = 30; connect[1] = 31; connect[2] = 32;
+
+ error = ex_put_elem_conn (exoid, ebids[7], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ free (connect);
+
+
+/* write individual side sets */
+
+ /* side set #1 - quad */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+ /* side set #2 - quad, spanning 2 elements */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+ /* side set #3 - hex */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+ /* side set #4 - 4-node tetras */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 33, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+ /* side set #5 - shells; front and back faces */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 34, 2, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 7; elem_list[1] = 7;
+
+ side_list[0] = 1; side_list[1] = 2;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+ /* side set #6 - shells; edges */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ error = ex_put_side_set_param (exoid, 35, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ elem_list[0] = 7; elem_list[1] = 7;
+ elem_list[2] = 7; elem_list[3] = 7;
+
+ side_list[0] = 3; side_list[1] = 4;
+ side_list[2] = 5; side_list[3] = 6;
+
+ error = ex_put_side_set (exoid, 35, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ END COMMENTED OUT SECTION */
+
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual side sets
+ */
+
+
+ ids[0] = 30;
+ ids[1] = 31;
+ ids[2] = 32;
+ ids[3] = 33;
+ ids[4] = 34;
+ ids[5] = 35;
+ ids[6] = 36;
+ ids[7] = 37;
+ ids[8] = 38;
+
+ /* side set #1 - NULL side set */
+ /* do nothing except set num_elem_per_set to 0 */
+
+ /* side set #2 - NULL side set */
+ /* do nothing except set num_elem_per_set to 0 */
+
+ /* side set #3 - quad; 2 sides */
+
+ node_list[0] = 8; node_list[1] = 5;
+ elem_list[0] = 2;
+
+ node_list[2] = 6; node_list[3] = 7;
+ elem_list[1] = 2;
+
+ /* side set #4 - quad; 2 sides spanning 2 elements */
+
+ node_list[4] = 2; node_list[5] = 3;
+ elem_list[2] = 1;
+
+ node_list[6] = 7; node_list[7] = 8;
+ elem_list[3] = 2;
+
+ /* side set #5 - hex; 7 sides */
+
+ node_list[8] = 9; node_list[9] = 12;
+ node_list[10] = 11; node_list[11] = 10;
+ elem_list[4] = 3;
+
+ node_list[12] = 11; node_list[13] = 12;
+ node_list[14] = 16; node_list[15] = 15;
+ elem_list[5] = 3;
+
+ node_list[16] = 16; node_list[17] = 15;
+ node_list[18] = 11; node_list[19] = 12;
+ elem_list[6] = 3;
+
+ node_list[20] = 10; node_list[21] = 11;
+ node_list[22] = 15; node_list[23] = 14;
+ elem_list[7] = 3;
+
+ node_list[24] = 13; node_list[25] = 16;
+ node_list[26] = 12; node_list[27] = 9;
+ elem_list[8] = 3;
+
+ node_list[28] = 14; node_list[29] = 13;
+ node_list[30] = 9; node_list[31] = 10;
+ elem_list[9] = 3;
+
+ node_list[32] = 16; node_list[33] = 13;
+ node_list[34] = 14; node_list[35] = 15;
+ elem_list[10] = 3;
+
+ /* side set #6 - 4-node tetras; 4 sides */
+
+ node_list[36] = 17; node_list[37] = 18;
+ node_list[38] = 20;
+ elem_list[11] = 4;
+
+ node_list[39] = 18; node_list[40] = 19;
+ node_list[41] = 20;
+ elem_list[12] = 4;
+
+ node_list[42] = 17; node_list[43] = 20;
+ node_list[44] = 19;
+ elem_list[13] = 4;
+
+ node_list[45] = 17; node_list[46] = 19;
+ node_list[47] = 18;
+ elem_list[14] = 4;
+
+ /* side set #7 - shells; front and back faces */
+
+ node_list[48] = 1; node_list[49] = 2;
+ node_list[50] = 3; node_list[51] = 4;
+ elem_list[15] = 7;
+
+ node_list[52] = 4; node_list[53] = 3;
+ node_list[54] = 2; node_list[55] = 1;
+ elem_list[16] = 7;
+
+ /* side set #8 - shells; 4 edges */
+
+ node_list[56] = 1; node_list[57] = 2;
+ elem_list[17] = 7;
+
+ node_list[58] = 2; node_list[59] = 3;
+ elem_list[18] = 7;
+
+ node_list[60] = 3; node_list[61] = 4;
+ elem_list[19] = 7;
+
+ node_list[62] = 4; node_list[63] = 1;
+ elem_list[20] = 7;
+
+ /* side set #9 -- 3-node shells -- front and back */
+
+ node_list[64] = 30;
+ node_list[65] = 31;
+ node_list[66] = 32;
+ elem_list[21] = 8;
+
+ node_list[67] = 32;
+ node_list[68] = 31;
+ node_list[69] = 30;
+ elem_list[22] = 8;
+
+ /* set up indices */
+ node_ind[0] = 0;
+ node_ind[1] = 0;
+ node_ind[2] = 0;
+ node_ind[3] = 4;
+ node_ind[4] = 8;
+ node_ind[5] = 36;
+ node_ind[6] = 48;
+ node_ind[7] = 56;
+ node_ind[8] = 64;
+
+ num_elem_per_set[0] = 0;
+ num_elem_per_set[1] = 0;
+ num_elem_per_set[2] = 2;
+ num_elem_per_set[3] = 2;
+ num_elem_per_set[4] = 7;
+ num_elem_per_set[5] = 4;
+ num_elem_per_set[6] = 2;
+ num_elem_per_set[7] = 4;
+ num_elem_per_set[8] = 2;
+
+ num_nodes_per_set[0] = 0;
+ num_nodes_per_set[1] = 0;
+ num_nodes_per_set[2] = 4;
+ num_nodes_per_set[3] = 4;
+ num_nodes_per_set[4] = 28;
+ num_nodes_per_set[5] = 12;
+ num_nodes_per_set[6] = 8;
+ num_nodes_per_set[7] = 8;
+ num_nodes_per_set[8] = 6;
+
+ elem_ind[0] = 0;
+ elem_ind[1] = 0;
+ elem_ind[2] = 0;
+ elem_ind[3] = 2;
+ elem_ind[4] = 4;
+ elem_ind[5] = 11;
+ elem_ind[6] = 15;
+ elem_ind[7] = 17;
+ elem_ind[8] = 21;
+
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+ num_df_per_set[0] = 0;
+ num_df_per_set[1] = 0;
+ num_df_per_set[2] = 4;
+ num_df_per_set[3] = 4;
+ num_df_per_set[4] = 0;
+ num_df_per_set[5] = 0;
+ num_df_per_set[6] = 0;
+ num_df_per_set[7] = 0;
+ num_df_per_set[8] = 0;
+
+ df_ind[0] = 0;
+ df_ind[1] = 0;
+ df_ind[2] = 0;
+ df_ind[3] = 4;
+ df_ind[4] = 0;
+ df_ind[5] = 0;
+ df_ind[6] = 0;
+ df_ind[7] = 0;
+ df_ind[8] = 0;
+
+ 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);
+
+ if (error) {
+ ex_close (exoid);
+ exit(-1);
+ }
+
+/* THIS SECTION IS COMMENTED OUT
+ END COMMENTED OUT SECTION */
+
+
+/* write QA records; test empty and just blank-filled records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ 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_ss.dmp b/cbind/test/testwt_ss.dmp
new file mode 100644
index 0000000..a764024
--- /dev/null
+++ b/cbind/test/testwt_ss.dmp
@@ -0,0 +1,291 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 33 ;
+ num_elem = 8 ;
+ num_el_blk = 8 ;
+ num_node_sets = 2 ;
+ num_side_sets = 9 ;
+ 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 = 4 ;
+ num_att_in_blk7 = 1 ;
+ num_el_in_blk8 = 1 ;
+ num_nod_per_el8 = 3 ;
+ num_att_in_blk8 = 1 ;
+ num_side_ss3 = 2 ;
+ num_df_ss3 = 4 ;
+ num_side_ss4 = 2 ;
+ num_df_ss4 = 4 ;
+ num_side_ss5 = 7 ;
+ num_side_ss6 = 4 ;
+ num_side_ss7 = 2 ;
+ num_side_ss8 = 4 ;
+ num_side_ss9 = 2 ;
+ 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 ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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) ;
+ 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 = "shell" ;
+ float attrib8(num_el_in_blk8, num_att_in_blk8) ;
+ char attrib_name8(num_att_in_blk8, len_string) ;
+ int connect8(num_el_in_blk8, num_nod_per_el8) ;
+ connect8:elem_type = "triangle" ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ float dist_fact_ss3(num_df_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ float dist_fact_ss4(num_df_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int elem_ss6(num_side_ss6) ;
+ int side_ss6(num_side_ss6) ;
+ int elem_ss7(num_side_ss7) ;
+ int side_ss7(num_side_ss7) ;
+ int elem_ss8(num_side_ss8) ;
+ int side_ss8(num_side_ss8) ;
+ int elem_ss9(num_side_ss9) ;
+ int side_ss9(num_side_ss9) ;
+ char qa_records(num_qa_rec, four, len_string) ;
+ char info_records(num_info, len_line) ;
+
+// 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, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14, 15, 16, 17 ;
+
+ ns_status = 0, 0 ;
+
+ ns_prop1 = 0, 0 ;
+
+ ss_status = 0, 0, 1, 1, 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ attrib1 =
+ 0 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 0 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 0 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 0 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 0 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ attrib6 =
+ 0 ;
+
+ attrib_name6 =
+ "" ;
+
+ connect6 =
+ 17, 18, 19, 20, 27, 28, 30, 29 ;
+
+ attrib7 =
+ 0 ;
+
+ attrib_name7 =
+ "" ;
+
+ connect7 =
+ 1, 2, 3, 4 ;
+
+ attrib8 =
+ 0 ;
+
+ attrib_name8 =
+ "" ;
+
+ connect8 =
+ 30, 31, 32 ;
+
+ elem_ss3 = 2, 2 ;
+
+ side_ss3 = 4, 2 ;
+
+ dist_fact_ss3 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss4 = 1, 2 ;
+
+ side_ss4 = 2, 3 ;
+
+ dist_fact_ss4 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss5 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss5 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss6 = 4, 4, 4, 4 ;
+
+ side_ss6 = 1, 2, 3, 4 ;
+
+ elem_ss7 = 7, 7 ;
+
+ side_ss7 = 1, 2 ;
+
+ elem_ss8 = 7, 7, 7, 7 ;
+
+ side_ss8 = 3, 4, 5, 6 ;
+
+ elem_ss9 = 8, 8 ;
+
+ side_ss9 = 1, 2 ;
+
+ qa_records =
+ "TESTWT",
+ "testwt",
+ "07/07/93",
+ "15:41:33",
+ "",
+ " ",
+ "",
+ " " ;
+
+ info_records =
+ "This is the first information record.",
+ "",
+ " " ;
+}
diff --git a/cbind/test/testwtbig.c b/cbind/test/testwtbig.c
new file mode 100644
index 0000000..75b35cc
--- /dev/null
+++ b/cbind/test/testwtbig.c
@@ -0,0 +1,777 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwtbig - test write a BIG 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: testwtbig.c,v 1.4 2006/11/28 14:02:18 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#define BIG 100000
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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_node_sets, num_sides, 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], ids[10];
+ int num_sides_per_set[10], 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], side_ind[10];
+ int num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int ndims, nvars, ngatts, recdim;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float *x, *y, *z, *dummy;
+ float attrib[1], dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char tmpstr[80];
+ char *prop_names[2];
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+ dummy = 0; /* assign this so the Cray compiler doesn't complain */
+
+/* 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.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 */
+
+ num_dim = 3;
+ num_nodes = BIG;
+ num_elem = BIG;
+ num_elem_blk = 5;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+ if (!(x = (float *) calloc(BIG, sizeof(float))))
+ {
+ printf ("couldn't allocate memory for x node array%d\n");
+ exit(1);
+ }
+
+ if (!(y = (float *) calloc(BIG, sizeof(float))))
+ {
+ printf ("couldn't allocate memory for y node array%d\n");
+ exit(1);
+ }
+
+ if (!(z = (float *) calloc(BIG, sizeof(float))))
+ {
+ printf ("couldn't allocate memory for z node array%d\n");
+ exit(1);
+ }
+
+ for (i=0; i<num_nodes; i++)
+ {
+ /* dummy up the coordinate space */
+ x[i]=i;
+ y[i]=i+.1;
+ z[i]=i+.2;
+ }
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+
+/* 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);
+
+ free (elem_map);
+
+
+/* write element block parameters */
+
+ 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_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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ 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);
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ attrib[0] = 6.14159;
+ error = ex_put_elem_attr (exoid, ebids[1], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+/* write individual node sets */
+
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, 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);
+
+
+/* write concatenated node sets; this produces the same information as
+ * the above code which writes individual node sets
+ */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ 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 */
+
+ /* side set #1 - quad */
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+
+ /* side set #2 - quad, spanning 2 elements */
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoid, 34, 5, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* END COMMENTED OUT SECTION */
+
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual side sets
+ */
+
+/* THIS SECTION IS COMMENTED OUT
+
+ 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);
+
+ /* END COMMENTED OUT SECTION */
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWT";
+ qa_record[0][1] = "testwt";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+
+/* write information records */
+
+ num_info = 3;
+
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ 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);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+ }
+
+/* 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwtd.c b/cbind/test/testwtd.c
new file mode 100644
index 0000000..c95da0a
--- /dev/null
+++ b/cbind/test/testwtd.c
@@ -0,0 +1,788 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwtd - 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: testwtd.c,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
+*
+*****************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "netcdf.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_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 num_qa_rec, num_info;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ double *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ double time_value;
+ double x[100], y[100], z[100];
+ double attrib[1], dist_fact[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char *prop_names[2];
+
+ ex_opts (EX_VERBOSE | EX_ABORT);
+
+/* Specify compute and i/o word size */
+
+ CPU_word_size = 8; /* double */
+ IO_word_size = 8; /* use double size (8 bytes) */
+
+/* create EXODUS II file */
+
+ exoid = ex_create ("test.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 */
+
+ num_dim = 3;
+ num_nodes = 26;
+ num_elem = 5;
+ num_elem_blk = 5;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+
+/* 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);
+
+ free (elem_map);
+
+
+/* write element block parameters */
+
+ 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_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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+
+
+ 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);
+
+ error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
+ num_nodes_per_elem[0], 1);
+ printf ("after ex_put_elem_block, error = %d\n", error);
+
+ 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);
+
+ 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);
+
+ 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);
+
+
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+
+ 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);
+
+ attrib[0] = 6.14159;
+ error = ex_put_elem_attr (exoid, ebids[1], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+
+/* write individual node sets */
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set_dist_fact, 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);
+
+
+/* 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;
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ /* side set #1 - quad */
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ /* side set #2 - quad, spanning 2 elements */
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ /* side set #3 - hex */
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoid, 34, 5, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5;
+
+ 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);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ /* END COMMENTED OUT SECTION */
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWTD";
+ qa_record[0][1] = "testwtd";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+
+/* write information records */
+
+ num_info = 3;
+
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ glob_var_vals = (double *) calloc (num_glo_vars, CPU_word_size);
+ nodal_var_vals = (double *) calloc (num_nodes, CPU_word_size);
+ elem_var_vals = (double *) calloc (4, CPU_word_size);
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (double)(i+1)/100.;
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+ }
+
+/* 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ return 0;
+}
diff --git a/cbind/test/testwtm.c b/cbind/test/testwtm.c
new file mode 100644
index 0000000..c0a9328
--- /dev/null
+++ b/cbind/test/testwtm.c
@@ -0,0 +1,1405 @@
+/*
+ * 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.
+ *
+ */
+/*****************************************************************************
+*
+* testwtm - test write many ExodusII database files
+*
+* 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. It tests multiple simultaneous output files.
+*
+* $Id: testwtm.c,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
+*
+*****************************************************************************/
+
+#define EX_TEST_INDIV_NODESET
+#define EX_TEST_INDIV_SIDESET
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "exodusII.h"
+#include "netcdf.h"
+int main (int argc, char **argv)
+{
+ int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
+ int exoidm[10], num_dim2, num_nodes2, num_elem2,num_elem_blk2;
+ int num_elem_in_block[10], num_node_sets, num_nodes_per_elem[10];
+ int num_elem_in_block2[10], num_node_sets2, num_nodes_per_elem2[10];
+ int num_side_sets, error;
+ int num_side_sets2, nexofiles = 5;
+ int i, j, k, m, n;
+ int *elem_map, *connect, node_list[100],elem_list[100],side_list[100];
+ int *elem_map2, *connect2, node_list2[100],elem_list2[100],side_list2[100];
+ int ebids[10], ids[10];
+ int ebids2[10], ids2[10];
+ int num_nodes_per_set[10], num_elem_per_set[10];
+ int num_nodes_per_set2[10], num_elem_per_set2[10];
+ int num_df_per_set[10], num_df_per_set2[10];
+ int df_ind[10], node_ind[10], elem_ind[10];
+ int df_ind2[10],node_ind2[10],elem_ind2[10];
+ int num_qa_rec, num_info;
+ int num_qa_rec2,num_info2;
+ int num_glo_vars, num_nod_vars, num_ele_vars;
+ int num_glo_vars2, num_nod_vars2, num_ele_vars2;
+ int *truth_tab;
+ int whole_time_step, num_time_steps;
+ int CPU_word_size,IO_word_size;
+ int prop_array[2];
+
+ float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
+ float time_value;
+ float time_value2;
+ float x[100], y[100], z[100];
+ float attrib[1], dist_fact[1008];
+ float attrib2[1], dist_fact2[100];
+ char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
+ char *coord_names2[3], *qa_record2[2][4], *info2[3], *var_names2[3];
+ char tmpstr[80];
+ char *prop_names[2];
+ char exofname[256];
+
+ 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 files */
+
+ exoid = ex_create ("test.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);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ sprintf(exofname,"test%d.exo",n);
+ printf("test file name: %s\n",exofname);
+ exoidm[n]= ex_create (exofname, /* 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 %s, exoid = %d\n", exofname,exoidm[n]);
+
+ }
+
+ /* ncopts = NC_VERBOSE; */
+
+/* initialize file with parameters */
+
+ num_dim = 3;
+ num_nodes = 26;
+ num_elem = 5;
+ num_elem_blk = 5;
+ num_node_sets = 2;
+ num_side_sets = 5;
+
+ error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
+ num_elem_blk, num_node_sets, num_side_sets);
+
+ printf ("after ex_put_init, error = %d\n", error);
+
+
+
+/* initialize file n with parameters */
+
+ num_dim2 = 3;
+ num_nodes2 = 26;
+ num_elem2 = 5;
+ num_elem_blk2 = 5;
+ num_node_sets2 = 2;
+ num_side_sets2 = 5;
+
+ for (n=0; n<nexofiles; n++)
+ {
+ sprintf(tmpstr,"This is test %d",n);
+
+ error=ex_put_init (exoidm[n],tmpstr,num_dim2,num_nodes2,num_elem2,
+ num_elem_blk2, num_node_sets2, num_side_sets2);
+
+ printf ("after ex_put_init (%d), error = %d\n", n, error);
+ }
+
+/* write nodal coordinates values and names to database */
+
+/* Quad #1 */
+ x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
+ x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
+ x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
+ x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
+
+/* Quad #2 */
+ x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
+ x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
+ x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
+ x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
+
+/* Hex #1 */
+ x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
+ x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
+ x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
+ x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
+ x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
+ x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
+ x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
+ x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
+
+/* Tetra #1 */
+ x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
+ x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
+ x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
+ x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
+
+/* Wedge #1 */
+ x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
+ x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
+ x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
+ x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
+ x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
+ x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
+
+ error = ex_put_coord (exoid, x, y, z);
+ printf ("after ex_put_coord, error = %d\n", error);
+
+/* write nodal coordinates values and names to database */
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_coord (exoidm[n], x, y, z);
+ printf ("after ex_put_coord (%d), error = %d\n", n,error);
+ }
+
+ coord_names[0] = "xcoor";
+ coord_names[1] = "ycoor";
+ coord_names[2] = "zcoor";
+
+ error = ex_put_coord_names (exoid, coord_names);
+ printf ("after ex_put_coord_names, error = %d\n", error);
+
+ coord_names2[0] = "xcoor";
+ coord_names2[1] = "ycoor";
+ coord_names2[2] = "zcoor";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_coord_names (exoidm[n], coord_names2);
+ printf ("after ex_put_coord_names (%d), error = %d\n", n, error);
+ }
+
+
+/* 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);
+
+ free (elem_map);
+
+ elem_map2= (int *) calloc(num_elem2, sizeof(int));
+
+ for (i=1; i<=num_elem2; i++)
+ {
+ elem_map2[i-1] = i;
+ }
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_map (exoidm[n], elem_map2);
+ printf ("after ex_put_map (%d), error = %d\n", n, error);
+ }
+
+ free (elem_map2);
+
+
+/* write element block parameters */
+
+ 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_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 #3 are 4-node tetras */
+ num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids[0] = 10;
+ ebids[1] = 11;
+ ebids[2] = 12;
+ ebids[3] = 13;
+ ebids[4] = 14;
+
+ 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);
+
+ 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);
+
+ error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
+ num_nodes_per_elem[2], 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);
+
+ 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);
+
+/* 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);
+
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+/* files n */
+
+ num_elem_in_block2[0] = 1;
+ num_elem_in_block2[1] = 1;
+ num_elem_in_block2[2] = 1;
+ num_elem_in_block2[3] = 1;
+ num_elem_in_block2[4] = 1;
+
+ num_nodes_per_elem2[0] = 4; /* elements in block #1 are 4-node quads */
+ num_nodes_per_elem2[1] = 4; /* elements in block #2 are 4-node quads */
+ num_nodes_per_elem2[2] = 8; /* elements in block #3 are 8-node hexes */
+ num_nodes_per_elem2[3] = 4; /* elements in block #3 are 4-node tetras */
+ num_nodes_per_elem2[4] = 6; /* elements in block #3 are 6-node wedges */
+
+ ebids2[0] = 10;
+ ebids2[1] = 11;
+ ebids2[2] = 12;
+ ebids2[3] = 13;
+ ebids2[4] = 14;
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error=ex_put_elem_block(exoidm[n],ebids2[0], "quad", num_elem_in_block2[0],
+ num_nodes_per_elem2[0], 1);
+ printf ("after ex_put_elem_block (%d), error = %d\n", n, error);
+
+ error=ex_put_elem_block(exoidm[n],ebids2[1], "quad", num_elem_in_block2[1],
+ num_nodes_per_elem2[1], 1);
+ printf ("after ex_put_elem_block (%d), error = %d\n", n, error);
+
+ error=ex_put_elem_block(exoidm[n],ebids2[2], "hex", num_elem_in_block2[2],
+ num_nodes_per_elem2[2], 1);
+ printf ("after ex_put_elem_block (%d), error = %d\n", n, error);
+
+ error=ex_put_elem_block(exoidm[n],ebids2[3], "tetra",num_elem_in_block2[3],
+ num_nodes_per_elem2[3], 1);
+ printf ("after ex_put_elem_block (%d), error = %d\n", n, error);
+
+ error=ex_put_elem_block(exoidm[n],ebids2[4], "wedge",num_elem_in_block2[4],
+ num_nodes_per_elem2[4], 1);
+ printf ("after ex_put_elem_block (%d), error = %d\n", n, error);
+
+/* write element block properties */
+
+ prop_names[0] = "MATL";
+ prop_names[1] = "DENSITY";
+ error = ex_put_prop_names(exoidm[n],EX_ELEM_BLOCK,2,prop_names);
+ printf ("after ex_put_prop_names (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_ELEM_BLOCK, ebids2[0], "MATL", 100);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ error = ex_put_prop(exoidm[n], EX_ELEM_BLOCK, ebids2[1], "MATL", 200);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ error = ex_put_prop(exoidm[n], EX_ELEM_BLOCK, ebids2[2], "MATL", 300);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ error = ex_put_prop(exoidm[n], EX_ELEM_BLOCK, ebids2[3], "MATL", 400);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ error = ex_put_prop(exoidm[n], EX_ELEM_BLOCK, ebids2[4], "MATL", 500);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ }
+
+/* write element connectivity */
+
+ connect = (int *) calloc(8, sizeof(int));
+ connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
+
+ error = ex_put_elem_conn (exoid, ebids[0], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
+
+ error = ex_put_elem_conn (exoid, ebids[1], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ 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);
+
+ connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
+
+ error = ex_put_elem_conn (exoid, ebids[3], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ connect[0] = 21; connect[1] = 22; connect[2] = 23;
+ connect[3] = 24; connect[4] = 25; connect[5] = 26;
+
+ error = ex_put_elem_conn (exoid, ebids[4], connect);
+ printf ("after ex_put_elem_conn, error = %d\n", error);
+
+ free (connect);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ connect2 = (int *) calloc(8, sizeof(int));
+ connect2[0] = 1; connect2[1] = 2; connect2[2] = 3; connect2[3] = 4;
+
+ error = ex_put_elem_conn (exoidm[n], ebids[0], connect2);
+ printf ("after ex_put_elem_conn (%d), error = %d\n", n, error);
+
+ connect2[0] = 5; connect2[1] = 6; connect2[2] = 7; connect2[3] = 8;
+
+ error = ex_put_elem_conn (exoidm[n], ebids[1], connect2);
+ printf ("after ex_put_elem_conn (%d), error = %d\n", n, error);
+
+ connect2[0] = 9; connect2[1] = 10; connect2[2] = 11; connect2[3] = 12;
+ connect2[4] = 13; connect2[5] = 14; connect2[6] = 15; connect2[7] = 16;
+
+ error = ex_put_elem_conn (exoidm[n], ebids2[2], connect2);
+ printf ("after ex_put_elem_conn (%d), error = %d\n", n, error);
+
+ connect2[0] = 17; connect2[1] = 18; connect2[2] = 19; connect2[3] = 20;
+
+ error = ex_put_elem_conn (exoidm[n], ebids2[3], connect2);
+ printf ("after ex_put_elem_conn (%d), error = %d\n", n, error);
+
+ connect2[0] = 21; connect2[1] = 22; connect2[2] = 23;
+ connect2[3] = 24; connect2[4] = 25; connect2[5] = 26;
+
+ error = ex_put_elem_conn (exoidm[n], ebids2[4], connect2);
+ printf ("after ex_put_elem_conn (%d), error = %d\n", n, error);
+
+ free (connect2);
+ }
+
+
+/* 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);
+
+ attrib[0] = 6.14159;
+ error = ex_put_elem_attr (exoid, ebids[1], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[2], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[3], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ error = ex_put_elem_attr (exoid, ebids[4], attrib);
+ printf ("after ex_put_elem_attr, error = %d\n", error);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ attrib2[0] = 3.;
+ error = ex_put_elem_attr (exoidm[n], ebids[0], attrib2);
+ printf ("after ex_put_elem_attr (%d), error = %d\n", n, error);
+
+ attrib2[0] = 6.;
+ error = ex_put_elem_attr (exoidm[n], ebids[1], attrib2);
+ printf ("after ex_put_elem_attr (%d), error = %d\n", n, error);
+
+ error = ex_put_elem_attr (exoidm[n], ebids[2], attrib2);
+ printf ("after ex_put_elem_attr (%d), error = %d\n", n, error);
+
+ error = ex_put_elem_attr (exoidm[n], ebids[3], attrib2);
+ printf ("after ex_put_elem_attr (%d), error = %d\n", n, error);
+
+ error = ex_put_elem_attr (exoidm[n], ebids[4], attrib2);
+ printf ("after ex_put_elem_attr (%d), error = %d\n", n, error);
+ }
+
+#ifdef EX_TEST_INDIV_NODESET
+/* write individual node sets */
+
+ error = ex_put_node_set_param (exoid, 20, 5, 5);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 100; node_list[1] = 101; node_list[2] = 102;
+ node_list[3] = 103; node_list[4] = 104;
+
+ 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;
+
+ error = ex_put_node_set (exoid, 20, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
+ printf ("after ex_put_node_set, error = %d\n", error);
+
+ error = ex_put_node_set_param (exoid, 21, 3, 3);
+ printf ("after ex_put_node_set_param, error = %d\n", error);
+
+ node_list[0] = 200; node_list[1] = 201; node_list[2] = 202;
+
+ dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
+
+ error = ex_put_node_set (exoid, 21, node_list);
+ printf ("after ex_put_node_set, error = %d\n", error);
+ error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
+ printf ("after ex_put_node_set, 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);
+
+/* file 2 */
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_node_set_param (exoidm[n], 20, 5, 5);
+ printf ("after ex_put_node_set_param (%d), error = %d\n", n, error);
+
+ node_list2[0] = 100; node_list2[1] = 101; node_list2[2] = 102;
+ node_list2[3] = 103; node_list2[4] = 104;
+
+ dist_fact2[0] = 1.0; dist_fact2[1] = 2.0; dist_fact2[2] = 3.0;
+ dist_fact2[3] = 4.0; dist_fact2[4] = 5.0;
+
+ error = ex_put_node_set (exoidm[n], 20, node_list2);
+ printf ("after ex_put_node_set (%d), error = %d\n", n, error);
+ error = ex_put_node_set_dist_fact (exoidm[n], 20, dist_fact2);
+ printf ("after ex_put_node_set (%d), error = %d\n", n, error);
+
+ error = ex_put_node_set_param (exoidm[n], 21, 3, 3);
+ printf ("after ex_put_node_set_param (%d), error = %d\n", n, error);
+
+ node_list2[0] = 200; node_list2[1] = 201; node_list2[2] = 202;
+
+ dist_fact2[0] = 1.1; dist_fact2[1] = 2.1; dist_fact2[2] = 3.1;
+
+ error = ex_put_node_set (exoidm[n], 21, node_list2);
+ printf ("after ex_put_node_set (%d), error = %d\n", n, error);
+ error = ex_put_node_set_dist_fact (exoidm[n], 21, dist_fact2);
+ printf ("after ex_put_node_set (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+ prop_array[0] = 1000;
+ prop_array[1] = 2000;
+
+ error = ex_put_prop_array(exoidm[n], EX_NODE_SET, "VELOCITY", prop_array);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+ }
+
+#else /* EX_TEST_INDIV_NODESET */
+/* write concatenated node sets; this produces the same information as
+ * the above code which writes individual node sets
+ */
+
+ 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, node_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);
+
+ ids2[0] = 20; ids2[1] = 21;
+
+ num_nodes_per_set2[0] = 5; num_nodes_per_set2[1] = 3;
+
+ node_ind2[0] = 0; node_ind2[1] = 5;
+
+ node_list2[0] = 100; node_list2[1] = 101; node_list2[2] = 102;
+ node_list2[3] = 103; node_list2[4] = 104;
+ node_list2[5] = 200; node_list2[6] = 201; node_list2[7] = 202;
+
+ num_df_per_set2[0] = 5; num_df_per_set2[1] = 3;
+
+ df_ind2[0] = 0; df_ind2[1] = 5;
+
+ dist_fact2[0] = 1.0; dist_fact2[1] = 2.0; dist_fact2[2] = 3.0;
+ dist_fact2[3] = 4.0; dist_fact2[4] = 5.0;
+ dist_fact2[5] = 1.1; dist_fact2[6] = 2.1; dist_fact2[7] = 3.1;
+
+ prop_array2[0] = 1000;
+ prop_array2[1] = 2000;
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_concat_node_sets (exoidm[n], ids2, num_nodes_per_set2,
+ num_df_per_set2, node_ind2,
+ df_ind2, node_list2, dist_fact2);
+ printf ("after ex_put_concat_node_sets, error = %d\n", error);
+
+
+ error = ex_put_prop(exoidm[n], EX_NODE_SET, 20, "FACE", 4);
+ printf ("after ex_put_prop, error = %d\n", error);
+ error = ex_put_prop(exoidm[n], EX_NODE_SET, 21, "FACE", 5);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop_array(exoidm[n], EX_NODE_SET, "VELOCITY", prop_array2);
+ printf ("after ex_put_prop_array, error = %d\n", error);
+ }
+
+#endif /* EX_TEST_INDIV_NODESET */
+
+#ifdef TEST_INDIV_SIDESET
+/* write individual side sets */
+
+ /* side set #1 - quad */
+
+ error = ex_put_side_set_param (exoid, 30, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 2; elem_list[1] = 2;
+
+ side_list[0] = 4; side_list[1] = 2;
+
+ dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
+ dist_fact[3] = 30.3;
+
+ error = ex_put_side_set (exoid, 30, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ /* side set #2 - quad spanning elements */
+
+ error = ex_put_side_set_param (exoid, 31, 2, 4);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 1; elem_list[1] = 2;
+
+ side_list[0] = 2; side_list[1] = 3;
+
+ dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
+ dist_fact[3] = 31.3;
+
+ error = ex_put_side_set (exoid, 31, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
+ printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoid, 32, 7, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 3; elem_list[1] = 3;
+ elem_list[2] = 3; elem_list[3] = 3;
+ elem_list[4] = 3; elem_list[5] = 3;
+ elem_list[6] = 3;
+
+ side_list[0] = 5; side_list[1] = 3;
+ side_list[2] = 3; side_list[3] = 2;
+ side_list[4] = 4; side_list[5] = 1;
+ side_list[6] = 6;
+
+ error = ex_put_side_set (exoid, 32, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoid, 33, 4, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 4; elem_list[1] = 4;
+ elem_list[2] = 4; elem_list[3] = 4;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+
+ error = ex_put_side_set (exoid, 33, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoid, 34, 5, 0);
+ printf ("after ex_put_side_set_param, error = %d\n", error);
+
+ elem_list[0] = 5; elem_list[1] = 5;
+ elem_list[2] = 5; elem_list[3] = 5;
+ elem_list[4] = 5;
+
+ side_list[0] = 1; side_list[1] = 2;
+ side_list[2] = 3; side_list[3] = 4;
+ side_list[4] = 5;
+
+ error = ex_put_side_set (exoid, 34, elem_list, side_list);
+ printf ("after ex_put_side_set, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+/* file 2 */
+
+ for (n=0; n<nexofiles; n++)
+ {
+ /* side set 1 */
+
+ error = ex_put_side_set_param (exoidm[n], 30, 2, 4);
+ printf ("after ex_put_side_set_param (%d), error = %d\n", n, error);
+
+ elem_list2[0] = 2; elem_list2[1] = 2;
+
+ side_list2[0] = 4; side_list2[1] = 2;
+
+ dist_fact2[0] = 30.0; dist_fact2[1] = 30.1;
+ dist_fact2[2] = 30.2; dist_fact2[3] = 30.3;
+
+ error = ex_put_side_set (exoidm[n], 30, elem_list2, side_list2);
+ printf ("after ex_put_side_set (%d), error = %d\n", n, error);
+
+ error = ex_put_side_set_dist_fact (exoidm[n], 30, dist_fact2);
+ printf ("after ex_put_side_set_dist_fact (%d), error = %d\n", n, error);
+
+ /* side set 2 */
+
+ error = ex_put_side_set_param (exoidm[n], 31, 2, 4);
+ printf ("after ex_put_side_set_param (%d), error = %d\n", n, error);
+
+ elem_list2[0] = 1; elem_list2[1] = 2;
+
+ side_list2[0] = 2; side_list2[1] = 3;
+
+ dist_fact2[0] = 31.0; dist_fact2[1] = 31.1;
+ dist_fact2[2] = 31.2; dist_fact2[3] = 31.3;
+
+ error = ex_put_side_set (exoidm[n], 31, elem_list2, side_list2);
+ printf ("after ex_put_side_set (%d), error = %d\n", n, error);
+
+ error = ex_put_side_set_dist_fact (exoidm[n], 31, dist_fact2);
+ printf ("after ex_put_side_set_dist_fact (%d), error = %d\n", n, error);
+
+ /* side set #3 - hex */
+
+ error = ex_put_side_set_param (exoidm[n], 32, 7, 0);
+ printf ("after ex_put_side_set_param (%d), error = %d\n", n, error);
+
+ elem_list2[0] = 3; elem_list2[1] = 3;
+ elem_list2[2] = 3; elem_list2[3] = 3;
+ elem_list2[4] = 3; elem_list2[5] = 3;
+ elem_list2[6] = 3;
+
+ side_list2[0] = 5; side_list2[1] = 3;
+ side_list2[2] = 3; side_list2[3] = 2;
+ side_list2[4] = 4; side_list2[5] = 1;
+ side_list2[6] = 6;
+
+ error = ex_put_side_set (exoidm[n], 32, elem_list2, side_list2);
+ printf ("after ex_put_side_set (%d), error = %d\n", n, error);
+
+ /* side set #4 - tetras */
+
+ error = ex_put_side_set_param (exoidm[n], 33, 4, 0);
+ printf ("after ex_put_side_set_param (%d), error = %d\n", n, error);
+
+ elem_list2[0] = 4; elem_list2[1] = 4;
+ elem_list2[2] = 4; elem_list2[3] = 4;
+
+ side_list2[0] = 1; side_list2[1] = 2;
+ side_list2[2] = 3; side_list2[3] = 4;
+
+ error = ex_put_side_set (exoidm[n], 33, elem_list2, side_list2);
+ printf ("after ex_put_side_set (%d), error = %d\n", n, error);
+
+ /* side set #5 - wedges */
+
+ error = ex_put_side_set_param (exoidm[n], 34, 5, 0);
+ printf ("after ex_put_side_set_param (%d), error = %d\n", n, error);
+
+ elem_list2[0] = 5; elem_list2[1] = 5;
+ elem_list2[2] = 5; elem_list2[3] = 5;
+ elem_list2[4] = 5;
+
+ side_list2[0] = 1; side_list2[1] = 2;
+ side_list2[2] = 3; side_list2[3] = 4;
+ side_list2[4] = 5;
+
+ error = ex_put_side_set (exoidm[n], 34, elem_list2, side_list2);
+ printf ("after ex_put_side_set (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+ }
+
+#else /* TEST_INDIV_SIDESET */
+/* write concatenated side sets; this produces the same information as
+ * the above code which writes individual 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);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+ error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop, error = %d\n", error);
+
+
+/* file 2 */
+
+ ids2[0] = 30;
+ ids2[1] = 31;
+ ids2[2] = 32;
+ ids2[3] = 33;
+ ids2[4] = 34;
+
+ node_list2[0] = 8; node_list2[1] = 5;
+ node_list2[2] = 6; node_list2[3] = 7;
+
+ node_list2[4] = 2; node_list2[5] = 3;
+ node_list2[6] = 7; node_list2[7] = 8;
+
+ node_list2[8] = 9; node_list2[9] = 12;
+ node_list2[10] = 11; node_list2[11] = 10;
+
+ node_list2[12] = 11; node_list2[13] = 12;
+ node_list2[14] = 16; node_list2[15] = 15;
+
+ node_list2[16] = 16; node_list2[17] = 15;
+ node_list2[18] = 11; node_list2[19] = 12;
+
+ node_list2[20] = 10; node_list2[21] = 11;
+ node_list2[22] = 15; node_list2[23] = 14;
+
+ node_list2[24] = 13; node_list2[25] = 16;
+ node_list2[26] = 12; node_list2[27] = 9;
+
+ node_list2[28] = 14; node_list2[29] = 13;
+ node_list2[30] = 9; node_list2[31] = 10;
+
+ node_list2[32] = 16; node_list2[33] = 13;
+ node_list2[34] = 14; node_list2[35] = 15;
+
+ node_list2[36] = 17; node_list2[37] = 18;
+ node_list2[38] = 20;
+
+ node_list2[39] = 18; node_list2[40] = 19;
+ node_list2[41] = 20;
+
+ node_list2[42] = 20; node_list2[43] = 19;
+ node_list2[44] = 17;
+
+ node_list2[45] = 19; node_list2[46] = 18;
+ node_list2[47] = 17;
+
+ node_list2[48] = 25; node_list2[49] = 24;
+ node_list2[50] = 21; node_list2[51] = 22;
+
+ node_list2[52] = 26; node_list2[53] = 25;
+ node_list2[54] = 22; node_list2[55] = 23;
+
+ node_list2[56] = 26; node_list2[57] = 23;
+ node_list2[58] = 21; node_list2[59] = 24;
+
+ node_list2[60] = 23; node_list2[61] = 22;
+ node_list2[62] = 21;
+
+ node_list2[63] = 24; node_list2[64] = 25;
+ node_list2[65] = 26;
+
+ node_ind2[0] = 0;
+ node_ind2[1] = 4;
+ node_ind2[2] = 8;
+ node_ind2[3] = 36;
+ node_ind2[4] = 47;
+
+ num_elem_per_set2[0] = 2;
+ num_elem_per_set2[1] = 2;
+ num_elem_per_set2[2] = 7;
+ num_elem_per_set2[3] = 4;
+ num_elem_per_set2[4] = 5;
+
+ num_nodes_per_set2[0] = 4;
+ num_nodes_per_set2[1] = 4;
+ num_nodes_per_set2[2] = 28;
+ num_nodes_per_set2[3] = 12;
+ num_nodes_per_set2[4] = 18;
+
+ elem_ind2[0] = 0;
+ elem_ind2[1] = 2;
+ elem_ind2[2] = 4;
+ elem_ind2[3] = 11;
+ elem_ind2[4] = 15;
+
+ elem_list2[0] = 2; elem_list2[1] = 2;
+ elem_list2[2] = 1; elem_list2[3] = 2;
+ elem_list2[4] = 3; elem_list2[5] = 3;
+ elem_list2[6] = 3; elem_list2[7] = 3;
+ elem_list2[8] = 3; elem_list2[9] = 3;
+ elem_list2[10] = 3; elem_list2[11] = 4;
+ elem_list2[12] = 4; elem_list2[13] = 4;
+ elem_list2[14] = 4; elem_list2[15] = 5;
+ elem_list2[16] = 5; elem_list2[17] = 5;
+ elem_list2[18] = 5; elem_list2[19] = 5;
+
+ num_df_per_set2[0] = 4;
+ num_df_per_set2[1] = 4;
+ num_df_per_set2[2] = 0;
+ num_df_per_set2[3] = 0;
+ num_df_per_set2[4] = 0;
+
+ df_ind2[0] = 0;
+ df_ind2[1] = 4;
+
+ dist_fact2[0] = 30.0; dist_fact2[1] = 30.1;
+ dist_fact2[2] = 30.2; dist_fact2[3] = 30.3;
+
+ dist_fact2[4] = 31.0; dist_fact2[5] = 31.1;
+ dist_fact2[6] = 31.2; dist_fact2[7] = 31.3;
+
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_cvt_nodes_to_sides(exoidm[n],
+ num_elem_per_set2,
+ num_nodes_per_set2,
+ elem_ind2,
+ node_ind2,
+ elem_list2,
+ node_list2,
+ side_list2);
+ printf ("after ex_cvt_nodes_to_sides (%d), error = %d\n", n, error);
+
+ error = ex_put_concat_side_sets (exoidm[n], ids2, num_elem_per_set2,
+ num_df_per_set2, elem_ind2, df_ind2,
+ elem_list2, side_list2, dist_fact2);
+ printf ("after ex_put_concat_side_sets (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_SIDE_SET, 30, "COLOR", 100);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+ error = ex_put_prop(exoidm[n], EX_SIDE_SET, 31, "COLOR", 101);
+ printf ("after ex_put_prop (%d), error = %d\n", n, error);
+
+
+ }
+
+
+
+ /* END COMMENTED OUT SECTION */
+
+#endif /* TEST_INDIV_SIDESET */
+
+/* write QA records */
+
+ num_qa_rec = 2;
+
+
+ qa_record[0][0] = "TESTWTM";
+ qa_record[0][1] = "testwtm";
+ qa_record[0][2] = "07/07/93";
+ qa_record[0][3] = "15:41:33";
+ qa_record[1][0] = "FASTQ";
+ qa_record[1][1] = "fastq";
+ qa_record[1][2] = "07/07/93";
+ qa_record[1][3] = "16:41:33";
+
+ error = ex_put_qa (exoid, num_qa_rec, qa_record);
+ printf ("after ex_put_qa, error = %d\n", error);
+
+ num_qa_rec2 = 2;
+
+ qa_record2[0][0] = "TESTWTM";
+ qa_record2[0][1] = "testwtm";
+ qa_record2[0][2] = "07/07/93";
+ qa_record2[0][3] = "15:41:33";
+ qa_record2[1][0] = "FASTQ";
+ qa_record2[1][1] = "fastq";
+ qa_record2[1][2] = "07/07/93";
+ qa_record2[1][3] = "16:41:33";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_qa (exoidm[n], num_qa_rec2, qa_record2);
+ printf ("after ex_put_qa (%d), error = %d\n", n, error);
+ }
+
+
+/* write information records */
+
+ num_info = 3;
+
+ info[0] = "This is the first information record.";
+ info[1] = "This is the second information record.";
+ info[2] = "This is the third information record.";
+
+ error = ex_put_info (exoid, num_info, info);
+ printf ("after ex_put_info, error = %d\n", error);
+
+ num_info2 = 3;
+
+ info2[0] = "This is the first information record.";
+ info2[1] = "This is the second information record.";
+ info2[2] = "This is the third information record.";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_info (exoidm[n], num_info2, info2);
+ printf ("after ex_put_info (%d), error = %d\n", n, error);
+ }
+
+
+/* write results variables parameters and names */
+
+ num_glo_vars = 1;
+
+ 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_var_names (exoid, "g", num_glo_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_glo_vars2 = 1;
+
+ var_names2[0] = "glo_vars";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_var_param (exoidm[n], "g", num_glo_vars2);
+ printf ("after ex_put_var_param (%d), error = %d\n", n, error);
+ error = ex_put_var_names (exoidm[n], "g", num_glo_vars2, var_names2);
+ printf ("after ex_put_var_names (%d), error = %d\n", n, error);
+ }
+
+ num_nod_vars = 2;
+
+ var_names[0] = "nod_var0";
+ 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_var_names (exoid, "n", num_nod_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_nod_vars2 = 2;
+
+ var_names2[0] = "nod_var0";
+ var_names2[1] = "nod_var1";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_var_param (exoidm[n], "n", num_nod_vars2);
+ printf ("after ex_put_var_param (%d), error = %d\n", n, error);
+ error = ex_put_var_names (exoidm[n], "n", num_nod_vars2, var_names2);
+ printf ("after ex_put_var_names (%d), error = %d\n", n, error);
+ }
+
+
+ num_ele_vars = 3;
+
+ var_names[0] = "ele_var0";
+ 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_var_names (exoid, "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names, error = %d\n", error);
+
+ num_ele_vars2 = 3;
+
+ var_names2[0] = "ele_var20";
+ var_names2[1] = "ele_var21";
+ var_names2[2] = "ele_var22";
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_var_param (exoidm[n], "e", num_ele_vars2);
+ printf ("after ex_put_var_param (%d), error = %d\n", n, error);
+ error = ex_put_var_names (exoidm[n], "e", num_ele_vars, var_names);
+ printf ("after ex_put_var_names (%d), error = %d\n", n, error);
+ }
+
+
+
+/* write element variable truth table */
+
+ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
+
+ k = 0;
+ for (i=0; i<num_elem_blk; i++)
+ {
+ for (j=0; j<num_ele_vars; j++)
+ {
+ truth_tab[k++] = 1;
+ }
+ }
+
+ error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
+ printf ("after ex_put_elem_var_tab, error = %d\n", error);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error=ex_put_elem_var_tab(exoidm[n],num_elem_blk,num_ele_vars,truth_tab);
+ printf ("after ex_put_elem_var_tab (%d), error = %d\n", n, error);
+ }
+
+ free (truth_tab);
+
+
+/* for each time step, write the analysis results;
+ * the code below fills the arrays glob_var_vals,
+ * nodal_var_vals, and elem_var_vals with values for debugging purposes;
+ * obviously the analysis code will populate these arrays
+ */
+
+ whole_time_step = 1;
+ num_time_steps = 10;
+
+ glob_var_vals = (float *) calloc (num_glo_vars, sizeof(CPU_word_size));
+ nodal_var_vals = (float *) calloc (num_nodes, sizeof(CPU_word_size));
+ elem_var_vals = (float *) calloc (4, sizeof(CPU_word_size));
+
+ for (i=0; i<num_time_steps; i++)
+ {
+ time_value = (float)(i+1)/100.;
+ time_value2 = (float)(i+1)/100.;
+
+
+/* write time value */
+
+ error = ex_put_time (exoid, whole_time_step, &time_value);
+ printf ("after ex_put_time, error = %d\n", error);
+
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_time (exoidm[n], whole_time_step, &time_value2);
+ printf ("after ex_put_time (%d), error = %d\n", n, error);
+ }
+
+/* write global variables */
+
+ for (j=0; j<num_glo_vars; j++)
+ {
+ glob_var_vals[j] = (float)(j+2) * time_value;
+ }
+
+ error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars, error = %d\n", error);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_glob_vars (exoidm[n], whole_time_step, num_glo_vars,
+ glob_var_vals);
+ printf ("after ex_put_glob_vars (%d), error = %d\n", n, error);
+
+ }
+/* 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);
+ printf ("after ex_put_nodal_var, error = %d\n", error);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_nodal_var (exoidm[n], whole_time_step, k, num_nodes,
+ nodal_var_vals);
+ printf ("after ex_put_nodal_var (%d), error = %d\n", n, error);
+ }
+ }
+
+/* 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);
+ printf ("after ex_put_elem_var, error = %d\n", error);
+
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_put_elem_var (exoidm[n], whole_time_step, k, ebids[j],
+ num_elem_in_block[j], elem_var_vals);
+ printf ("after ex_put_elem_var (%d), error = %d\n", n, error);
+ }
+ }
+ }
+
+ whole_time_step++;
+
+/* update the data file; this should be done at the end of every time step
+ * to ensure that no data is lost if the analysis dies
+ */
+ error = ex_update (exoid);
+ printf ("after ex_update, error = %d\n", error);
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_update (exoidm[n]);
+ printf ("after ex_update (%d), error = %d\n", n, error);
+ }
+ }
+ free(glob_var_vals);
+ free(nodal_var_vals);
+ free(elem_var_vals);
+
+
+/* close the EXODUS files
+ */
+ error = ex_close (exoid);
+ printf ("after ex_close, error = %d\n", error);
+ for (n=0; n<nexofiles; n++)
+ {
+ error = ex_close (exoidm[n]);
+ printf ("after ex_close (%d), error = %d\n", n, error);
+ }
+ return 0;
+}
diff --git a/exodusii.dsp b/exodusii.dsp
new file mode 100644
index 0000000..9a60605
--- /dev/null
+++ b/exodusii.dsp
@@ -0,0 +1,497 @@
+# 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.
+#
+
+# Microsoft Developer Studio Project File - Name="exodusii" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=exodusii - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exodusii.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exodusii.mak" CFG="exodusii - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exodusii - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "exodusii - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exodusii - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "$(CUBITROOT)/netcdf/netcdf-3.4.snl/include" /I "../../include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "EX_ERR_STR" /D "NT" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/nt/libexoIIv2c406.lib"
+
+!ELSEIF "$(CFG)" == "exodusii - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(CUBITROOT)/netcdf/netcdf-3.4.snl/include" /I "../../include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "EX_ERR_STR" /D "NT" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/nt/libexoIIv2c406_db.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "exodusii - Win32 Release"
+# Name "exodusii - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\ex_conv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\ex_utils.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exclos.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\excn2s.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\excopy.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\excre.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exerr.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgatm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgcns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgcon.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgcor.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgcss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgeat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgebi.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgelb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgelc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgem.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgenm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgev.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgevt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgfrm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exggv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exggvt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exginf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgini.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgmap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnsd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnsi.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgnvt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgpa.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgpn.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgqa.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgsnl.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgsp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgssc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgssd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgssi.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgssn.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgtim.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgvan.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgvnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgvp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exgvtt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exinq.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exopen.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exopts.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expclb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expcns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expcon.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expcor.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expcss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expeat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expelb.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expelc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expem.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expenm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expev.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expfrm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expgv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expinf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expini.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expmap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expnnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expnp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expns.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expnsd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expnv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exppa.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exppn.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expqa.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expsp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expssd.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exptim.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expvan.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expvnm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expvp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expvpc.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expvtt.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\exupda.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\include\exodusII.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\exodusII_int.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/forbind/CVS/Entries b/forbind/CVS/Entries
new file mode 100644
index 0000000..f235e61
--- /dev/null
+++ b/forbind/CVS/Entries
@@ -0,0 +1,3 @@
+D/include////
+D/src////
+D/test////
diff --git a/forbind/CVS/Repository b/forbind/CVS/Repository
new file mode 100644
index 0000000..61b0d94
--- /dev/null
+++ b/forbind/CVS/Repository
@@ -0,0 +1 @@
+exodusii/forbind
diff --git a/forbind/CVS/Root b/forbind/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/forbind/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/forbind/include/CVS/Entries b/forbind/include/CVS/Entries
new file mode 100644
index 0000000..aa22f7b
--- /dev/null
+++ b/forbind/include/CVS/Entries
@@ -0,0 +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//
+D
diff --git a/forbind/include/CVS/Repository b/forbind/include/CVS/Repository
new file mode 100644
index 0000000..836d9fc
--- /dev/null
+++ b/forbind/include/CVS/Repository
@@ -0,0 +1 @@
+exodusii/forbind/include
diff --git a/forbind/include/CVS/Root b/forbind/include/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/forbind/include/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/forbind/include/Imakefile b/forbind/include/Imakefile
new file mode 100644
index 0000000..470a686
--- /dev/null
+++ b/forbind/include/Imakefile
@@ -0,0 +1,6 @@
+XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:02:19 gdsjaar Exp $
+
+INCLIST=exodusII.inc exodusII_int.inc
+
+InstallIncludeList(install,$(INCLIST),$(INCDIR))
+
diff --git a/forbind/include/exodusII.inc b/forbind/include/exodusII.inc
new file mode 100644
index 0000000..24d8e37
--- /dev/null
+++ b/forbind/include/exodusII.inc
@@ -0,0 +1,183 @@
+! -*- mode: fortran -*-
+!
+! Copyright 1994 Sandia Corporation. Under the terms of Contract
+! DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+! retains certain rights in this software.
+!
+! See the COPYRIGHT file for copying and redistribution conditions.
+!
+!***************************************************************
+!
+! Name: exodusII.inc - Exodus II Application include file
+!
+! Use this include file to define general Exodus II parameters
+!
+! author - Victor R. Yarberry, Sandia National Laboratories
+!
+! 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
+!
+ integer excre,exopen,exlgmd
+ external excre, exopen, exlgmd
+!
+! Define access modes
+!
+ integer EXNOCL,EXCLOB,EXREAD,EXWRIT,EXWRT,EXNORM,EXLARG
+ integer EXNET4, EXNOSH, EXSHAR
+! EXNOCL - File create with no overwrite (no clobber), default
+ parameter (EXNOCL = 0)
+! EXCLOB - File create with overwrite (clobber)
+ parameter (EXCLOB = 1)
+! EXNORM - Disable large model modifications
+ parameter (EXNORM = 2)
+! EXLARG - Large model modifications
+ parameter (EXLARG = 4)
+! EXNET4 - use the hdf5-based netcdf4 output
+ parameter (EXNET4 = 8)
+! EXNOSH - Do not open netcdf file in "share" mode
+ parameter (EXNOSH = 16)
+! EXSHAR - Do open netcdf file in "share" mode
+ parameter (EXSHAR = 32)
+! EXREAD - File open for read
+ parameter (EXREAD = 0)
+! EXWRIT, EXWRT - File open for write
+ parameter (EXWRIT = 1, EXWRT = 1)
+!
+! --INQUIRE FLAGS
+! --
+! -- EXTYPE - EXODUS II file type is desired.
+! -- EXVERS - EXODUS API version number (in file) is desired
+! -- EXDBVR - EXODUS Database version number is desired
+! -- EXLBVR - EXODUS API Library version number is desired
+! -- EXTITL - Netcdf file title is desired
+! -- EXDIM - Dimensionality (the number of coordinates per node)
+! -- is desired.
+! -- EXNODE - The number of nodal points is desired.
+! -- EXELEM - The number of elements is desired.
+! -- EXELBL - The number of element blocks is desired.
+! -- EXNODS - The number of node sets is desired.
+! -- EXSSNL - The length of the concatenated node list for all the
+! -- node sets.
+! -- EXSIDS - The number of side sets is desired.
+! -- EXSSEL - The length of the concatenated element list for all
+! -- the side sets.
+! -- EXNSNL - The length of the concatenated node list for all the
+! -- side sets.
+! -- EXQA - The number of QA records is desired.
+! -- EXINFO - The number of information records is desired.
+! -- EXTIMS - The number of time steps is desired.
+! -- EXNEBP - The number of element block properties
+! -- EXNNSP - The number of node set properties
+! -- EXNSSP - The number of side set properties
+! -- EXNSDF - The length of the node set dist factors array
+! -- EXSSDF - The length of the side set dist factors array
+! -- EXNEMP - The number of element map properties
+! -- EXNNMP - The number of node map properties
+! -- EXNEM - The number of element maps
+! -- EXNNM - The number of node maps
+! --
+ integer EXTYPE, EXVERS, EXDBVR, EXTITL, EXDIM, EXNODE, &
+ & EXELEM, EXELBL, EXNODS, EXSIDS, EXQA, EXINFO, &
+ & EXTIMS, EXSSNL, EXSSEL, EXNSNL, EXNEBP, EXNNSP, &
+ & EXNSSP, EXNSDF, EXSSDF, EXLBVR, EXNEMP, EXNNMP, &
+ & EXNEM, EXNNM
+!
+ parameter (EXTYPE = 1)
+ parameter (EXVERS = 2)
+ parameter (EXDBVR = 3)
+ parameter (EXTITL = 4)
+ parameter (EXDIM = 5)
+ parameter (EXNODE = 6)
+ parameter (EXELEM = 7)
+ parameter (EXELBL = 8)
+ parameter (EXNODS = 9)
+ parameter (EXNSNL = 10)
+ parameter (EXSIDS = 11)
+ parameter (EXSSNL = 12)
+ parameter (EXSSEL = 13)
+ parameter (EXQA = 14)
+ parameter (EXINFO = 15)
+ parameter (EXTIMS = 16)
+ parameter (EXNEBP = 17)
+ parameter (EXNNSP = 18)
+ parameter (EXNSSP = 19)
+ parameter (EXNSDF = 20)
+ parameter (EXSSDF = 21)
+ parameter (EXLBVR = 22)
+ parameter (EXNEMP = 23)
+ parameter (EXNNMP = 24)
+ parameter (EXNEM = 25)
+ parameter (EXNNM = 26)
+!
+! Define limits
+!
+ integer MXSTLN, MXLNLN
+! MXSTLN - Maximum string length: used for store strings
+ parameter (MXSTLN = 32)
+! MXLNLN - Maximum line string length
+ parameter (MXLNLN = 80)
+!
+! properties
+!
+ integer EXEBLK, EXNSET, EXSSET, EXEMAP, EXNMAP
+! EXEBLK - element block property code
+ parameter (EXEBLK = 1)
+! EXNSPR - node set property code
+ parameter (EXNSET = 2)
+! EXSSPR - side set property code
+ parameter (EXSSET = 3)
+! EXEMAP - element map property code
+ parameter (EXEMAP = 4)
+! EXNMAP - node map property code
+ parameter (EXNMAP = 5)
+!
+! Define options codes
+!
+ integer EXVRBS, EXDEBG, EXABRT
+! EXVRBS - verbose mode message flag
+ parameter (EXVRBS = 1)
+! EXDEBG - debug mode message flag
+ parameter (EXDEBG = 2)
+! EXABRT - abort mode flag
+ parameter (EXABRT = 4)
+!
+! Define error return codes
+!
+ integer EXFATL, EXOK, EXWARN
+! EXFATL - fatal error flag def
+ parameter (EXFATL = -1)
+! EXOK - no err (success) flag def
+ parameter (EXOK = 0)
+! EXWARN - warning flag def
+ parameter (EXWARN = 1)
+!
+! Define error return codes and flags
+!
+ integer EXMEMF, EXBFMD, EXBFID, EXBTID, EXBPRM, EXNULL, &
+ & EXPMSG, EXLMSG
+! EXMEMF - memory allocation failure flag def
+ parameter (EXMEMF = 1000)
+! EXBFMD - wrong file mode
+ parameter (EXBFMD = 1001)
+! EXBFID - bad file id def
+ parameter (EXBFID = 1002)
+! EXBTID - id table lookup failed
+ parameter (EXBTID = 1004)
+! EXBPRM - bad parameter passed
+ parameter (EXBPRM = 1005)
+! EXNULL - null entity found
+ parameter (EXNULL = -1006)
+! EXPMSG - message print code - no error implied
+ parameter (EXPMSG = -1000)
+! EXLMSG - print last error message msg code
+ parameter (EXLMSG = -1001)
diff --git a/forbind/include/exodusII_int.inc b/forbind/include/exodusII_int.inc
new file mode 100644
index 0000000..96c31e6
--- /dev/null
+++ b/forbind/include/exodusII_int.inc
@@ -0,0 +1,167 @@
+C*****************************************************************************
+C Copyright 1994 Sandia Corporation. Under the terms of Contract
+C DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+C retains certain rights in this software.
+C
+C See the COPYRIGHT file for copying and redistribution conditions.
+C
+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
+C -- netCDF variables, attributes, or dimensions in which the EXODUS
+C -- II data are stored. Using the defined constants will allow the
+C -- names of the netCDF entities to be changed easily in the future
+C -- if needed.
+C --
+C --Constants:
+C --
+C --ATTRIBUTES
+C --
+C -- A_TYPE The EXODUS II file type:
+C "r" = regular
+C "h" = history
+C -- A_TITLE The database title
+C -- A_VERSION The EXODUS II version number
+C -- A_NAMELB The element type name for a given element block
+C --
+C --DIMENSIONS
+C --
+C -- D_NUMNOD The number of nodes
+C -- D_NDIM The number of coordinates per node
+C -- D_NUMEL The number of elements
+C -- D_NELBLK the number of element blocks
+C -- D_NUMELB The number of elements in a given element block
+C -- D_NELNOD The number of nodes per element in a given element
+C -- block
+C -- D_NATRIB The number of attributes in a given element block
+C -- D_NUMESS The number of side sets
+C -- D_NEESS The number of elements in a given side set
+C -- D_NNESS The number of nodes in a given side set
+C -- D_NUMNPS The number of node sets
+C -- D_NNNPS The number of nodes in a given node set
+C -- D_NQAREC The number of QA records
+C -- D_NINFO The number of information records
+C -- D_NVARGL The number of global variables
+C -- D_NVARNP The number of nodal variables
+C -- D_NVAREL The number of element variables
+C -- D_NVARHI The number of history variables
+C -- D_N4 General dimension of length 4
+C -- D_STRLEN General dimension of length MXSTLN used for lengths
+C -- of names
+C -- D_LINLEN General dimension of length MXLNLN used for lengths
+C -- of long strings
+C -- D_TIMSTP The number of whole time steps
+C -- D_HTMSTP The number of history time steps
+C --
+C --VARIABLES
+C --
+C -- V_COORD The nodal coordinates
+C -- V_NAMECO The names of coordinates
+C -- V_IDEBLK The element block IDs
+C -- V_ICONK The element connectivity for a given element block
+C -- V_ATRIBK The list of attributes for a given element block
+C -- V_MAP The element order map
+C -- V_IDESS The side set Ids
+C -- V_FACESS The distribution factor for each node in a given
+C -- side set
+C -- V_ELSSET The list of elements in a given side set
+C -- V_NDSSET The list of nodes in a given side set
+C -- V_IDNPS The node set IDs
+C -- V_NODSET The list of nodes in a given node set
+C -- V_FNPS The list of distribution factors in a given node set
+C -- V_INFO The information records
+C -- V_TIMEHS The simulation times for history time steps
+C -- V_TIME The simulation times for whole time steps
+C -- V_QATITL The QA records
+C -- V_ISEVOK The element variable truth table
+C -- V_NAMEGV The names of global variables
+C -- V_VARGL The values of global variables
+C -- V_NAMENV The names of nodal variables
+C -- V_VARNP The values of nodal variables
+C -- V_NAMEEV The names of element variables
+C -- V_VAREL The values of element variables for a given element
+C -- block and given element within that block
+C -- V_NAMEHV The names of the history variables
+C -- V_VARHI The values of the history variables
+C --
+
+ character A_TYPE*4, A_TITLE*5, A_VERSION*7, A_NAMELB*9,
+ 1 D_NUMNOD*9, D_NDIM*7, D_NUMEL*8, D_NELBLK*10, D_NUMELB*13,
+ 1 D_NELNOD*14, D_NATRIB*14, D_NUMESS*13, D_NEESS*9, D_NNESS*10,
+ 1 D_NUMNPS*13, D_NNNPS*10, D_NQAREC*10, D_NINFO*8, D_NVARGL*11,
+ 1 D_NVARNP*11, D_NVAREL*12, D_NVARHI*11, D_N4*4, D_STRLEN*10,
+ 1 D_LINLEN*8, V_COORD*5, V_NAMECO*10, V_IDEBLK*9, V_ICONK*7,
+ 1 V_ATRIBK*6, V_MAP*8, V_IDESS*12, V_FACESS*12, V_ELSSET*7,
+ 1 V_NDSSET*7, V_IDNPS*12, V_NODSET*7, V_FNPS*12, V_INFO*12,
+ 1 V_TIMEHS*9, V_TIME*10, V_QATITL*10, V_ISEVOK*12, V_NAMEGV*12,
+ 1 V_VARGL*12, V_NAMENV*12, V_VARNP*12, V_NAMEEV*13, V_VAREL*13,
+ 1 V_NAMEHV*12, V_VARHI*12, D_TIMSTP*9, D_HTMSTP*14
+
+c
+c Define attributes
+c
+ parameter (A_TYPE = 'type', A_TITLE = 'title')
+ parameter (A_VERSION = 'version')
+c
+c Define dimensions
+c
+ parameter (D_NUMNOD = 'num_nodes', D_NDIM = 'num_dim')
+ parameter (D_NUMEL ='num_elem')
+ parameter (D_NELBLK = 'num_el_blk', D_NUMELB ='num_el_in_blk')
+ parameter (D_NELNOD = 'num_nod_per_el')
+ parameter (D_NATRIB = 'num_att_in_blk')
+ parameter (D_NUMESS = 'num_side_sets', D_NEESS = 'num_el_ss')
+ parameter (D_NNESS = 'num_nod_ss', D_NUMNPS = 'num_node_sets')
+ parameter (D_NNNPS = 'num_nod_ns', D_NQAREC = 'num_qa_rec')
+ parameter (D_NINFO = 'num_info', D_NVARGL ='num_glo_var')
+ parameter (D_NVARNP = 'num_nod_var', D_NVAREL ='num_elem_var')
+ parameter (D_NVARHI = 'num_his_var', D_N4 = 'four')
+ parameter (D_STRLEN = 'len_string', D_LINLEN = 'len_line')
+ parameter (D_TIMSTP = 'time_step', D_HTMSTP ='hist_time_step')
+c
+c Define variables
+c
+ parameter (V_COORD = 'coord', V_NAMECO = 'coor_names')
+ parameter (V_IDEBLK = 'el_blk_id', V_ICONK = 'connect')
+ parameter (V_ATRIBK = 'attrib', A_NAMELB = 'elem_type')
+ parameter (V_MAP ='elem_map', V_IDESS = 'side_set_ids')
+ parameter (V_FACESS = 'dist_fact_ss')
+ parameter (V_ELSSET = 'elem_ss', V_NDSSET = 'node_ss')
+ parameter (V_IDNPS = 'node_set_ids', V_NODSET ='node_ns')
+ parameter (V_FNPS = 'dist_fact_ns', V_INFO = 'info_records')
+ parameter (V_TIMEHS = 'time_hist')
+ parameter (V_TIME = 'time_whole', V_QATITL = 'qa_records')
+ parameter (V_ISEVOK = 'elem_var_tab', V_NAMEGV ='name_glo_var')
+ parameter (V_VARGL ='vals_glo_var', V_NAMENV = 'name_nod_var')
+ parameter (V_VARNP = 'vals_nod_var')
+ parameter (V_NAMEEV = 'name_elem_var', V_VAREL = 'vals_elem_var')
+ parameter (V_NAMEHV = 'name_his_var', V_VARHI = 'vals_his_var')
+c
+c dummy character variables used through out EXODUS
+c
+ character name*32
+
+c
+c dummy integer variables used throughout EXODUS
+c
+ integer istart(3), icount(3), id
+c
+c declaration for various functions
+c
+ integer chkfil
+
+
diff --git a/forbind/src/CVS/Entries b/forbind/src/CVS/Entries
new file mode 100644
index 0000000..daf5a9b
--- /dev/null
+++ b/forbind/src/CVS/Entries
@@ -0,0 +1,57 @@
+/Imakefile/1.4/Tue Nov 28 14:02:20 2006//
+/Makefile.standalone/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/addrwrap.F/1.3/Sun Nov 26 05:37:24 2006//
+/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//
+/common.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/common.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/common2.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/cougar.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/cray.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/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//
+/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//
+/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//
+/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//
+/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//
+/fortc3_.sed/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/hp.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/hpux.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/hpux0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/interix.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/irix.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/irix0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/linux.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/msoft.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/msoft0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/osf.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/osf0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/paragon.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/puma.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/pumagon.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/sgi.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/sun.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/sunos.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/sunos0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/ultrix.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/ultrix0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/unicos.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/unicos0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/vms.m4/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/vms0.inc/1.1.1.1/Tue Sep 6 15:59:03 2005//
+D
diff --git a/forbind/src/CVS/Repository b/forbind/src/CVS/Repository
new file mode 100644
index 0000000..57b878d
--- /dev/null
+++ b/forbind/src/CVS/Repository
@@ -0,0 +1 @@
+exodusii/forbind/src
diff --git a/forbind/src/CVS/Root b/forbind/src/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/forbind/src/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/forbind/src/Imakefile b/forbind/src/Imakefile
new file mode 100644
index 0000000..7ea3718
--- /dev/null
+++ b/forbind/src/Imakefile
@@ -0,0 +1,234 @@
+# 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.
+#
+
+XCOMM $Id: Imakefile,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+
+#if defined CrayArchitecture || defined SunArchitecture || defined AIXArchitecture
+#define Libtype sharable
+#define ArNet ar
+#else
+#define Libtype nonsharable
+#define ArNet ar clr
+#endif
+
+#if defined CatamountArchitecture
+#define OSystem catamount
+
+#elif defined CougarArchitecture
+#define OSystem cougar
+
+#elif defined SGIArchitecture
+#define OSystem irix
+
+#elif defined CrayArchitecture
+#define OSystem unicos
+
+#elif defined SunArchitecture
+#define OSystem sunos
+
+#elif defined HPArchitecture
+#define OSystem hpux
+
+#elif defined UltrixArchitecture
+#define OSystem ultrix
+
+#elif defined OSF1Architecture
+#define OSystem osf
+
+#elif defined AIXArchitecture
+#define OSystem aix
+
+#elif defined InterixArchitecture
+#define OSystem interix
+
+#elif defined AlphaArchitecture
+#define OSystem linux
+
+#elif defined i386Architecture
+#define OSystem linux
+
+#elif defined x86_64Architecture
+#define OSystem linux
+
+#elif defined ia64Architecture
+#define OSystem linux
+
+#elif defined DarwinArchitecture
+#define OSystem darwin
+
+#else
+#define OSystem ""
+#error "Could not determine Operating System type in exodusii/forbind/src/Imakefile."
+#endif
+
+#ifndef CArchive
+#define CArchive ""
+#endif
+
+/* Use *.h files in ../../cbind/include/ instead of installed *.h files */
+INCLUDES = IncRef-I../../cbind/include
+F77EXTRAOPTIONS = IncRef-I../include
+
+OS_TYPE = OSystem
+
+DEFINES = -DEX_ERR_STR
+
+F77CPPFLAGS = F77CppFlags
+
+SRCS = exo_jack.c exgenm_jack.c expenm_jack.c exgnnm_jack.c \
+ exgvnm_jack.c expvnm_jack.c expnnm_jack.c excopy_jack.c \
+ exgem_jack.c exgmp_jack.c exgnm_jack.c expem_jack.c \
+ expmp_jack.c expnm_jack.c
+
+SRCSF = addrwrap.f
+
+OBJS = ${SRCS:.c=.o} ${SRCSF:.f=.o}
+
+#if Build64BitAccess == YES
+#define Bits 64
+#else
+#define Bits 32
+#endif
+
+BITS = Bits
+
+#if Build64BitAccess == YES
+
+SRCS32 = exo_jack32.c exgenm_jack32.c expenm_jack32.c exgnnm_jack32.c \
+ exgvnm_jack32.c expvnm_jack32.c expnnm_jack32.c excopy_jack32.c \
+ exgem_jack32.c exgmp_jack32.c exgnm_jack32.c expem_jack32.c \
+ expmp_jack32.c expnm_jack32.c
+
+OBJS32 = ${SRCS32:.c=.o}
+
+exo_jack32.c: exo_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exo_jack.src > $@
+
+exgenm_jack32.c: exgenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgenm_jack.src > $@
+
+expenm_jack32.c: expenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expenm_jack.src > $@
+
+exgnnm_jack32.c: exgnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgnnm_jack.src > $@
+
+expnnm_jack32.c: expnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expnnm_jack.src > $@
+
+exgvnm_jack32.c: exgvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgvnm_jack.src > $@
+
+expvnm_jack32.c: expvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expvnm_jack.src > $@
+
+excopy_jack32.c: excopy_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) excopy_jack.src > $@
+
+exgem_jack32.c: exgem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgem_jack.src > $@
+
+exgmp_jack32.c: exgmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgmp_jack.src > $@
+
+exgnm_jack32.c: exgnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) exgnm_jack.src > $@
+
+expem_jack32.c: expem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expem_jack.src > $@
+
+expmp_jack32.c: expmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expmp_jack.src > $@
+
+expnm_jack32.c: expnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P 32 -O $(OS_TYPE) expnm_jack.src > $@
+
+all:: libexoIIv2for32.a
+libexoIIv2for32.a: $(OBJS32)
+ $(AR) $@ $?
+ $(_NULLCMD_)
+ $(_NULLCMD_)
+ $(CP) libexoIIv2for32.a ../../
+
+#endif
+
+
+exo_jack.c: exo_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exo_jack.src > $@
+
+exgenm_jack.c: exgenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgenm_jack.src > $@
+
+expenm_jack.c: expenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expenm_jack.src > $@
+
+exgnnm_jack.c: exgnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgnnm_jack.src > $@
+
+expnnm_jack.c: expnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expnnm_jack.src > $@
+
+exgvnm_jack.c: exgvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgvnm_jack.src > $@
+
+expvnm_jack.c: expvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expvnm_jack.src > $@
+
+excopy_jack.c: excopy_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) excopy_jack.src > $@
+
+exgem_jack.c: exgem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgem_jack.src > $@
+
+exgmp_jack.c: exgmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgmp_jack.src > $@
+
+exgnm_jack.c: exgnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgnm_jack.src > $@
+
+expem_jack.c: expem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expem_jack.src > $@
+
+expmp_jack.c: expmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expmp_jack.src > $@
+
+expnm_jack.c: expnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expnm_jack.src > $@
+
+LibraryTargetSubdirsCopy(libexoIIv2for.a,$(OBJS),../../)
+
+ExtraStuffToClean(*.c)
+CleanupCapF(addrwrap.f)
+
+DependTarget()
+
diff --git a/forbind/src/Makefile.standalone b/forbind/src/Makefile.standalone
new file mode 100644
index 0000000..4058a3b
--- /dev/null
+++ b/forbind/src/Makefile.standalone
@@ -0,0 +1,109 @@
+# 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.
+#
+
+INCLUDES = -I../../cbind/include
+F77EXTRAOPTIONS = -I../include
+
+SRCS = exo_jack.c exgenm_jack.c expenm_jack.c exgnnm_jack.c \
+ exgvnm_jack.c expvnm_jack.c expnnm_jack.c excopy_jack.c exgem_jack.c \
+ exgmp_jack.c exgnm_jack.c expem_jack.c expmp_jack.c expnm_jack.c
+
+SRCSF = addrwrap.f
+
+OBJS = ${SRCS:.c=.o} ${SRCSF:.f=.o}
+
+exo_jack.c: exo_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exo_jack.src > $@
+
+exgenm_jack.c: exgenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgenm_jack.src > $@
+
+expenm_jack.c: expenm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expenm_jack.src > $@
+
+exgnnm_jack.c: exgnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgnnm_jack.src > $@
+
+expnnm_jack.c: expnnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expnnm_jack.src > $@
+
+exgvnm_jack.c: exgvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgvnm_jack.src > $@
+
+expvnm_jack.c: expvnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expvnm_jack.src > $@
+
+excopy_jack.c: excopy_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) excopy_jack.src > $@
+
+exgem_jack.c: exgem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgem_jack.src > $@
+
+exgmp_jack.c: exgmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgmp_jack.src > $@
+
+exgnm_jack.c: exgnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) exgnm_jack.src > $@
+
+expem_jack.c: expem_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expem_jack.src > $@
+
+expmp_jack.c: expmp_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expmp_jack.src > $@
+
+expnm_jack.c: expnm_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4
+ ./fortc -L . -P $(BITS) -O $(OS_TYPE) expnm_jack.src > $@
+
+all:: libexoIIv2for.a
+libexoIIv2for.a: $(OBJS)
+ $(AR) $@ $?
+ $(RANLIB) $@
+ cp libexoIIv2for.a ../../
+
+clean::
+ rm -f *.c
+
+clean::
+ rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
+
+.SUFFIXES: .c .F .f
+.c.o:
+ $(CC) -c $(CFLAGS) $*.c
+.f.o:
+ $(FC) -c $(FFLAGS) $*.f
+.F.o:
+ $(FC) -c $(DEFINES) $(FFLAGS) $*.F
+
+# ----------------------------------------------------------------------
+# dependencies generated by makedepend or sfmakedepend
+
diff --git a/forbind/src/addrwrap.F b/forbind/src/addrwrap.F
new file mode 100644
index 0000000..a7de596
--- /dev/null
+++ b/forbind/src/addrwrap.F
@@ -0,0 +1,3135 @@
+C Copyright (c) 2005 Sandia Corporation. Under the terms of Contract
+C DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+C retains certain rights in this software.
+C
+C Redistribution and use in source and binary forms, with or without
+C modification, are permitted provided that the following conditions are
+C met:
+C
+C * Redistributions of source code must retain the above copyright
+C notice, this list of conditions and the following disclaimer.
+C
+C * Redistributions in binary form must reproduce the above
+C copyright notice, this list of conditions and the following
+C disclaimer in the documentation and/or other materials provided
+C with the distribution.
+C
+C * Neither the name of Sandia Corporation nor the names of its
+C contributors may be used to endorse or promote products derived
+C from this software without specific prior written permission.
+C
+C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+C "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+C LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+C A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+C OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+C SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+C LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+C DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+C THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+C (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+C OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+C
+
+ SUBROUTINE ADRDUM
+ END
+
+#ifdef Build64
+ SUBROUTINE EXCLOS (IDEXO, IERR)
+C
+C CLOSE EXODUS II FILE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXCLOS4 (IDEXO4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXCN2S (IDEXO, NSESS, NDESS, IXEESS, IXNESS,
+ & LTEESS, LTNESS, LTSESS, IERR)
+C
+C CONVERT SIDE SET NODES TO SIDES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NSESS (*) ! (R)
+ INTEGER NDESS (*) ! (R)
+ INTEGER IXEESS (*) ! (R)
+ INTEGER IXNESS (*) ! (R)
+ INTEGER LTEESS (*) ! (R)
+ INTEGER LTNESS (*) ! (R)
+ INTEGER LTSESS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NSESS4 (1) ! (R)
+ INTEGER*4 NDESS4 (1) ! (R)
+ INTEGER*4 IXEESS4 (1) ! (R)
+ INTEGER*4 IXNESS4 (1) ! (R)
+ INTEGER*4 LTEESS4 (1) ! (R)
+ INTEGER*4 LTNESS4 (1) ! (R)
+ INTEGER*4 LTSESS4 (1) ! (W)
+ POINTER (PNSESS4, NSESS4)
+ POINTER (PNDESS4, NDESS4)
+ POINTER (PIXEESS4, IXEESS4)
+ POINTER (PIXNESS4, IXNESS4)
+ POINTER (PLTEESS4, LTEESS4)
+ POINTER (PLTNESS4, LTNESS4)
+ POINTER (PLTSESS4, LTSESS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXSIDS
+ INTEGER*4 NEXELEM
+ INTEGER*4 NEXNODE
+ INTEGER*4 NEXNSNL
+ INTEGER*4 NEXSSEL
+ INTEGER*4 I
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXSIDS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSIDS = INTRET4
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ INFREQ4 = EXNODE
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODE = INTRET4
+ NEXNSNL = 0
+ NEXSSEL = 0
+ DO I = 1, NEXSIDS
+ NEXNSNL = NEXNSNL + NDESS(I)
+ NEXSSEL = NEXSSEL + NSESS(I)
+ END DO
+ CALL I8I4 (NEXSIDS, NSESS, PNSESS4)
+ CALL I8I4 (NEXSIDS, NDESS, PNDESS4)
+ CALL I8I4 (NEXSIDS, IXEESS, PIXEESS4)
+ CALL I8I4 (NEXSIDS, IXNESS, PIXNESS4)
+ CALL I8I4 (NEXSSEL, LTEESS, PLTEESS4)
+ CALL I8I4 (NEXNSNL, LTNESS, PLTNESS4)
+ CALL I4ALLOC (NEXSSEL, PLTSESS4)
+ CALL EXCN2S4 (IDEXO4, NSESS4, NDESS4, IXEESS4, IXNESS4,
+ & LTEESS4, LTNESS4, LTSESS4, IERR4)
+ CALL I4I8 (NEXSSEL, PLTSESS4, LTSESS)
+ CALL I4FREE (PNSESS4)
+ CALL I4FREE (PNDESS4)
+ CALL I4FREE (PIXEESS4)
+ CALL I4FREE (PIXNESS4)
+ CALL I4FREE (PLTEESS4)
+ CALL I4FREE (PLTNESS4)
+ IERR = IERR4
+ END
+
+ INTEGER FUNCTION EXCRE (PATH, ICMODE, ICOMPWS, IOWS, IERR)
+C
+C CREATE EXODUS II FILE
+C
+ IMPLICIT NONE
+ CHARACTER* (*) PATH ! (R)
+ INTEGER ICMODE ! (R)
+ INTEGER ICOMPWS ! (RW)
+ INTEGER IOWS ! (RW)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 EXCRE4
+ EXTERNAL EXCRE4
+ INTEGER*4 IRET4
+ INTEGER IRET
+ INTEGER*4 ICMODE4 ! (R)
+ INTEGER*4 ICOMPWS4 ! (RW)
+ INTEGER*4 IOWS4 ! (RW)
+ INTEGER*4 IERR4 ! (W)
+
+ ICMODE4 = ICMODE
+
+C ... This needs to be set explicitly since all wrapper routines
+C are passing REAL*8 and the exo_jack.c routines all take double*
+ ICOMPWS4 = 8
+ IOWS4 = IOWS
+ IRET4 = EXCRE4 (PATH, ICMODE4, ICOMPWS4, IOWS4, IERR4)
+ ICOMPWS = ICOMPWS4
+ IOWS = IOWS4
+ IERR = IERR4
+ IRET = IRET4
+ EXCRE = IRET
+ END
+
+ SUBROUTINE EXERR (MODNAM, MSG, ERRNUM)
+C
+C ERROR REPORTING
+C
+ CHARACTER* (*) MODNAM ! (R)
+ CHARACTER* (*) MSG ! (R)
+ INTEGER ERRNUM ! (R)
+
+ INTEGER*4 ERRNUM4 ! (R)
+
+ ERRNUM4 = ERRNUM
+ CALL EXERR4 (MODNAM, MSG, ERRNUM4)
+ END
+
+ SUBROUTINE EXGATM (IDEXO, TIME, IERR)
+C
+C READ ALL TIME VALUES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ REAL TIME (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGATM4 (IDEXO4, TIME, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGCNS (IDEXO, IDNPSS, NNNPS, NDNPS, IXNNPS,
+ & IXDNPS, LTNNPS, FACNPS, IERR)
+C
+C READ CONCATENATED NODE SETS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPSS (*) ! (W)
+ INTEGER NNNPS (*) ! (W)
+ INTEGER NDNPS (*) ! (W)
+ INTEGER IXNNPS (*) ! (W)
+ INTEGER IXDNPS (*) ! (W)
+ INTEGER LTNNPS (*) ! (W)
+ REAL FACNPS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPSS4 (1) ! (W)
+ INTEGER*4 NNNPS4 (1) ! (W)
+ INTEGER*4 NDNPS4 (1) ! (W)
+ INTEGER*4 IXNNPS4 (1) ! (W)
+ INTEGER*4 IXDNPS4 (1) ! (W)
+ INTEGER*4 LTNNPS4 (1) ! (W)
+ POINTER (PIDNPSS4, IDNPSS4)
+ POINTER (PNNNPS4, NNNPS4)
+ POINTER (PNDNPS4, NDNPS4)
+ POINTER (PIXNNPS4, IXNNPS4)
+ POINTER (PIXDNPS4, IXDNPS4)
+ POINTER (PLTNNPS4, LTNNPS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODS
+ INTEGER*4 NEXNSNL
+ INTEGER*4 NEXNSDF
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODS = INTRET4
+ INFREQ4 = EXNSNL
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNSNL = INTRET4
+ CALL I4ALLOC (NEXNODS, PIDNPSS4)
+ CALL I4ALLOC (NEXNODS, PNNNPS4)
+ CALL I4ALLOC (NEXNODS, PNDNPS4)
+ CALL I4ALLOC (NEXNODS, PIXNNPS4)
+ CALL I4ALLOC (NEXNODS, PIXDNPS4)
+ CALL I4ALLOC (NEXNSNL, PLTNNPS4)
+ CALL EXGCNS4 (IDEXO4, IDNPSS4, NNNPS4, NDNPS4, IXNNPS4,
+ & IXDNPS4, LTNNPS4, FACNPS, IERR4)
+ CALL I4I8 (NEXNODS, PIDNPSS4, IDNPSS)
+ CALL I4I8 (NEXNODS, PNNNPS4, NNNPS)
+ CALL I4I8 (NEXNODS, PNDNPS4, NDNPS)
+ CALL I4I8 (NEXNODS, PIXNNPS4, IXNNPS)
+ CALL I4I8 (NEXNODS, PIXDNPS4, IXDNPS)
+ CALL I4I8 (NEXNSNL, PLTNNPS4, LTNNPS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGCON (IDEXO, NAMECO, IERR)
+C
+C READ COORDINATE NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) NAMECO (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGCON4 (IDEXO4, NAMECO, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGCOR (IDEXO, XN, YN, ZN, IERR)
+C
+C READ NODAL COORDINATES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ REAL XN (*) ! (W)
+ REAL YN (*) ! (W)
+ REAL ZN (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGCOR4 (IDEXO4, XN, YN, ZN, IERR4)
+
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGCSS (IDEXO, IDESSS, NSESS, NDESS, IXEESS,
+ & IXDESS, LTEESS, LTSESS, FACESS, 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)
+ REAL FACESS (*) ! (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 EXGCSS4 (IDEXO4, IDESSS4, NSESS4, NDESS4, IXEESS4,
+ & IXDESS4, LTEESS4, LTSESS4, FACESS, 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
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ REAL ATRIB (*) ! (NUMATR,NUMELB) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ CALL EXGEAT4 (IDEXO4, IDELB4, ATRIB, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGEAN (IDEXO, IDELB, NATTR, NAMES, IERR)
+C
+C READ ELEMENT BLOCK ATTRIBUTES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER NATTR ! (R)
+ CHARACTER* (*) NAMES (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NATTR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ NATTR4 = NATTR
+ CALL EXGEAN4 (IDEXO4, IDELB4, NATTR4, NAMES, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGEBI (IDEXO, IDELBS, IERR)
+C
+C READ ELEMENT BLOCK IDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELBS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELBS4 (1) ! (W)
+ POINTER (PIDELBS4, IDELBS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELBL
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELBL
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELBL = INTRET4
+ CALL I4ALLOC (NEXELBL, PIDELBS4)
+ CALL EXGEBI4 (IDEXO4, IDELBS4, IERR4)
+ CALL I4I8 (NEXELBL, PIDELBS4, IDELBS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGELB (IDEXO, IDELB, NAMELB, NUMELB, NUMLNK,
+ & NUMATR, IERR)
+C
+C READ ELEMENT BLOCK PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ CHARACTER* (*) NAMELB ! (W)
+ INTEGER NUMELB ! (W)
+ INTEGER NUMLNK ! (W)
+ INTEGER NUMATR ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NUMELB4 ! (W)
+ INTEGER*4 NUMLNK4 ! (W)
+ INTEGER*4 NUMATR4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, IERR4)
+ NUMELB = NUMELB4
+ NUMLNK = NUMLNK4
+ NUMATR = NUMATR4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGELC (IDEXO, IDELB, LINK, IERR)
+C
+C READ ELEMENT BLOCK CONNECTIVITY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER LINK (*) ! (NUMLNK,NUMELB) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 LINK4 (1) ! (NUMLNK,NUMELB) ! (W)
+ POINTER (PLINK4, LINK4)
+ INTEGER*4 IERR4 ! (W)
+
+ CHARACTER* (MXSTLN) NAMELB
+ INTEGER*4 NUMELB4
+ INTEGER*4 NUMLNK4
+ INTEGER*4 NUMATR4
+
+ IDEXO4 = IDEXO
+ 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)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGENM (IDEXO, MAPEL, IERR)
+C
+C READ ELEMENT NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPEL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (W)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I4ALLOC (NEXELEM, PMAPEL4)
+ CALL EXGENM4 (IDEXO4, MAPEL4, IERR4)
+ CALL I4I8 (NEXELEM, PMAPEL4, MAPEL)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGEM (IDEXO, MAPID, MAPEL, IERR)
+C
+C READ ELEMENT ORDER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER MAPEL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (W)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ MAPID4 = MAPID
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I4ALLOC (NEXELEM, PMAPEL4)
+ CALL EXGEM4 (IDEXO4, MAPID4, MAPEL4, IERR4)
+ CALL I4I8 (NEXELEM, PMAPEL4, MAPEL)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGPEM (IDEXO, MAPID, ISTART, ICOUNT, MAPEL, IERR)
+C
+C READ ELEMENT ORDER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER ISTART ! (R)
+ INTEGER ICOUNT ! (R)
+ INTEGER MAPEL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 ISTART4 ! (R)
+ INTEGER*4 ICOUNT4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (W)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ IDEXO4 = IDEXO
+ MAPID4 = MAPID
+ ISTART4 = ISTART
+ ICOUNT4 = ICOUNT
+ INFREQ4 = EXELEM
+ CALL I4ALLOC (ICOUNT4, PMAPEL4)
+ CALL EXGPEM4 (IDEXO4, MAPID4, ISTART4, ICOUNT4, MAPEL4, IERR4)
+ CALL I4I8 (ICOUNT4, PMAPEL4, MAPEL)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGEV (IDEXO, ISTEP, IXELEV, IDELB, NUMELB,
+ & VALEV, IERR)
+C
+C READ ELEMENT VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXELEV ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER NUMELB ! (R)
+ REAL VALEV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXELEV4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NUMELB4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXELEV4 = IXELEV
+ IDELB4 = IDELB
+ NUMELB4 = NUMELB
+ CALL EXGEV4 (IDEXO4, ISTEP4, IXELEV4, IDELB4, NUMELB4,
+ & VALEV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGEVT (IDEXO, IXELEV, IELNUM, ISTPB, ISTPE,
+ & VALEV, IERR)
+C
+C READ ELEMENT VARIABLE VALUES THROUGH TIME
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IXELEV ! (R)
+ INTEGER IELNUM ! (R)
+ INTEGER ISTPB ! (R)
+ INTEGER ISTPE ! (R)
+ REAL VALEV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IXELEV4 ! (R)
+ INTEGER*4 IELNUM4 ! (R)
+ INTEGER*4 ISTPB4 ! (R)
+ INTEGER*4 ISTPE4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IXELEV4 = IXELEV
+ IELNUM4 = IELNUM
+ ISTPB4 = ISTPB
+ ISTPE4 = ISTPE
+
+ CALL EXGEVT4 (IDEXO4, IXELEV4, IELNUM4, ISTPB4, ISTPE4,
+ & VALEV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNSV (IDEXO, ISTEP, IXV, ID, NUM, VAL, IERR)
+C
+C READ NODESET VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXV ! (R)
+ INTEGER ID ! (R)
+ INTEGER NUM ! (R)
+ REAL VAL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXV4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 NUM4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXV4 = IXV
+ ID4 = ID
+ NUM4 = NUM
+ CALL EXGNSV4 (IDEXO4, ISTEP4, IXV4, ID4, NUM4, VAL, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSV (IDEXO, ISTEP, IXV, ID, NUM, VAL, IERR)
+C
+C READ SIDESET VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXV ! (R)
+ INTEGER ID ! (R)
+ INTEGER NUM ! (R)
+ REAL VAL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXV4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 NUM4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXV4 = IXV
+ ID4 = ID
+ NUM4 = NUM
+ CALL EXGSSV4 (IDEXO4, ISTEP4, IXV4, ID4, NUM4, VAL, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGGV (IDEXO, ISTEP, NVARGL, VALGV, IERR)
+C
+C READ GLOBAL VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER NVARGL ! (R)
+ REAL VALGV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 NVARGL4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ NVARGL4 = NVARGL
+ CALL EXGGV4 (IDEXO4, ISTEP4, NVARGL4, VALGV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGGVT (IDEXO, IXGLOV, ISTPB, ISTPE, VALGV, IERR)
+C
+C READ GLOBAL VARIABLE VALUES THROUGH TIME
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IXGLOV ! (R)
+ INTEGER ISTPB ! (R)
+ INTEGER ISTPE ! (R)
+ REAL VALGV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IXGLOV4 ! (R)
+ INTEGER*4 ISTPB4 ! (R)
+ INTEGER*4 ISTPE4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IXGLOV4 = IXGLOV
+ ISTPB4 = ISTPB
+ ISTPE4 = ISTPE
+ CALL EXGGVT4 (IDEXO4, IXGLOV4, ISTPB4, ISTPE4, VALGV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGINF (IDEXO, INFO, IERR)
+C
+C READ INFORMATION RECORDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) INFO (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGINF4 (IDEXO4, INFO, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGINI (IDEXO, TITLE, NDIM, NUMNP, NUMEL, NELBLK,
+ & NUMNPS, NUMESS, IERR)
+C
+C READ INITIALIZATION PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) TITLE ! (W)
+ INTEGER NDIM ! (W)
+ INTEGER NUMNP ! (W)
+ INTEGER NUMEL ! (W)
+ INTEGER NELBLK ! (W)
+ INTEGER NUMNPS ! (W)
+ INTEGER NUMESS ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NDIM4 ! (W)
+ INTEGER*4 NUMNP4 ! (W)
+ INTEGER*4 NUMEL4 ! (W)
+ INTEGER*4 NELBLK4 ! (W)
+ INTEGER*4 NUMNPS4 ! (W)
+ INTEGER*4 NUMESS4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGINI4 (IDEXO4, TITLE, NDIM4, NUMNP4, NUMEL4, NELBLK4,
+ & NUMNPS4, NUMESS4, IERR4)
+ NDIM = NDIM4
+ NUMNP = NUMNP4
+ NUMEL = NUMEL4
+ NELBLK = NELBLK4
+ NUMNPS = NUMNPS4
+ NUMESS = NUMESS4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGMP (IDEXO, NNMAP, NEMAP, IERR)
+C
+C GET MAP PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NNMAP ! (W)
+ INTEGER NEMAP ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NNMAP4 ! (W)
+ INTEGER*4 NEMAP4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGMP4 (IDEXO4, NNMAP4, NEMAP4, IERR4)
+ NNMAP = NNMAP4
+ NEMAP = NEMAP4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPMP (IDEXO, NNMAP, NEMAP, IERR)
+C
+C PUT MAP PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NNMAP ! (W)
+ INTEGER NEMAP ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NNMAP4 ! (W)
+ INTEGER*4 NEMAP4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NNMAP4 = NNMAP
+ NEMAP4 = NEMAP
+ CALL EXPMP4 (IDEXO4, NNMAP4, NEMAP4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGMAP (IDEXO, MAPEL, IERR)
+C
+C READ ELEMENT ORDER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPEL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (W)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I4ALLOC (NEXELEM, PMAPEL4)
+ CALL EXGMAP4 (IDEXO4, MAPEL4, IERR4)
+ CALL I4I8 (NEXELEM, PMAPEL4, MAPEL)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNNM (IDEXO, MAPNOD, IERR)
+C
+C READ NODE NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPNOD (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPNOD4 (1) ! (W)
+ POINTER (PMAPNOD4, MAPNOD4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODE
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODE
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODE = INTRET4
+ CALL I4ALLOC (NEXNODE, PMAPNOD4)
+ CALL EXGNNM4 (IDEXO4, MAPNOD4, IERR4)
+ CALL I4I8 (NEXNODE, PMAPNOD4, MAPNOD)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNM (IDEXO, MAPID, MAPNOD, IERR)
+C
+C READ NODE ORDER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER MAPNOD (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 MAPNOD4 (1) ! (W)
+ POINTER (PMAPNOD4, MAPNOD4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODE
+
+ IDEXO4 = IDEXO
+ MAPID4 = MAPID
+ INFREQ4 = EXNODE
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODE = INTRET4
+ CALL I4ALLOC (NEXNODE, PMAPNOD4)
+ CALL EXGNM4 (IDEXO4, MAPID4, MAPNOD4, IERR4)
+ CALL I4I8 (NEXNODE, PMAPNOD4, MAPNOD)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNP (IDEXO, IDNPS, NNNPS, NDNPS, IERR)
+C
+C READ NODE SET PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ INTEGER NNNPS ! (W)
+ INTEGER NDNPS ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 NNNPS4 ! (W)
+ INTEGER*4 NDNPS4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+ CALL EXGNP4 (IDEXO4, IDNPS4, NNNPS4, NDNPS4, IERR4)
+ NNNPS = NNNPS4
+ NDNPS = NDNPS4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNS (IDEXO, IDNPS, LTNNPS, IERR)
+C
+C READ NODE SET
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ INTEGER LTNNPS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 LTNNPS4 (1) ! (W)
+ POINTER (PLTNNPS4, LTNNPS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 NNNPS4
+ INTEGER*4 NDNPS4
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+ CALL EXGNP4 (IDEXO4, IDNPS4, NNNPS4, NDNPS4, IERR4)
+ CALL I4ALLOC (NNNPS4, PLTNNPS4)
+ CALL EXGNS4 (IDEXO4, IDNPS4, LTNNPS4, IERR4)
+ CALL I4I8 (NNNPS4, PLTNNPS4, LTNNPS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNSD (IDEXO, IDNPS, FACNPS, IERR)
+C
+C READ NODE SET DISTRIBUTION FACTORS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ REAL FACNPS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+
+ CALL EXGNSD4 (IDEXO4, IDNPS4, FACNPS, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNSI (IDEXO, IDNPSS, IERR)
+C
+C READ NODE SET IDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPSS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPSS4 (1) ! (W)
+ POINTER (PIDNPSS4, IDNPSS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODS
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODS = INTRET4
+ CALL I4ALLOC (NEXNODS, PIDNPSS4)
+ CALL EXGNSI4 (IDEXO4, IDNPSS4, IERR4)
+ CALL I4I8 (NEXNODS, PIDNPSS4, IDNPSS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNV (IDEXO, ISTEP, IXNODV, NUMNP, VALNV, IERR)
+C
+C READ NODAL VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXNODV ! (R)
+ INTEGER NUMNP ! (R)
+ REAL VALNV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXNODV4 ! (R)
+ INTEGER*4 NUMNP4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXNODV4 = IXNODV
+ NUMNP4 = NUMNP
+ CALL EXGNV4 (IDEXO4, ISTEP4, IXNODV4, NUMNP4, VALNV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNVT (IDEXO, IXNODV, NODNUM, ISTPB, ISTPE,
+ & VALNV, IERR)
+C
+C READ NODAL VARIABLE VALUES THROUGH TIME
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IXNODV ! (R)
+ INTEGER NODNUM ! (R)
+ INTEGER ISTPB ! (R)
+ INTEGER ISTPE ! (R)
+ REAL VALNV (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IXNODV4 ! (R)
+ INTEGER*4 NODNUM4 ! (R)
+ INTEGER*4 ISTPB4 ! (R)
+ INTEGER*4 ISTPE4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IXNODV4 = IXNODV
+ NODNUM4 = NODNUM
+ ISTPB4 = ISTPB
+ ISTPE4 = ISTPE
+ CALL EXGNVT4 (IDEXO4, IXNODV4, NODNUM4, ISTPB4, ISTPE4,
+ & VALNV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGP (IDEXO, ITYPE, ID, NAMEPR, IVAL, IERR)
+C
+C READ OBJECT PROPERTY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ INTEGER ID ! (R)
+ CHARACTER* (*) NAMEPR ! (R)
+ INTEGER IVAL ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 IVAL4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ ID4 = ID
+ CALL EXGP4 (IDEXO4, ITYPE4, ID4, NAMEPR, IVAL4, IERR4)
+ IVAL = IVAL4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGPA (IDEXO, ITYPE, NAMEPR, IVAL, IERR)
+C
+C READ OBJECT PROPERTY ARRAY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ CHARACTER* (*) NAMEPR ! (R)
+ INTEGER IVAL (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 IVAL4 (1) ! (W)
+ POINTER (PIVAL4, IVAL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NUMOBJ
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ IF (ITYPE4 .EQ. EXEBLK) THEN
+ INFREQ4 = EXELBL
+ ELSE IF (ITYPE4 .EQ. EXNSET) THEN
+ INFREQ4 = EXNODS
+ ELSE IF (ITYPE4 .EQ. EXSSET) THEN
+ INFREQ4 = EXSIDS
+ ELSE IF (ITYPE4 .EQ. EXEMAP) THEN
+ INFREQ4 = EXNEM
+ ELSE IF (ITYPE4 .EQ. EXNMAP) THEN
+ INFREQ4 = EXNNM
+ END IF
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NUMOBJ = INTRET4
+ CALL I4ALLOC (NUMOBJ, PIVAL4)
+ CALL EXGPA4 (IDEXO4, ITYPE4, NAMEPR, IVAL4, IERR4)
+ CALL I4I8 (NUMOBJ, PIVAL4, IVAL)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGPN (IDEXO, ITYPE, NAMEPR, IERR)
+C
+C READ PROPERTY ARRAY NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ CHARACTER* (*) NAMEPR (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ CALL EXGPN4 (IDEXO4, ITYPE4, NAMEPR, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGQA (IDEXO, QAREC, IERR)
+C
+C READ QA RECORDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) QAREC (4,*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGQA4 (IDEXO4, QAREC, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSP (IDEXO, IDESS, NSESS, NDESS, IERR)
+C
+C READ SIDE SET PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER NSESS ! (W)
+ INTEGER NDESS ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 NSESS4 ! (W)
+ INTEGER*4 NDESS4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ NSESS = NSESS4
+ NDESS = NDESS4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSNL (IDEXO, IDESS, NNESS, IERR)
+C
+C GET SIDE SET NODELIST LENGTH
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER NNESS ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 NNESS4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSNL4 (IDEXO4, IDESS4, NNESS4, IERR4)
+ NNESS = NNESS4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSS (IDEXO, IDESS, LTEESS, LTSESS, IERR)
+C
+C READ SIDE SET
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER LTEESS (*) ! (W)
+ INTEGER LTSESS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 LTEESS4 (1) ! (W)
+ INTEGER*4 LTSESS4 (1) ! (W)
+ POINTER (PLTEESS4, LTEESS4)
+ POINTER (PLTSESS4, LTSESS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 NSESS4
+ INTEGER*4 NDESS4
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ CALL I4ALLOC (NSESS4, PLTEESS4)
+ CALL I4ALLOC (NSESS4, PLTSESS4)
+ CALL EXGSS4 (IDEXO4, IDESS4, LTEESS4, LTSESS4, IERR4)
+ CALL I4I8 (NSESS4, PLTEESS4, LTEESS)
+ CALL I4I8 (NSESS4, PLTSESS4, LTSESS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSD (IDEXO, IDESS, FACESS, IERR)
+C
+C READ SIDE SET DISTRIBUTION FACTORS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ REAL FACESS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSSD4 (IDEXO4, IDESS4, FACESS, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSI (IDEXO, IDESSS, IERR)
+C
+C READ SIDE SET IDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESSS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESSS4 (1) ! (W)
+ POINTER (PIDESSS4, IDESSS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+ INTEGER*4 NEXSIDS
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXSIDS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSIDS = INTRET4
+ CALL I4ALLOC (NEXSIDS, PIDESSS4)
+ CALL EXGSSI4 (IDEXO4, IDESSS4, IERR4)
+ CALL I4I8 (NEXSIDS, PIDESSS4, IDESSS)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSN (IDEXO, IDESS, INCNT, LTNESS, IERR)
+C
+C READ SIDE SET NODE LIST
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER INCNT (*) ! (W)
+ INTEGER LTNESS (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 INCNT4 (1) ! (W)
+ INTEGER*4 LTNESS4 (1) ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 TMP4(1)
+ POINTER (PTMP4, TMP4)
+ POINTER (PINCNT4, INCNT4)
+ POINTER (PLTNESS4, LTNESS4)
+
+ INTEGER*4 NSESS4
+ INTEGER*4 NDESS4
+ INTEGER*4 NLTNESS
+
+ INTEGER*4 NINCNT
+ integer i
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+C ... NOTE: It is not permissible to assume that the number of
+C distribution factors is the same as the number of
+C nodes associated with a sideset since some codes
+C are not maintaining that associativity...
+ CALL EXGSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ NINCNT = NSESS4
+
+C MUST COMPUTE NODE LIST SIZE
+
+ NINCNT = NSESS4
+ CALL I4ALLOC (NINCNT, PTMP4)
+
+ CALL EXGSSC4 (IDEXO4, IDESS4, TMP4, IERR4)
+ nltness = 0
+ do 11 i=1, nincnt
+ nltness = nltness + tmp4(i)
+ 11 continue
+ CALL I4FREE (PTMP4)
+ CALL I4ALLOC (NINCNT, PINCNT4)
+ CALL I4ALLOC (NLTNESS, PLTNESS4)
+
+ CALL EXGSSN4 (IDEXO4, IDESS4, INCNT4, LTNESS4, IERR4)
+ CALL I4I8 (NLTNESS, PLTNESS4, LTNESS)
+ CALL I4I8 (NINCNT, PINCNT4, INCNT)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSC (IDEXO, IDESS, INCNT, IERR)
+C
+C READ SIDE SET NODE LIST
+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 ndess4
+ INTEGER*4 NINCNT
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ NINCNT = NSESS4
+ CALL I4ALLOC (NINCNT, PINCNT4)
+
+ CALL EXGSSC4 (IDEXO4, IDESS4, 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
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NSTEP ! (R)
+ REAL TIME ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NSTEP4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NSTEP4 = NSTEP
+ CALL EXGTIM4 (IDEXO4, NSTEP4, TIME, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGVAN (IDEXO, VARTYP, NVAR, NAMES, IERR)
+C
+C READ RESULTS VARIABLE NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ CHARACTER* (*) NAMES (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NVAR4 = NVAR
+ CALL EXGVAN4 (IDEXO4, VARTYP, NVAR4, NAMES, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGVNM (IDEXO, VARTYP, NVAR, NAME, IERR)
+C
+C READ RESULTS VARIABLE NAME
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ CHARACTER* (*) NAME ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NVAR4 = NVAR
+ CALL EXGVNM4 (IDEXO4, VARTYP, NVAR4, NAME, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPVNM (IDEXO, VARTYP, NVAR, NAME, IERR)
+C
+C WRITE RESULTS VARIABLE NAME
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ CHARACTER* (*) NAME ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NVAR4 = NVAR
+ CALL EXPVNM4 (IDEXO4, VARTYP, NVAR4, NAME, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGVP (IDEXO, VARTYP, NVAR, IERR)
+C
+C READ RESULTS VARIABLE PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXGVP4 (IDEXO4, VARTYP, NVAR4, IERR4)
+ NVAR = NVAR4
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGVTT (IDEXO, NELBLK, NVAREL, ISEVOK, IERR)
+C
+C READ ELEMENT VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NELBLK ! (R)
+ INTEGER NVAREL ! (R)
+ INTEGER ISEVOK(*) ! (NVAREL,NELBLK) (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NELBLK4 ! (R)
+ INTEGER*4 NVAREL4 ! (R)
+ INTEGER*4 ISEVOK4(1) ! (NVAREL,NELBLK) (W)
+ POINTER (PISEVOK4, ISEVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NELBLK4 = NELBLK
+ NVAREL4 = NVAREL
+ CALL I4ALLOC (NVAREL4*NELBLK4, PISEVOK4)
+ CALL EXGVTT4 (IDEXO4, NELBLK4, NVAREL4, ISEVOK4, IERR4)
+ CALL I4I8 (NVAREL4*NELBLK4, PISEVOK4, ISEVOK)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNSTT (IDEXO, NBLK, NVAR, ISVOK, IERR)
+C
+C READ NODESET VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NBLK ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ISVOK(*) ! (NVAR,NBLK) (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NBLK4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 ISVOK4(1) ! (NVAR,NBLK) (W)
+ POINTER (PISVOK4, ISVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NBLK4 = NBLK
+ NVAR4 = NVAR
+ CALL I4ALLOC (NVAR4*NBLK4, PISVOK4)
+ CALL EXGNSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4)
+ CALL I4I8 (NVAR4*NBLK4, PISVOK4, ISVOK)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGSSTT (IDEXO, NBLK, NVAR, ISVOK, IERR)
+C
+C READ SIDESET VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NBLK ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ISVOK(*) ! (NVAR,NBLK) (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NBLK4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 ISVOK4(1) ! (NVAR,NBLK) (W)
+ POINTER (PISVOK4, ISVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NBLK4 = NBLK
+ NVAR4 = NVAR
+ CALL I4ALLOC (NVAR4*NBLK4, PISVOK4)
+ CALL EXGSSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4)
+ CALL I4I8 (NVAR4*NBLK4, PISVOK4, ISVOK)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXINQ (IDEXO, INFREQ, INTRET, RELRET, CHRRET, IERR)
+C
+C INQUIRE EXODUS PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER INFREQ ! (R)
+ INTEGER INTRET ! (W)
+ REAL RELRET ! (W)
+ CHARACTER* (*) CHRRET ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 INFREQ4 ! (R)
+ INTEGER*4 INTRET4 ! (W)
+ REAL*4 RELRET4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ INFREQ4 = INFREQ
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ INTRET = INTRET4
+ RELRET = RELRET4
+ IERR = IERR4
+ END
+
+ INTEGER FUNCTION EXOPEN (PATH, IMODE, ICOMPWS, IOWS, VERS, IERR)
+C
+C OPEN EXODUS II FILE
+C
+ IMPLICIT NONE
+ CHARACTER* (*) PATH ! (R)
+ INTEGER IMODE ! (R)
+ INTEGER ICOMPWS ! (RW)
+ INTEGER IOWS ! (RW)
+ REAL VERS ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 EXOPEN4
+ EXTERNAL EXOPEN4
+ INTEGER*4 IRET4
+ INTEGER IRET
+ INTEGER*4 IMODE4 ! (R)
+ INTEGER*4 ICOMPWS4 ! (RW)
+ INTEGER*4 IOWS4 ! (RW)
+ REAL*4 VERS4 ! (W)
+ INTEGER*4 IERR4 ! (W)
+
+ IMODE4 = IMODE
+
+C ... This needs to be set explicitly since all wrapper routines
+C are passing REAL*8 and the exo_jack.c routines all take double*
+ ICOMPWS4 = 8
+ IOWS4 = IOWS
+ IRET4 = EXOPEN4 (PATH, IMODE4, ICOMPWS4, IOWS4, VERS4, IERR4)
+ ICOMPWS = ICOMPWS4
+ IOWS = IOWS4
+ VERS = VERS4
+ IERR = IERR4
+ IRET = IRET4
+ EXOPEN = IRET
+ END
+
+ INTEGER FUNCTION EXLGMD (IDEXO)
+ IMPLICIT NONE
+ INTEGER IDEXO ! (R)
+ INTEGER IRET
+
+ INTEGER*4 EXLGMD4
+ EXTERNAL EXLGMD4
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IRET4
+
+ IDEXO4 = IDEXO
+ IRET4 = EXLGMD4(IDEXO4)
+ IRET = IRET4
+ EXLGMD = IRET
+ END
+
+ SUBROUTINE EXOPTS (OPTVAL, IERR)
+C
+C SET ERROR REPORTING LEVEL
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER OPTVAL ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 OPTVAL4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ OPTVAL4 = OPTVAL
+ CALL EXOPTS4 (OPTVAL4, IERR4)
+ IERR = IERR4
+ END
+
+
+ SUBROUTINE EXPCNS (IDEXO, IDNPSS, NNNPS, NDNPS, IXNNPS,
+ & IXDNPS, LTNNPS, FACNPS, IERR)
+C
+C WRITE CONCATENATED NODE SETS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPSS (*) ! (R)
+ INTEGER NNNPS (*) ! (R)
+ INTEGER NDNPS (*) ! (R)
+ INTEGER IXNNPS (*) ! (R)
+ INTEGER IXDNPS (*) ! (R)
+ INTEGER LTNNPS (*) ! (R)
+ REAL FACNPS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPSS4 (1) ! (R)
+ INTEGER*4 NNNPS4 (1) ! (R)
+ INTEGER*4 NDNPS4 (1) ! (R)
+ INTEGER*4 IXNNPS4 (1) ! (R)
+ INTEGER*4 IXDNPS4 (1) ! (R)
+ INTEGER*4 LTNNPS4 (1) ! (R)
+ POINTER (PIDNPSS4, IDNPSS4)
+ POINTER (PNNNPS4, NNNPS4)
+ POINTER (PNDNPS4, NDNPS4)
+ POINTER (PIXNNPS4, IXNNPS4)
+ POINTER (PIXDNPS4, IXDNPS4)
+ POINTER (PLTNNPS4, LTNNPS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODS
+ INTEGER*4 NEXNSNL
+ INTEGER*4 I
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODS = INTRET4
+C INFREQ4 = EXNSNL
+C CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+C NEXNSNL = INTRET4
+C INFREQ4 = EXNSDF
+C CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+C NEXNSDF = INTRET4
+ NEXNSNL = 0
+ DO I = 1, NEXNODS
+ NEXNSNL = NEXNSNL + NNNPS(I)
+ END DO
+ CALL I8I4 (NEXNODS, IDNPSS, PIDNPSS4)
+ CALL I8I4 (NEXNODS, NNNPS, PNNNPS4)
+ CALL I8I4 (NEXNODS, NDNPS, PNDNPS4)
+ CALL I8I4 (NEXNODS, IXNNPS, PIXNNPS4)
+ CALL I8I4 (NEXNODS, IXDNPS, PIXDNPS4)
+ CALL I8I4 (NEXNSNL, LTNNPS, PLTNNPS4)
+ CALL EXPCNS4 (IDEXO4, IDNPSS4, NNNPS4, NDNPS4, IXNNPS4,
+ & IXDNPS4, LTNNPS4, FACNPS, IERR4)
+ CALL I4FREE (PIDNPSS4)
+ CALL I4FREE (PNNNPS4)
+ CALL I4FREE (PNDNPS4)
+ CALL I4FREE (PIXNNPS4)
+ CALL I4FREE (PIXDNPS4)
+ CALL I4FREE (PLTNNPS4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPCON (IDEXO, NAMECO, IERR)
+C
+C WRITE COORDINATE NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) NAMECO (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXPCON4 (IDEXO4, NAMECO, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPCOR (IDEXO, XN, YN, ZN, IERR)
+C
+C WRITE NODAL COORDINATES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ REAL XN (*) ! (R)
+ REAL YN (*) ! (R)
+ REAL ZN (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXPCOR4 (IDEXO4, XN, YN, ZN, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPCSS (IDEXO, IDESSS, NSESS, NDESS, IXEESS,
+ & IXDESS, LTEESS, LTSESS, FACESS, IERR)
+C
+C WRITE CONCATENATED SIDE SETS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESSS (*) ! (R)
+ INTEGER NSESS (*) ! (R)
+ INTEGER NDESS (*) ! (R)
+ INTEGER IXEESS (*) ! (R)
+ INTEGER IXDESS (*) ! (R)
+ INTEGER LTEESS (*) ! (R)
+ INTEGER LTSESS (*) ! (R)
+ REAL FACESS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESSS4 (1) ! (R)
+ INTEGER*4 NSESS4 (1) ! (R)
+ INTEGER*4 NDESS4 (1) ! (R)
+ INTEGER*4 IXEESS4 (1) ! (R)
+ INTEGER*4 IXDESS4 (1) ! (R)
+ INTEGER*4 LTEESS4 (1) ! (R)
+ INTEGER*4 LTSESS4 (1) ! (R)
+ 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
+ INTEGER*4 I
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXSIDS
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXSIDS = INTRET4
+C INFREQ4 = EXSSEL
+C CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+C NEXSSEL = INTRET4
+C INFREQ4 = EXSSDF
+C CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+C NEXSSDF = INTRET4
+ NEXSSEL = 0
+ DO I = 1, NEXSIDS
+ NEXSSEL = NEXSSEL + NSESS(I)
+ END DO
+ CALL I8I4 (NEXSIDS, IDESSS, PIDESSS4)
+ CALL I8I4 (NEXSIDS, NSESS, PNSESS4)
+ CALL I8I4 (NEXSIDS, NDESS, PNDESS4)
+ CALL I8I4 (NEXSIDS, IXEESS, PIXEESS4)
+ CALL I8I4 (NEXSIDS, IXDESS, PIXDESS4)
+ CALL I8I4 (NEXSSEL, LTEESS, PLTEESS4)
+ CALL I8I4 (NEXSSEL, LTSESS, PLTSESS4)
+ CALL EXPCSS4 (IDEXO4, IDESSS4, NSESS4, NDESS4, IXEESS4,
+ & IXDESS4, LTEESS4, LTSESS4, FACESS, IERR4)
+ CALL I4FREE (PIDESSS4)
+ CALL I4FREE (PNSESS4)
+ CALL I4FREE (PNDESS4)
+ CALL I4FREE (PIXEESS4)
+ CALL I4FREE (PIXDESS4)
+ CALL I4FREE (PLTEESS4)
+ CALL I4FREE (PLTSESS4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPEAT (IDEXO, IDELB, ATRIB, IERR)
+C
+C WRITE ELEMENT BLOCK ATTRIBUTES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ REAL ATRIB(*) ! (NUMATR,NUMELB) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+
+ CALL EXPEAT4 (IDEXO4, IDELB4, ATRIB, IERR4)
+
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPEAN (IDEXO, IDELB, NATTR, NAMES, IERR)
+C
+C WRITE ELEMENT BLOCK ATTRIBUTE NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER NATTR ! (R)
+ CHARACTER* (*) NAMES (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NATTR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ NATTR4 = NATTR
+
+ CALL EXPEAN4 (IDEXO4, IDELB4, NATTR4, NAMES, IERR4)
+
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPCLB (IDEXO, IDELB, NAMELB, NUMELB, NUMLNK,
+ & NUMATR, MKMAP, IERR)
+C
+C WRITE ELEMENT BLOCK PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB(*) ! (R)
+ CHARACTER*(*) NAMELB(*) ! (R)
+ INTEGER NUMELB(*) ! (R)
+ INTEGER NUMLNK(*) ! (R)
+ INTEGER NUMATR(*) ! (R)
+ INTEGER MKMAP ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4(1) ! (R)
+ INTEGER*4 NUMELB4(1) ! (R)
+ INTEGER*4 NUMLNK4(1) ! (R)
+ INTEGER*4 NUMATR4(1) ! (R)
+ INTEGER*4 MKMAP4 ! (R)
+ POINTER (PIDELB4, IDELB4)
+ POINTER (PNUMELB4, NUMELB4)
+ POINTER (PNUMLNK4, NUMLNK4)
+ POINTER (PNUMATR4, NUMATR4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NUMBLK
+
+ IDEXO4 = IDEXO
+
+ INFREQ4 = EXELBL
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NUMBLK = INTRET4
+
+ CALL I8I4 (NUMBLK, IDELB, PIDELB4)
+ CALL I8I4 (NUMBLK, NUMELB, PNUMELB4)
+ CALL I8I4 (NUMBLK, NUMLNK, PNUMLNK4)
+ CALL I8I4 (NUMBLK, NUMATR, PNUMATR4)
+ MKMAP4 = MKMAP
+
+ CALL EXPCLB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, MKMAP4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPELB (IDEXO, IDELB, NAMELB, NUMELB, NUMLNK,
+ & NUMATR, IERR)
+C
+C WRITE ELEMENT BLOCK PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ CHARACTER* (*) NAMELB ! (R)
+ INTEGER NUMELB ! (R)
+ INTEGER NUMLNK ! (R)
+ INTEGER NUMATR ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NUMELB4 ! (R)
+ INTEGER*4 NUMLNK4 ! (R)
+ INTEGER*4 NUMATR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ NUMELB4 = NUMELB
+ NUMLNK4 = NUMLNK
+ NUMATR4 = NUMATR
+ CALL EXPELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPELC (IDEXO, IDELB, LINK, IERR)
+C
+C WRITE ELEMENT BLOCK CONNECTIVITY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER LINK (*) ! (NUMLNK,NUMELB) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 LINK4 (1) ! (NUMLNK,NUMELB) ! (R)
+ POINTER (PLINK4, LINK4)
+ INTEGER*4 IERR4 ! (W)
+
+ CHARACTER* (MXSTLN) NAMELB
+ INTEGER*4 NUMELB4
+ INTEGER*4 NUMLNK4
+ INTEGER*4 NUMATR4
+
+ IDEXO4 = IDEXO
+ IDELB4 = IDELB
+ CALL EXGELB4 (IDEXO4, IDELB4, NAMELB, NUMELB4, NUMLNK4,
+ & NUMATR4, IERR4)
+ CALL I8I4 (NUMLNK4*NUMELB4, LINK, PLINK4)
+ CALL EXPELC4 (IDEXO4, IDELB4, LINK4, IERR4)
+ CALL I4FREE (PLINK4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPENM (IDEXO, MAPEL, IERR)
+C
+C WRITE ELEMENT NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPEL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (R)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I8I4 (NEXELEM, MAPEL, PMAPEL4)
+ CALL EXPENM4 (IDEXO4, MAPEL4, IERR4)
+ CALL I4FREE (PMAPEL4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPEM (IDEXO, MAPID, MAPEL, IERR)
+C
+C WRITE ELEMENT NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER MAPEL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (R)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ MAPID4 = MAPID
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I8I4 (NEXELEM, MAPEL, PMAPEL4)
+ CALL EXPEM4 (IDEXO4, MAPID4, MAPEL4, IERR4)
+ CALL I4FREE (PMAPEL4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPPEM (IDEXO, MAPID, ISTART, ICOUNT, MAPEL, IERR)
+C
+C WRITE ELEMENT NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER ISTART ! (R)
+ INTEGER ICOUNT ! (R)
+ INTEGER MAPEL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 ISTART4 ! (R)
+ INTEGER*4 ICOUNT4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (R)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ MAPID4 = MAPID
+ ISTART4 = ISTART
+ ICOUNT4 = ICOUNT
+ CALL I8I4 (ICOUNT4, MAPEL, PMAPEL4)
+ CALL EXPPEM4 (IDEXO4, MAPID4, ISTART4, ICOUNT4, MAPEL4, IERR4)
+ CALL I4FREE (PMAPEL4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPEV (IDEXO, ISTEP, IXELEV, IDELB, NUMELB,
+ & VALEV, IERR)
+C
+C WRITE ELEMENT VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXELEV ! (R)
+ INTEGER IDELB ! (R)
+ INTEGER NUMELB ! (R)
+ REAL VALEV (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXELEV4 ! (R)
+ INTEGER*4 IDELB4 ! (R)
+ INTEGER*4 NUMELB4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXELEV4 = IXELEV
+ IDELB4 = IDELB
+ NUMELB4 = NUMELB
+ CALL EXPEV4 (IDEXO4, ISTEP4, IXELEV4, IDELB4, NUMELB4,
+ & VALEV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNSV (IDEXO, ISTEP, IXV, ID, NUM, VAL, IERR)
+C
+C WRITE NODESET VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXV ! (R)
+ INTEGER ID ! (R)
+ INTEGER NUM ! (R)
+ REAL VAL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXV4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 NUM4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXV4 = IXV
+ ID4 = ID
+ NUM4 = NUM
+ CALL EXPNSV4 (IDEXO4, ISTEP4, IXV4, ID4, NUM4, VAL, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPSSV (IDEXO, ISTEP, IXV, ID, NUM, VAL, IERR)
+C
+C WRITE SIDESET VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXV ! (R)
+ INTEGER ID ! (R)
+ INTEGER NUM ! (R)
+ REAL VAL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXV4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 NUM4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXV4 = IXV
+ ID4 = ID
+ NUM4 = NUM
+ CALL EXPSSV4 (IDEXO4, ISTEP4, IXV4, ID4, NUM4, VAL, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPGV (IDEXO, ISTEP, NVARGL, VALGV, IERR)
+C
+C WRITE GLOBAL VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER NVARGL ! (R)
+ REAL VALGV (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 NVARGL4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ NVARGL4 = NVARGL
+ CALL EXPGV4 (IDEXO4, ISTEP4, NVARGL4, VALGV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPINF (IDEXO, NINFO, INFO, IERR)
+C
+C WRITE INFORMATION RECORDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NINFO ! (R)
+ CHARACTER* (*) INFO (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NINFO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NINFO4 = NINFO
+ CALL EXPINF4 (IDEXO4, NINFO4, INFO, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPINI (IDEXO, TITLE, NDIM, NUMNP, NUMEL, NELBLK,
+ & NUMNPS, NUMESS, IERR)
+C
+C WRITE INITIALIZATION PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER* (*) TITLE ! (R)
+ INTEGER NDIM ! (R)
+ INTEGER NUMNP ! (R)
+ INTEGER NUMEL ! (R)
+ INTEGER NELBLK ! (R)
+ INTEGER NUMNPS ! (R)
+ INTEGER NUMESS ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NDIM4 ! (R)
+ INTEGER*4 NUMNP4 ! (R)
+ INTEGER*4 NUMEL4 ! (R)
+ INTEGER*4 NELBLK4 ! (R)
+ INTEGER*4 NUMNPS4 ! (R)
+ INTEGER*4 NUMESS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NDIM4 = NDIM
+ NUMNP4 = NUMNP
+ NUMEL4 = NUMEL
+ NELBLK4 = NELBLK
+ NUMNPS4 = NUMNPS
+ NUMESS4 = NUMESS
+ CALL EXPINI4 (IDEXO4, TITLE, NDIM4, NUMNP4, NUMEL4, NELBLK4,
+ & NUMNPS4, NUMESS4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPMAP (IDEXO, MAPEL, IERR)
+C
+C WRITE ELEMENT ORDER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPEL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPEL4 (1) ! (R)
+ POINTER (PMAPEL4, MAPEL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXELEM
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXELEM
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXELEM = INTRET4
+ CALL I8I4 (NEXELEM, MAPEL, PMAPEL4)
+ CALL EXPMAP4 (IDEXO4, MAPEL4, IERR4)
+ CALL I4FREE (PMAPEL4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNNM (IDEXO, MAPNOD, IERR)
+C
+C WRITE NODE NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPNOD (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPNOD4 (1) ! (R)
+ POINTER (PMAPNOD4, MAPNOD4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODE
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODE
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODE = INTRET4
+ CALL I8I4 (NEXNODE, MAPNOD, PMAPNOD4)
+ CALL EXPNNM4 (IDEXO4, MAPNOD4, IERR4)
+ CALL I4FREE (PMAPNOD4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNM (IDEXO, MAPID, MAPNOD, IERR)
+C
+C WRITE NODE NUMBER MAP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER MAPID ! (R)
+ INTEGER MAPNOD (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 MAPID4 ! (R)
+ INTEGER*4 MAPNOD4 (1) ! (R)
+ POINTER (PMAPNOD4, MAPNOD4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NEXNODE
+
+ IDEXO4 = IDEXO
+ INFREQ4 = EXNODE
+ MAPID4 = MAPID
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NEXNODE = INTRET4
+ CALL I8I4 (NEXNODE, MAPNOD, PMAPNOD4)
+ CALL EXPNM4 (IDEXO4, MAPID4, MAPNOD4, IERR4)
+ CALL I4FREE (PMAPNOD4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNP (IDEXO, IDNPS, NNNPS, NDNPS, IERR)
+C
+C WRITE NODE SET PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ INTEGER NNNPS ! (R)
+ INTEGER NDNPS ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 NNNPS4 ! (R)
+ INTEGER*4 NDNPS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+ NNNPS4 = NNNPS
+ NDNPS4 = NDNPS
+ CALL EXPNP4 (IDEXO4, IDNPS4, NNNPS4, NDNPS4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNS (IDEXO, IDNPS, LTNNPS, IERR)
+C
+C WRITE NODE SET
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ INTEGER LTNNPS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 LTNNPS4 (1) ! (R)
+ POINTER (PLTNNPS4, LTNNPS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 NNNPS4
+ INTEGER*4 NDNPS4
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+ CALL EXGNP4 (IDEXO4, IDNPS4, NNNPS4, NDNPS4, IERR4)
+ CALL I8I4 (NNNPS4, LTNNPS, PLTNNPS4)
+ CALL EXPNS4 (IDEXO4, IDNPS4, LTNNPS4, IERR4)
+ CALL I4FREE (PLTNNPS4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNSD (IDEXO, IDNPS, FACNPS, IERR)
+C
+C WRITE NODE SET DISTRIBUTION FACTORS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDNPS ! (R)
+ REAL FACNPS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDNPS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDNPS4 = IDNPS
+ CALL EXPNSD4 (IDEXO4, IDNPS4, FACNPS, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNV (IDEXO, ISTEP, IXNODV, NUMNP, VALNV, IERR)
+C
+C WRITE NODAL VARIABLE VALUES AT A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ISTEP ! (R)
+ INTEGER IXNODV ! (R)
+ INTEGER NUMNP ! (R)
+ REAL VALNV (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ISTEP4 ! (R)
+ INTEGER*4 IXNODV4 ! (R)
+ INTEGER*4 NUMNP4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ISTEP4 = ISTEP
+ IXNODV4 = IXNODV
+ NUMNP4 = NUMNP
+ CALL EXPNV4 (IDEXO4, ISTEP4, IXNODV4, NUMNP4, VALNV, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPP (IDEXO, ITYPE, ID, NAMEPR, IVAL, IERR)
+C
+C WRITE OBJECT PROPERTY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ INTEGER ID ! (R)
+ CHARACTER* (*) NAMEPR ! (R)
+ INTEGER IVAL ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 ID4 ! (R)
+ INTEGER*4 IVAL4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ ID4 = ID
+ IVAL4 = IVAL
+ CALL EXPP4 (IDEXO4, ITYPE4, ID4, NAMEPR, IVAL4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPPA (IDEXO, ITYPE, NAMEPR, IVAL, IERR)
+C
+C WRITE OBJECT PROPERTY ARRAY
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ CHARACTER* (*) NAMEPR ! (R)
+ INTEGER IVAL (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 IVAL4 (1) ! (R)
+ POINTER (PIVAL4, IVAL4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 INFREQ4
+ INTEGER*4 INTRET4
+ REAL*4 RELRET4
+ CHARACTER* (4) CHRRET
+
+ INTEGER*4 NUMOBJ
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ IF (ITYPE4 .EQ. EXEBLK) THEN
+ INFREQ4 = EXELBL
+ ELSE IF (ITYPE4 .EQ. EXNSET) THEN
+ INFREQ4 = EXNODS
+ ELSE IF (ITYPE4 .EQ. EXSSET) THEN
+ INFREQ4 = EXSIDS
+ ELSE IF (ITYPE4 .EQ. EXEMAP) THEN
+ INFREQ4 = EXNEM
+ ELSE IF (ITYPE4 .EQ. EXNMAP) THEN
+ INFREQ4 = EXNNM
+ END IF
+ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET4, RELRET4, CHRRET, IERR4)
+ NUMOBJ = INTRET4
+ CALL I8I4 (NUMOBJ, IVAL, PIVAL4)
+ CALL EXPPA4 (IDEXO4, ITYPE4, NAMEPR, IVAL4, IERR4)
+ CALL I4FREE (PIVAL4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPPN (IDEXO, ITYPE, NPROPS, NAMEPR, IERR)
+C
+C WRITE PROPERTY ARRAY NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER ITYPE ! (R)
+ INTEGER NPROPS ! (R)
+ CHARACTER* (*) NAMEPR (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 NPROPS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ NPROPS4 = NPROPS
+ CALL EXPPN4 (IDEXO4, ITYPE4, NPROPS4, NAMEPR, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPQA (IDEXO, NQAREC, QAREC, IERR)
+C
+C WRITE QA RECORDS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NQAREC ! (R)
+ CHARACTER* (*) QAREC (4,*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NQAREC4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NQAREC4 = NQAREC
+ CALL EXPQA4 (IDEXO4, NQAREC4, QAREC, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPSP (IDEXO, IDESS, NSESS, NDESS, IERR)
+C
+C WRITE SIDE SET PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER NSESS ! (R)
+ INTEGER NDESS ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 NSESS4 ! (R)
+ INTEGER*4 NDESS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ NSESS4 = NSESS
+ NDESS4 = NDESS
+ CALL EXPSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPSS (IDEXO, IDESS, LTEESS, LTSESS, IERR)
+C
+C WRITE SIDE SET
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ INTEGER LTEESS (*) ! (R)
+ INTEGER LTSESS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 LTEESS4 (1) ! (R)
+ INTEGER*4 LTSESS4 (1) ! (R)
+ POINTER (PLTEESS4, LTEESS4)
+ POINTER (PLTSESS4, LTSESS4)
+ INTEGER*4 IERR4 ! (W)
+
+ INTEGER*4 NSESS4
+ INTEGER*4 NDESS4
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXGSP4 (IDEXO4, IDESS4, NSESS4, NDESS4, IERR4)
+ CALL I8I4 (NSESS4, LTEESS, PLTEESS4)
+ CALL I8I4 (NSESS4, LTSESS, PLTSESS4)
+ CALL EXPSS4 (IDEXO4, IDESS4, LTEESS4, LTSESS4, IERR4)
+ CALL I4FREE (PLTEESS4)
+ CALL I4FREE (PLTSESS4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPSSD (IDEXO, IDESS, FACESS, IERR)
+C
+C WRITE SIDE SET DISTRIBUTION FACTORS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IDESS ! (R)
+ REAL FACESS (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IDESS4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ IDESS4 = IDESS
+ CALL EXPSSD4 (IDEXO4, IDESS4, FACESS, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPTIM (IDEXO, NSTEP, TIME, IERR)
+C
+C WRITE TIME VALUE FOR A TIME STEP
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NSTEP ! (R)
+ REAL TIME ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NSTEP4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NSTEP4 = NSTEP
+ CALL EXPTIM4 (IDEXO4, NSTEP4, TIME, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPVAN (IDEXO, VARTYP, NVAR, NAMES, IERR)
+C
+C WRITE RESULTS VARIABLE NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ CHARACTER* (*) NAMES (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NVAR4 = NVAR
+ CALL EXPVAN4 (IDEXO4, VARTYP, NVAR4, NAMES, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPVP (IDEXO, VARTYP, NVAR, IERR)
+C
+C WRITE RESULTS VARIABLE PARAMETERS
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NVAR4 = NVAR
+ CALL EXPVP4 (IDEXO4, VARTYP, NVAR4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPVTT (IDEXO, NELBLK, NVAREL, ISEVOK, IERR)
+C
+C WRITE ELEMENT VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NELBLK ! (R)
+ INTEGER NVAREL ! (R)
+ INTEGER ISEVOK (*) ! (NVAREL,NELBLK) (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NELBLK4 ! (R)
+ INTEGER*4 NVAREL4 ! (R)
+ INTEGER*4 ISEVOK4 (1) ! (NVAREL,NELBLK) (R)
+ POINTER (PISEVOK4, ISEVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NELBLK4 = NELBLK
+ NVAREL4 = NVAREL
+ CALL I8I4 (NVAREL4*NELBLK4, ISEVOK, PISEVOK4)
+ CALL EXPVTT4 (IDEXO4, NELBLK4, NVAREL4, ISEVOK4, IERR4)
+ CALL I4FREE (PISEVOK4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNSTT (IDEXO, NBLK, NVAR, ISVOK, IERR)
+C
+C WRITE NODESET VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NBLK ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ISVOK (*) ! (NVAR,NBLK) (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NBLK4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 ISVOK4 (1) ! (NVAR,NBLK) (R)
+ POINTER (PISVOK4, ISVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NBLK4 = NBLK
+ NVAR4 = NVAR
+ CALL I8I4 (NVAR4*NBLK4, ISVOK, PISVOK4)
+ CALL EXPNSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4)
+ CALL I4FREE (PISVOK4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPSSTT (IDEXO, NBLK, NVAR, ISVOK, IERR)
+C
+C WRITE SIDESET VARIABLE TRUTH TABLE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER NBLK ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ISVOK (*) ! (NVAR,NBLK) (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 NBLK4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 ISVOK4 (1) ! (NVAR,NBLK) (R)
+ POINTER (PISVOK4, ISVOK4)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ NBLK4 = NBLK
+ NVAR4 = NVAR
+ CALL I8I4 (NVAR4*NBLK4, ISVOK, PISVOK4)
+ CALL EXPSSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4)
+ CALL I4FREE (PISVOK4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXGNAMS (IDEXO, ITYPE, NVAR, NAMES, IERR)
+C
+C READ OBJECT NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ITYPE ! (R)
+ CHARACTER* (*) NAMES (*) ! (W)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ NVAR4 = NVAR
+ CALL EXGNAMS4 (IDEXO4, ITYPE4, NVAR4, NAMES, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXPNAMS (IDEXO, ITYPE, NVAR, NAMES, IERR)
+C
+C WRITE OBJECT NAMES
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ CHARACTER*1 VARTYP ! (R)
+ INTEGER NVAR ! (R)
+ INTEGER ITYPE ! (R)
+ CHARACTER* (*) NAMES (*) ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 ITYPE4 ! (R)
+ INTEGER*4 NVAR4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ ITYPE4 = ITYPE
+ NVAR4 = NVAR
+ CALL EXPNAMS4 (IDEXO4, ITYPE4, NVAR4, NAMES, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXUPDA (IDEXO, IERR)
+C
+C UPDATE EXODUS II FILE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO4 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO4 = IDEXO
+ CALL EXUPDA4 (IDEXO4, IERR4)
+ IERR = IERR4
+ END
+
+ SUBROUTINE EXCOPY (IDEXO1, IDEXO2, IERR)
+C
+C COPY EXODUS II FILE
+C
+ IMPLICIT NONE
+ INCLUDE 'exodusII.inc'
+ INTEGER IDEXO1 ! (R)
+ INTEGER IDEXO2 ! (R)
+ INTEGER IERR ! (W)
+
+ INTEGER*4 IDEXO14 ! (R)
+ INTEGER*4 IDEXO24 ! (R)
+ INTEGER*4 IERR4 ! (W)
+
+ IDEXO14 = IDEXO1
+ IDEXO24 = IDEXO2
+ CALL EXCOPY4 (IDEXO14, IDEXO24, IERR4)
+ IERR = IERR4
+ END
+
+
+ SUBROUTINE I8I4 (N, I8, PI4)
+C
+C CREATE I4 ARRAY AND COPY I8 ARRAY CONTENTS TO I4
+C
+ IMPLICIT NONE
+ INTEGER*4 N
+ INTEGER I8 (*)
+ INTEGER*4 I4 (1)
+ POINTER (PI4, I4)
+ INTEGER*4 I
+
+ CALL I4ALLOC (N, PI4)
+ DO I = 1, N
+ I4 (I) = I8 (I)
+ END DO
+ END
+
+ SUBROUTINE I4I8 (N, PI4, I8)
+C
+C COPY I4 ARRAY CONTENTS TO I8 AND FREE I4 ARRAY
+C
+ IMPLICIT NONE
+ INTEGER*4 N
+ INTEGER*4 I4 (1)
+ POINTER (PI4, I4)
+ INTEGER I8 (*)
+ INTEGER*4 I
+
+ DO I = 1, N
+ I8 (I) = I4 (I)
+ END DO
+ CALL I4FREE (PI4)
+ END
+
+ SUBROUTINE I4ALLOC (N, PI4)
+C
+C ALLOCATE DYNAMIC I4 ARRAY N ELEMENTS IN SIZE
+C
+ IMPLICIT NONE
+ INTEGER*4 N
+ INTEGER*4 I4 (1)
+ POINTER (PI4, I4)
+ INTEGER MALLOC
+ INTEGER*4 NB
+
+ PI4 = 0
+ IF (N .EQ. 0) RETURN
+ NB = N * 4
+ PI4 = MALLOC (NB)
+ END
+
+ SUBROUTINE I4FREE (PI4)
+C
+C FREE DYNAMIC MEMORY ASSOCIATED WITH I4 ARRAY REFERENCED BY PI4
+C
+ IMPLICIT NONE
+ INTEGER*4 I4 (1)
+ POINTER (PI4, I4)
+
+ IF (PI4 .EQ. 0) RETURN
+ CALL FREE (PI4)
+ PI4 = 0
+ END
+#endif
diff --git a/forbind/src/aix.m4 b/forbind/src/aix.m4
new file mode 100644
index 0000000..d689026
--- /dev/null
+++ b/forbind/src/aix.m4
@@ -0,0 +1,68 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', AIX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1') # for AIX, use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/aix0.inc b/forbind/src/aix0.inc
new file mode 100644
index 0000000..8515772
--- /dev/null
+++ b/forbind/src/aix0.inc
@@ -0,0 +1,29 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+c parameter(XDRDINF = 1.7014118346046923e+38)
+c parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+ parameter(XDRDINF = 1.797693134862315900e+308)
+ parameter(XDRFINF = 3.40282357e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483647-1)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/catamount.m4 b/forbind/src/catamount.m4
new file mode 100644
index 0000000..d59dee7
--- /dev/null
+++ b/forbind/src/catamount.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', cougar)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# our C compiler replaces a "$" in a module name with an "_"
+# dont now what to do about that just yet
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/common.inc b/forbind/src/common.inc
new file mode 100644
index 0000000..ce6544d
--- /dev/null
+++ b/forbind/src/common.inc
@@ -0,0 +1,153 @@
+C*****************************************************************************
+C Copyright 1994 Sandia Corporation. Under the terms of Contract
+C DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement
+C retains certain rights in this software.
+C
+C See the COPYRIGHT file for copying and redistribution conditions.
+C
+C*****************************************************************************
+c
+c Functions in the FORTRAN interface
+c These declarations may cause "unused variable" warnings
+ integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen
+ integer ncsfil
+
+ integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC
+ integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE
+ integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL
+ integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR
+ integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID
+ integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN
+ integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME
+ integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS
+ integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC
+ integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL
+
+ integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE
+
+ parameter(NCBYTE = 1)
+ parameter(NCCHAR = 2)
+ parameter(NCSHORT = 3)
+ parameter(NCLONG = 4)
+ parameter(NCFLOAT = 5)
+ parameter(NCDOUBLE = 6)
+
+c
+c masks for the struct NC flag field; passed in as 'mode' arg to
+c nccreate and ncopen.
+c
+
+c read/write, 0 => readonly
+ parameter(NCRDWR = 1)
+c in create phase, cleared by ncendef
+ parameter(NCCREAT = 2)
+c on create destroy existing file
+ parameter(NCEXCL = 4)
+c in define mode, cleared by ncendef
+ parameter(NCINDEF = 8)
+c synchronise numrecs on change (X'10')
+ parameter(NCNSYNC = 16)
+c synchronise whole header on change (X'20')
+ parameter(NCHSYNC = 32)
+c numrecs has changed (X'40')
+ parameter(NCNDIRTY = 64)
+c header info has changed (X'80')
+ parameter(NCHDIRTY = 128)
+c prefill vars on endef and increase of record, the default behavior
+ parameter(NCFILL = 0)
+c don't fill vars on endef and increase of record (X'100')
+ parameter(NCNOFILL = 256)
+c isa link (X'8000')
+ parameter(NCLINK = 32768)
+
+c
+c 'mode' arguments for nccreate and ncopen
+c
+
+ parameter(NCNOWRIT = 0)
+ parameter(NCWRITE = NCRDWR)
+ parameter(NCCLOB = 11)
+ parameter(NCNOCLOB = 15)
+c
+c 'size' argument to ncdimdef for an unlimited dimension
+c
+ LONG_INT NCUNLIM
+ parameter(NCUNLIM = 0)
+
+c
+c attribute id to put/get a global attribute
+c
+ parameter(NCGLOBAL = 0)
+c
+c Advisory Maximums
+c
+ parameter(MAXNCOP = 32)
+ parameter(MAXNCDIM = 32)
+ parameter(MAXNCATT = 512)
+ parameter(MAXNCVAR = 512)
+c Not enforced
+ parameter(MAXNCNAM = 128)
+ parameter(MAXVDIMS = MAXNCDIM)
+
+
+c
+c The netcdf data types
+c
+
+c
+c Global netcdf error status variable
+c Initialized in error.c
+c
+
+c No Error
+ parameter(NCNOERR = 0)
+c Not a netcdf id
+ parameter(NCEBADID = 1)
+c Too many netcdfs open
+ parameter(NCENFILE = 2)
+c netcdf file exists && NCNOCLOB
+ parameter(NCEEXIST = 3)
+c Invalid Argument
+ parameter(NCEINVAL = 4)
+c Write to read only
+ parameter(NCEPERM = 5)
+c Operation not allowed in data mode
+ parameter(NCENOTIN = 6)
+c Operation not allowed in define mode
+ parameter(NCEINDEF = 7)
+c Coordinates out of Domain
+ parameter(NCECOORD = 8)
+c MAXNCDIMS exceeded
+ parameter(NCEMAXDS = 9)
+c String match to name in use
+ parameter(NCENAME = 10)
+c Attribute not found
+ parameter(NCENOATT = 11)
+c MAXNCATTRS exceeded
+ parameter(NCEMAXAT = 12)
+c Not a netcdf data type
+ parameter(NCEBADTY = 13)
+c Invalid dimension id
+ parameter(NCEBADD = 14)
+c NCUNLIMITED in the wrong index
+ parameter(NCEUNLIM = 15)
+c MAXNCVARS exceeded
+ parameter(NCEMAXVS = 16)
+c Variable not found
+ parameter(NCENOTVR = 17)
+c Action prohibited on NCGLOBAL varid
+ parameter(NCEGLOB = 18)
+c Not a netcdf file
+ parameter(NCENOTNC = 19)
+ parameter(NCESTS = 20)
+ parameter (NCENTOOL = 21)
+ parameter(NCFOOBAR = 32)
+ parameter(NCSYSERR = -1)
+
+
+c
+c Global options variable. Used to determine behavior of error handler.
+c Initialized in lerror.c
+c
+ parameter(NCFATAL = 1)
+ parameter(NCVERBOS = 2)
diff --git a/forbind/src/common.m4 b/forbind/src/common.m4
new file mode 100644
index 0000000..b4d082d
--- /dev/null
+++ b/forbind/src/common.m4
@@ -0,0 +1,79 @@
+divert(-1)dnl
+# 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.
+#
+
+#
+# diversion 1 is for collecting formal arguments
+# diversion 2 is for extra formal arguments for string lengths
+# diversion 3 is for formal argument declarations
+# diversion 4 is for extra local variables derived from formal arguments
+#
+define(`STRING',`divert(1)ifdef(`INIT',,`, ')STRINGF(`$1')`'undefine(`INIT')divert(2)`'STRINGX(`$1')`'divert(3)`'STRINGD(`$1',`$2')`'divert(4)`'STRINGL(`$1')`'divert(0)')dnl
+define(`INTSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ int *$1; `$2'divert(0)')dnl
+define(`LONGSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ long *$1; `$2'divert(0)')dnl
+define(`FLOATSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ float *$1; `$2'divert(0)')dnl
+define(`DOUBLESTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ double *$1; `$2'divert(0)')dnl
+define(`REALSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ real *$1; `$2'divert(0)')dnl
+#
+# The following is for a pointer to a single character, not a Fortran
+# character variable
+#
+define(`CHARSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ char *$1; `$2'divert(0)')dnl
+define(`VOIDSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ void *$1; `$2'divert(0)')dnl
+define(`M4__PROTO',`define(`INIT',1)$2`'NAMEF($1)(undivert(1)undivert(2))undivert(3)')
+define(`M4__LOCALS',`undivert(4)')
+
+# Note: override the following default definitions in OS.m4, where necessary
+
+# Includes needed at the top of a file of C to be called from FORTRAN,
+# e.g. "#include descrip" for VMS
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`')
+
+# FORTRAN syntax for including a file, e.g. `$include: "filename"' for msoft
+define(`M4__RIGHT_QUOTE',')
+define(`F_INCLUDE',` `include' M4__RIGHT_QUOTE`'$1`'M4__RIGHT_QUOTE')
+
+# include declaring C interfaces, needed in FORTRAN when calling C, e.g.
+# Microsoft FORTRAN needs to include msoft.int
+define(`M4__C_INTERFACE_DECLARATIONS',`')
+divert(0)dnl
diff --git a/forbind/src/common2.m4 b/forbind/src/common2.m4
new file mode 100644
index 0000000..ebf44f8
--- /dev/null
+++ b/forbind/src/common2.m4
@@ -0,0 +1,79 @@
+divert(-1)dnl
+# 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.
+#
+
+#
+# diversion 1 is for collecting formal arguments
+# diversion 2 is for extra formal arguments for string lengths
+# diversion 3 is for formal argument declarations
+# diversion 4 is for extra local variables derived from formal arguments
+#
+define(`STRING',`divert(1)ifdef(`INIT',,`, ')STRINGF(`$1')`'undefine(`INIT')`'STRINGX(`$1')`'divert(3)`'STRINGD(`$1',`$2')`'divert(4)`'STRINGL(`$1')`'divert(0)')dnl
+define(`INTSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ int *$1; `$2'divert(0)')dnl
+define(`LONGSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ long *$1; `$2'divert(0)')dnl
+define(`FLOATSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ float *$1; `$2'divert(0)')dnl
+define(`DOUBLESTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ double *$1; `$2'divert(0)')dnl
+define(`REALSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ real *$1; `$2'divert(0)')dnl
+#
+# The following is for a pointer to a single character, not a Fortran
+# character variable
+#
+define(`CHARSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ char *$1; `$2'divert(0)')dnl
+define(`VOIDSTAR',`divert(1)ifdef(`INIT',,`, ')$1`'undefine(`INIT')divert(3)
+ void *$1; `$2'divert(0)')dnl
+define(`M4__PROTO',`define(`INIT',1)$2`'NAMEF($1)(undivert(1)undivert(2))undivert(3)')
+define(`M4__LOCALS',`undivert(4)')
+
+# Note: override the following default definitions in OS.m4, where necessary
+
+# Includes needed at the top of a file of C to be called from FORTRAN,
+# e.g. "#include descrip" for VMS
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`')
+
+# FORTRAN syntax for including a file, e.g. `$include: "filename"' for msoft
+define(`M4__RIGHT_QUOTE',')
+define(`F_INCLUDE',` `include' M4__RIGHT_QUOTE`'$1`'M4__RIGHT_QUOTE')
+
+# include declaring C interfaces, needed in FORTRAN when calling C, e.g.
+# Microsoft FORTRAN needs to include msoft.int
+define(`M4__C_INTERFACE_DECLARATIONS',`')
+divert(0)dnl
diff --git a/forbind/src/cougar.m4 b/forbind/src/cougar.m4
new file mode 100644
index 0000000..d59dee7
--- /dev/null
+++ b/forbind/src/cougar.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', cougar)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# our C compiler replaces a "$" in a module name with an "_"
+# dont now what to do about that just yet
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/cray.m4 b/forbind/src/cray.m4
new file mode 100644
index 0000000..5023fea
--- /dev/null
+++ b/forbind/src/cray.m4
@@ -0,0 +1,82 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', UNICOS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`
+#include <fortran.h> /* for _fcd functions */
+')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+')
+
+# transformation from fortran name to name of C module
+# for unicos, just convert to uppercase
+define(`NAMEF',
+ `translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ _fcd $1d; `$2'') # declare string parameter as type _fcd
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+ char *$1 = _fcdtocp ($1d);
+ unsigned $1len = _fcdlen ($1d);') # use _fcd functions
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`real')
+
+divert(0)dnl
diff --git a/forbind/src/darwin.m4 b/forbind/src/darwin.m4
new file mode 100755
index 0000000..a07d019
--- /dev/null
+++ b/forbind/src/darwin.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', DARWIN)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/excopy_jack.src b/forbind/src/excopy_jack.src
new file mode 100644
index 0000000..7be9559
--- /dev/null
+++ b/forbind/src/excopy_jack.src
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* excopy - ex_copy exodusII fortran jacket
+*
+* author - Larry A. Schoof, Sandia National Laboratories
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int in_exoid input exodus file id
+* int out_exoid output exodus file id
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * copy EXODUS file
+ */
+% void
+% excopy (
+% int *idexo_in, /* input EXODUS file ID */
+% int *idexo_out, /* output EXODUS file ID */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_copy (*idexo_in, *idexo_out) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to copy EXODUS file id %d to file id %d",
+ *idexo_in, *idexo_out);
+ ex_err("excopy",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgem_jack.src b/forbind/src/exgem_jack.src
new file mode 100644
index 0000000..b055158
--- /dev/null
+++ b/forbind/src/exgem_jack.src
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exgem - ex_get_elem_map exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id element map id
+*
+* exit conditions -
+* int* elem_map element map array
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * get element map
+ */
+% void
+% exgem (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* element map ID */
+% int *elem_map, /* returned element map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_elem_map (*idexo, *map_id, elem_map);
+ if (*ierr < 0)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element map from file id %d",
+ *idexo);
+ ex_err("exgem",errmsg,EX_MSG);
+ }
+ }
+}
+/*
+ * get partial_element map
+ */
+% void
+% exgpem (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* element map ID */
+% int *start, /* starting entity */
+% int *count, /* number to read */
+% int *elem_map, /* returned element map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_partial_elem_map (*idexo, *map_id, *start, *count, elem_map);
+ if (*ierr < 0)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get partial element map from file id %d",
+ *idexo);
+ ex_err("exgem",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgenm_jack.src b/forbind/src/exgenm_jack.src
new file mode 100644
index 0000000..7592141
--- /dev/null
+++ b/forbind/src/exgenm_jack.src
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exgenm - ex_get_elem_num_map exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* elem_map element numbering map array
+*
+* revision history -
+*
+* $Id: exgenm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * get element number map
+ */
+% void
+% exgenm (
+% int *idexo, /* EXODUS file ID */
+% int *elem_map, /* returned element order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_elem_num_map (*idexo, elem_map);
+ if (*ierr < 0)
+/* if (ex_get_elem_num_map (*idexo, elem_map) == -1) */
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element number map from file id %d",
+ *idexo);
+ ex_err("exgenm",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgmp_jack.src b/forbind/src/exgmp_jack.src
new file mode 100644
index 0000000..2bfa985
--- /dev/null
+++ b/forbind/src/exgmp_jack.src
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exgmp - ex_get_map_param exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* num_node_maps number of node maps
+* int* num_elem_maps number of element maps
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * get map parameters
+ */
+% void
+% exgmp (
+% int *idexo, /* EXODUS file ID */
+% int *num_node_maps, /* returned number of node maps */
+% int *num_elem_maps, /* returned number of element maps */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_map_param (*idexo, num_node_maps, num_elem_maps);
+ if (*ierr < 0)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get map parameters from file id %d",
+ *idexo);
+ ex_err("exgmp",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgnm_jack.src b/forbind/src/exgnm_jack.src
new file mode 100644
index 0000000..35a7923
--- /dev/null
+++ b/forbind/src/exgnm_jack.src
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exgnm - ex_get_node_map exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id node map id
+*
+* exit conditions -
+* int* node_map node map array
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * get node map
+ */
+% void
+% exgnm (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* node map ID */
+% int *node_map, /* returned node map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_node_map (*idexo, *map_id, node_map);
+ if (*ierr < 0)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node map from file id %d",
+ *idexo);
+ ex_err("exgem",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgnnm_jack.src b/forbind/src/exgnnm_jack.src
new file mode 100644
index 0000000..8a47bbc
--- /dev/null
+++ b/forbind/src/exgnnm_jack.src
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exgnnm - ex_get_node_num_map exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+*
+* exit conditions -
+* int* node_map node numbering map array
+*
+* revision history -
+*
+* $Id: exgnnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * get node number map
+ */
+% void
+% exgnnm (
+% int *idexo, /* EXODUS file ID */
+% int *node_map, /* returned node order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ *ierr = ex_get_node_num_map (*idexo, node_map);
+ if (*ierr < 0)
+/* if (ex_get_node_num_map (*idexo, node_map) == -1) */
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node number map from file id %d",
+ *idexo);
+ ex_err("exgnnm",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exgvnm_jack.src b/forbind/src/exgvnm_jack.src
new file mode 100644
index 0000000..53b8844
--- /dev/null
+++ b/forbind/src/exgvnm_jack.src
@@ -0,0 +1,155 @@
+/*
+ * 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_var_name exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int* idexo exodus file id
+* char* var_type variable type: G,N, or E
+* int* var_index variable index to read
+*
+* exit conditions -
+* char* var_name ptr to variable name
+* int* ierr returned error code
+*
+* revision history -
+*
+* $Id: exgvnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+extern void ex_fcdcpy(char*, int, char*);
+/*
+ * read results variables names
+ */
+% void
+% exgvnm (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variable which is described */
+% int *var_index /* variable index to be read */
+% string var_name, /* returned string containing variable name */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* ptr to temp staging space for string */
+ int slen;
+ *ierr=0; /* default no errror */
+
+ /* WARNING: var_namelen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGVNM spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (var_namelen != MAX_STR_LENGTH)
+ {
+ slen = var_namelen;
+ sprintf(errmsg,
+ "Warning: variable name string length is %d in file id %d\n",
+ var_namelen, *idexo);
+ ex_err("exgvnm",errmsg,EX_MSG);
+ }
+
+ /* Allocate staging space for the variable name */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for results variable name for file id %d",
+ *idexo);
+ ex_err("exgvnm",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* do ExodusII C call to read results variables names */
+ if (ex_get_var_name(*idexo,var_type,*var_index,sptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up allocated space */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get results variable name from file id %d",
+ *idexo);
+ ex_err("exgvnm",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* Copy Fortran variable names to staging space */
+ /** printf("[exgvnm] var_name(%d): %s\n",*var_index,sptr)); **/
+ ex_fcdcpy(var_name,slen,sptr);/* copy string into Fortran buffer */
+
+ free(sptr); /* Free up string staging area */
+}
diff --git a/forbind/src/exo_jack.src b/forbind/src/exo_jack.src
new file mode 100644
index 0000000..d580d17
--- /dev/null
+++ b/forbind/src/exo_jack.src
@@ -0,0 +1,4785 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* exo_jack - exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: exo_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+%*
+%* Meta-source for various versions of ExodusII FORTRAN jacket library.
+%*
+%* Patterned after the jackets.src netCDF library.
+%*
+%* 02/12/93 V.R. Yarberry
+%* 08/31/93 V.R. Yarberry - Modified for cbind Version 2.00
+%*
+%* After minor preprocessing via a sed script, this file becomes source
+%* to the m4 macro processor for a C library to be called from FORTRAN.
+%* The main differences between this source and C are the way function
+%* prototypes are declared. All such declarations occur in lines beginning
+%* with the "%" character. A sed script converts these into calls to m4
+%* macros for handling the various conventions for calling C functions from
+%* FORTRAN. Formal parameters corresponding to FORTRAN character strings
+%* must be declared using the pseudo type "string". Appending "len" to the
+%* name of such variables is the convention used for variables representing
+%* the FORTRAN length of string parameters.
+%*
+%* For example, the following input
+%*
+%* % void
+%* % ncadel (
+%* % int *cdfid, /* netCDF ID */
+%* % int *varid, /* variable ID */
+%* % string attname, /* attribute name */
+%* % int *rcode /* returned error code */
+%* % )
+%* % {
+%*
+%* will be converted to the following m4 macro calls:
+%*
+%* void`'M4__dnl
+%* M4__PROTO(`ncadel',
+%* `INTSTAR(cdfid)',
+%* `INTSTAR(varid)',
+%* `STRING(attname)',
+%* `INTSTAR(rcode)'
+%* )
+%* {M4__LOCALS
+%*
+%* which may be converted to the following C, using sun.m4 and common.m4
+%*
+%* void
+%* ncadel_ (cdfid, varid, attname, rcode, attnamelen)
+%* int *cdfid;
+%* int *varid;
+%* char *attname;
+%* int attnamelen;
+%* int *rcode;
+%* {
+%*
+/*
+ * OVERVIEW
+ *
+ * This file contains jacket routines written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+extern int ncopts;/* default is (NC_FATAL | NC_VERBOSE) */
+extern int exerrval; /* global integer that contains a Exodus-specific error code */
+
+/* blank fill C string to make FORTRAN string */
+void
+ex_fcdcpy (fstring, fslen, sstring)
+ char *fstring; /* output string to be blank-filled */
+ int fslen; /* length of output string */
+ char *sstring; /* input string, null-terminated */
+{
+ int i, len;
+
+ if (sstring != NULL) {
+ len = strlen(sstring);
+
+ for (i = 0; i < len; i++)
+ *(fstring + i) = *(sstring + i);
+ for (i = len; i < fslen; i++)
+ *(fstring + i) = ' ';
+ } else {
+ for (i = 0; i < fslen; i++)
+ *(fstring + i) = ' ';
+ }
+}
+
+/* ex_lenstr - string length (w/o trailing blanks) */
+#ifdef __STDC__
+int ex_lenstr (char *string)
+#else
+int ex_lenstr (string)
+ char *string;
+#endif
+{
+ char *ptr;
+
+ ptr=string+strlen(string); /* start at end of string including blanks */
+ while (*(--ptr) == ' '); /* skip blanks */
+ return(ptr-string+1); /* return trimmed length of string */
+}
+
+/* copy function used to copy strings and strip trailing blanks */
+void
+ex_fstrncpy (target, source, maxlen)
+ char *target; /* space to be copied into */
+ char *source; /* string to be copied */
+ int maxlen; /* maximum length of *source */
+{
+ int len=maxlen;
+
+ while (len-- && *source != '\0')
+ *target++ = *source++;
+
+ len=maxlen;
+ while (len-- && *(--target) == ' '); /* strip blanks */
+ *(++target) = '\0'; /* insert new EOS marker */
+}
+
+/* copy function used to copy strings terminated with blanks */
+static void
+nstrncpy (target, source, maxlen)
+ char *target; /* space to be copied into */
+ char *source; /* string to be copied */
+ int maxlen; /* maximum length of *source */
+{
+ while (maxlen-- && *source != ' ')
+ *target++ = *source++;
+ *target = '\0';
+}
+
+
+/* copy 1D Fortran string arrays into C string arrays */
+void fstra2cstra(out_array,in_array,slen,arraylen)
+ char *out_array; /* output character array */
+ char *in_array; /* input character array */
+ int slen; /* length of an individual string */
+ int arraylen; /* array length (Fortran dimension) */
+{
+ int i;
+
+ while (arraylen--)
+ {
+ /** if (exoptval & EX_DEBUG) printf("[fstr2cstra] [%d]: ",arraylen); **/
+ for (i=0;i<slen;i++)
+ {
+ /** if (exoptval & EX_DEBUG) printf("%c",*in_array); **/
+ *out_array++=*in_array++;
+ }
+ *out_array++='\0'; /* add string terminator */
+ /** if (exoptval & EX_DEBUG) printf("\n"); **/
+ }
+}
+/* copy 1D C string arrays into Fortran string arrays */
+void cstra2fstra(out_array,in_array,slen,arraylen)
+ char *out_array; /* output character array */
+ char *in_array; /* input character array */
+ int slen; /* length of an individual string */
+ int arraylen; /* array length (Fortran dimension) */
+{
+ int i;
+
+ while (arraylen--)
+ {
+ for (i=0;i<slen;i++)
+ *out_array++=*in_array++;
+ in_array++; /* skip string terminator */
+ }
+}
+
+/* copy 2D Fortran string arrays into C string arrays */
+void fstra2cstra2d(out_array,in_array,slen,xarraylen,yarraylen)
+ char *out_array; /* output character array */
+ char *in_array; /* input character array */
+ int slen; /* length of an individual string */
+ int xarraylen; /* array length (Fortran 1st dimension) */
+ int yarraylen; /* array length (Fortran 2nd dimension) */
+{
+ int i,j,k;
+
+/* char *s;
+ s=out_array; */
+
+ for (k=0;k<yarraylen;k++)
+ {
+ for(j=0;j<xarraylen;j++)
+ {
+ for (i=0;i<slen;i++)
+ *out_array++=*in_array++;
+ *out_array++='\0'; /* insert C string terminator */
+ /* printf("(%d,%d): %s\n",k,j,s);
+ s=out_array; */
+ }
+ }
+}
+
+/* copy 2D C string arrays into Fortran string arrays */
+void cstra2fstra2d(out_array,in_array,slen,xarraylen,yarraylen)
+ char *out_array; /* output character array */
+ char *in_array; /* input character array */
+ int slen; /* length of an individual string */
+ int xarraylen; /* array length (Fortran 1st dimension) */
+ int yarraylen; /* array length (Fortran 2nd dimension) */
+{
+ int i,j,k;
+
+/* char *s;
+ s=out_array; */
+
+ for (k=0;k<xarraylen;k++)
+ {
+ for(j=0;j<yarraylen;j++)
+ {
+ for (i=0;i<slen;i++)
+ *out_array++=*in_array++;
+ in_array++; /* skip string terminator */
+ /* printf("(%d,%d): %s\n",k,j,s);
+ s=out_array; */
+ }
+ }
+}
+
+#ifdef FORTRAN_HAS_NO_SHORT
+/*
+ * Convert multi-dimensional array of shorts stored in ints to packed array of
+ * shorts, in malloc'ed space. Returns pointer to shorts or NULL if malloc
+ * failed.
+ */
+static short *
+itos(ints, dims, ndims)
+ int *ints; /* multi-dimensional array of ints */
+ int *dims; /* list of dimensions */
+ int ndims; /* number of dimensions in list */
+{
+ long iocount = dimprod (dims, ndims); /* product of dimensions */
+ short *shorts = malloc (iocount * sizeof (short));
+ int *ip;
+ short *sp = shorts;
+
+ if (shorts != NULL)
+ for (ip = ints; iocount > 0; iocount--)
+ *sp++ = (short) *ip++;
+ return shorts;
+}
+#endif /* FORTRAN_HAS_NO_SHORT */
+
+/* ------------ M4__SYSTEM FORTRAN jackets for EXODUS II Functions ---------- */
+
+/*
+ * create an EXODUS II file
+ */
+% int
+% excre (
+% string path, /* file name for the new EXODUS II file */
+% int *clobmode, /* either EXNOCL or EXCLOB */
+% int *cpu_word_size /* CPU word size */
+% int *io_word_size /* IO word size */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *name;
+ int idexo;
+
+ if (!(name = malloc((pathlen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for file name buffer");
+ ex_err("excre",errmsg,EX_MSG);
+ }
+ return(EX_FATAL);
+ }
+
+ (void) nstrncpy (name, path, pathlen);
+
+ if (exoptval & EX_DEBUG)
+ printf("[excre] name: %s, mode: %d\n",name,*clobmode);
+ if ((idexo =
+ ex_create (name, *clobmode, cpu_word_size, io_word_size)) != EX_FATAL)
+ {
+ free(name);
+ *ierr = 0;
+ return (idexo);
+ }
+ free(name);
+ *ierr = ncerr;
+ return (EX_FATAL);
+}
+
+/*
+ * open an EXODUS II file
+ */
+% int
+% exopen (
+% string path, /* file name of the EXODUS II file to be opened */
+% int *mode, /* either EXREAD or EXWRIT */
+% int *cpu_word_size /* CPU word size */
+% int *io_word_size /* returned IO word size */
+% float *version, /* returned EXODUS II version number */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *name;
+ int idexo;
+
+ if (!(name = malloc((pathlen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for file name buffer");
+ ex_err("exopen",errmsg,EX_MSG);
+ }
+ return(EX_FATAL);
+ }
+
+ (void) nstrncpy (name, path, pathlen);
+ if ((idexo =
+ ex_open (name, *mode, cpu_word_size, io_word_size, version)) != EX_FATAL)
+ {
+ free(name);
+ if (exoptval & EX_DEBUG)
+ printf("[exopen] file: %d, version: %f\n",
+ idexo,*version);
+ *ierr = 0;
+ return (idexo);
+ }
+ free(name);
+ *ierr = EX_FATAL;
+ return (EX_FATAL);
+}
+
+/*
+ * close an EXODUS II file
+ */
+% void
+% exclos (
+% int *idexo, /* EXODUS file ID */
+% int *ierr /* returned error code */
+% )
+% {
+
+ *ierr = 0;
+ if (ex_close(*idexo) == EX_FATAL)
+ *ierr = EX_FATAL;
+}
+
+/*
+ * update an EXODUS II file
+ */
+% void
+% exupda (
+% int *idexo, /* EXODUS file ID */
+% int *ierr /* returned error code */
+% )
+% {
+
+ *ierr = 0;
+ if (ex_update (*idexo) == EX_FATAL)
+ *ierr = EX_FATAL;
+}
+
+/*
+ * write initialization parameters
+ */
+% void
+% expini (
+% int *idexo, /* EXODUS file ID */
+% string title, /* database title */
+% int *num_dim, /* dimensionality of the database */
+% int *num_nodes, /* number of nodal points */
+% int *num_elem, /* number of elements */
+% int *num_elem_blk, /* number of element blocks */
+% int *num_node_sets, /* number of node sets */
+% int *num_side_sets, /* number of side sets */
+% int *ierr /* returned error code */
+% )
+% {
+
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ char errmsg[MAX_ERR_LENGTH];
+#endif
+ int slen;
+ char* name;
+
+ *ierr = 0;
+ /* WARNING: titlelen SHOULD be MAX_LINE_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPINI spec. */
+ slen = MAX_LINE_LENGTH; /* max line size */
+ if (titlelen != MAX_LINE_LENGTH)
+ {
+ slen = titlelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: title string length is %d in file id %d\n",
+ titlelen, *idexo);
+ ex_err("expini",errmsg,EX_MSG);
+#endif
+ }
+
+ name = malloc((slen + 1)*sizeof(char));
+
+ (void) ex_fstrncpy (name, title, slen);
+ if (ex_put_init (*idexo, name, *num_dim, *num_nodes, *num_elem,
+ *num_elem_blk, *num_node_sets, *num_side_sets) == EX_FATAL)
+ *ierr = EX_FATAL;
+ free(name);
+}
+
+/*
+ * read initialization parameters
+ */
+% void
+% exgini (
+% int *idexo, /* EXODUS file ID */
+% string title, /* returned database title */
+% int *num_dim, /* returned dimensionality of the database */
+% int *num_nodes, /* returned number of nodal points */
+% int *num_elem, /* returned number of elements */
+% int *num_elem_blk, /* returned number of element blocks */
+% int *num_node_sets, /* returned number of node sets */
+% int *num_side_sets, /* returned number of side sets */
+% int *ierr /* returned error code */
+% )
+% {
+
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ char errmsg[MAX_ERR_LENGTH];
+#endif
+ int slen;
+ char* name;
+
+ *ierr = 0;
+ /* WARNING: titlelen SHOULD be MAX_LINE_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGINI spec. */
+ slen = MAX_LINE_LENGTH; /* max line size */
+ if (titlelen != MAX_LINE_LENGTH)
+ {
+ slen = titlelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: title string length is %d in file id %d\n",
+ titlelen, *idexo);
+ ex_err("exgini",errmsg,EX_MSG);
+#endif
+ }
+
+ name = malloc((slen + 1)*sizeof(char));
+ memset(name, 0, slen+1);
+
+ if (ex_get_init (*idexo, name, num_dim, num_nodes, num_elem, num_elem_blk,
+ num_node_sets, num_side_sets) == EX_FATAL)
+ *ierr = EX_FATAL;
+ /* printf("title: %s\n",name); */
+ ex_fcdcpy (title, slen, name);
+ free(name);
+}
+
+/*
+ * write QA records
+ */
+% void
+% expqa (
+% int *idexo, /* EXODUS file ID */
+% int *num_qa_records, /* number of QA records */
+% string qa_record, /* string containing the QA records */
+% /* qa records are Fortran character*8 (4,*) */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **sptr; /* internal string pointer array for malloc use */
+ int i,ii,iii,slen,alen;
+
+ *ierr=0; /* default no errror */
+
+ /** if (exoptval & EX_DEBUG)
+ print("[expqa] # of QA records: %d\n",*num_qa_records); **/
+ /* WARNING: qa_recordslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPQA spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (qa_recordlen != MAX_STR_LENGTH)
+ {
+ slen = qa_recordlen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: qa record string length is %d in file id %d\n",
+ qa_recordlen, *idexo);
+ ex_err("expqa",errmsg,EX_MSG);
+#endif
+ }
+ alen = 4; /* qa records are 4 strings deep */
+
+ /* Allocate space for the name ptr array */
+ if (!(sptr=malloc(((*num_qa_records)*alen+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for qa_records ptr array for file id %d",
+ *idexo);
+ ex_err("expqa",errmsg,EX_MSG);
+ }
+ return;
+ }
+ /* Allocate space for each of the strings, where size = slen,
+ place ptr into str ptr array, and
+ Copy Fortran qa records to staging space */
+ iii = 0; /* offset counter */
+ for (i=0;i<*num_qa_records;i++)
+ {
+ for (ii=0;ii<alen;ii++)
+ {
+ *(sptr+iii)=malloc((slen+1)*sizeof(char));
+ if (*(sptr+iii) == 0)
+ {
+ free(sptr); /* free up array ptr space */
+ *ierr = EX_MEMFAIL;
+ sprintf(errmsg,
+ "Error: failed to allocate space for qa record %d for file id %d",
+ i,*idexo);
+ ex_err("expqa",errmsg,EX_MEMFAIL);
+ return;
+ }
+ /* copy fortran string into allocated space */
+ /** printf("[expqa] rec #: %d fortran str#: %d, loc: %ld , %8s\n",
+ i,ii,qa_record+iii*slen,qa_record+iii*slen); **/
+ ex_fstrncpy(*(sptr+iii),qa_record+iii*slen,slen);
+ /**printf("[expqa] after ex_fstrncpy: %s\n",*(sptr+iii)); **/
+ iii++; /* bump char array pointer */
+ }
+ }
+ /**printf("[expqa] last i: %d of %d\n",i,alen); **/
+ *(sptr+iii) = 0; /* set last pointer to null */
+
+ if (ex_put_qa(*idexo,*num_qa_records,(void *)sptr) == EX_FATAL)
+ *ierr=EX_FATAL;
+
+ /* Free up the space we used */
+ iii=0;
+ for (i=0;i<*num_qa_records;i++)
+ {
+ for (ii=0;ii<alen;ii++)
+ {
+ free(*(sptr+iii)); /* First free up string space */
+ iii++;
+ }
+ }
+ free(sptr); /* Then free up array ptr space */
+}
+
+/*
+ * read QA records
+ */
+% void
+% exgqa (
+% int *idexo, /* EXODUS file ID */
+% string qa_record, /* returned string containing the QA records */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char cdummy[2];
+ int num_qa_records;
+ real rdummy;
+ char **sptr; /* internal string pointer array for malloc use */
+ int i,ii,iii,slen,alen;
+
+ *ierr=0; /* default no errror */
+
+ /* WARNING: qa_recordslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPQA spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (qa_recordlen != MAX_STR_LENGTH)
+ {
+ slen = qa_recordlen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: qa record string length is %d in file id %d\n",
+ qa_recordlen, *idexo);
+ ex_err("exgqa",errmsg,EX_MSG);
+#endif
+ }
+ alen = 4; /* qa records are 4 strings deep */
+
+ /* do ExodusII C call to find out how many qa records are avail */
+ if (ex_inquire
+ (*idexo,EX_INQ_QA,&num_qa_records,&rdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of qa records from file id %d",
+ *idexo);
+ ex_err("exgqa",errmsg,EX_MSG);
+ }
+ return;
+ }
+ /** if (exoptval & EX_DEBUG)
+ print("[exgqa] # of QA records: %d\n",num_qa_records); **/
+ /* Allocate space for the QA string ptr array */
+ if (!(sptr=malloc((num_qa_records*alen+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for qa records ptr array for file id %d",
+ *idexo);
+ ex_err("exgqa",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Step 1: Allocate space for each of the strings, where size = slen,
+ place string ptr into str ptr array.
+ Step 2: Call routine to get qa records
+ Step 3: Copy C qa records to passed Fortran array space */
+
+ iii = 0; /* offset counter */
+ for (i=0;i<num_qa_records;i++) /* pointer allocation loop */
+ {
+ for (ii=0;ii<alen;ii++)
+ {
+ *(sptr+iii)=malloc((slen+1)*sizeof(char));
+ if (*(sptr+iii) == 0)
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for qa record %d for file id %d",
+ i,*idexo);
+ ex_err("exgqa",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ iii++; /* bump char array pointer */
+ }
+ }
+ *(sptr+iii) = 0; /* null out last pointer */
+
+ /* do ExodusII C call to get qa records */
+ if (ex_get_qa(*idexo,(void *)sptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get qa records from file id %d",
+ *idexo);
+ ex_err("exgqa",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ iii = 0; /* offset counter */
+ for (i=0;i<num_qa_records;i++) /* string copy loop */
+ {
+ for (ii=0;ii<alen;ii++)
+ {
+ /* copy fortran string into allocated space */
+ /** printf("[exgqa] rec #: %d C str#: %d, loc: %ld , %-8s\n",
+ i,ii,*(sptr+iii),*(sptr+iii)); **/
+ ex_fcdcpy(qa_record+iii*slen,slen,*(sptr+iii));
+ /** printf("[exgqa] after ex_fstrncpy: %8s\n",qa_record+iii*slen); **/
+ iii++; /* bump char array pointer */
+ }
+ }
+
+ /* Free up the space we used */
+ iii=0;
+ for (i=0;i<num_qa_records;i++)
+ {
+ for (ii=0;ii<alen;ii++)
+ {
+ free(*(sptr+iii)); /* First free up string space */
+ iii++;
+ }
+ }
+ free(sptr); /* Then free up array ptr space */
+}
+
+/*
+ * write information records
+ */
+% void
+% expinf (
+% int *idexo, /* EXODUS file ID */
+% int *num_info, /* number of information records */
+% string info, /* array containing the information records */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr; /* internal string array pointer for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+ /** if (exoptval & EX_DEBUG)
+ printf("[expinf] # of info records: %d\n",*num_info); **/
+ /* WARNING: infolen SHOULD be MAX_LINE_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPINF spec. */
+ slen = MAX_LINE_LENGTH; /* max str size */
+ if (infolen != MAX_LINE_LENGTH)
+ {
+ slen = infolen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: info record length is %d in file id %d\n",
+ infolen, *idexo);
+ ex_err("expinf",errmsg,EX_MSG);
+#endif
+ }
+
+
+ /* Allocate space for the string ptr array */
+ if (!(aptr=malloc(((*num_info)+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for info record ptr array for file id %d",
+ *idexo);
+ ex_err("expinf",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the info records */
+ if (!(sptr=malloc(*num_info*(slen+1)*sizeof(char))))
+ {
+ free(aptr); /* Free up string ptr array */
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for info record buffer for file id %d",
+ *idexo);
+ ex_err("expinf",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /* Copy Fortran info records to staging space */
+ for (i=0;i<*num_info;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ ex_fstrncpy(*(aptr+i),info+i*slen,slen); /* copy string into buffer */
+ /* printf("[expinf] rec: %d , %s\n",i,*(aptr+i)); */
+ }
+ *(aptr+i) = 0; /* null out last ptr */
+ if (ex_put_info(*idexo,*num_info,aptr) == EX_FATAL)
+ {
+ *ierr=EX_FATAL;
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store info record in file id %d",
+ *idexo);
+ ex_err("expinf",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+
+/*
+ * read information records
+ */
+% void
+% exginf (
+% int *idexo, /* EXODUS file ID */
+% string info, /* returned array containing the information */
+% /* records */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr; /* internal string array pointer for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ int i,slen,num_info;
+ real fdummy;
+ char cdummy[2];
+
+ *ierr=0; /* default no errror */
+
+ /* do exodusII C call to find out how many info records are avail */
+ if (ex_inquire(*idexo,EX_INQ_INFO,&num_info,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of info records from file id %d",
+ *idexo);
+ ex_err("exginf",errmsg,EX_MSG);
+ }
+ return;
+ }
+ /** if (exoptval & EX_DEBUG)
+ printf("[exginf] # of info records: %d\n",num_info); **/
+
+ /* WARNING: infolen SHOULD be MAX_LINE_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGINF spec. */
+ slen = MAX_LINE_LENGTH; /* max str size */
+ if (infolen != MAX_LINE_LENGTH)
+ {
+ slen = infolen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: info record length is %d in file id %d\n",
+ infolen, *idexo);
+ ex_err("exginf",errmsg,EX_MSG);
+#endif
+ }
+
+ /* Step 1: Allocate space for string ptr array
+ Step 2: Allocate space for info record strings, and
+ put pointers into str ptr array
+ Step 3: Do ExodusII call to get records
+ Step 4: Copy strings into passed Fortran buffer space */
+
+ /* Allocate space for the string ptr array */
+ if (!(aptr=malloc((num_info+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for info ptr array for file id %d",
+ *idexo);
+ ex_err("exginf",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate block of space for info strings */
+ if (!(sptr=malloc(num_info*(slen+1)*sizeof(char))))
+ {
+ free(aptr); /* Free up string ptr array */
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for info records for file id %d",
+ *idexo);
+ ex_err("exginf",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ for (i=0;i<num_info;i++) /* Put pointers to the info records in ptr array */
+ *(aptr+i) = sptr+i*(slen+1); /* put ptr in string ptr array */
+ *(aptr+i) = 0; /* null out last pointer */
+
+ /* Do exodusII call to get info records */
+ if (ex_get_info(*idexo,aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr);
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get info records from file id %d",
+ *idexo);
+ ex_err("exginf",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ for (i=0;i<num_info;i++) /* Copy Fortran info records to staging space */
+ {
+ ex_fcdcpy(info+i*slen,slen,*(aptr+i)); /* copy string into buffer */
+ /** printf("[exginf] rec: %d , %s\n",i,*(aptr+i)); **/
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+
+}
+
+/*
+ * write nodal coordinates
+ */
+% void
+% expcor (
+% int *idexo, /* EXODUS file ID */
+% real *x_coor, /* x coordinates of the nodes */
+% real *y_coor, /* y coordinates of the nodes */
+% real *z_coor, /* z coordinates of the nodes */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_coord (*idexo, x_coor, y_coor, z_coor) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store coordinates in file id %d",
+ *idexo);
+ ex_err("expcor",errmsg,EX_MSG);
+ }
+
+ }
+}
+
+/*
+ * read nodal coordinates
+ */
+% void
+% exgcor (
+% int *idexo, /* EXODUS file ID */
+% real *x_coor, /* returned x coordinates of the nodes */
+% real *y_coor, /* returned y coordinates of the nodes */
+% real *z_coor, /* returned z coordinates of the nodes */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_coord (*idexo, x_coor, y_coor, z_coor) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get coordinates from file id %d",
+ *idexo);
+ ex_err("exgcor",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write coordinate names
+ */
+% void
+% expcon (
+% int *idexo, /* EXODUS file ID */
+% string coord_names, /* array containing names for the nodal */
+% /* coordinates */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ char **aptr; /* internal array of string pointers for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ char cdummy[2];
+ int i,ndim,slen;
+ real fdummy;
+
+ *ierr=0; /* default no errror */
+
+/** printf("[expcon] ID: %d, len: %d\n",*idexo,coord_nameslen); **/
+ /* WARNING: coord_nameslen SHOULD be MAX_STR_LENGTH, but may not be
+ depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPCON spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (coord_nameslen != MAX_STR_LENGTH)
+ {
+ slen = coord_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: coord name string length is %d in file id %d\n",
+ coord_nameslen, *idexo);
+ ex_err("expcon",errmsg,EX_MSG);
+#endif
+ }
+ /* do ExodusII C call to find out how many dimensions */
+ if (ex_inquire(*idexo,EX_INQ_DIM,&ndim,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of dimensions from file id %d",
+ *idexo);
+ ex_err("expcon",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* Allocate space for the name ptr array */
+ if (!(aptr=malloc((ndim+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for coordinate name ptr array for file id %d",
+ *idexo);
+ ex_err("expcon",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /* Allocate a block of space for the strings, where size = slen,
+ place ptrs into str ptr array, and
+ Copy Fortran coordinate names to staging space */
+
+ if(!(sptr=malloc(ndim*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for coordinate name buffer for file id %d",
+ *idexo);
+ ex_err("expcon",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ for (i=0;i<ndim;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1);
+ /* copy fortran string into allocated space */
+ /* nstrncpy(*(aptr+i),coord_names+i*slen,slen); */
+ ex_fstrncpy(*(aptr+i),coord_names+i*slen,slen);
+ /**printf("[expcon] str#: %d,target: %ld, source: %ld, len: %d\n",
+ i,*(aptr+i),coord_names+i*slen,slen); **/
+ }
+ *(aptr+i) = 0; /* set last pointer to null */
+
+ if (ex_put_coord_names(*idexo,aptr) == EX_FATAL)
+ {
+ *ierr=EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store coordinate names in file id %d",
+ *idexo);
+ ex_err("expcon",errmsg,EX_MSG);
+ }
+ }
+ /* Free up the space we used */
+ free(sptr); /* First free up string space */
+ free(aptr); /* Then free up array ptr space */
+}
+/*
+ * read coordinate names
+ */
+% void
+% exgcon (
+% int *idexo, /* EXODUS file ID */
+% string coord_names, /* returned array containing names for the */
+% /* nodal coordinates */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr; /* internal string array pointer for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ char cdummy[2];
+ int ndim;
+ real fdummy;
+ int i,slen;
+
+ *ierr = 0; /* default no error */
+
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgcon] Fortran target loc: %ld\n",coord_names); **/
+ slen = MAX_STR_LENGTH; /* max string size */
+ if (coord_nameslen != MAX_STR_LENGTH)
+ {
+ slen = coord_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,"Warning: coord name string length is %d in file id %d\n",
+ coord_nameslen, *idexo);
+ ex_err("exgcon",errmsg,EX_MSG);
+#endif
+ }
+
+ /* do ExodusII C call to find out how many dimensions */
+ if (ex_inquire(*idexo,EX_INQ_DIM,&ndim,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of dimensions from file id %d",
+ *idexo);
+ ex_err("exgcon",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory to stage the coordinate name ptrs into */
+ if (!(aptr = malloc((ndim+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for coordinate name ptr array for file id %d",
+ *idexo);
+ ex_err("exgcon",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgcon] str ptr array: %ld\n",aptr); **/
+
+ /* allocate a block of memory to stage the coordinate names into */
+ if (!(sptr=malloc(ndim*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ free(aptr); /* free up array ptr space */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for coordinate name buffer for file id %d",
+ *idexo);
+ ex_err("exgcon",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgcon] str ptr buffer base: %ld\n",sptr); **/
+
+ for (i=0;i<ndim;i++) /* put pointers to staging space into ptr array */
+ {
+ *(aptr+i)=sptr+i*(slen+1);
+ /** if (exoptval & EX_DEBUG) printf("[exgcon] i: %d, ptr: %ld, buf:%ld\n",
+ i,aptr+i,*(aptr+i)); **/
+ }
+
+ /* do ExodusII C call to get coord name records */
+ if (ex_get_coord_names(*idexo,aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up string space */
+ free(aptr); /* free up array ptr space */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get coordinate names from file id %d",
+ *idexo);
+ ex_err("exgcon",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* copy C strings to Fortran arrays */
+ for (i=0;i<ndim;i++)
+ {
+ if (exoptval & EX_DEBUG)
+ printf("[exgcon] name(%d): %s\n",i,*(aptr+i));
+ ex_fcdcpy(coord_names+i*slen,slen,*(aptr+i)); /* copy and blank fill */
+ }
+
+ free(sptr); /* Free up string buffer space */
+ free(aptr); /* Finally, free up array ptr space */
+ return;
+}
+
+/*
+ * write element order map
+ */
+% void
+% expmap (
+% int *idexo, /* EXODUS file ID */
+% int *elem_map, /* element order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_map (*idexo, elem_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element order map in file id %d",
+ *idexo);
+ ex_err("expmap",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read element order map
+ */
+% void
+% exgmap (
+% int *idexo, /* EXODUS file ID */
+% int *elem_map, /* returned element order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_map (*idexo, elem_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element order map from file id %d",
+ *idexo);
+ ex_err("exgmap",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write concatenated element block parameters
+ */
+% void
+% expclb (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block IDs */
+% string elem_type, /* type of elements in each element block */
+% int *num_elem_this_blk, /* number of elements in each element block */
+% int *num_nodes_per_elem,/* number of nodes per element in each element */
+% /* block */
+% int *num_attr, /* number of attributes in each element block */
+% int *create_maps, /* TRUE/FALSE should library define maps? */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ int num_elem_blk;
+ char cdummy[2];
+ real fdummy;
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i, slen;
+
+ *ierr = 0; /* default no error */
+
+ if (ex_inquire(*idexo,EX_INQ_ELEM_BLK,&num_elem_blk,&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("expcss",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* WARNING: elem_typelen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPCLB spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (elem_typelen != MAX_STR_LENGTH)
+ {
+ slen = elem_typelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: element type string length is %d in file id %d\n",
+ elem_typelen, *idexo);
+ ex_err("expclb",errmsg,EX_MSG);
+#endif
+ }
+
+
+ /* allocate memory for pointer array */
+ if (!(aptr=malloc((num_elem_blk+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element block type names ptr array for file id %d",
+ *idexo);
+ ex_err("expclb",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* allocate memory to stage the element type name into */
+ if (!(sptr=malloc(num_elem_blk*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element type name buffer for file id %d",
+ *idexo);
+ ex_err("expclb",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Copy element type names from Fortran array to staging area */
+ for (i=0;i<num_elem_blk;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ ex_fstrncpy(*(aptr+i),elem_type+i*slen,slen);/* copy string into buffer */
+ }
+ *(aptr+i) = 0; /* null out last ptr */
+
+ if (ex_put_concat_elem_block (*idexo, elem_blk_id, aptr, num_elem_this_blk,
+ num_nodes_per_elem, num_attr, *create_maps) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element block parameters in file id %d",
+ *idexo);
+ ex_err("expclb",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+ free(aptr);
+}
+
+/*
+ * write element block parameters
+ */
+% void
+% expelb (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% string elem_type, /* type of elements in the element block */
+% int *num_elem_this_blk, /* number of elements in the element block */
+% int *num_nodes_per_elem,/* number of nodes per element in the element */
+% /* block */
+% int *num_attr, /* number of attributes in the element block */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0; /* default no error */
+
+ /* WARNING: elem_typelen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPELB spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (elem_typelen != MAX_STR_LENGTH)
+ {
+ slen = elem_typelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: element type string length is %d in file id %d\n",
+ elem_typelen, *idexo);
+ ex_err("expelb",errmsg,EX_MSG);
+#endif
+ }
+
+
+ /** if (exoptval & EX_DEBUG) print(
+ "[expelb] file ID: %d, Elem blk ID: %d, #Elem: %d, #Nodes: %d, #Attrib: %d\n",
+ *idexo,*elem_blk_id,*num_elem_this_blk,*num_nodes_per_elem,*num_attr); **/
+
+ /* allocate memory to stage the element type name into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element type name buffer for file id %d",
+ *idexo);
+ ex_err("expelb",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Copy element type names from Fortran array to staging area */
+ /* nstrncpy(sptr,elem_type,slen); */
+ ex_fstrncpy(sptr,elem_type,slen);
+
+ if (ex_put_elem_block (*idexo, *elem_blk_id, sptr, *num_elem_this_blk,
+ *num_nodes_per_elem, *num_attr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element block parameters in file id %d",
+ *idexo);
+ ex_err("expelb",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+}
+
+/*
+ * read element block parameters
+ */
+% void
+% exgelb (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% string elem_type, /* type of elements in the element block */
+% int *num_elem_this_blk, /* returned number of elements in the element */
+% /* block */
+% int *num_nodes_per_elem,/* returned number of nodes per element in the */
+% /* element block */
+% int *num_attr, /* returned number of attributes in the */
+% /* element block */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0;
+
+ /* WARNING: elem_typelen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGELB spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (elem_typelen != MAX_STR_LENGTH)
+ {
+ slen = elem_typelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: element type string length is %d in file id %d\n",
+ elem_typelen, *idexo);
+ ex_err("exgelb",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to stage the element type names into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element type name buffer for file id %d",
+ *idexo);
+ ex_err("exgelc",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ if (ex_get_elem_block (*idexo, *elem_blk_id, sptr, num_elem_this_blk,
+ num_nodes_per_elem,num_attr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to read element block parameters in file id %d",
+ *idexo);
+ ex_err("exgelb",errmsg,EX_MSG);
+ }
+ return;
+ }
+ /* Copy element type name from staging area to Fortran array */
+ ex_fcdcpy (elem_type, slen, sptr);
+/* cstra2fstra(sptr,elem_type,elem_typelen,num_elem_this_blk); */
+ free(sptr);
+
+}
+
+/*
+ * read element blocks IDs
+ */
+% void
+% exgebi (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_ids, /* returned array of element blocks IDs */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_elem_blk_ids (*idexo, elem_blk_ids) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element block ids from file id %d",
+ *idexo);
+ ex_err("exgebi",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write element block connectivity
+ */
+% void
+% expelc (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% int *connect, /* connectivity array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ *ierr = 0;
+
+ /* do ExodusII C call to write the element block connectivity */
+ if (ex_put_elem_conn(*idexo,*elem_blk_id,connect) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element block connectivitys in file id %d",
+ *idexo);
+ ex_err("expelc",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read element block connectivity
+ */
+% void
+% exgelc (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% int * connect, /* returned connectivity array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ *ierr = 0;
+
+ /* do ExodusII C call to read the element block connectivity */
+ if (ex_get_elem_conn(*idexo,*elem_blk_id,connect) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element block connectivity from file id %d",
+ *idexo);
+ ex_err("exgelc",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 */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+/* WARNING - this routine must be fixed for multiple attributed blocks !!! */
+ *ierr = 0;
+ /** if (exoptval & EX_DEBUG)
+ printf("[expeat] file ID: %d, elem_blk_id: %d, attrib: %f\n",
+ *idexo,*elem_blk_id,*attrib); **/
+ if (ex_put_elem_attr(*idexo,*elem_blk_id,attrib) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element block attributes in file id %d",
+ *idexo);
+ ex_err("expeat",errmsg,EX_MSG);
+ }
+ }
+}
+
+
+/*
+ * read element block attributes
+ */
+% void
+% exgeat (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% real *attrib, /* returned list of attributes for the element */
+% /* block */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+/* WARNING - this routine must be fixed for multiple attributed blocks !!! */
+
+ *ierr = 0;
+ if (ex_get_elem_attr(*idexo,*elem_blk_id,attrib) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element block attributes from file id %d",
+ *idexo);
+ ex_err("exgeat",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read element block attribute names
+ */
+% void
+% exgean (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% int *num_attr, /* number of attributes */
+% string names, /* string containing attribute names */
+% /* block */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /* WARNING: nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (nameslen != MAX_STR_LENGTH)
+ {
+ slen = nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ nameslen, *idexo);
+ ex_err("exgean",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to for pointer array */
+ if (!(aptr=malloc((*num_attr+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element attribute names ptr array for file id %d",
+ *idexo);
+ ex_err("exgean",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_attr*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for object names for file id %d",
+ *idexo);
+ ex_err("exgean",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ return;
+ }
+ for (i=0;i<*num_attr;i++)
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ *(aptr+i) = 0; /* null out last ptr */
+
+ *ierr = 0;
+ if (ex_get_elem_attr_names(*idexo,*elem_blk_id, aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up allocated space */
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element block attribute names from file id %d",
+ *idexo);
+ ex_err("exgean",errmsg,EX_MSG);
+ }
+ }
+ /* Copy Fortran names from staging space */
+ for (i=0;i<*num_attr;i++)
+ {
+ ex_fcdcpy(names+i*slen,slen,*(aptr+i));/* copy str into Fortran buffer */
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+
+/*
+ * write element block attribute names
+ */
+% void
+% expean (
+% int *idexo, /* EXODUS file ID */
+% int *elem_blk_id, /* element block ID */
+% int *num_attr, /* number of attributes */
+% string names, /* string containing attribute names */
+% /* block */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /* WARNING: nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (nameslen != MAX_STR_LENGTH)
+ {
+ slen = nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ nameslen, *idexo);
+ ex_err("expean",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to for pointer array */
+ if (!(aptr=malloc((*num_attr+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for element attribute names ptr array for file id %d",
+ *idexo);
+ ex_err("expean",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_attr*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for object names for file id %d",
+ *idexo);
+ ex_err("expean",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ return;
+ }
+
+ /* Copy Fortran names to staging space */
+ for (i=0;i<*num_attr;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ ex_fstrncpy(*(aptr+i),names+i*slen,slen);/* copy string into buffer */
+ }
+ *(aptr+i) = 0; /* null out last ptr */
+
+ *ierr = 0;
+ if (ex_put_elem_attr_names(*idexo,*elem_blk_id, aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element block attribute names from file id %d",
+ *idexo);
+ ex_err("expean",errmsg,EX_MSG);
+ }
+ }
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+
+/*
+ * write object names
+ */
+% void
+% expnams (
+% int *idexo, /* EXODUS file ID */
+% int *type, /* type of objects which are described */
+% int *num_obj, /* number of objects of specified type */
+% string names, /* string containing object names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /* WARNING: nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (nameslen != MAX_STR_LENGTH)
+ {
+ slen = nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ nameslen, *idexo);
+ ex_err("expnams",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory for pointer array */
+ if (!(aptr=malloc((*num_obj+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for variable names ptr array for file id %d",
+ *idexo);
+ ex_err("expnams",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_obj*(slen+1)*sizeof(char))))
+ {
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for variable names buffer for file id %d",
+ *idexo);
+ ex_err("expnams",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ *ierr = EX_MEMFAIL;
+ return;
+ }
+ /* Copy Fortran names to staging space */
+ for (i=0;i<*num_obj;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ ex_fstrncpy(*(aptr+i),names+i*slen,slen);/* copy string into buffer */
+ }
+ *(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)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store object names in file id %d",
+ *idexo);
+ ex_err("expnams",errmsg,EX_MSG);
+ }
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+/*
+ * read object names
+ */
+% void
+% exgnams (
+% int *idexo, /* EXODUS file ID */
+% int *type, /* type of object which is described */
+% int *num_obj, /* number of 'type' names to be read */
+% string names, /* returned string containing num_obj names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /* WARNING: nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (nameslen != MAX_STR_LENGTH)
+ {
+ slen = nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ nameslen, *idexo);
+ ex_err("exgnams",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to for pointer array */
+ if (!(aptr=malloc((*num_obj+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for results variable names ptr array for file id %d",
+ *idexo);
+ ex_err("exgvan",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_obj*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for object names for file id %d",
+ *idexo);
+ ex_err("exgnams",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ return;
+ }
+ for (i=0;i<*num_obj;i++)
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ *(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)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up allocated space */
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get results variable names from file id %d",
+ *idexo);
+ ex_err("exgnams",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* Copy Fortran names from staging space */
+ for (i=0;i<*num_obj;i++)
+ {
+ ex_fcdcpy(names+i*slen,slen,*(aptr+i));/* copy str into Fortran buffer */
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+
+/*
+ * write property array names
+ */
+% void
+% exppn (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% int *num_props, /* number of properties */
+% string prop_names /* character array of property names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char **aptr; /* internal string array pointer for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ int i, slen;
+
+ *ierr = 0;
+
+ /* WARNING: prop_nameslen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPPN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_nameslen != MAX_STR_LENGTH)
+ {
+ slen = prop_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property names string length is %d in file id %d\n",
+ prop_nameslen, *idexo);
+ ex_err("exppn",errmsg,EX_MSG);
+#endif
+ }
+
+ /* Allocate space for the name ptr array */
+ if (!(aptr=malloc((*num_props+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name ptr array for file id %d",
+ *idexo);
+ ex_err("exppn",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate a block of space for the strings, where size = slen,
+ place ptrs into str ptr array, and
+ Copy Fortran coordinate names to staging space */
+
+ if(!(sptr=malloc((*num_props)*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("exppn",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ for (i=0;i<*num_props;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1);
+ /* copy fortran string into allocated space */
+ /* nstrncpy(*(aptr+i),prop_names+i*slen,slen); */
+ ex_fstrncpy(*(aptr+i),prop_names+i*slen,slen);
+ /**printf("[exppn] str#: %d,target: %ld, source: %ld, len: %d\n",
+ i,*(aptr+i),prop_names+i*slen,slen); **/
+ }
+ *(aptr+i) = 0; /* set last pointer to null */
+
+
+ if (ex_put_prop_names(*idexo,*obj_type, *num_props, aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store property names in file id %d",
+ *idexo);
+ ex_err("exppn",errmsg,EX_MSG);
+ }
+ }
+ /* Free up the space we used */
+ free(sptr); /* First free up string space */
+ free(aptr); /* Then free up array ptr space */
+}
+
+
+/*
+ * read property array names
+ */
+% void
+% exgpn (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% string prop_names /* character array of property names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char **aptr; /* internal string array pointer for malloc use */
+ char *sptr; /* internal string pointer for malloc use */
+ char *cdummy = 0;
+ int i, slen;
+ int inq_code, num_props;
+ real fdummy;
+
+ *ierr = 0;
+
+ /* WARNING: prop_nameslen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPPN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_nameslen != MAX_STR_LENGTH)
+ {
+ slen = prop_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property names string length is %d in file id %d\n",
+ prop_nameslen, *idexo);
+ ex_err("exgpn",errmsg,EX_MSG);
+#endif
+ }
+
+ switch (*obj_type)
+ {
+ case EX_ELEM_BLOCK:
+ inq_code = EX_INQ_EB_PROP;
+ break;
+ case EX_NODE_SET:
+ inq_code = EX_INQ_NS_PROP;
+ break;
+ case EX_SIDE_SET:
+ inq_code = EX_INQ_SS_PROP;
+ break;
+ case EX_ELEM_MAP:
+ inq_code = EX_INQ_EM_PROP;
+ break;
+ case EX_NODE_MAP:
+ inq_code = EX_INQ_NM_PROP;
+ break;
+ default:
+ exerrval = EX_BADPARAM;
+ *ierr = EX_BADPARAM;
+ sprintf(errmsg, "Error: object type %d not supported; file id %d",
+ *obj_type, *idexo);
+ ex_err("exgpn",errmsg,exerrval);
+ return;
+ }
+
+
+ /* do ExodusII C call to find out how many properties */
+ if (ex_inquire(*idexo,inq_code,&num_props,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of properties from file id %d",
+ *idexo);
+ ex_err("exgpn",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+
+ /* Allocate space for the name ptr array */
+ if (!(aptr=malloc((num_props+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name ptr array for file id %d",
+ *idexo);
+ ex_err("exgpn",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate a block of space for the strings, where size = slen,
+ place ptrs into str ptr array, and
+ Copy Fortran coordinate names to staging space */
+
+ if(!(sptr=malloc(num_props*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("exgpn",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ memset(sptr, 0, num_props*(slen+1));
+
+ for (i=0;i<num_props;i++)
+ *(aptr+i) = sptr+i*(slen+1);/* put ptrs to staging space into ptr array */
+ *(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)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up string space */
+ free(aptr); /* free up array ptr space */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get property names in file id %d",
+ *idexo);
+ ex_err("exgpn",errmsg,EX_MSG);
+ }
+ return;
+ }
+ /* copy C strings to Fortran arrays */
+ for (i=0;i<num_props;i++)
+ {
+ if (exoptval & EX_DEBUG)
+ printf("[exgpn] name(%d): %s\n",i,*(aptr+i));
+ ex_fcdcpy(prop_names+i*slen,slen,*(aptr+i)); /* copy and blank fill */
+ }
+
+ /* Free up the space we used */
+ free(sptr); /* First free up string space */
+ free(aptr); /* Then free up array ptr space */
+}
+
+/*
+ * write object property
+ */
+% void
+% expp (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% int *obj_id, /* object id code */
+% string prop_name, /* property name */
+% int *value, /* property value */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0;
+
+ /* WARNING: prop_namelen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPP spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_namelen != MAX_STR_LENGTH)
+ {
+ slen = prop_namelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property name string length is %d in file id %d\n",
+ prop_namelen, *idexo);
+ ex_err("expp",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to stage the property name into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("expp",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /* Copy property name from Fortran string to staging area */
+ /* nstrncpy(sptr,prop_name,slen); */
+ ex_fstrncpy(sptr,prop_name,slen);
+
+ if (ex_put_prop (*idexo, *obj_type, *obj_id, sptr, *value) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store property names in file id %d",
+ *idexo);
+ ex_err("expp",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+}
+
+/*
+ * read object property
+ */
+% void
+% exgp (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% int *obj_id, /* object id code */
+% string prop_name, /* property name */
+% int *value, /* returned property value */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0;
+
+ /* WARNING: prop_namelen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGP spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_namelen != MAX_STR_LENGTH)
+ {
+ slen = prop_namelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property name string length is %d in file id %d\n",
+ prop_namelen, *idexo);
+ ex_err("exgp",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to stage the property name into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("exgp",errmsg,EX_MEMFAIL);
+ }
+ }
+
+ /* Copy property name from Fortran string to staging area */
+ /* nstrncpy(sptr,prop_name,slen); */
+ 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)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get %s property value in file id %d",
+ sptr, *idexo);
+ ex_err("exgp",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+}
+
+/*
+ * read object property array
+ */
+% void
+% exgpa (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% string prop_name, /* property name */
+% int *values, /* returned property values array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0;
+
+ /* WARNING: prop_namelen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGP spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_namelen != MAX_STR_LENGTH)
+ {
+ slen = prop_namelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property name string length is %d in file id %d\n",
+ prop_namelen, *idexo);
+ ex_err("exgpa",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to stage the property name into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("exgpa",errmsg,EX_MEMFAIL);
+ }
+ }
+ memset(sptr, 0, slen+1);
+
+ /* Copy property name from Fortran string to staging area */
+ /* nstrncpy(sptr,prop_name,slen); */
+ ex_fstrncpy(sptr,prop_name,slen);
+
+
+ /* use exodusII C routine to get the values array */
+ if (ex_get_prop_array (*idexo, *obj_type, sptr, values) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get %s property values in file id %d",
+ sptr, *idexo);
+ ex_err("exgpa",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+}
+
+/*
+ * write object property array
+ */
+% void
+% exppa (
+% int *idexo, /* EXODUS file ID */
+% int *obj_type, /* object type code */
+% string prop_name, /* property name */
+% int *values, /* property values array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* internal string pointer for malloc use */
+ int slen;
+
+ *ierr = 0;
+
+ /* WARNING: prop_namelen SHOULD be MAX_STR_LENGTH, but may not be depending on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGP spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (prop_namelen != MAX_STR_LENGTH)
+ {
+ slen = prop_namelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: property name string length is %d in file id %d\n",
+ prop_namelen, *idexo);
+ ex_err("exppa",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to stage the property name into */
+ if (!(sptr=malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for property name buffer for file id %d",
+ *idexo);
+ ex_err("exppa",errmsg,EX_MEMFAIL);
+ }
+ }
+
+ /* Copy property name from Fortran string to staging area */
+ /* nstrncpy(sptr,prop_name,slen); */
+ ex_fstrncpy(sptr,prop_name,slen);
+
+
+ /* Use exodusII C routine to store the property values */
+ if (ex_put_prop_array (*idexo, *obj_type, sptr, values) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store %s property values in file id %d",
+ sptr, *idexo);
+ ex_err("exppa",errmsg,EX_MSG);
+ }
+ }
+ free(sptr);
+}
+
+/*
+ * write node set parameters
+ */
+% void
+% expnp (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% int *num_nodes_in_set, /* number of nodes in the node set */
+% int *num_dist_in_set, /* number of dist factors in the node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_node_set_param(*idexo,*node_set_id,
+ *num_nodes_in_set, *num_dist_in_set) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store node set parameters in file id %d",
+ *idexo);
+ ex_err("expnp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read node set parameters
+ */
+% void
+% exgnp (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% int *num_nodes_in_set, /* returned number of nodes in the node set */
+% int *num_dist_in_set, /* number of dist factors in the node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_node_set_param(*idexo,*node_set_id,
+ num_nodes_in_set, num_dist_in_set) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node set parameters from file id %d",
+ *idexo);
+ ex_err("exgnp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write node set
+ */
+% void
+% expns (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% int *node_set_node_list,/* node list for the node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_node_set(*idexo,*node_set_id,node_set_node_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store node set in file id %d",
+ *idexo);
+ ex_err("expns",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write node set dist factors
+ */
+% void
+% expnsd (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% real *node_set_dist_fact, /* distribution factors for the node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if(ex_put_node_set_dist_fact(*idexo,*node_set_id, node_set_dist_fact) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store node set dist factors in file id %d",
+ *idexo);
+ ex_err("expnsd",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read node set
+ */
+% void
+% exgns (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% int *node_set_node_list,/* returned node list for the node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_node_set(*idexo,*node_set_id,node_set_node_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node set from file id %d",
+ *idexo);
+ ex_err("exgns",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read node set dist factors
+ */
+% void
+% exgnsd (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_id, /* node set ID */
+% real *node_set_dist_fact, /* returned distribution factors for the */
+% /* node set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if(ex_get_node_set_dist_fact(*idexo,*node_set_id, node_set_dist_fact) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node set dist factors from file id %d",
+ *idexo);
+ ex_err("exgnsd",errmsg,EX_MSG);
+ }
+ }
+}
+
+
+/*
+ * read node sets IDs
+ */
+% void
+% exgnsi (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_ids, /* returned node set IDs */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_node_set_ids(*idexo,node_set_ids) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node set ids from file id %d",
+ *idexo);
+ ex_err("exgnsi",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write concatenated node sets
+ */
+% void
+% expcns (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_ids, /* node set ID for each node set */
+% int *num_nodes_per_set, /* number of nodes for each node node set */
+% int *num_dist_per_set, /* number of dist fact for each node node set */
+% int *node_sets_node_index,/* indices into the node_set_node_list */
+% /* which are the locations of the first node */
+% /* for each node set - 1 based */
+% int *node_sets_dist_index,/* indices into the node_set_dist_fact which */
+% /* are the locations of the first dist factor */
+% /* 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 */
+% /* for all node sets */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ int num_node_sets, i, *node_index_ptr, *dist_index_ptr;
+ char cdummy[2];
+ real fdummy;
+
+ *ierr = 0;
+
+ if (ex_inquire(*idexo,EX_INQ_NODE_SETS,&num_node_sets,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of nodes sets for file id %d",
+ *idexo);
+ ex_err("expcns",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory for C node index array */
+ if (!(node_index_ptr=malloc(num_node_sets*sizeof(int))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for node index array for file id %d",
+ *idexo);
+ ex_err("expcns",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* allocate memory for C dist factor index array */
+ if (!(dist_index_ptr=malloc(num_node_sets*sizeof(int))))
+ {
+ free(node_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("expcns",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ for (i=0;i<num_node_sets;i++) /* change from 1-based to 0 index */
+ {
+ node_index_ptr[i] = node_sets_node_index[i] - 1;
+ dist_index_ptr[i] = node_sets_dist_index[i] - 1;
+ }
+
+
+
+ if (ex_put_concat_node_sets(*idexo,node_set_ids,num_nodes_per_set,
+ num_dist_per_set,node_index_ptr,
+ dist_index_ptr, node_sets_node_list,
+ node_sets_dist_fact) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(node_index_ptr);
+ free(dist_index_ptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store concatenated node sets in file id %d",
+ *idexo);
+ ex_err("expcns",errmsg,EX_MSG);
+ }
+ return;
+ }
+ free(node_index_ptr);
+ free(dist_index_ptr);
+}
+
+/*
+ * read concatenated node sets
+ */
+% void
+% exgcns (
+% int *idexo, /* EXODUS file ID */
+% int *node_set_ids, /* node set ID for each node set */
+% int *num_nodes_per_set, /* number of nodes for each node node set */
+% int *num_dist_per_set, /* number of dist fact for each node node set */
+% int *node_sets_node_index,/* indices into the node_set_node_list */
+% /* which are the locations of the first node */
+% /* for each node set - 1 based */
+% int *node_sets_dist_index,/* indices into the node_set_dist_fact which */
+% /* are the locations of the first dist factor */
+% /* 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 */
+% /* for all node sets */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ int num_node_sets, i, *node_index_ptr, *dist_index_ptr;
+ real fdummy;
+ char cdummy[2];
+
+ *ierr = 0;
+
+ if (ex_inquire(*idexo,EX_INQ_NODE_SETS,&num_node_sets,&fdummy,cdummy) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get number of node sets for file id %d",
+ *idexo);
+ ex_err("exgcns",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory for C node index array */
+ if (!(node_index_ptr=malloc(num_node_sets*sizeof(int))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for node index array for file id %d",
+ *idexo);
+ ex_err("exgcns",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* allocate memory for C dist factor index array */
+ if (!(dist_index_ptr=malloc(num_node_sets*sizeof(int))))
+ {
+ free(node_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("exgcns",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgcns] %d node sets defined\n",num_node_sets); **/
+ ex_inquire(*idexo,EX_INQ_NS_NODE_LEN,&i,&fdummy,cdummy);
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgcns] node set array length: %d\n",i); **/
+
+ if (ex_get_concat_node_sets(*idexo,node_set_ids,num_nodes_per_set,
+ num_dist_per_set,node_index_ptr,
+ dist_index_ptr,node_sets_node_list,
+ node_sets_dist_fact) == EX_FATAL)
+ {
+ free(node_index_ptr);
+ free(dist_index_ptr);
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get nodes sets from file id %d",
+ *idexo);
+ ex_err("exgcns",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+
+ for (i=0;i<num_node_sets;i++) /* change from 0-based to 1 index */
+ {
+ node_sets_node_index[i] = node_index_ptr[i] + 1;
+ node_sets_dist_index[i] = dist_index_ptr[i] + 1;
+ }
+
+ free(node_index_ptr);
+ free(dist_index_ptr);
+
+}
+
+/*
+ * write side set parameters
+ */
+% void
+% expsp (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *num_sides_in_set, /* number of sides in the side set */
+% int *num_df_in_set, /* number of dist factors in the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_side_set_param(*idexo,*side_set_id,*num_sides_in_set,
+ *num_df_in_set) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store side set parameters in file id %d",
+ *idexo);
+ ex_err("expsp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read side set parameters
+ */
+% void
+% exgsp (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *num_sides_in_set, /* returned num of sides in the side set */
+% int *num_df_in_set, /* returned num of dist factors in the side set*/
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_side_set_param(*idexo,*side_set_id,num_sides_in_set,
+ num_df_in_set) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set parameters from file id %d",
+ *idexo);
+ ex_err("exgsp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * get side set node list length
+ */
+% void
+% exgsnl (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *num_nodes_in_set, /* returned num of sides in the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_side_set_node_list_len(*idexo,*side_set_id,
+ num_nodes_in_set) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set node list length from file id %d",
+ *idexo);
+ ex_err("exgsnl",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write side set
+ */
+% void
+% expss (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *side_set_elem_list,/* element list for the side set */
+% int *side_set_side_list,/* side list for the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_side_set(*idexo,*side_set_id,side_set_elem_list,
+ side_set_side_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store side set in file id %d",
+ *idexo);
+ ex_err("expss",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read side set
+ */
+% void
+% exgss (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *side_set_elem_list,/* returned element list for the side set */
+% int *side_set_side_list,/* returned side list for the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_side_set(*idexo,*side_set_id,side_set_elem_list,
+ side_set_side_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set from file id %d",
+ *idexo);
+ ex_err("exgss",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write side set distribution factors
+ */
+% void
+% expssd (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% real *side_set_dist_fact, /* distribution factors */
+% /* for the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_side_set_dist_fact(*idexo,*side_set_id,
+ side_set_dist_fact) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store side set distribution factors in file id %d",
+ *idexo);
+ ex_err("expssd",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read side set distribution factors
+ */
+% void
+% exgssd (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% real *side_set_dist_fact, /* returned distribution factors */
+% /* for the side set */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_side_set_dist_fact(*idexo,*side_set_id,
+ side_set_dist_fact) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set distribution factors from file id %d",
+ *idexo);
+ ex_err("exgssd",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read side sets IDs
+ */
+% void
+% exgssi (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_ids, /* returned side set IDs */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_side_set_ids(*idexo,side_set_ids) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get side set ids from file id %d",
+ *idexo);
+ ex_err("exgssi",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write concatenated side sets
+ */
+% void
+% expcss (
+% int *idexo, /* EXODUS file ID */
+% int *side_set_ids, /* side set ID for each side set */
+% int *num_elem_per_set, /* number of elements for each side set */
+% int *num_dist_per_set, /* number of dist factors for each side set */
+% int *side_sets_elem_index,/* indices into the side_set_elem_list which */
+% /* are the locations of the first element for*/
+% /* each side set - 1 based */
+% int *side_sets_dist_index,/* indices into the side_set_dist_fact which */
+% /* are the locations of the first node for */
+% /* each side set - 1 based */
+% int *side_sets_elem_list, /* concatenated list of elements for all the */
+% /* side sets */
+% int *side_sets_side_list, /* concatenated list of sides for all the */
+% /* side sets */
+% real *side_sets_dist_fact, /* concatenated list of distribution */
+% /* factors for all side sets */
+% int *ierr /* returned error code */
+% )
+% {
+ int num_side_sets, i, *elem_index_ptr, *dist_index_ptr;
+ real fdummy;
+ char *cdummy = 0;
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+
+ if (exoptval & EX_DEBUG) printf("[expcss]\n");
+
+ 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("expcss",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory for C element 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("expcss",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("expcss",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ for (i=0;i<num_side_sets;i++) /* change from 1-based to 0 index */
+ {
+ elem_index_ptr[i] = side_sets_elem_index[i] - 1;
+ dist_index_ptr[i] = side_sets_dist_index[i] - 1;
+ }
+
+ if (ex_put_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,side_sets_dist_fact) == EX_FATAL)
+ {
+ free(elem_index_ptr);
+ free(dist_index_ptr);
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store concatenated side sets in file id %d",
+ *idexo);
+ ex_err("expcss",errmsg,EX_MSG);
+ }
+ return;
+ }
+ free(elem_index_ptr);
+ free(dist_index_ptr);
+}
+
+/*
+ * read concatenated side sets
+ */
+% void
+% exgcss (
+% 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 */
+% real *side_sets_dist_fact, /* returned concatenated list of */
+% /* distribution factors for all 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;
+ }
+
+/* printf("[exgcss] calling ex_get_side_set ...\n");
+ printf("[exgcss] loc side_set_ids: %ld\n",side_set_ids);
+ printf("[exgcss] loc num_elem_per_set: %ld\n",num_elem_per_set);
+ printf("[exgcss] loc num_nodes_per_set: %ld\n",num_nodes_per_set);
+ printf("[exgcss] loc side_sets_node_index: %ld\n",side_sets_node_index);
+ printf("[exgcss] loc side_sets_elem_index: %ld\n",side_sets_elem_index);
+ printf("[exgcss] loc side_sets_node_list: %ld\n",side_sets_node_list);
+ printf("[exgcss] loc side_sets_elem_list: %ld\n",side_sets_elem_list);
+ printf("[exgcss] loc side_sets_dist_fact: %ld\n",side_sets_dist_fact); */
+
+ 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,side_sets_dist_fact) == 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;
+/* First walk element index array */
+ /* printf("[exgcss] # of elem per side set[%d]: %d\n",i,num_elem_per_set[i]);
+ printf("[exgcss] elem index[%d]: %d\n",i,side_sets_elem_index[i]); */
+/* Then walk node index array */
+ /* printf("[exgcss] # of nodes per side set: %d\n",num_nodes_per_set[i]);
+ printf("[exgcss] node index[%d]: %d\n",i,side_sets_node_index[i]); */
+ }
+ free (elem_index_ptr);
+ free (dist_index_ptr);
+}
+
+/*
+ * write results variables parameters
+ */
+% void
+% expvp (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variable which is described */
+% int *num_vars, /* number of var_type variables */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_var_param(*idexo,var_type,*num_vars) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store results variables parameters in file id %d",
+ *idexo);
+ ex_err("expvp",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read results variables parameters
+ */
+% void
+% exgvp (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variable which is described */
+% int *num_vars, /* returned number of var_type variables */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_var_param(*idexo,var_type,num_vars) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get results variables parameters from file id %d",
+ *idexo);
+ ex_err("exgvp",errmsg,EX_MSG);
+ }
+ }
+ /** if (exoptval & EX_DEBUG)
+ printf("[exgvp] # of vars for type %c: %d\n",
+ *var_type,*num_vars); **/
+}
+
+/*
+ * write results variables names
+ */
+% void
+% expvan (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variables which is described */
+% int *num_vars, /* number of var_type variables to be written */
+% string var_names, /* string containing num_vars variable names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /** if (exoptval & EX_DEBUG)
+ printf("[expvan] # of variable names: %d\n",*num_vars); **/
+
+ /* WARNING: var_nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (var_nameslen != MAX_STR_LENGTH)
+ {
+ slen = var_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ var_nameslen, *idexo);
+ ex_err("expvan",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory for pointer array */
+ if (!(aptr=malloc((*num_vars+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for variable names ptr array for file id %d",
+ *idexo);
+ ex_err("expvan",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_vars*(slen+1)*sizeof(char))))
+ {
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for variable names buffer for file id %d",
+ *idexo);
+ ex_err("expvan",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ *ierr = EX_MEMFAIL;
+ return;
+ }
+ /* Copy Fortran variable names to staging space */
+ for (i=0;i<*num_vars;i++)
+ {
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ /* nstrncpy(*(aptr+i),var_names+i*slen,slen); */
+ ex_fstrncpy(*(aptr+i),var_names+i*slen,slen);/* copy string into buffer */
+ /** printf("[expvan] var_name(%d): %s\n",i,*(aptr+i)); **/
+ }
+ *(aptr+i) = 0; /* null out last ptr */
+ /* do ExodusII C call to write results variables names */
+ if (ex_put_var_names(*idexo,var_type,*num_vars,aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store results variables names in file id %d",
+ *idexo);
+ ex_err("expvan",errmsg,EX_MSG);
+ }
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+/*
+ * read results variables names
+ */
+% void
+% exgvan (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variable which is described */
+% int *num_vars, /* number of var_type variables to be read */
+% string var_names, /* returned string containing num_vars variable*/
+% /* names */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char **aptr;/* ptr to temp staging space for string array ptrs */
+ char *sptr; /* ptr to temp staging space for strings */
+ int i,slen;
+
+ *ierr=0; /* default no errror */
+
+ /**if (exoptval & EX_DEBUG)
+ printf("[exgvan] # of variable names: %d\n",*num_vars); **/
+
+ /* WARNING: var_nameslen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXGVAN spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (var_nameslen != MAX_STR_LENGTH)
+ {
+ slen = var_nameslen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable names string length is %d in file id %d\n",
+ var_nameslen, *idexo);
+ ex_err("exgvan",errmsg,EX_MSG);
+#endif
+ }
+
+ /* allocate memory to for pointer array */
+ if (!(aptr=malloc((*num_vars+1)*sizeof(char *))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for results variable names ptr array for file id %d",
+ *idexo);
+ ex_err("exgvan",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* Allocate staging space for the variable names */
+ if (!(sptr=malloc(*num_vars*(slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for results variable names for file id %d",
+ *idexo);
+ ex_err("exgvan",errmsg,EX_MEMFAIL);
+ }
+ free(aptr); /* Free up string ptr array */
+ return;
+ }
+ for (i=0;i<*num_vars;i++)
+ *(aptr+i) = sptr+i*(slen+1); /* put address into ptr array */
+ *(aptr+i) = 0; /* null out last ptr */
+
+ /* do ExodusII C call to read results variables names */
+ if (ex_get_var_names(*idexo,var_type,*num_vars,aptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up allocated space */
+ free(aptr);
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get results variable names from file id %d",
+ *idexo);
+ ex_err("exgvan",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* Copy Fortran variable names to staging space */
+ for (i=0;i<*num_vars;i++)
+ {
+ /** printf("[exgvan] var_name(%d): %s\n",i,*(aptr+i)); **/
+ ex_fcdcpy(var_names+i*slen,slen,*(aptr+i));/* copy str into Fortran buffer */
+ }
+
+ free(sptr); /* Free up string staging area */
+ free(aptr); /* Free up string ptr array */
+}
+
+/*
+ * write element variable truth table
+ */
+% void
+% expvtt (
+% int *idexo, /* EXODUS file ID */
+% int *num_elem_blk, /* number of element blocks */
+% int *num_elem_var, /* number of element variables */
+% int *elem_var_tab, /* element variable truth table 2D array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ /** printf("[expvtt] # elem blks: %d, # elem vars: %d\n",
+ *num_elem_blk,*num_elem_var); **/
+ *ierr = 0;
+
+ if (ex_put_elem_var_tab(
+ *idexo,*num_elem_blk,*num_elem_var,elem_var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element variable truth table in file id %d",
+ *idexo);
+ ex_err("expvtt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * write nodeset variable truth table
+ */
+% void
+% expnstt (
+% int *idexo, /* EXODUS file ID */
+% int *num_entity, /* number of entity blocks */
+% int *num_var, /* number of variables */
+% int *var_tab, /* entity variable truth table 2D array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_put_nset_var_tab(
+ *idexo,*num_entity,*num_var,var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store nodeset variable truth table in file id %d",
+ *idexo);
+ ex_err("expnstt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * write sideset variable truth table
+ */
+% void
+% expsstt (
+% int *idexo, /* EXODUS file ID */
+% int *num_entity, /* number of entity blocks */
+% int *num_var, /* number of variables */
+% int *var_tab, /* entity variable truth table 2D array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_put_sset_var_tab(
+ *idexo,*num_entity,*num_var,var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store sideset variable truth table in file id %d",
+ *idexo);
+ ex_err("expsstt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * read element variable truth table
+ */
+% void
+% exgvtt (
+% int *idexo, /* EXODUS file ID */
+% int *num_elem_blk, /* number of element blocks */
+% int *num_elem_var, /* number of element variables */
+% int *elem_var_tab, /* returned element variable truth table array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+
+ if (ex_get_elem_var_tab(
+ *idexo,*num_elem_blk,*num_elem_var,elem_var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to failed to get element variable truth table from file id %d",
+ *idexo);
+ ex_err("exgvtt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * read nodeset variable truth table
+ */
+% void
+% exgnstt (
+% int *idexo, /* EXODUS file ID */
+% int *num_entity, /* number of entity blocks */
+% int *num_var, /* number of variables */
+% int *var_tab, /* returned variable truth table array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+
+ if (ex_get_nset_var_tab(
+ *idexo,*num_entity,*num_var,var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to failed to get nodeset variable truth table from file id %d",
+ *idexo);
+ ex_err("exgnstt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * read sideset variable truth table
+ */
+% void
+% exgsstt (
+% int *idexo, /* EXODUS file ID */
+% int *num_entity, /* number of entity blocks */
+% int *num_var, /* number of variables */
+% int *var_tab, /* returned variable truth table array */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+
+ if (ex_get_sset_var_tab(
+ *idexo,*num_entity,*num_var,var_tab) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to failed to get sideset variable truth table from file id %d",
+ *idexo);
+ ex_err("exgsstt",errmsg,EX_MSG);
+ }
+ return;
+ }
+}
+
+/*
+ * write global variable values at time step
+ */
+% void
+% expgv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *num_glob_vars, /* number of global variables */
+% real *glob_var_vals, /* array of global variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+ if (ex_put_glob_vars(*idexo,*time_step,*num_glob_vars,glob_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store global variables in file id %d",
+ *idexo);
+ ex_err("expvg",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read global variable values at a time step
+ */
+% void
+% exggv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *num_glob_vars, /* number of global variables */
+% real *glob_var_vals, /* returned array of global variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+ if (ex_get_glob_vars(*idexo,*time_step,*num_glob_vars,glob_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get global variables from file id %d",
+ *idexo);
+ ex_err("exggv",errmsg,EX_MSG);
+ }
+
+ }
+}
+
+/*
+ * read global variable values through time
+ */
+% void
+% exggvt (
+% int *idexo, /* EXODUS file ID */
+% int *glob_var_index, /* index of desired global variable */
+% int *beg_time_step, /* first time step for which value is desired */
+% int *end_time_step, /* last time step for which value is desired */
+% real *glob_var_vals, /* returned array of global variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_glob_var_time(*idexo,
+ *glob_var_index,
+ *beg_time_step,
+ *end_time_step,
+ glob_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get global variables thru time from file id %d",
+ *idexo);
+ ex_err("exggvt",errmsg,EX_MSG);
+ }
+
+ }
+}
+
+/*
+ * write nodal variable values at a time step
+ */
+% void
+% expnv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *nodal_var_index, /* index of nodal variable */
+% int *num_nodes, /* number of nodal points */
+% real *nodal_var_vals, /* array of nodal variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_nodal_var(*idexo,
+ *time_step,
+ *nodal_var_index,
+ *num_nodes,
+ nodal_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store nodal variables in file id %d",
+ *idexo);
+ ex_err("expnv",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read nodal variable values at a time step
+ */
+% void
+% exgnv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *nodal_var_index, /* index of nodal variable */
+% int *num_nodes, /* number of nodal points */
+% real *nodal_var_vals, /* returned array of nodal variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_nodal_var(*idexo,
+ *time_step,
+ *nodal_var_index,
+ *num_nodes,
+ nodal_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get nodal variables at time step %d from file id %d",
+ *time_step,*idexo);
+ ex_err("exgnv",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read nodal variable values through time
+ */
+% void
+% exgnvt (
+% int *idexo, /* EXODUS file ID */
+% int *nodal_var_index, /* index of nodal variable */
+% int *node_number, /* number of desired node */
+% int *beg_time_step, /* first time step for which value is desired */
+% int *end_time_step, /* last time step for which value is desired */
+% real *nodal_var_vals, /* returned array of nodal variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_nodal_var_time(*idexo,
+ *nodal_var_index,
+ *node_number,
+ *beg_time_step,
+ *end_time_step,
+ nodal_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get nodal variables thru time from file id %d",
+ *idexo);
+ ex_err("exgnvt",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write element variable values at a time step
+ */
+% void
+% expev (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *elem_var_index, /* index of element variable */
+% int *elem_blk_id, /* element block ID */
+% int *num_elem_this_blk, /* number of elements in this element block */
+% real *elem_var_vals, /* array of element variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_elem_var(*idexo,
+ *time_step,
+ *elem_var_index,
+ *elem_blk_id,
+ *num_elem_this_blk,
+ elem_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element variables in file id %d",
+ *idexo);
+ ex_err("expev",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read element variable values at a time step
+ */
+% void
+% exgev (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *elem_var_index, /* index of element variable */
+% int *elem_blk_id, /* element block ID */
+% int *num_elem_this_blk, /* number of elements in this element block */
+% real *elem_var_vals, /* returned array of element variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_elem_var(*idexo,
+ *time_step,
+ *elem_var_index,
+ *elem_blk_id,
+ *num_elem_this_blk,
+ elem_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element variables from file id %d",
+ *idexo);
+ ex_err("exgev",errmsg,EX_MSG);
+ }
+
+ if (exoptval & EX_DEBUG)
+ ex_err("exgev"," error reading element variables",EX_MSG);
+ }
+}
+
+/*
+ * read element variable values through time
+ */
+% void
+% exgevt (
+% int *idexo, /* EXODUS file ID */
+% int *elem_var_index, /* index of element variable */
+% int *elem_number, /* number of desired element */
+% int *beg_time_step, /* first time step for which value is desired */
+% int *end_time_step, /* last time step for which value is desired */
+% real *elem_var_vals, /* returned element variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_elem_var_time(*idexo,
+ *elem_var_index,
+ *elem_number,
+ *beg_time_step,
+ *end_time_step,
+ elem_var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get element variables thru time from file id %d",
+ *idexo);
+ ex_err("exgevt",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * write nodeset variable values at a time step
+ */
+% void
+% expnsv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *var_index, /* index of variable */
+% int *entity_id, /* entity ID */
+% int *num_entity, /* number of entities in this entity block */
+% real *var_vals, /* array of variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_nset_var(*idexo,
+ *time_step,
+ *var_index,
+ *entity_id,
+ *num_entity,
+ var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store nodeset variables in file id %d",
+ *idexo);
+ ex_err("expnsv",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read nodeset variable values at a time step
+ */
+% void
+% exgnsv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *var_index, /* index of variable */
+% int *entity_id, /* entity ID */
+% int *num_entity, /* number of entities in this entity block */
+% real *var_vals, /* returned array of variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_nset_var(*idexo,
+ *time_step,
+ *var_index,
+ *entity_id,
+ *num_entity,
+ var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get nodeset variables from file id %d",
+ *idexo);
+ ex_err("exgnsv",errmsg,EX_MSG);
+ }
+
+ if (exoptval & EX_DEBUG)
+ ex_err("exgnsv"," error reading nodeset variables",EX_MSG);
+ }
+}
+
+/*
+ * write sideset variable values at a time step
+ */
+% void
+% expssv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *var_index, /* index of variable */
+% int *entity_id, /* entity ID */
+% int *num_entity, /* number of entities in this entity block */
+% real *var_vals, /* array of variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_sset_var(*idexo,
+ *time_step,
+ *var_index,
+ *entity_id,
+ *num_entity,
+ var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store sideset variables in file id %d",
+ *idexo);
+ ex_err("expssv",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read sideset variable values at a time step
+ */
+% void
+% exgssv (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* time step number */
+% int *var_index, /* index of variable */
+% int *entity_id, /* entity ID */
+% int *num_entity, /* number of entities in this entity block */
+% real *var_vals, /* returned array of variable values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_sset_var(*idexo,
+ *time_step,
+ *var_index,
+ *entity_id,
+ *num_entity,
+ var_vals) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get sideset variables from file id %d",
+ *idexo);
+ ex_err("exgssv",errmsg,EX_MSG);
+ }
+
+ if (exoptval & EX_DEBUG)
+ ex_err("exgssv"," error reading sideset variables",EX_MSG);
+ }
+}
+
+/*
+ * write time value for a time step
+ */
+% void
+% exptim (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* the time step number */
+% real *time_value, /* simulation time value */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_time(*idexo,*time_step,time_value) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store time step value in file id %d",
+ *idexo);
+ ex_err("exptim",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read time value for a time step
+ */
+% void
+% exgtim (
+% int *idexo, /* EXODUS file ID */
+% int *time_step, /* the time step number */
+% real *time_value, /* returned simulation time value */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_time(*idexo,*time_step,time_value) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get time step value from file id %d",
+ *idexo);
+ ex_err("exgtim",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read all time values
+ */
+% void
+% exgatm (
+% int *idexo, /* EXODUS file ID */
+% real *time_values, /* returned simulation time values */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_get_all_times(*idexo,time_values) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get time step values from file id %d",
+ *idexo);
+ ex_err("exgatm",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * inquire EXODUS parameters
+ */
+% void
+% exinq (
+% int *idexo, /* EXODUS file ID */
+% 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 */
+% string ret_char, /* returned string, if string value requested */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+
+ *ierr = 0;
+ if (ex_inquire(*idexo,*req_info,ret_int,ret_real,ret_char) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get requested parameter from file id %d",
+ *idexo);
+ ex_err("exinq",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * convert side set node lists to side set side lists
+ */
+% void
+% excn2s(
+% int *idexo, /* EXODUS file ID */
+% int *num_elem_per_set, /* number of element per set
+% int *num_nodes_per_set, /* number of nodes per set
+% int *side_sets_elem_index, /* index array of elements into elem list
+% int *side_sets_node_index, /* index array of nodes
+% int *side_sets_elem_list, /* array of elements
+% int *side_sets_node_list, /* array of nodes
+% int *side_sets_side_list, /* array of sides/faces
+% int *ierr /* returned error code */
+% )
+% {
+
+ int i, num_side_sets, *node_index_ptr, *elem_index_ptr;
+ real fdummy;
+ char *cdummy = 0;
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *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("excn2s",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ /* allocate memory for C element 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("excn2s",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ /* allocate memory for C node factor index array */
+ if (!(node_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 node index array for file id %d",
+ *idexo);
+ ex_err("excn2s",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+ /* change from 1-based to 0 index */
+ for (i=0;i<num_side_sets;i++)
+ {
+ elem_index_ptr[i] = side_sets_elem_index[i] - 1;
+ node_index_ptr[i] = side_sets_node_index[i] - 1;
+ }
+
+ if (ex_cvt_nodes_to_sides(*idexo,
+ num_elem_per_set,
+ num_nodes_per_set,
+ elem_index_ptr,
+ node_index_ptr,
+ side_sets_elem_list,
+ side_sets_node_list,
+ side_sets_side_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to convert nodes to sides in file id %d",
+ *idexo);
+ ex_err("excn2s",errmsg,EX_MSG);
+ }
+ }
+ free(elem_index_ptr);
+ free(node_index_ptr);
+}
+
+/*
+ * read side set node list
+ */
+% void
+% exgssn(
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set ID */
+% int *side_set_node_cnt_list,/* array of node counts */
+% int *side_set_node_list, /* array of nodes */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+
+ if (ex_get_side_set_node_list(*idexo,*side_set_id, side_set_node_cnt_list,
+ side_set_node_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get nodes for side set %d in file id %d",
+ *side_set_id, *idexo);
+ ex_err("exgssn",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * read side set node count
+ */
+% void
+% exgssc(
+% int *idexo, /* EXODUS file ID */
+% int *side_set_id, /* side set 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_side_set_node_count(*idexo,*side_set_id, side_set_node_cnt_list) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get node counts for side set %d in file id %d",
+ *side_set_id, *idexo);
+ ex_err("exgssc",errmsg,EX_MSG);
+ }
+ }
+}
+
+/* Routine to return floating point word size */
+% int
+% excpws ()
+% {
+ return (ex_get_cpu_ws());
+}
+
+/* Routine to return large model setting */
+% int
+% exlgmd (
+% int *idexo
+% )
+% {
+ return (ex_large_model(*idexo));
+}
+
+
+/* Generalized error handling function */
+% void
+% exerr (
+% string pname, /* procedure name */
+% string err_string, /* error message string */
+% int *errcode /* error code */
+% )
+% {
+
+ char *proc_name, *error_string;
+ if (!(proc_name = malloc((pnamelen+1)*sizeof(char))))
+ {
+ ex_err("exerr","Error: failed to allocate space for process name buffer",
+ EX_MEMFAIL);
+ return;
+ }
+ if (!(error_string = malloc((err_stringlen+1)*sizeof(char))))
+ {
+ free(proc_name);
+ ex_err("exerr","Error: failed to allocate space for error msg buffer",
+ EX_MEMFAIL);
+ return;
+ }
+ /* printf("[exerr] called by: %s, msg: %s, msglen: %d\n",
+ pname,err_string,err_stringlen); */
+ ex_fstrncpy(proc_name,pname,pnamelen);
+ ex_fstrncpy(error_string,err_string,err_stringlen);
+ ex_err(proc_name,error_string,*errcode);
+ free(proc_name);
+ free(error_string);
+}
+
+/* Error message reporting options setting function */
+% void
+% exopts (
+% int *option_val /* option value */
+% int *ierr /* error return code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+ *ierr = 0;
+ ex_opts(*option_val);
+ if (exerrval != 0)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to set error reporting option to %d",
+ *option_val);
+ ex_err("exopts",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/exodus.hh b/forbind/src/exodus.hh
new file mode 100644
index 0000000..e4c7a92
--- /dev/null
+++ b/forbind/src/exodus.hh
@@ -0,0 +1,186 @@
+/*
+ * 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.
+ *
+ */
+/*
+ * This file contains defined constants that are used in the EXODUS II API.
+ *
+ * The first group of constants refer to netCDF variables, attributes, or
+ * dimensions in which the EXODUS II data are stored. Using the defined
+ * constants will allow the names of the netCDF entities to be changed easily
+ * in the future if needed. The first three letters of the constant identify
+ * the netCDF entity as a variable (VAR), dimension (DIM), or attribute (ATT).
+ *
+ * DEFINED CONSTANT ENTITY NAME DATA STORED IN ENTITY
+ */
+#define ATT_FILE_TYPE "type" /* the EXODUS II file type */
+ /* ("r" for regular or "h" */
+ /* for history) */
+#define ATT_TITLE "title" /* the database title */
+#define ATT_VERSION "version" /* the EXODUS II version # */
+#define DIM_NUM_NODES "num_nodes" /* # of nodes */
+#define DIM_NUM_DIM "num_dim" /* # of dimensions; 2- or 3-d*/
+#define DIM_NUM_ELEM "num_elem" /* # of elements */
+#define DIM_NUM_EL_BLK "num_el_blk" /* # of element blocks */
+#define VAR_COORD "coord" /* nodal coordinates */
+#define VAR_NAME_COOR "coor_names" /* names of coordinates */
+#define VAR_ID_EL_BLK "el_blk_id" /* element block ids */
+#define ATT_NAME_ELB "elem_type" /* element type names for */
+ /* each element block */
+#define DIM_NUM_EL_IN_BLK(num) catstr("num_el_in_blk",num)
+ /* # of elements in element */
+ /* block num */
+#define DIM_NUM_NOD_PER_EL(num) catstr("num_nod_per_el",num)
+ /* # of nodes per element in */
+ /* element block num */
+#define DIM_NUM_ATT_IN_BLK(num) catstr("num_att_in_blk",num)
+ /* # of attributes in element*/
+ /* block num */
+#define VAR_CONN(num) catstr("connect",num)
+ /* element connectivity for */
+ /* element block num */
+#define VAR_ATTRIB(num) catstr("attrib",num)
+ /* list of attributes for */
+ /* element block num */
+#define VAR_MAP "elem_map" /* element order map */
+#define DIM_NUM_SS "num_side_sets" /* # of side sets */
+#define VAR_SS_IDS "side_set_ids" /* side set id's */
+#define DIM_NUM_EL_SS(num) catstr("num_el_ss",num)
+ /* # of elements in side set */
+ /* num */
+#define DIM_NUM_NOD_SS(num) catstr("num_nod_ss",num)
+ /* # of nodes in side set num*/
+#define VAR_FACT_SS(num) catstr("dist_fact_ss",num)
+ /* the distribution factors */
+ /* for each node in side */
+ /* set num */
+#define VAR_ELEM_SS(num) catstr("elem_ss",num)
+ /* list of elements in side */
+ /* set num */
+#define VAR_NODE_SS(num) catstr("node_ss",num)
+ /* list of nodes in side set */
+ /* num */
+#define DIM_NUM_NS "num_node_sets" /* # of node sets */
+#define DIM_NUM_NOD_NS(num) catstr("num_nod_ns",num)
+ /* # of nodes in node set */
+ /* num */
+#define VAR_NS_IDS "node_set_ids" /* node set ids */
+#define VAR_NODE_NS(num) catstr("node_ns",num)
+ /* list of nodes in node set */
+ /* num */
+#define VAR_FACT_NS(num) catstr("dist_fact_ns",num)
+ /* list of distribution */
+ /* factors in node set num */
+#define DIM_NUM_QA "num_qa_rec" /* # of QA records */
+#define VAR_QA_TITLE "qa_records" /* QA records */
+#define DIM_NUM_INFO "num_info" /* # of information records */
+#define VAR_INFO "info_records" /* information records */
+#define VAR_HIS_TIME "time_hist" /* simulation times for */
+ /* history time steps */
+#define VAR_WHOLE_TIME "time_whole" /* simulation times for whole*/
+ /* time steps */
+#define VAR_ELEM_TAB "elem_var_tab" /* element variable truth */
+ /* table */
+#define DIM_NUM_GLO_VAR "num_glo_var" /* # of global variables */
+#define VAR_NAME_GLO_VAR "name_glo_var" /* names of global variables */
+#define VAR_GLO_VAR "vals_glo_var" /* values of global variables*/
+#define DIM_NUM_NOD_VAR "num_nod_var" /* # of nodal variables */
+#define VAR_NAME_NOD_VAR "name_nod_var" /* names of nodal variables */
+#define VAR_NOD_VAR "vals_nod_var" /* values of nodal variables */
+#define DIM_NUM_ELE_VAR "num_elem_var" /* # of element variables */
+#define VAR_NAME_ELE_VAR "name_elem_var" /* names of element variables*/
+#define VAR_ELEM_VAR(num1,num2) catstr2("vals_elem_var",num1,"eb",num2)
+ /* values of element variable*/
+ /* num1 in element block */
+ /* num2 */
+#define DIM_NUM_HIS_VAR "num_his_var" /* # of history variables */
+#define VAR_NAME_HIS_VAR "name_his_var" /* names of history variables*/
+#define VAR_HIS_VAR "vals_his_var" /* values of history */
+ /* variables */
+#define DIM_STR "len_string" /* general dimension of */
+ /* length MAX_STR_LENGTH */
+ /* used for name lengths */
+#define DIM_LIN "len_line" /* general dimension of */
+ /* length MAX_LINE_LENGTH */
+ /* used for long strings */
+#define DIM_N4 "four" /* general dimension of */
+ /* length 4 */
+#define DIM_TIME "time_step" /* unlimited (expandable) */
+ /* dimension for time steps*/
+#define DIM_HTIME "hist_time_step"/* unlimited (expandable) */
+ /* dimension for history */
+ /* variable time steps */
+
+/*
+ * The following are miscellaneous constants used in the EXODUS II API.
+ */
+
+#define EX_NOCLOBBER 0
+#define EX_CLOBBER 1
+
+#define EX_READ 0
+#define EX_WRITE 1
+
+#define EX_VERS 1.01
+
+#define EX_VERBOSE 1
+
+#define EX_INQ_FILE_TYPE 1 /* inquire EXODUS II file type*/
+#define EX_INQ_VERS 2 /* inquire version number */
+#define EX_INQ_TITLE 3 /* inquire database title */
+#define EX_INQ_DIM 4 /* inquire number of */
+ /* dimensions */
+#define EX_INQ_NODES 5 /* inquire number of nodes */
+#define EX_INQ_ELEM 6 /* inquire number of elements */
+#define EX_INQ_ELEM_BLK 7 /* inquire number of element */
+ /* blocks */
+#define EX_INQ_NODE_SETS 8 /* inquire number of node sets*/
+#define EX_INQ_NS_NODE_LEN 9 /* inquire length of node set */
+ /* node list */
+#define EX_INQ_SIDE_SETS 10 /* inquire number of side sets*/
+#define EX_INQ_SS_NODE_LEN 11 /* inquire length of side set */
+ /* node list */
+#define EX_INQ_SS_ELEM_LEN 12 /* inquire length of side set */
+ /* element list */
+#define EX_INQ_QA 13 /* inquire number of QA */
+ /* records */
+#define EX_INQ_INFO 14 /* inquire number of info */
+ /* records */
+#define EX_INQ_TIME 15 /* inquire number of time */
+ /* steps in the database */
+
+#define MAX_STR_LENGTH 8
+#define MAX_VAR_NAME_LENGTH 20
+#define MAX_LINE_LENGTH 80
+
+#define verbose 1
diff --git a/forbind/src/expem_jack.src b/forbind/src/expem_jack.src
new file mode 100644
index 0000000..20e706a
--- /dev/null
+++ b/forbind/src/expem_jack.src
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* expem - ex_put_elem_map exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id element map id
+* int* elem_map element map array
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * put element map
+ */
+% void
+% expem (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* element map ID */
+% int *elem_map, /* element map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_elem_map (*idexo, *map_id, elem_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element map in file id %d",
+ *idexo);
+ ex_err("expem",errmsg,EX_MSG);
+ }
+ }
+}
+
+/*
+ * put partial element map
+ */
+% void
+% exppem (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* element map ID */
+% int *start, /* starting entity */
+% int *count, /* number to write */
+% int *elem_map, /* element map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_partial_elem_map (*idexo, *map_id, *start, *count, elem_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element map in file id %d",
+ *idexo);
+ ex_err("expem",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/expenm_jack.src b/forbind/src/expenm_jack.src
new file mode 100644
index 0000000..176f777
--- /dev/null
+++ b/forbind/src/expenm_jack.src
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* expenm - ex_put_elem_num_map exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int* elem_map element numbering map array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expenm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * put element number map
+ */
+% void
+% expenm (
+% int *idexo, /* EXODUS file ID */
+% int *elem_map, /* element order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_elem_num_map (*idexo, elem_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store element number map in file id %d",
+ *idexo);
+ ex_err("expenm",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/expmp_jack.src b/forbind/src/expmp_jack.src
new file mode 100644
index 0000000..1e2b132
--- /dev/null
+++ b/forbind/src/expmp_jack.src
@@ -0,0 +1,109 @@
+/*
+ * 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_map_param exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int num_node_maps number of node maps
+* int num_elem_maps number of element maps
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * put map parameters
+ */
+% void
+% expmp (
+% int *idexo, /* EXODUS file ID */
+% int *num_node_maps, /* number of node maps */
+% int *num_elem_maps, /* number of element maps */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_map_param (*idexo, *num_node_maps, *num_elem_maps) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to put map parameters in file id %d",
+ *idexo);
+ ex_err("expmp",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/expnm_jack.src b/forbind/src/expnm_jack.src
new file mode 100644
index 0000000..047d2ce
--- /dev/null
+++ b/forbind/src/expnm_jack.src
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* expnm - ex_put_node_map exodusII fortran jacket
+*
+* author - Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int map_id node map id
+* int* node_map node map array
+*
+* exit conditions -
+*
+* revision history -
+*
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * put node map
+ */
+% void
+% expnm (
+% int *idexo, /* EXODUS file ID */
+% int *map_id, /* node map ID */
+% int *node_map, /* node map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_node_map (*idexo, *map_id, node_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store node map in file id %d",
+ *idexo);
+ ex_err("expnm",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/expnnm_jack.src b/forbind/src/expnnm_jack.src
new file mode 100644
index 0000000..4a58099
--- /dev/null
+++ b/forbind/src/expnnm_jack.src
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* expnnm - ex_put_node_num_map exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int exoid exodus file id
+* int* node_map node numbering map array
+*
+* exit conditions -
+*
+* revision history -
+*
+* $Id: expnnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+
+/*
+ * put node number map
+ */
+% void
+% expnnm (
+% int *idexo, /* EXODUS file ID */
+% int *node_map, /* node order map */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ *ierr = 0;
+ if (ex_put_node_num_map (*idexo, node_map) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to store node number map in file id %d",
+ *idexo);
+ ex_err("expnnm",errmsg,EX_MSG);
+ }
+ }
+}
diff --git a/forbind/src/expvnm_jack.src b/forbind/src/expvnm_jack.src
new file mode 100644
index 0000000..f06fdf6
--- /dev/null
+++ b/forbind/src/expvnm_jack.src
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ *
+ */
+/****************************************************************************
+*
+* expvnm - ex_get_var_name exodusII fortran jacket
+*
+* author - Victor R. Yarberry, Sandia National Laboratories
+* Larry A. Schoof - Original in C
+*
+* environment - UNIX
+*
+* entry conditions -
+* input parameters:
+* int* idexo exodus file id
+* char* var_type variable type: G,N, or E
+* int* var_index variable index to write
+* char* var_name ptr to variable name
+*
+* exit conditions -
+ int* ierr returned error code
+*
+* revision history -
+*
+* $Id: expvnm_jack.src,v 1.4 2006/11/28 14:02:20 gdsjaar Exp $
+*
+*****************************************************************************/
+/*
+ * OVERVIEW
+ *
+ * This file contains a jacket routine written in C for interfacing Fortran
+ * ExodusII function calls to the actual C binding for ExodusII. This code
+ * is written explicitly for M4__SYSTEM. In general, these functions handle
+ * character-string parameter conventions, convert between
+ * column-major-order arrays and row-major-order arrays, and map between
+ * array indices beginning at one and array indices beginning at zero.
+ *
+ */
+
+/* LINTLIBRARY */
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "netcdf.h"
+#include "exodusII.h"
+#include "exodusII_int.h"
+
+M4__STRING_DESCRIPTOR_INCLUDES
+
+M4__FORTRAN_DEFINES
+
+/* global integer that contains a Exodus-specific error code */
+extern int exerrval;
+extern void ex_fstrncpy(char*, char*, int);
+
+/*
+ * write results variable name
+ */
+% void
+% expvnm (
+% int *idexo, /* EXODUS file ID */
+% string var_type, /* (single) character indicating the type of */
+% /* variable which is described */
+% int *var_index /* variable index to be read */
+% string var_name, /* string containing variable name */
+% int *ierr /* returned error code */
+% )
+% {
+
+ char errmsg[MAX_ERR_LENGTH];
+
+
+ char *sptr; /* ptr to temp staging space for string */
+ int slen;
+ *ierr=0; /* default no errror */
+
+ /* WARNING: var_namelen SHOULD be MAX_STR_LENGTH, but may not be depending
+ on how the Fortran programmer passed it. It is best at
+ this time to hard code it per EXPVNM spec. */
+ slen = MAX_STR_LENGTH; /* max str size */
+ if (var_namelen != MAX_STR_LENGTH)
+ {
+ slen = var_namelen;
+#if defined(EXODUS_STRING_LENGTH_WARNING)
+ sprintf(errmsg,
+ "Warning: variable name string length is %d in file id %d\n",
+ var_namelen, *idexo);
+ ex_err("expvnm",errmsg,EX_MSG);
+#endif
+ }
+
+ /* Allocate staging space for the variable name */
+ if (!(sptr=(char *)malloc((slen+1)*sizeof(char))))
+ {
+ *ierr = EX_MEMFAIL;
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to allocate space for results variable name for file id %d",
+ *idexo);
+ ex_err("expvnm",errmsg,EX_MEMFAIL);
+ }
+ return;
+ }
+
+ ex_fstrncpy(sptr,var_name,slen);/* copy string into buffer */
+
+
+ /* do ExodusII C call to write results variable name */
+ if (ex_put_var_name(*idexo,var_type,*var_index,sptr) == EX_FATAL)
+ {
+ *ierr = EX_FATAL;
+ free(sptr); /* free up allocated space */
+ if (exoptval & EX_DEBUG)
+ {
+ sprintf(errmsg,
+ "Error: failed to get write variable name to file id %d",
+ *idexo);
+ ex_err("expvnm",errmsg,EX_MSG);
+ }
+ return;
+ }
+
+ free(sptr); /* Free up string staging area */
+}
diff --git a/forbind/src/fortc b/forbind/src/fortc
new file mode 100755
index 0000000..56d12c2
--- /dev/null
+++ b/forbind/src/fortc
@@ -0,0 +1,112 @@
+#!/bin/sh
+# 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.
+#
+
+# fortc - make Fortran-callable C source
+# usage: fortc [-L LibDir] [-O OperSys] [file ...]
+
+#set -x
+
+InFiles=
+LibDir=/usr/local/ldm/lib
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -P) shift; ADDRMODE=$1; shift;;
+ -P*)
+ ADDRMODE=`echo $1 | sed 's/-.//'`; shift;;
+ -L) shift; LibDir=$1; shift;;
+ -L*)
+ LibDir=`echo $1 | sed 's/-.//'`; shift;;
+ -O) shift; OS=$1; shift;;
+ -O*)
+ OS=`echo $1 | sed 's/-.//'`; shift;;
+ -*) echo 1>&2 "Option '$1' is unknown"; exit 1;;
+ *) InFiles="$InFiles $1"; shift;;
+ esac
+done
+
+case "$ADDRMODE" in
+ 64)
+ TYPE=double;;
+ 32)
+ TYPE=float;;
+esac
+
+# Default is invalid file if does not support 64-bit mode.
+# If is supported, use fortc3.sed if no underscore on name,
+# or use fortc3_.sed if underscore on function name.
+TO64=invalid.sed
+
+case "$OS" in
+ aix*)
+ OS=aix;COMMON=common;TO64=fortc3.sed;;
+ msoft*)
+ OS=msoft;COMMON=common2;;
+ hp*)
+ OS=hp;COMMON=common;TO64=fortc3.sed;;
+ next*)
+ OS=next;COMMON=common;;
+ osf*)
+ OS=osf;COMMON=common;;
+ sun*)
+ OS=sunos;COMMON=common;TO64=fortc3_.sed;;
+ cougar*)
+ OS=cougar;COMMON=common;;
+ catamount*)
+ OS=catamount;COMMON=common;TO64=fortc3_.sed;;
+ interix*)
+ OS=interix;COMMON=common;;
+ irix*)
+ OS=irix;COMMON=common;TO64=fortc3_.sed;;
+ ultrix*)
+ OS=ultrix;COMMON=common;;
+ unicos*)
+ OS=unicos;COMMON=common;;
+ linux*)
+ OS=linux;COMMON=common;TO64=fortc3_.sed;;
+ darwin*)
+ OS=darwin;COMMON=common;;
+ vms*)
+ OS=vms;;
+ "") echo 1>&2 \
+ "$0: Operating-system not defined: environmental-variable OS not" \
+ "set or option \"-O<system>\" not specified."
+ exit 2;;
+esac
+
+sed -f $LibDir/fortc1.sed $InFiles |
+ m4 $LibDir/$COMMON.m4 $LibDir/$OS.m4 - |
+ sed -f $LibDir/fortc2.sed |
+ sed s/real/$TYPE/g |
+ (test "$ADDRMODE" -eq 64 && sed -f $LibDir/$TO64 || cat)
diff --git a/forbind/src/fortc1.sed b/forbind/src/fortc1.sed
new file mode 100644
index 0000000..d99f3da
--- /dev/null
+++ b/forbind/src/fortc1.sed
@@ -0,0 +1,95 @@
+s/\([^a-zA-Z]\)len/\1M4_len_4M/g
+s/CHARSTAR/M4_CHARSTAR_4M/g
+s/DOUBLESTAR/M4_DOUBLESTAR_4M/g
+s/FLOATSTAR/M4_FLOATSTAR_4M/g
+s/REALSTAR/M4_REALSTAR_4M/g
+s/INTSTAR/M4_INTSTAR_4M/g
+s/LONGSTAR/M4_LONGSTAR_4M/g
+s/NAMEF/M4_NAMEF_4M/g
+s/STRINGD/M4_STRINGD_4M/g
+s/STRINGF/M4_STRINGF_4M/g
+s/STRINGL/M4_STRINGL_4M/g
+s/STRINGX/M4_STRINGX_4M/g
+s/VOIDSTAR/M4_VOIDSTAR_4M/g
+s/changecom/M4_changecom_4M/g
+s/changequote/M4_changequote_4M/g
+s/decr/M4_decr_4M/g
+s/define/M4_define_4M/g
+s/defn/M4_defn_4M/g
+s/divert/M4_divert_4M/g
+s/divnum/M4_divnum_4M/g
+s/dnl/M4_dnl_4M/g
+s/dumpdef/M4_dumpdef_4M/g
+s/errprint/M4_errprint_4M/g
+s/eval/M4_eval_4M/g
+s/ifdef/M4_ifdef_4M/g
+s/ifelse/M4_ifelse_4M/g
+s/include/M4_include_4M/g
+s/incr/M4_incr_4M/g
+s/index/M4_index_4M/g
+s/m4exit/M4_m4exit_4M/g
+s/m4wrap/M4_m4wrap_4M/g
+s/maketemp/M4_maketemp_4M/g
+s/popdef/M4_popdef_4M/g
+s/pushdef/M4_pushdef_4M/g
+s/shift/M4_shift_4M/g
+s/sinclude/M4_sinclude_4M/g
+s/substr/M4_substr_4M/g
+s/syscmd/M4_syscmd_4M/g
+s/sysval/M4_sysval_4M/g
+s/traceoff/M4_traceoff_4M/g
+s/traceon/M4_traceon_4M/g
+s/translit/M4_translit_4M/g
+s/undefine/M4_undefine_4M/g
+s/undivert/M4_undivert_4M/g
+s/unix/M4_unix_4M/g
+/^%\*/ {
+ d
+ b
+}
+/^\(%.*\)\/\*.*\*\/\(.*\)/s//\1\2/
+/^%[ ]*\([a-zA-Z0-9_]*\)[ ]*(/ {
+ s//M4__PROTO(`\1',/
+ b
+}
+/^%[ ]*string[ ]*\([a-zA-Z_][^ ]*\).*$/ {
+ s//`STRING(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*int[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`INTSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*long[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`LONGSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*float[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`FLOATSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*double[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`DOUBLESTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*real[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`REALSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*void[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`VOIDSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*char[ ]*\*[ ]*\([A-Za-z_][^ ]*\).*$/ {
+ s//`CHARSTAR(\1)dnl'/
+ b cleanup
+}
+/^%[ ]*{[ ]*$/ {
+ s//{M4__LOCALS/
+ b
+}
+/^%[ ]*\(.*\)$/s//\1/
+ b
+: cleanup
+ s/[ ]*$//
+ s/,)/)/
diff --git a/forbind/src/fortc2.sed b/forbind/src/fortc2.sed
new file mode 100644
index 0000000..5b1658d
--- /dev/null
+++ b/forbind/src/fortc2.sed
@@ -0,0 +1,44 @@
+s/M4_CHARSTAR_4M/CHARSTAR/g
+s/M4_DOUBLESTAR_4M/DOUBLESTAR/g
+s/M4_FLOATSTAR_4M/FLOATSTAR/g
+s/M4_REALSTAR_4M/REALSTAR/g
+s/M4_INTSTAR_4M/INTSTAR/g
+s/M4_NAMEF_4M/NAMEF/g
+s/M4_STRINGD_4M/STRINGD/g
+s/M4_STRINGF_4M/STRINGF/g
+s/M4_STRINGL_4M/STRINGL/g
+s/M4_STRINGX_4M/STRINGX/g
+s/M4_VOIDSTAR_4M/VOIDSTAR/g
+s/M4_changecom_4M/changecom/g
+s/M4_changequote_4M/changequote/g
+s/M4_decr_4M/decr/g
+s/M4_define_4M/define/g
+s/M4_defn_4M/defn/g
+s/M4_divert_4M/divert/g
+s/M4_divnum_4M/divnum/g
+s/M4_dnl_4M/dnl/g
+s/M4_dumpdef_4M/dumpdef/g
+s/M4_errprint_4M/errprint/g
+s/M4_eval_4M/eval/g
+s/M4_ifdef_4M/ifdef/g
+s/M4_ifelse_4M/ifelse/g
+s/M4_include_4M/include/g
+s/M4_incr_4M/incr/g
+s/M4_index_4M/index/g
+s/M4_len_4M/len/g
+s/M4_m4exit_4M/m4exit/g
+s/M4_m4wrap_4M/m4wrap/g
+s/M4_maketemp_4M/maketemp/g
+s/M4_popdef_4M/popdef/g
+s/M4_pushdef_4M/pushdef/g
+s/M4_shift_4M/shift/g
+s/M4_sinclude_4M/sinclude/g
+s/M4_substr_4M/substr/g
+s/M4_syscmd_4M/syscmd/g
+s/M4_sysval_4M/sysval/g
+s/M4_traceoff_4M/traceoff/g
+s/M4_traceon_4M/traceon/g
+s/M4_translit_4M/translit/g
+s/M4_undefine_4M/undefine/g
+s/M4_undivert_4M/undivert/g
+s/M4_unix_4M/unix/g
diff --git a/forbind/src/fortc3.sed b/forbind/src/fortc3.sed
new file mode 100644
index 0000000..042d89c
--- /dev/null
+++ b/forbind/src/fortc3.sed
@@ -0,0 +1 @@
+s/^\(ex[a-zA-Z0-9_]*\)(/\14(/
diff --git a/forbind/src/fortc3_.sed b/forbind/src/fortc3_.sed
new file mode 100644
index 0000000..cf89f37
--- /dev/null
+++ b/forbind/src/fortc3_.sed
@@ -0,0 +1 @@
+s/^\(ex[a-zA-Z0-9_]*\)_(/\14_(/
diff --git a/forbind/src/hp.m4 b/forbind/src/hp.m4
new file mode 100644
index 0000000..3fb5382
--- /dev/null
+++ b/forbind/src/hp.m4
@@ -0,0 +1,68 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', HP-UX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1') # for HP-UX, use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/hpux.m4 b/forbind/src/hpux.m4
new file mode 100644
index 0000000..3fb5382
--- /dev/null
+++ b/forbind/src/hpux.m4
@@ -0,0 +1,68 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', HP-UX)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1') # for HP-UX, use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/hpux0.inc b/forbind/src/hpux0.inc
new file mode 100644
index 0000000..1083e80
--- /dev/null
+++ b/forbind/src/hpux0.inc
@@ -0,0 +1,34 @@
+c machine specific xdr infinity constants
+c
+ real XDRFINF
+ double precision XDRDINF
+c ifdef vax
+c
+c parameter(XDRDINF = 1.7014118346046923e+38)
+c parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+c parameter(XDRDINF = 1.797693134862315900e+308)
+c parameter(XDRFINF = 3.40282357e+38)
+
+c ifdef hpux
+ parameter(XDRDINF = Z'7FF0000000000000')
+ parameter(XDRFINF = Z'7F800000')
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483647-1)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/interix.m4 b/forbind/src/interix.m4
new file mode 100644
index 0000000..4eb8d02
--- /dev/null
+++ b/forbind/src/interix.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', INTERIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/irix.m4 b/forbind/src/irix.m4
new file mode 100644
index 0000000..c7dc924
--- /dev/null
+++ b/forbind/src/irix.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', IRIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/irix0.inc b/forbind/src/irix0.inc
new file mode 100644
index 0000000..d8b6178
--- /dev/null
+++ b/forbind/src/irix0.inc
@@ -0,0 +1,25 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+ parameter(XDRDINF = 1.70141178e+38)
+ parameter(XDRFINF = 1.70141178e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483648)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/linux.m4 b/forbind/src/linux.m4
new file mode 100644
index 0000000..fb45ed7
--- /dev/null
+++ b/forbind/src/linux.m4
@@ -0,0 +1,72 @@
+divert(-1)
+# 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.
+#
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', LINUX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/msoft.m4 b/forbind/src/msoft.m4
new file mode 100644
index 0000000..8e4c8df
--- /dev/null
+++ b/forbind/src/msoft.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', MICROSOFT)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`__stdcall translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)`'define(`STR_COUNT',1)')# for microsoft, just use upper case
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ unsigned $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer*4')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+# FORTRAN syntax for including a file
+define(`F_INCLUDE',`$`include': "$1"')
+
+divert(0)dnl
diff --git a/forbind/src/msoft0.inc b/forbind/src/msoft0.inc
new file mode 100644
index 0000000..f392ec3
--- /dev/null
+++ b/forbind/src/msoft0.inc
@@ -0,0 +1,29 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+c parameter(XDRDINF = 1.7014118346046923e+38)
+c parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+ parameter(XDRDINF = 1.797693134862315809d+308)
+ parameter(XDRFINF = 3.4028235677e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483647-1)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/osf.m4 b/forbind/src/osf.m4
new file mode 100644
index 0000000..13bbc81
--- /dev/null
+++ b/forbind/src/osf.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', OSF)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# C integral type equivalent to a FORTRAN INTEGER
+define(`F_INTEGER',`int')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/osf0.inc b/forbind/src/osf0.inc
new file mode 100644
index 0000000..d8b6178
--- /dev/null
+++ b/forbind/src/osf0.inc
@@ -0,0 +1,25 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+ parameter(XDRDINF = 1.70141178e+38)
+ parameter(XDRFINF = 1.70141178e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483648)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/paragon.m4 b/forbind/src/paragon.m4
new file mode 100644
index 0000000..b489ce6
--- /dev/null
+++ b/forbind/src/paragon.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Paragon)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# our C compiler replaces a "$" in a module name with an "_"
+# dont now what to do about that just yet
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/puma.m4 b/forbind/src/puma.m4
new file mode 100644
index 0000000..b489ce6
--- /dev/null
+++ b/forbind/src/puma.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Paragon)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# our C compiler replaces a "$" in a module name with an "_"
+# dont now what to do about that just yet
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/pumagon.m4 b/forbind/src/pumagon.m4
new file mode 100644
index 0000000..b489ce6
--- /dev/null
+++ b/forbind/src/pumagon.m4
@@ -0,0 +1,71 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Paragon)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# our C compiler replaces a "$" in a module name with an "_"
+# dont now what to do about that just yet
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer*1')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/sgi.m4 b/forbind/src/sgi.m4
new file mode 100644
index 0000000..c7dc924
--- /dev/null
+++ b/forbind/src/sgi.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', IRIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/sun.m4 b/forbind/src/sun.m4
new file mode 100644
index 0000000..b10da2b
--- /dev/null
+++ b/forbind/src/sun.m4
@@ -0,0 +1,67 @@
+divert(-1)
+# 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.
+#
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/sunos.m4 b/forbind/src/sunos.m4
new file mode 100644
index 0000000..4c781dc
--- /dev/null
+++ b/forbind/src/sunos.m4
@@ -0,0 +1,68 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', Sun)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/sunos0.inc b/forbind/src/sunos0.inc
new file mode 100644
index 0000000..8515772
--- /dev/null
+++ b/forbind/src/sunos0.inc
@@ -0,0 +1,29 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+c parameter(XDRDINF = 1.7014118346046923e+38)
+c parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+ parameter(XDRDINF = 1.797693134862315900e+308)
+ parameter(XDRFINF = 3.40282357e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483647-1)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/ultrix.m4 b/forbind/src/ultrix.m4
new file mode 100644
index 0000000..144a7f6
--- /dev/null
+++ b/forbind/src/ultrix.m4
@@ -0,0 +1,73 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', ULTRIX)
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+')
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1_') # for Sun and most unixes, just append an underscore
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`, $1len') # one extra stringlen parameter
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ char *$1; `$2'
+ int $1`'`len';') # declare argument string with extra stringlen parameter
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`')
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/ultrix0.inc b/forbind/src/ultrix0.inc
new file mode 100644
index 0000000..d8b6178
--- /dev/null
+++ b/forbind/src/ultrix0.inc
@@ -0,0 +1,25 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+ parameter(XDRDINF = 1.70141178e+38)
+ parameter(XDRFINF = 1.70141178e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483648)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/unicos.m4 b/forbind/src/unicos.m4
new file mode 100644
index 0000000..5023fea
--- /dev/null
+++ b/forbind/src/unicos.m4
@@ -0,0 +1,82 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', UNICOS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',`
+#include <fortran.h> /* for _fcd functions */
+')
+
+# Special #defines needed for this FORTRAN, e.g. FORTRAN_HAS_NO_SHORT
+define(`M4__FORTRAN_DEFINES',`
+#define FORTRAN_HAS_NO_BYTE
+#define FORTRAN_HAS_NO_SHORT
+')
+
+# transformation from fortran name to name of C module
+# for unicos, just convert to uppercase
+define(`NAMEF',
+ `translit($1,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ)')
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d')
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ _fcd $1d; `$2'') # declare string parameter as type _fcd
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+ char *$1 = _fcdtocp ($1d);
+ unsigned $1len = _fcdlen ($1d);') # use _fcd functions
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`integer')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`real')
+
+divert(0)dnl
diff --git a/forbind/src/unicos0.inc b/forbind/src/unicos0.inc
new file mode 100644
index 0000000..b57ac08
--- /dev/null
+++ b/forbind/src/unicos0.inc
@@ -0,0 +1,29 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+c parameter(XDRDINF = 1.7014118346046923e+38)
+c parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+ parameter(XDRDINF = 1.797693134862315900e+308)
+ parameter(XDRFINF = 3.40282357e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483648)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/src/vms.m4 b/forbind/src/vms.m4
new file mode 100644
index 0000000..5ea1ce8
--- /dev/null
+++ b/forbind/src/vms.m4
@@ -0,0 +1,74 @@
+divert(-1)
+# 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.
+#
+
+
+# Name of system platform (for use in comments)
+define(`M4__SYSTEM', VMS)
+
+# Includes needed at the top of a file of C to be called from FORTRAN
+define(`M4__STRING_DESCRIPTOR_INCLUDES',
+`#include descrip'
+)
+
+# transformation from fortran name to name of C module
+define(`NAMEF',`$1') # for vms, just use same name
+
+# transformation from string name to corresponding argument name
+define(`STRINGF',`$1d') # append d for argument name descriptor
+
+# extra arguments, if any, for string length
+define(`STRINGX',`')
+
+# declaration to be used for argument name descriptor
+define(`STRINGD',`
+ struct dsc$descriptor_s * $1d; `$2'')
+
+# declarations and initializations of canonical local variables
+define(`STRINGL',`
+ char *$1 = $1d->dsc$a_pointer;
+ int $1len = $1d->dsc$w_length;') # use descriptor components
+
+# FORTRAN declaration for a long integer (e.g. integer*4 for Microsoft)
+define(`LONG_INT',`integer')
+
+# FORTRAN declaration for a short integer (e.g. integer*2)
+define(`SHORT_INT',`integer*2')
+
+# FORTRAN declaration for an integer byte (e.g. integer*1 or byte)
+define(`BYTE_INT',`byte')
+
+# FORTRAN declaration for double precision (e.g. real for a Cray)
+define(`DOUBLE_PRECISION',`double precision')
+
+divert(0)dnl
diff --git a/forbind/src/vms0.inc b/forbind/src/vms0.inc
new file mode 100644
index 0000000..d3a3538
--- /dev/null
+++ b/forbind/src/vms0.inc
@@ -0,0 +1,29 @@
+c machine specific xdr infinity constants
+c
+ double precision XDRDINF,XDRFINF
+c ifdef vax
+c
+ parameter(XDRDINF = 1.7014118346046923e+38)
+ parameter(XDRFINF = 2.93873588e-39)
+
+c ifdef sun
+c parameter(XDRDINF = 1.797693134862315900e+308)
+c parameter(XDRFINF = 3.40282357e+38)
+c
+c Fill values
+c These values are stuffed into newly allocated space as appropriate.
+c The hope is that one might use these to notice that a particular dataum
+c has not been set.
+c
+ integer FILBYTE,FILCHAR, FILSHORT,FILLONG
+ real FILFLOAT
+ double precision FILDOUB
+c
+c Largest Negative value
+ parameter(FILBYTE = 128)
+ parameter(FILCHAR = 0)
+ parameter(FILSHORT = 32768)
+ parameter(FILLONG = -2147483648)
+c IEEE Infinity
+ parameter(FILFLOAT = XDRFINF)
+ parameter(FILDOUB = XDRDINF)
diff --git a/forbind/test/CVS/Entries b/forbind/test/CVS/Entries
new file mode 100644
index 0000000..df20467
--- /dev/null
+++ b/forbind/test/CVS/Entries
@@ -0,0 +1,33 @@
+/Imakefile/1.3/Sun Nov 26 05:37:24 2006//
+/Makefile.standalone/1.1.1.1/Tue Sep 6 15:59:03 2005//
+/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//
+/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//
+/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//
+/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//
+/testrd.f/1.3/Sun Nov 26 05:37:25 2006//
+/testrd1.dmp/1.2/Wed Apr 12 17:44:49 2006//
+/testrd1.f/1.2/Wed Apr 12 17:44:49 2006//
+/testrdd.dmp/1.2/Wed Apr 12 17:44:49 2006//
+/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//
+/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/CVS/Repository b/forbind/test/CVS/Repository
new file mode 100644
index 0000000..d186d5d
--- /dev/null
+++ b/forbind/test/CVS/Repository
@@ -0,0 +1 @@
+exodusii/forbind/test
diff --git a/forbind/test/CVS/Root b/forbind/test/CVS/Root
new file mode 100644
index 0000000..187e03d
--- /dev/null
+++ b/forbind/test/CVS/Root
@@ -0,0 +1 @@
+:ext:gdsjaar at exodusii.cvs.sourceforge.net:/cvsroot/exodusii
diff --git a/forbind/test/Imakefile b/forbind/test/Imakefile
new file mode 100644
index 0000000..5a14663
--- /dev/null
+++ b/forbind/test/Imakefile
@@ -0,0 +1,70 @@
+### 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.
+###
+
+### Imakefile ---
+
+ALTINC = -I../include
+
+#if defined CatamountArchitecture
+EXOIITEST = -L../.. -lexoIIv2for32 -lexoIIv2c
+LOCALEXO = ../../libexoIIv2for32.a ../../libexoIIv2c.a
+#else
+EXOIITEST = -L../.. -lexoIIv2for -lexoIIv2c
+LOCALEXO = ../../libexoIIv2for.a ../../libexoIIv2c.a
+#endif
+
+LIBS = $(LOCALEXO) -L$(USRLIBDIR) $(NETCDF)
+
+PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln
+
+all:: check
+
+NormalFortranTarget(testwt, testwt.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testwtd, testwtd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testrd, testrd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testrd1, testrd1.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testrdd, testrdd.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testwt1, testwt1.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testwt2, testwt2.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testwtm, testwtm.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testcp, testcp.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testcpnl, testcpnl.o, $(LOCALEXO), /**/, $(LIBS))
+NormalFortranTarget(testcpln, testcpln.o, $(LOCALEXO), /**/, $(LIBS))
+
+test: check
+check: $(PROGS)
+ csh -f ./testall
+
+ExtraStuffToClean(*.res)
+ExtraStuffToClean(*.exo)
+ExtraStuffToClean(test.output)
diff --git a/forbind/test/Makefile.standalone b/forbind/test/Makefile.standalone
new file mode 100644
index 0000000..a46177f
--- /dev/null
+++ b/forbind/test/Makefile.standalone
@@ -0,0 +1,105 @@
+# 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.
+#
+
+
+EXOIITEST = -L../.. -lexoIIv2for -lexoIIv2c
+LOCALEXO = ../../libexoIIv2for.a ../../libexoIIv2c.a
+LIBS = $(LOCALEXO) $(NETCDF_LIB)
+
+PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp
+
+all:: check
+
+all:: testwt
+testwt:: testwt.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testwt.o $(LDFLAGS) $(LIBS)
+
+all:: testwtd
+testwtd:: testwtd.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testwtd.o $(LDFLAGS) $(LIBS)
+
+all:: testrd
+testrd:: testrd.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testrd.o $(LDFLAGS) $(LIBS)
+
+all:: testrd1
+testrd1:: testrd1.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testrd1.o $(LDFLAGS) $(LIBS)
+
+all:: testrdd
+testrdd:: testrdd.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testrdd.o $(LDFLAGS) $(LIBS)
+
+all:: testwt1
+testwt1:: testwt1.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testwt1.o $(LDFLAGS) $(LIBS)
+
+all:: testwt2
+testwt2:: testwt2.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testwt2.o $(LDFLAGS) $(LIBS)
+
+all:: testwtm
+testwtm:: testwtm.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testwtm.o $(LDFLAGS) $(LIBS)
+
+all:: testcp
+testcp:: testcp.o $(LOCALEXO)
+ $(FC) $(FFLAGS) -o $@ testcp.o $(LDFLAGS) $(LIBS)
+
+test: check
+check: $(PROGS)
+ csh ./testall
+
+clean::
+ rm -f *.res $(PROGS)
+
+clean::
+ rm -f *.exo
+
+clean::
+ rm -f test.output
+
+clean::
+ rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
+
+.SUFFIXES: .F .f .c
+.c.o:
+ $(CC) -c $(CFLAGS) $*.c
+.f.o:
+ $(FC) -c $(FFLAGS) $*.f
+.F.o:
+ $(FC) -c $(DEFINES) $(FFLAGS) $*.F
+
+# ----------------------------------------------------------------------
+# dependencies generated by makedepend or sfmakedepend
+
diff --git a/forbind/test/makedmp b/forbind/test/makedmp
new file mode 100644
index 0000000..f0d13d0
--- /dev/null
+++ b/forbind/test/makedmp
@@ -0,0 +1,104 @@
+# 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.
+#
+
+# script to save dump files.
+#
+# testwt - single precision write test
+echo "testwt ..."
+echo "begin testwt" >> test.output
+testwt >> test.output
+echo "end testwt" >> test.output
+ncdump -d5,5 test.exo > test.dmp
+
+# testrd - single precision read test
+echo "testrd ..."
+testrd > testrd.dmp
+
+# testcp_ss - single-to-single precision copy test
+echo "testcp_ss ..."
+echo "begin testcp_ss" >> test.output
+testcp >> test.output
+echo "end testcp_ss" >> test.output
+ncdump -d5,5 testcp.exo > testcp_ss.dmp
+
+# testcp_sd - single-to-double precision copy test
+echo "testcp_sd ..."
+echo "begin testcp_sd" >> test.output
+testcpd >> test.output
+echo "end testcp_sd" >> test.output
+ncdump -d5,5 testcpd.exo > testcp_sd.dmp
+
+# testwt1 - single precision write test with multiple side sets
+echo "testwt1 ..."
+echo "begin testwt1" >> test.output
+testwt1 >> test.output
+echo "end testwt1" >> test.output
+ncdump -d5,5 test.exo > test1.dmp
+
+# testrd1 - single precision read test with multiple side sets
+echo "testrd1 ..."
+testrd1 > testrd1.dmp
+
+# testwtd - double precision write test
+echo "testwtd ..."
+echo "begin testwtd" >> test.output
+testwtd >> test.output
+echo "end testwtd" >> test.output
+ncdump -d5,5 test.exo > testd.dmp
+
+# testrdd - double precision read test
+echo "testrdd ..."
+testrdd > testrdd.dmp
+
+# testcp_dd - double-to-double precision copy test
+echo "testcp_dd ..."
+echo "begin testcp_dd" >> test.output
+testcpd >> test.output
+echo "end testcp_dd" >> test.output
+ncdump -d5,5 testcpd.exo > testcp_dd.dmp
+
+# testcp_ds - double-to-single precision copy test
+echo "testcp_ds ..."
+echo "begin testcp_ds" >> test.output
+testcp >> test.output
+echo "end testcp_ds" >> test.output
+ncdump -d5,5 testcp.exo > testcp_ds.dmp
+
+# testwt2 - single precision write 2 files (simultaneously open) test
+echo "testwt2 ..."
+echo "begin testwt2" >> test.output
+testwt2 >> test.output
+echo "end testwt2" >> test.output
+ncdump -d5,5 test.exo > test2-1.dmp
+ncdump -d5,5 test2.exo > test2-2.dmp
+
diff --git a/forbind/test/t.f.tmp b/forbind/test/t.f.tmp
new file mode 100644
index 0000000..1f1ac40
--- /dev/null
+++ b/forbind/test/t.f.tmp
@@ -0,0 +1,924 @@
+ program testwt
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines.
+c
+
+c history -
+c Original L.A. Schoof
+c 02/25/93 V.R. Yarberry - Added error checks for file creation.
+c 03/04/93 V.R. Yarberry - Fixed bug in expvtt test, ebids was not passed
+c 08/31/93 VRY - updated to match API version 2.00
+c
+ include 'exodusII.inc'
+
+ integer iin, iout, exoid1
+ 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(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(30)
+ character*(MXSTLN) prop_names(2)
+
+ data iin /5/, iout /6/
+
+ call exopts (EXABRT, ierr)
+ cpu_word_size = 0
+ io_word_size = 0
+c
+c create EXODUS II files
+c
+ exoid = excre ("junk.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.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
+
+ exoid1 = excre ("junk1.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for junk1.exo, id: ", i4)') exoid1
+ 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 = 26
+ num_elem = 5
+ num_elem_blk = 5
+ num_node_sets = 2
+ num_side_sets = 5
+
+ 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)
+
+ call expini (exoid1, "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
+
+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
+ call expcor (exoid, x, y, z, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+
+ 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
+
+
+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
+
+c
+c write element block parameters
+c
+
+ 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_nodes_per_elem(1) = 4
+ num_nodes_per_elem(2) = 4
+ num_nodes_per_elem(3) = 8
+ num_nodes_per_elem(4) = 4
+ num_nodes_per_elem(5) = 6
+
+ ebids(1) = 10
+ ebids(2) = 11
+ ebids(3) = 12
+ ebids(4) = 13
+ ebids(5) = 14
+
+ numattr(1) = 1
+ numattr(2) = 1
+ numattr(3) = 1
+ numattr(4) = 1
+ numattr(5) = 1
+
+ cname = "quad"
+ 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
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),
+ 1 num_nodes_per_elem(2),numattr(2),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "hex"
+ call expelb (exoid,ebids(3),cname,num_elem_in_block(3),
+ 1 num_nodes_per_elem(3),numattr(3),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "tetra"
+ call expelb (exoid,ebids(4),cname,num_elem_in_block(4),
+ 1 num_nodes_per_elem(4),numattr(4),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "wedge"
+ call expelb (exoid,ebids(5),cname,num_elem_in_block(5),
+ 1 num_nodes_per_elem(5),numattr(5),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(3), "MATL", 30, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(4), "MATL", 40, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(5), "MATL", 50, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 9
+ connect(2) = 10
+ connect(3) = 11
+ connect(4) = 12
+ connect(5) = 13
+ connect(6) = 14
+ connect(7) = 15
+ connect(8) = 16
+
+ call expelc (exoid, ebids(3), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 17
+ connect(2) = 18
+ connect(3) = 19
+ connect(4) = 20
+
+ call expelc (exoid, ebids(4), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 21
+ connect(2) = 22
+ connect(3) = 23
+ connect(4) = 24
+ connect(5) = 25
+ connect(6) = 26
+
+ call expelc (exoid, ebids(5), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+c
+c write element block attributes
+c
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(3), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(4), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(5), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+c
+c write individual node sets
+c
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+ call expnp (exoid, 20, 5, 5, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+ call expns (exoid, 20, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 20, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+ call expnp (exoid, 21, 3, 3, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+ call expns (exoid, 21, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 21, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ num_df_per_set(1) = 5
+ num_df_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ df_ind(1) = 1
+ df_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+c call expcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+c 1 node_ind, df_ind, node_list, dist_fact, ierr)
+c write (iout, '("after expcns, error = ", i4)' ) ierr
+
+c write node set properties
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+
+c
+c write individual side sets
+c
+
+c side set #1 - quad
+
+ elem_list(1) = 2
+ elem_list(2) = 2
+
+ side_list(1) = 4
+ side_list(2) = 2
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+ call expsp (exoid, 30, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 30, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+ call expssd (exoid, 30, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+
+c side set #2 - quad, spanning 2 elements
+
+ elem_list(1) = 1
+ elem_list(2) = 2
+
+ side_list(1) = 2
+ side_list(2) = 3
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+ call expsp (exoid, 31, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 31, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+ call expssd (exoid, 31, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+
+c side set #3 - hex
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 3
+ elem_list(4) = 3
+ elem_list(5) = 3
+ elem_list(6) = 3
+ elem_list(7) = 3
+
+ side_list(1) = 5
+ side_list(2) = 3
+ side_list(3) = 3
+ side_list(4) = 2
+ side_list(5) = 4
+ side_list(6) = 1
+ side_list(7) = 6
+
+ call expsp (exoid, 32, 7, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 32, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+c side set #4 - tetras
+
+ elem_list(1) = 4
+ elem_list(2) = 4
+ elem_list(3) = 4
+ elem_list(4) = 4
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+
+ call expsp (exoid, 33, 4, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 33, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+c side set #5 - wedges
+
+ elem_list(1) = 5
+ elem_list(2) = 5
+ elem_list(3) = 5
+ elem_list(4) = 5
+ elem_list(5) = 5
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+ side_list(5) = 5
+
+ call expsp (exoid, 34, 5, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 34, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+ ids(1) = 30
+ ids(2) = 31
+ ids(3) = 32
+ ids(4) = 33
+ ids(5) = 34
+
+c side set #1
+ node_list(1) = 8
+ node_list(2) = 5
+ node_list(3) = 6
+ node_list(4) = 7
+
+c side set #2
+ node_list(5) = 2
+ node_list(6) = 3
+ node_list(7) = 7
+ node_list(8) = 8
+
+c side set #3
+ node_list(9) = 9
+ node_list(10) = 12
+ node_list(11) = 11
+ node_list(12) = 10
+
+ node_list(13) = 11
+ node_list(14) = 12
+ node_list(15) = 16
+ node_list(16) = 15
+
+ node_list(17) = 16
+ node_list(18) = 15
+ node_list(19) = 11
+ node_list(20) = 12
+
+ node_list(21) = 10
+ node_list(22) = 11
+ node_list(23) = 15
+ node_list(24) = 14
+
+ node_list(25) = 13
+ node_list(26) = 16
+ node_list(27) = 12
+ node_list(28) = 9
+
+ node_list(29) = 14
+ node_list(30) = 13
+ node_list(31) = 9
+ node_list(32) = 10
+
+ node_list(33) = 16
+ node_list(34) = 13
+ node_list(35) = 14
+ node_list(36) = 15
+
+c side set #4
+ node_list(37) = 17
+ node_list(38) = 18
+ node_list(39) = 20
+
+ node_list(40) = 18
+ node_list(41) = 19
+ node_list(42) = 20
+
+ node_list(43) = 20
+ node_list(44) = 19
+ node_list(45) = 17
+
+ node_list(46) = 19
+ node_list(47) = 18
+ node_list(48) = 17
+
+c side set #5
+ node_list(49) = 25
+ node_list(50) = 24
+ node_list(51) = 21
+ node_list(52) = 22
+
+ node_list(53) = 26
+ node_list(54) = 25
+ node_list(55) = 22
+ node_list(56) = 23
+
+ node_list(57) = 26
+ node_list(58) = 23
+ node_list(59) = 21
+ node_list(60) = 24
+
+ node_list(61) = 23
+ node_list(62) = 22
+ node_list(63) = 21
+
+ node_list(64) = 24
+ node_list(65) = 25
+ node_list(66) = 26
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+ num_elem_per_set(3) = 7
+ num_elem_per_set(4) = 4
+ num_elem_per_set(5) = 5
+
+ num_nodes_per_set(1) = 4
+ num_nodes_per_set(2) = 4
+ num_nodes_per_set(3) = 28
+ num_nodes_per_set(4) = 12
+ num_nodes_per_set(5) = 20
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+ elem_ind(3) = 5
+ elem_ind(4) = 12
+ elem_ind(5) = 16
+
+ node_ind(1) = 1
+ node_ind(2) = 5
+ node_ind(3) = 9
+ node_ind(4) = 37
+ node_ind(5) = 48
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 1
+ elem_list(4) = 3
+ elem_list(5) = 4
+ elem_list(6) = 4
+ elem_list(7) = 4
+ elem_list(8) = 4
+ elem_list(9) = 4
+ elem_list(10) = 4
+ elem_list(11) = 4
+ elem_list(12) = 5
+ elem_list(13) = 5
+ elem_list(14) = 5
+ elem_list(15) = 5
+ elem_list(16) = 6
+ elem_list(17) = 6
+ elem_list(18) = 6
+ elem_list(19) = 6
+ elem_list(20) = 6
+
+c side_list(1) = 1
+c side_list(2) = 2
+c side_list(3) = 3
+c side_list(4) = 4
+
+c call excn2s(exoid, num_elem_per_set, num_nodes_per_set, elem_ind,
+c 1 node_ind, elem_list, node_list, side_list, ierr)
+c write (iout, '("after excn2s, error = ", i4)' ) ierr
+
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+ num_df_per_set(3) = 0
+ num_df_per_set(4) = 0
+ num_df_per_set(5) = 0
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+c call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss, error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+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
+
+
+c
+c write information records
+c
+
+ num_info = 13
+
+ inform(2) = "This is the first information record."
+ inform(3) = "This is the second information record."
+ inform(4) = "This is the second information record."
+ inform(5) = "This is the second information record."
+ inform(6) = "This is the second information record."
+ inform(7) = "This is the second information record."
+ inform(8) = "This is the second information record."
+ inform(9) = "This is the second information record."
+ inform(10) = "This is the second information record."
+ inform(11) = "This is the second information record."
+ inform(12) = "This is the second information record."
+ inform(13) = "This is the second information record."
+ inform(1) = ""
+
+ call expinf (exoid, num_info, inform, ierr)
+ write (iout, '("after expinf, error = ", i4)' ) ierr
+
+ call expinf (exoid1, num_info, inform, ierr)
+ write (iout, '("after expinf, error = ", i4)' ) ierr
+
+ call exclos (exoid,ierr)
+ call exclos (exoid1,ierr)
+ stop
+
+
+c write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = real(i)/100.
+c
+c write time value
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+c write(iout,*)'elem_var_val(',m,'): ',elem_var_vals(m)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ stop
+ end
diff --git a/forbind/test/test.dmp b/forbind/test/test.dmp
new file mode 100644
index 0000000..ae5793c
--- /dev/null
+++ b/forbind/test/test.dmp
@@ -0,0 +1,550 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ 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) ;
+ 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 ;
+ :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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ 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 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT fortran version",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/forbind/test/test.exo_f b/forbind/test/test.exo_f
new file mode 100644
index 0000000..f3c6673
Binary files /dev/null and b/forbind/test/test.exo_f differ
diff --git a/forbind/test/test1.dmp b/forbind/test/test1.dmp
new file mode 100644
index 0000000..e034ae0
--- /dev/null
+++ b/forbind/test/test1.dmp
@@ -0,0 +1,708 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 28 ;
+ num_elem = 8 ;
+ num_el_blk = 7 ;
+ num_node_sets = 2 ;
+ num_side_sets = 5 ;
+ num_node_maps = 1 ;
+ num_elem_maps = 2 ;
+ num_el_in_blk1 = 1 ;
+ num_nod_per_el1 = 4 ;
+ num_att_in_blk1 = 3 ;
+ num_el_in_blk2 = 2 ;
+ num_nod_per_el2 = 4 ;
+ num_att_in_blk2 = 3 ;
+ num_el_in_blk3 = 1 ;
+ num_nod_per_el3 = 8 ;
+ num_att_in_blk3 = 3 ;
+ num_el_in_blk4 = 1 ;
+ num_nod_per_el4 = 4 ;
+ num_att_in_blk4 = 3 ;
+ num_el_in_blk5 = 1 ;
+ num_nod_per_el5 = 1 ;
+ num_att_in_blk5 = 3 ;
+ num_el_in_blk6 = 1 ;
+ num_nod_per_el6 = 1 ;
+ num_att_in_blk6 = 3 ;
+ num_el_in_blk7 = 1 ;
+ num_nod_per_el7 = 6 ;
+ num_att_in_blk7 = 3 ;
+ num_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 2 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, len_string) ;
+ int nm_prop1(num_node_maps) ;
+ nm_prop1:name = "ID" ;
+ char nmap_names(num_node_maps, len_string) ;
+ int node_map1(num_nodes) ;
+ int em_prop1(num_elem_maps) ;
+ em_prop1:name = "ID" ;
+ char emap_names(num_elem_maps, len_string) ;
+ int elem_map1(num_elem) ;
+ int elem_map2(num_elem) ;
+ int em_prop2(num_elem_maps) ;
+ em_prop2:_FillValue = 0 ;
+ em_prop2:name = "ORDER" ;
+ int em_prop3(num_elem_maps) ;
+ em_prop3:_FillValue = 0 ;
+ em_prop3:name = "NUMBER" ;
+ int nm_prop2(num_node_maps) ;
+ nm_prop2:_FillValue = 0 ;
+ nm_prop2:name = "NUMBER" ;
+ 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 = "circle" ;
+ 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 = "sphere" ;
+ 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 = "wedge" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ float vals_elem_var1eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var1eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var1eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var1eb6(time_step, num_el_in_blk6) ;
+ float vals_elem_var1eb7(time_step, num_el_in_blk7) ;
+ float vals_elem_var2eb1(time_step, num_el_in_blk1) ;
+ float vals_elem_var2eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var2eb3(time_step, num_el_in_blk3) ;
+ float vals_elem_var2eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var2eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var2eb6(time_step, num_el_in_blk6) ;
+ float vals_elem_var2eb7(time_step, num_el_in_blk7) ;
+ float vals_elem_var3eb1(time_step, num_el_in_blk1) ;
+ float vals_elem_var3eb2(time_step, num_el_in_blk2) ;
+ float vals_elem_var3eb3(time_step, num_el_in_blk3) ;
+ float vals_elem_var3eb4(time_step, num_el_in_blk4) ;
+ float vals_elem_var3eb5(time_step, num_el_in_blk5) ;
+ float vals_elem_var3eb6(time_step, num_el_in_blk6) ;
+ 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 ;
+ :title = "This is testwt1" ;
+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_prop1 = 10, 11, 12, 13, 14, 15, 16 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ nm_prop1 = 333 ;
+
+ nmap_names =
+ "" ;
+
+ node_map1 = 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51,
+ 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84 ;
+
+ em_prop1 = 111, 222 ;
+
+ emap_names =
+ "",
+ "" ;
+
+ elem_map1 = 1, 2, 3, 4, 5, 6, 7, 8 ;
+
+ elem_map2 = 2, 4, 6, 8, 10, 12, 14, 16 ;
+
+ em_prop2 = 1, _ ;
+
+ em_prop3 = _, 1 ;
+
+ nm_prop2 = 1 ;
+
+ attrib1 =
+ 1, 2, 3 ;
+
+ attrib_name1 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 1.11, 2.11, 3.11,
+ 1.12, 2.12, 3.12 ;
+
+ attrib_name2 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect2 =
+ 1, 2, 3, 4,
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 1.2, 2.2, 3.2 ;
+
+ attrib_name3 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 1.3, 2.3, 3.3 ;
+
+ attrib_name4 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 1.4, 2.4, 3.4 ;
+
+ attrib_name5 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect5 =
+ 21 ;
+
+ attrib6 =
+ 1.5, 2.5, 3.5 ;
+
+ attrib_name6 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect6 =
+ 22 ;
+
+ attrib7 =
+ 1.6, 2.6, 3.6 ;
+
+ attrib_name7 =
+ "attribute_1",
+ "attribute_2",
+ "attribute_3" ;
+
+ connect7 =
+ 23, 24, 25, 26, 27, 28 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ;
+
+ eb_prop3 = _, _, _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 3, 3 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 3 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 4, 4, 4, 4, 4, 4, 4 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 5, 5, 5, 5 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 6, 7 ;
+
+ side_ss5 = 1, 1 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT1 fortran version",
+ "testwt1",
+ "03/16/94",
+ "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." ;
+
+ name_glo_var =
+ "glo vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var1eb2 =
+ 5.01, 5.02,
+ 5.02, 5.04,
+ 5.03, 5.06,
+ 5.04, 5.08,
+ 5.05, 5.1,
+ 5.06, 5.12,
+ 5.07, 5.14,
+ 5.08, 5.16,
+ 5.09, 5.18,
+ 5.1, 5.2 ;
+
+ 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_var1eb5 =
+ 8.01,
+ 8.02,
+ 8.03,
+ 8.04,
+ 8.05,
+ 8.06,
+ 8.07,
+ 8.08,
+ 8.09,
+ 8.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_var1eb7 =
+ 10.01,
+ 10.02,
+ 10.03,
+ 10.04,
+ 10.05,
+ 10.06,
+ 10.07,
+ 10.08,
+ 10.09,
+ 10.1 ;
+
+ vals_elem_var2eb1 =
+ 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.02, 6.04,
+ 6.03, 6.06,
+ 6.04, 6.08,
+ 6.05, 6.1,
+ 6.06, 6.12,
+ 6.07, 6.14,
+ 6.08, 6.16,
+ 6.09, 6.18,
+ 6.1, 6.2 ;
+
+ 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_var2eb4 =
+ 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_var2eb6 =
+ 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_var3eb1 =
+ 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.02, 7.04,
+ 7.03, 7.06,
+ 7.04, 7.08,
+ 7.05, 7.1,
+ 7.06, 7.12,
+ 7.07, 7.14,
+ 7.08, 7.16,
+ 7.09, 7.18,
+ 7.1, 7.2 ;
+
+ 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_var3eb4 =
+ 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_var3eb6 =
+ 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 ;
+}
diff --git a/forbind/test/test2-1.dmp b/forbind/test/test2-1.dmp
new file mode 100644
index 0000000..fc15fae
--- /dev/null
+++ b/forbind/test/test2-1.dmp
@@ -0,0 +1,550 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ 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) ;
+ 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 ;
+ :title = "This is test 2" ;
+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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT2 fortran version",
+ "testwt2",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/forbind/test/test2-2.dmp b/forbind/test/test2-2.dmp
new file mode 100644
index 0000000..a5311e6
--- /dev/null
+++ b/forbind/test/test2-2.dmp
@@ -0,0 +1,550 @@
+netcdf test2 {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ float vals_nod_var(time_step, num_nod_var, 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) ;
+ 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) ;
+ 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 ;
+ :title = "This is test 2" ;
+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 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6 ;
+
+ attrib_name3 =
+ "" ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6 ;
+
+ attrib_name4 =
+ "" ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6 ;
+
+ attrib_name5 =
+ "" ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 100, 200, 300, 400, 500 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+
+ qa_records =
+ "TESTWT2 fortran version",
+ "testwt2",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 ;
+
+ name_nod_var =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/forbind/test/testall b/forbind/test/testall
new file mode 100644
index 0000000..97aa340
--- /dev/null
+++ b/forbind/test/testall
@@ -0,0 +1,110 @@
+# 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.
+#
+
+# script to run all tests and compare them to saved dump files.
+#
+# 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 = "valgrind --tool=memcheck"
+set PREFIX = ""
+
+# testwt - single precision write test
+echo "************************************************************************"
+echo "************************************************************************"
+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
+
+# 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
+
+# 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
+
+# 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
+
+# testwt1 - single precision write test with multiple side sets
+echo "testwt1 ..."
+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
+
+# 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
+
+# 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
+
+# testrdd - double precision read test
+echo "testrdd ..."
+${PREFIX} ./testrdd | 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
+echo "************************************************************************"
+echo "************************************************************************"
+
diff --git a/forbind/test/testcp.f b/forbind/test/testcp.f
new file mode 100644
index 0000000..2ef47e4
--- /dev/null
+++ b/forbind/test/testcp.f
@@ -0,0 +1,63 @@
+ program testcpd
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database copy function (excopy).
+c
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, exoid, exoid1, ierr, cpu_ws, io_ws
+
+ real vers
+
+ data iin /5/, iout /6/
+
+c
+c open EXODUS II input file
+c
+
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 4
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size: ",i4)') io_ws
+
+c
+c create EXODUS II output file with default size reals
+c
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 0
+
+ exoid1 = excre ("testcp.exo",
+ 1 EXCLOB, cpu_ws, io_ws, ierr)
+ write (iout,'("after excre, id = ", i3, ", error = ",i3)')
+ 1 exoid1, ierr
+ write (iout,'(" I/O word size: ",i4)') io_ws
+
+ write (iout,'("after excre, error = ", i4)') ierr
+
+ call excopy (exoid, exoid1, ierr)
+ write (iout, '(/"after excopy, error = ", i3)' ) ierr
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ call exclos (exoid1, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testcp_dd.dmp b/forbind/test/testcp_dd.dmp
new file mode 100644
index 0000000..50ccc4d
--- /dev/null
+++ b/forbind/test/testcp_dd.dmp
@@ -0,0 +1,139 @@
+netcdf testcpd {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 2 ;
+ num_nodes = 8 ;
+ num_elem = 2 ;
+ num_el_blk = 2 ;
+ num_node_sets = 2 ;
+ num_side_sets = 2 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ int elem_map(num_elem) ;
+ double attrib1(num_el_in_blk1, num_att_in_blk1) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double attrib2(num_el_in_blk2, num_att_in_blk2) ;
+ int connect2(num_el_in_blk2, num_nod_per_el2) ;
+ connect2:elem_type = "quad" ;
+ int eb_prop2(num_el_blk) ;
+ eb_prop2:name = "MATL" ;
+ eb_prop2:_FillValue = 0 ;
+ int eb_prop3(num_el_blk) ;
+ eb_prop3:name = "DENSITY" ;
+ eb_prop3:_FillValue = 0 ;
+ int node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int ss_prop2(num_side_sets) ;
+ 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" ;
+data:
+
+ eb_status = 1, 1 ;
+
+ eb_prop1 = 10, 11 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1 ;
+
+ ss_prop1 = 30, 31 ;
+
+ coord =
+ 0, 1, 1, 0, 1, 2, 2, 1,
+ 0, 0, 1, 1, 0, 0, 1, 1 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor" ;
+
+ elem_map = 1, 2 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ eb_prop2 = 10, 20 ;
+
+ eb_prop3 = _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 11, 12 ;
+
+ side_ss1 = 1, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 13, 14 ;
+
+ side_ss2 = 3, 4 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ ss_prop2 = 100, 101 ;
+}
diff --git a/forbind/test/testcp_ds.dmp b/forbind/test/testcp_ds.dmp
new file mode 100644
index 0000000..617721f
--- /dev/null
+++ b/forbind/test/testcp_ds.dmp
@@ -0,0 +1,139 @@
+netcdf testcp {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 2 ;
+ num_nodes = 8 ;
+ num_elem = 2 ;
+ num_el_blk = 2 ;
+ num_node_sets = 2 ;
+ num_side_sets = 2 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ int elem_map(num_elem) ;
+ float attrib1(num_el_in_blk1, num_att_in_blk1) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ float attrib2(num_el_in_blk2, num_att_in_blk2) ;
+ int connect2(num_el_in_blk2, num_nod_per_el2) ;
+ connect2:elem_type = "quad" ;
+ int eb_prop2(num_el_blk) ;
+ eb_prop2:name = "MATL" ;
+ eb_prop2:_FillValue = 0 ;
+ int eb_prop3(num_el_blk) ;
+ eb_prop3:name = "DENSITY" ;
+ eb_prop3:_FillValue = 0 ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int ss_prop2(num_side_sets) ;
+ 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" ;
+data:
+
+ eb_status = 1, 1 ;
+
+ eb_prop1 = 10, 11 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1 ;
+
+ ss_prop1 = 30, 31 ;
+
+ coord =
+ 0, 1, 1, 0, 1, 2, 2, 1,
+ 0, 0, 1, 1, 0, 0, 1, 1 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor" ;
+
+ elem_map = 1, 2 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ eb_prop2 = 10, 20 ;
+
+ eb_prop3 = _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 11, 12 ;
+
+ side_ss1 = 1, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 13, 14 ;
+
+ side_ss2 = 3, 4 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ ss_prop2 = 100, 101 ;
+}
diff --git a/forbind/test/testcp_sd.dmp b/forbind/test/testcp_sd.dmp
new file mode 100644
index 0000000..17ec210
--- /dev/null
+++ b/forbind/test/testcp_sd.dmp
@@ -0,0 +1,201 @@
+netcdf testcpd {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ int elem_map(num_elem) ;
+ double attrib1(num_el_in_blk1, num_att_in_blk1) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double attrib2(num_el_in_blk2, num_att_in_blk2) ;
+ int connect2(num_el_in_blk2, num_nod_per_el2) ;
+ connect2:elem_type = "quad" ;
+ double attrib3(num_el_in_blk3, num_att_in_blk3) ;
+ int connect3(num_el_in_blk3, num_nod_per_el3) ;
+ connect3:elem_type = "hex" ;
+ double attrib4(num_el_in_blk4, num_att_in_blk4) ;
+ int connect4(num_el_in_blk4, num_nod_per_el4) ;
+ connect4:elem_type = "tetra" ;
+ double attrib5(num_el_in_blk5, num_att_in_blk5) ;
+ int connect5(num_el_in_blk5, num_nod_per_el5) ;
+ connect5:elem_type = "wedge" ;
+ int eb_prop2(num_el_blk) ;
+ eb_prop2:name = "MATL" ;
+ eb_prop2:_FillValue = 0 ;
+ int eb_prop3(num_el_blk) ;
+ eb_prop3:name = "DENSITY" ;
+ eb_prop3:_FillValue = 0 ;
+ int node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ 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" ;
+data:
+
+ eb_status = 1, 1, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ attrib3 =
+ 6.1416 ;
+
+ connect3 =
+ 9, 10, 11, 12, 13, 14, 15, 16 ;
+
+ attrib4 =
+ 6.1416 ;
+
+ connect4 =
+ 17, 18, 19, 20 ;
+
+ attrib5 =
+ 6.1416 ;
+
+ connect5 =
+ 21, 22, 23, 24, 25, 26 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, 0, 0, 0 ;
+}
diff --git a/forbind/test/testcp_ss.dmp b/forbind/test/testcp_ss.dmp
new file mode 100644
index 0000000..89872c0
--- /dev/null
+++ b/forbind/test/testcp_ss.dmp
@@ -0,0 +1,244 @@
+netcdf testcp {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ 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_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ 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 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/forbind/test/testcpd.f b/forbind/test/testcpd.f
new file mode 100644
index 0000000..ac2d5b6
--- /dev/null
+++ b/forbind/test/testcpd.f
@@ -0,0 +1,63 @@
+ program testcpd
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database copy function (excopy).
+c
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, exoid, exoid1, ierr, cpu_ws, io_ws
+
+ real vers
+
+ data iin /5/, iout /6/
+
+c
+c open EXODUS II input file
+c
+
+c the setting of cpu_ws isn't used in copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 0
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size: ",i4)') io_ws
+
+c
+c create EXODUS II output file with 8-byte reals
+c
+c the setting of cpu_ws isn't used in copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 8
+
+ exoid1 = excre ("testcpd.exo",
+ 1 EXCLOB, cpu_ws, io_ws, ierr)
+ write (iout,'("after excre, id = ", i3, ", error = ",i3)')
+ 1 exoid1, ierr
+ write (iout,'(" I/O word size: ",i4)') io_ws
+
+ write (iout,'("after excre, error = ", i4)') ierr
+
+ call excopy (exoid, exoid1, ierr)
+ write (iout, '(/"after excopy, error = ", i3)' ) ierr
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ call exclos (exoid1, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testcpln.f b/forbind/test/testcpln.f
new file mode 100644
index 0000000..921b80f
--- /dev/null
+++ b/forbind/test/testcpln.f
@@ -0,0 +1,68 @@
+ program testcpnl
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database copy function (excopy).
+c
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, exoid, exoid1, ierr, cpu_ws, io_ws, mod_sz
+
+ real vers
+
+ data iin /5/, iout /6/
+
+c
+c open EXODUS II input file
+c
+
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 4
+
+ exoid = exopen ("testcpnl.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size: ",i4)') io_ws
+ mod_sz = exlgmd(exoid)
+ write (iout, '(" Model Size",i2)') mod_sz
+
+c
+c create EXODUS II output file with default size reals
+c
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 0
+
+ exoid1 = excre ("testcp.exo",
+ 1 EXCLOB+EXNORM, cpu_ws, io_ws, ierr)
+ write (iout,'("after excre, id = ", i3, ", error = ",i3)')
+ 1 exoid1, ierr
+ write (iout,'(" I/O word size: ",i4)') io_ws
+
+ mod_sz = exlgmd(exoid1)
+ write (iout, '(" Model Size",i2)') mod_sz
+
+ write (iout,'("after excre, error = ", i4)') ierr
+
+ call excopy (exoid, exoid1, ierr)
+ write (iout, '(/"after excopy, error = ", i3)' ) ierr
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ call exclos (exoid1, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testcpnl.dmp b/forbind/test/testcpnl.dmp
new file mode 100644
index 0000000..9dff25e
--- /dev/null
+++ b/forbind/test/testcpnl.dmp
@@ -0,0 +1,247 @@
+netcdf testcpnl { // format variant: 64bit
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (0 currently)
+ num_dim = 3 ;
+ num_nodes = 26 ;
+ num_elem = 5 ;
+ num_el_blk = 5 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_side_ss3 = 7 ;
+ num_side_ss4 = 4 ;
+ num_side_ss5 = 5 ;
+variables:
+ float time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ int ss_status(num_side_sets) ;
+ int ss_prop1(num_side_sets) ;
+ ss_prop1:name = "ID" ;
+ 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) ;
+ 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ float dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ float dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ float dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ float dist_fact_ss2(num_df_ss2) ;
+ int elem_ss3(num_side_ss3) ;
+ int side_ss3(num_side_ss3) ;
+ int elem_ss4(num_side_ss4) ;
+ int side_ss4(num_side_ss4) ;
+ int elem_ss5(num_side_ss5) ;
+ int side_ss5(num_side_ss5) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ 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" ;
+data:
+
+ eb_status = 1, 1, 1, 1, 1 ;
+
+ eb_prop1 = 10, 11, 12, 13, 14 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1, 1, 1, 1 ;
+
+ ss_prop1 = 30, 31, 32, 33, 34 ;
+
+ 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 ;
+
+ 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 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor",
+ "zcoor" ;
+
+ eb_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "",
+ "",
+ "",
+ "" ;
+
+ elem_map = 1, 2, 3, 4, 5 ;
+
+ 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 ;
+
+ eb_prop2 = 10, 20, 30, 40, 50 ;
+
+ eb_prop3 = _, _, _, _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 2, 2 ;
+
+ side_ss1 = 4, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 1, 2 ;
+
+ side_ss2 = 2, 3 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ elem_ss3 = 3, 3, 3, 3, 3, 3, 3 ;
+
+ side_ss3 = 5, 3, 3, 2, 4, 1, 6 ;
+
+ elem_ss4 = 4, 4, 4, 4 ;
+
+ side_ss4 = 1, 2, 3, 4 ;
+
+ elem_ss5 = 5, 5, 5, 5, 5 ;
+
+ side_ss5 = 1, 2, 3, 4, 5 ;
+
+ ss_prop2 = 100, 101, _, _, _ ;
+}
diff --git a/forbind/test/testcpnl.f b/forbind/test/testcpnl.f
new file mode 100644
index 0000000..6006331
--- /dev/null
+++ b/forbind/test/testcpnl.f
@@ -0,0 +1,68 @@
+ program testcpnl
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database copy function (excopy).
+c
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, exoid, exoid1, ierr, cpu_ws, io_ws, mod_sz
+
+ real vers
+
+ data iin /5/, iout /6/
+
+c
+c open EXODUS II input file
+c
+
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 4
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size: ",i4)') io_ws
+ mod_sz = exlgmd(exoid)
+ write (iout, '(" Model Size",i2)') mod_sz
+
+c
+c create EXODUS II output file with default size reals
+c
+c the setting of cpu_ws isn't used for copying but will test the
+c conversion routines
+
+ cpu_ws = 8
+ io_ws = 0
+
+ exoid1 = excre ("testcpnl.exo",
+ 1 EXCLOB+EXLARG, cpu_ws, io_ws, ierr)
+ write (iout,'("after excre, id = ", i3, ", error = ",i3)')
+ 1 exoid1, ierr
+ write (iout,'(" I/O word size: ",i4)') io_ws
+
+ mod_sz = exlgmd(exoid1)
+ write (iout, '(" Model Size",i2)') mod_sz
+
+ write (iout,'("after excre, error = ", i4)') ierr
+
+ call excopy (exoid, exoid1, ierr)
+ write (iout, '(/"after excopy, error = ", i3)' ) ierr
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ call exclos (exoid1, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testd.dmp b/forbind/test/testd.dmp
new file mode 100644
index 0000000..711b93e
--- /dev/null
+++ b/forbind/test/testd.dmp
@@ -0,0 +1,322 @@
+netcdf test {
+dimensions:
+ len_string = 33 ;
+ len_line = 81 ;
+ four = 4 ;
+ time_step = UNLIMITED ; // (10 currently)
+ num_dim = 2 ;
+ num_nodes = 8 ;
+ num_elem = 2 ;
+ num_el_blk = 2 ;
+ num_node_sets = 2 ;
+ num_side_sets = 2 ;
+ 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_nod_ns1 = 5 ;
+ num_nod_ns2 = 3 ;
+ num_side_ss1 = 2 ;
+ num_df_ss1 = 4 ;
+ num_side_ss2 = 2 ;
+ num_df_ss2 = 4 ;
+ num_qa_rec = 2 ;
+ num_info = 3 ;
+ num_glo_var = 1 ;
+ num_nod_var = 2 ;
+ num_elem_var = 3 ;
+variables:
+ double time_whole(time_step) ;
+ int eb_status(num_el_blk) ;
+ int eb_prop1(num_el_blk) ;
+ eb_prop1:name = "ID" ;
+ int ns_status(num_node_sets) ;
+ int ns_prop1(num_node_sets) ;
+ ns_prop1:name = "ID" ;
+ 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) ;
+ char eb_names(num_el_blk, len_string) ;
+ char ns_names(num_node_sets, len_string) ;
+ char ss_names(num_side_sets, 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) ;
+ int connect1(num_el_in_blk1, num_nod_per_el1) ;
+ connect1:elem_type = "quad" ;
+ double 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" ;
+ 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" ;
+ int node_ns1(num_nod_ns1) ;
+ double dist_fact_ns1(num_nod_ns1) ;
+ int node_ns2(num_nod_ns2) ;
+ double dist_fact_ns2(num_nod_ns2) ;
+ int ns_prop2(num_node_sets) ;
+ ns_prop2:_FillValue = 0 ;
+ ns_prop2:name = "FACE" ;
+ int ns_prop3(num_node_sets) ;
+ ns_prop3:name = "VELOCITY" ;
+ int elem_ss1(num_side_ss1) ;
+ int side_ss1(num_side_ss1) ;
+ double dist_fact_ss1(num_df_ss1) ;
+ int elem_ss2(num_side_ss2) ;
+ int side_ss2(num_side_ss2) ;
+ double dist_fact_ss2(num_df_ss2) ;
+ int ss_prop2(num_side_sets) ;
+ ss_prop2:_FillValue = 0 ;
+ ss_prop2:name = "COLOR" ;
+ 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) ;
+ double vals_glo_var(time_step, num_glo_var) ;
+ double vals_nod_var(time_step, num_nod_var, 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) ;
+ double vals_elem_var2eb1(time_step, num_el_in_blk1) ;
+ double vals_elem_var3eb1(time_step, num_el_in_blk1) ;
+ double vals_elem_var1eb2(time_step, num_el_in_blk2) ;
+ double vals_elem_var2eb2(time_step, num_el_in_blk2) ;
+ double vals_elem_var3eb2(time_step, num_el_in_blk2) ;
+ 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 ;
+ :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 ;
+
+ eb_prop1 = 10, 11 ;
+
+ ns_status = 1, 1 ;
+
+ ns_prop1 = 20, 21 ;
+
+ ss_status = 1, 1 ;
+
+ ss_prop1 = 30, 31 ;
+
+ coord =
+ 0, 1, 1, 0, 1, 2, 2, 1,
+ 0, 0, 1, 1, 0, 0, 1, 1 ;
+
+ coor_names =
+ "xcoor",
+ "ycoor" ;
+
+ eb_names =
+ "",
+ "" ;
+
+ ns_names =
+ "",
+ "" ;
+
+ ss_names =
+ "",
+ "" ;
+
+ elem_map = 1, 2 ;
+
+ attrib1 =
+ 3.1416 ;
+
+ attrib_name1 =
+ "" ;
+
+ connect1 =
+ 1, 2, 3, 4 ;
+
+ attrib2 =
+ 6.1416 ;
+
+ attrib_name2 =
+ "" ;
+
+ connect2 =
+ 5, 6, 7, 8 ;
+
+ eb_prop2 = 10, 20 ;
+
+ eb_prop3 = _, _ ;
+
+ node_ns1 = 100, 101, 102, 103, 104 ;
+
+ dist_fact_ns1 = 1, 2, 3, 4, 5 ;
+
+ node_ns2 = 200, 201, 202 ;
+
+ dist_fact_ns2 = 1.1, 2.1, 3.1 ;
+
+ ns_prop2 = 4, 5 ;
+
+ ns_prop3 = 1000, 2000 ;
+
+ elem_ss1 = 11, 12 ;
+
+ side_ss1 = 1, 2 ;
+
+ dist_fact_ss1 = 30, 30.1, 30.2, 30.3 ;
+
+ elem_ss2 = 13, 14 ;
+
+ side_ss2 = 3, 4 ;
+
+ dist_fact_ss2 = 31, 31.1, 31.2, 31.3 ;
+
+ ss_prop2 = 100, 101 ;
+
+ qa_records =
+ "TESTWTD fortran version",
+ "testwtd",
+ "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." ;
+
+ name_glo_var =
+ "glo_vars" ;
+
+ vals_glo_var =
+ 0.02,
+ 0.04,
+ 0.06,
+ 0.08,
+ 0.1,
+ 0.12,
+ 0.14,
+ 0.16,
+ 0.18,
+ 0.2 ;
+
+ vals_nod_var =
+ 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,
+ 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 =
+ "nod_var0",
+ "nod_var1" ;
+
+ name_elem_var =
+ "ele_var0",
+ "ele_var1",
+ "ele_var2" ;
+
+ vals_elem_var1eb1 =
+ 4.01,
+ 4.02,
+ 4.03,
+ 4.04,
+ 4.05,
+ 4.06,
+ 4.07,
+ 4.08,
+ 4.09,
+ 4.1 ;
+
+ vals_elem_var2eb1 =
+ 5.01,
+ 5.02,
+ 5.03,
+ 5.04,
+ 5.05,
+ 5.06,
+ 5.07,
+ 5.08,
+ 5.09,
+ 5.1 ;
+
+ 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 ;
+
+ elem_var_tab =
+ 1, 1, 1,
+ 1, 1, 1 ;
+}
diff --git a/forbind/test/testrd.dmp b/forbind/test/testrd.dmp
new file mode 100644
index 0000000..3dccdde
--- /dev/null
+++ b/forbind/test/testrd.dmp
@@ -0,0 +1,799 @@
+
+after exopen, error = 0
+test.exo is an EXODUSII file; version 3.05
+ I/O word size 4
+ Model Size 0
+
+after exgini, error = 0
+database parameters:
+title = This is a test
+num_dim = 3
+num_nodes = 26
+num_elem = 5
+num_elem_blk = 5
+num_node_sets = 2
+num_side_sets = 5
+
+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
+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
+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
+
+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
+
+after exgebi, error = 0
+
+after exgelb, error = 0
+element block id = 10
+element type = quad
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after exgelb, error = 0
+element block id = 11
+element type = quad
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after exgelb, error = 0
+element block id = 12
+element type = hex
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 1
+
+after exgelb, error = 0
+element block id = 13
+element type = tetra
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after exgelb, error = 0
+element block id = 14
+element type = wedge
+num_elem_in_block = 1
+num_nodes_per_elem = 6
+num_attr = 1
+
+after exinq, error = 0
+
+There are 3 properties for each element block
+after exgpn, error = 0
+elem block 1 property( 1): ID = 10
+elem block 2 property( 1): ID = 11
+elem block 3 property( 1): ID = 12
+elem block 4 property( 1): ID = 13
+elem block 5 property( 1): ID = 14
+elem block 1 property( 2): MATL = 10
+elem block 2 property( 2): MATL = 20
+elem block 3 property( 2): MATL = 30
+elem block 4 property( 2): MATL = 40
+elem block 5 property( 2): MATL = 50
+elem block 1 property( 3): DENSITY = 0
+elem block 2 property( 3): DENSITY = 0
+elem block 3 property( 3): DENSITY = 0
+elem block 4 property( 3): DENSITY = 0
+elem block 5 property( 3): DENSITY = 0
+
+after exgelc, error = 0
+connect array for elem block 10
+ 1
+ 2
+ 3
+ 4
+
+after exgelc, error = 0
+connect array for elem block 11
+ 5
+ 6
+ 7
+ 8
+
+after exgelc, error = 0
+connect array for elem block 12
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+
+after exgelc, error = 0
+connect array for elem block 13
+ 17
+ 18
+ 19
+ 20
+
+after exgelc, error = 0
+connect array for elem block 14
+ 21
+ 22
+ 23
+ 24
+ 25
+ 26
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 10 has 1 attribute(s) and 1 element(s):
+THICKNESS = 3.1416
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 11 has 1 attribute(s) and 1 element(s):
+THICKNESS = 6.1416
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 12 has 1 attribute(s) and 1 element(s):
+THICKNESS = 6.1416
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 13 has 1 attribute(s) and 1 element(s):
+THICKNESS = 6.1416
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 14 has 1 attribute(s) and 1 element(s):
+THICKNESS = 6.1416
+
+after exgnsi, error = 0
+
+after exgnp, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after exgnp, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after exinq, error = 0
+
+There are 3 properties for each node set
+after exgpn, error = 0
+node set 1 property( 1): ID = 20
+node set 2 property( 1): ID = 21
+node set 1 property( 2): FACE = 4
+node set 2 property( 2): FACE = 5
+node set 1 property( 3): VELOCITY = 1000
+node set 2 property( 3): VELOCITY = 2000
+
+after exinq, error = 0
+
+after EXNSNL = 8 exinq, error = 0
+
+after EXNSDF = 8 exinq, error = 0
+
+after exgcns, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 1
+ 6
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after exgssi, error = 0
+
+after exgsp, error = 0
+side set 30 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+after exgssd, error = 0
+
+element list for side set 30
+ 2
+ 2
+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
+30.200
+30.300
+
+after exgsp, error = 0
+side set 31 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+after exgssd, error = 0
+
+element list for side set 31
+ 1
+ 2
+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
+31.200
+31.300
+
+after exgsp, error = 0
+side set 32 parameters:
+num_sides = 7
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 32
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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 exgsp, error = 0
+side set 33 parameters:
+num_sides = 4
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 33
+ 4
+ 4
+ 4
+ 4
+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
+no dist factors for side set 33
+
+after exgsp, error = 0
+side set 34 parameters:
+num_sides = 5
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 34
+ 5
+ 5
+ 5
+ 5
+ 5
+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
+no dist factors for side set 34
+
+after exinq, error = 0
+
+There are 2 properties for each side set
+after exgpn, error = 0
+side set 1 property( 1): ID = 30
+side set 2 property( 1): ID = 31
+side set 3 property( 1): ID = 32
+side set 4 property( 1): ID = 33
+side set 5 property( 1): ID = 34
+side set 1 property( 2): COLOR = 100
+side set 2 property( 2): COLOR = 101
+side set 3 property( 2): COLOR = 0
+side set 4 property( 2): COLOR = 0
+side set 5 property( 2): COLOR = 0
+
+after exinq: EXSIDS = 5, error = 0
+
+after exinq: EXSSEL = 20, error = 0
+
+after exinq: EXSSNL = 66, error = 0
+
+after exinq: EXSSDF = 8, error = 0
+
+after exgcss, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 4
+ 5
+num_df_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 1
+ 3
+ 5
+ 12
+ 16
+df_ind =
+ 1
+ 5
+ 9
+ 9
+ 9
+elem_list =
+ 2
+ 2
+ 1
+ 2
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 3
+ 4
+ 4
+ 4
+ 4
+ 5
+ 5
+ 5
+ 5
+ 5
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 2
+ 3
+ 4
+ 5
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after exinq, error = 0
+
+after exgqa, error = 0
+QA records =
+TESTWT fortran version
+testwt
+07/07/93
+15:41:33
+FASTQ
+fastq
+07/07/93
+16:41:33
+
+after exinq, error = 0
+
+after exginf, error = 0
+info records =
+ This is the first information record.
+ This is the second information record.
+ This is the third information record.
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 1 global variables; their names are :
+glo_vars
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 2 nodal variables; their names are :
+nod_var0
+nod_var1
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 3 element variables; their names are :
+ele_var0
+ele_var1
+ele_var2
+
+after exgvtt, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after exinq, error = 0
+There are 10 time steps in the database.
+
+after exgtim, error = 0
+time value at time step 3 = 0.030
+
+after exgatm, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after exggv, error = 0
+global variable values at time step 3
+0.060
+
+after exggvt, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after exgnv, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+1.720
+1.750
+1.780
+
+after exgnvt, error = 0
+nodal variable 1 values for node 1 through time:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+after exgebi, error = 0
+
+after exgev, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+after exgev, error = 0
+element variable 1 values of element block 11 at time step 3
+5.030
+
+after exgev, error = 0
+element variable 1 values of element block 12 at time step 3
+6.030
+
+after exgev, error = 0
+element variable 1 values of element block 13 at time step 3
+7.030
+
+after exgev, error = 0
+element variable 1 values of element block 14 at time step 3
+8.030
+
+after exgevt, 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
+
+after exclos, error = 0
diff --git a/forbind/test/testrd.f b/forbind/test/testrd.f
new file mode 100644
index 0000000..12cf32c
--- /dev/null
+++ b/forbind/test/testrd.f
@@ -0,0 +1,733 @@
+ 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
+ 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(5), connect(10), node_list(100)
+ integer elem_list(100), side_list(100), 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 typ*(MXSTLN), 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 = excre("test.exo", EXNOCL, cpu_ws, io_ws, ierr)
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.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), typ, 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), typ, num_elem_in_block(i),
+ 6 num_nodes_per_elem(i), num_attr(i)
+
+40 continue
+
+c read element block properties */
+
+ call exinq (exoid, EXNEBP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each element block")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXEBLK, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 47 i = 1, num_props
+ do 45 j = 1, num_elem_blk
+ call exgp(exoid, EXEBLK,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("elem block ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+45 continue
+47 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
+
+ write (iout, '("connect array for elem block ", i2)') ids(i)
+
+ do 50 j = 1, num_nodes_per_elem(i)
+ write (iout, '(i3)') connect(j)
+50 continue
+
+60 continue
+
+c
+c read element block attributes
+c
+
+ do 70 i = 1, num_elem_blk
+
+ call exgeat (exoid, ids(i), attrib, ierr)
+ write (iout, '(/"after exgeat, error = ", i3)' ) ierr
+
+ call exgean (exoid, ids(i), num_attr(i), attrib_names, ierr)
+ write (iout, '(/"after exgean, error = ", i3)' ) ierr
+
+ write (iout,
+ * '("element block ", i2, " has ",i2," attribute(s) and ",
+ * i2, " element(s):")')
+ 1 ids(i), num_attr(i), num_elem_in_block(i)
+ do j=1, num_attr(i)
+ write (iout, 69) attrib_names(j),
+ * (attrib(k),k= j, num_attr(i)*num_elem_in_block(i),
+ * num_attr(i))
+ end do
+ 69 format(A32," = ", 10(f6.4,2x))
+70 continue
+
+c
+c read individual node sets
+c
+ if (num_node_sets .gt. 0) then
+ call exgnsi (exoid, ids, ierr)
+ write (iout, '(/"after exgnsi, error = ", i3)' ) ierr
+ endif
+
+ do 100 i = 1, num_node_sets
+
+ call exgnp (exoid, ids(i), num_nodes_in_set,
+ 1 num_df_in_set, ierr)
+ write (iout, '(/"after exgnp, error = ", i3)' ) ierr
+
+ write (iout, '(/"node set ", i2, " parameters: ",/
+ 2 "num_nodes = ", i2)') ids(i), num_nodes_in_set
+
+ call exgns (exoid, ids(i), node_list, ierr)
+ write (iout, '(/"after exgns, error = ", i3)' ) ierr
+
+ if (num_df_in_set .gt. 0) then
+ call exgnsd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgnsd, error = ", i3)' ) ierr
+ endif
+
+ write (iout, '(/"node list for node set ", i2)') ids(i)
+
+ do 80 j = 1, num_nodes_in_set
+ write (iout, '(i3)') node_list(j)
+80 continue
+
+ if (num_df_in_set .gt. 0) then
+ write (iout, '("dist factors for node set ", i2)') ids(i)
+ do 90 j = 1, num_nodes_in_set
+ write (iout, '(f5.2)') dist_fact(j)
+90 continue
+ else
+ write (iout, '("no dist factors for node set ", i2)') ids(i)
+ endif
+
+100 continue
+
+c read node set properties
+
+ call exinq (exoid, EXNNSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each node set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXNSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 107 i = 1, num_props
+ do 105 j = 1, num_node_sets
+ call exgp(exoid,EXNSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("node set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+105 continue
+107 continue
+
+c
+c read concatenated node sets; this produces the same information as
+c the above code which reads individual node sets
+c
+ call exinq (exoid, EXNODS, num_node_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ if (num_node_sets .gt. 0) then
+ call exinq (exoid, EXNSNL, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSNL =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exinq (exoid, EXNSDF, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSDF =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exgcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+ 1 node_ind, df_ind, node_list, dist_fact, ierr)
+ write (iout, '(/"after exgcns, error = ", i3)' ) ierr
+
+ write (iout, '(/"concatenated node set info")')
+
+ write (iout, '("ids = ")')
+
+ do 110 i = 1, num_node_sets
+ write (iout, '(i3)') ids(i)
+110 continue
+
+ write (iout, '("num_nodes_per_set = ")')
+
+ do 120 i = 1, num_node_sets
+ write (iout, '(i3)') num_nodes_per_set(i)
+120 continue
+
+ write (iout, '("node_ind = ")')
+
+ do 130 i = 1, num_node_sets
+ write (iout, '(i3)') node_ind(i)
+130 continue
+
+ write (iout, '("node_list = ")')
+
+ do 140 i = 1, list_len
+ write (iout, '(i3)') node_list(i)
+140 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 150 i = 1, list_len
+ write (iout, '(f5.3)') dist_fact(i)
+150 continue
+ endif
+
+c
+c read individual side sets
+c
+ if (num_side_sets .gt. 0) then
+ call exgssi (exoid, ids, ierr)
+ write (iout, '(/"after exgssi, error = ", i3)' ) ierr
+ endif
+
+ do 190 i = 1, num_side_sets
+
+ call exgsp (exoid, ids(i), num_sides_in_set, num_df_in_set,
+ 1 ierr)
+ write (iout, '(/"after exgsp, error = ", i3)' ) ierr
+
+ write (iout, '("side set ", i2, " parameters:",/
+ 2 "num_sides = ", i3,/
+ 3 "num_dist_factors = ", i3)')
+ 4 ids(i), num_sides_in_set, num_df_in_set
+
+ call exgss (exoid, ids(i), elem_list, side_list, ierr)
+ write (iout, '(/"after exgss, error = ", i3)' ) ierr
+
+ call exgssn (exoid, ids(i), node_ctr_list, node_list, ierr)
+ write (iout, '(/"after exgssn, error = ", i3)' ) ierr
+
+ if (num_df_in_set .gt. 0) then
+ call exgssd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgssd, error = ", i3)' ) ierr
+ endif
+
+ write (iout, '(/"element list for side set ", i2)') ids(i)
+
+ num_elem_in_set = num_sides_in_set
+ do 160 j = 1, num_elem_in_set
+ write (iout, '(i3)') elem_list(j)
+160 continue
+
+ write (iout, '("side list for side set ", i2)') ids(i)
+
+ do 170 j = 1, num_sides_in_set
+ write (iout, '(i3)') side_list(j)
+170 continue
+
+ node_ctr = 0
+ write (iout, '("node list for side set ", i2)') ids(i)
+ do 178 k=1, num_elem_in_set
+ do 175 j=1, node_ctr_list(k)
+ write (iout, '(i3)') node_list(j+node_ctr)
+175 continue
+ node_ctr = node_ctr+node_ctr_list(k)
+178 continue
+
+ if (num_df_in_set .gt. 0) then
+ write (iout, '("dist factors for side set ", i2)') ids(i)
+ do 180 j = 1, num_df_in_set
+ write (iout, '(f6.3)') dist_fact(j)
+180 continue
+ else
+ write (iout, '("no dist factors for side set ", i2)') ids(i)
+ endif
+
+190 continue
+
+c read side set properties
+
+ call exinq (exoid, EXNSSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each side set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXSSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 197 i = 1, num_props
+ do 195 j = 1, num_side_sets
+ call exgp(exoid, EXSSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("side set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+195 continue
+197 continue
+
+ call exinq (exoid, EXSIDS, num_side_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSIDS =",i3,", error = ",i3)')
+ 1 num_side_sets,ierr
+
+ if (num_side_sets .gt. 0) then
+ call exinq (exoid, EXSSEL, elem_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSEL =",i3,", error = ",i3)')
+ 1 elem_list_len,ierr
+
+ call exinq (exoid, EXSSNL, node_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSNL =",i3,", error = ",i3)')
+ 1 node_list_len,ierr
+
+ call exinq (exoid, EXSSDF, df_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSDF =",i3,", error = ",i3)')
+ 1 df_list_len,ierr
+c
+c read concatenated side sets; this produces the same information as
+c the above code which reads individual side sets
+c
+ call exgcss (exoid, ids, num_elem_per_set, num_df_per_set,
+ 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+ 2 ierr)
+ write (iout, '(/"after exgcss, error = ", i3)' ) ierr
+
+ write (iout, '("concatenated side set info")')
+
+ write (iout, '("ids = ")')
+
+ do 200 i = 1, num_side_sets
+ write (iout, '(i3)') ids(i)
+200 continue
+
+ write (iout, '("num_elem_per_set = ")')
+
+ do 210 i = 1, num_side_sets
+ write (iout, '(i3)') num_elem_per_set(i)
+210 continue
+
+ write (iout, '("num_df_per_set = ")')
+
+ do 220 i = 1, num_side_sets
+ write (iout, '(i3)') num_df_per_set(i)
+220 continue
+
+ write (iout, '("elem_ind = ")')
+
+ do 230 i = 1, num_side_sets
+ write (iout, '(i3)') elem_ind(i)
+230 continue
+
+ write (iout, '("df_ind = ")')
+
+ do 240 i = 1, num_side_sets
+ write (iout, '(i3)') df_ind(i)
+240 continue
+
+ write (iout, '("elem_list = ")')
+
+ do 250 i = 1, elem_list_len
+ write (iout, '(i3)') elem_list(i)
+250 continue
+
+ write (iout, '("side_list = ")')
+
+ do 260 i = 1, elem_list_len
+ write (iout, '(i3)') side_list(i)
+260 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 270 i = 1, df_list_len
+ write (iout, '(f6.3)') dist_fact(i)
+270 continue
+ endif
+
+275 continue
+
+c
+c read QA records
+c
+ call exinq (exoid, EXQA, num_qa_rec, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exgqa (exoid, qa_record, ierr)
+ write (iout, '(/"after exgqa, error = ", i3)' ) ierr
+
+ write (iout, '("QA records = ")')
+
+ do 290 i = 1, num_qa_rec
+ do 280 j = 1, 4
+ write (iout, '(a)') qa_record(j,i)
+280 continue
+290 continue
+
+c
+c read information records
+c
+ call exinq (exoid, EXINFO, num_info, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exginf (exoid, inform, ierr)
+ write (iout, '(/"after exginf, error = ", i3)' ) ierr
+
+ write (iout, '("info records = ")')
+
+ do 300 i = 1, num_info
+ write (iout, '(a81)') inform(i)
+300 continue
+
+c
+c read global variables parameters and names
+c
+ call exgvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," global variables; their names ",
+ 1 "are :")') num_glo_vars
+
+ do 320 i = 1, num_glo_vars
+ write (iout, '(a9)') var_names(i)
+320 continue
+
+c
+c read nodal variables parameters and names
+c
+ call exgvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," nodal variables; their names ",
+ 1 "are :")') num_nod_vars
+
+ do 330 i = 1, num_nod_vars
+ write (iout, '(a9)') var_names(i)
+330 continue
+
+c
+c read element variables parameters and names
+c
+ call exgvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," element variables; their names ",
+ 1 "are :")') num_ele_vars
+
+ do 340 i = 1, num_ele_vars
+ write (iout, '(a9)') var_names(i)
+340 continue
+
+c
+c read element variable truth table
+c
+ call exgvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '(/"after exgvtt, error = ", i3)' ) ierr
+
+ write (iout, '("This is the element variable truth table:")')
+
+ do 360 i = 1, num_elem_blk
+ do 350 j = 1, num_ele_vars
+ write (iout, '(i2)') truth_tab(j,i)
+350 continue
+360 continue
+
+c
+c determine how many time steps are stored
+c
+ call exinq (exoid, EXTIMS, num_time_steps, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," time steps in the database.")')
+ 1 num_time_steps
+c
+c read time value at one time step
+c
+ time_step = 3
+ call exgtim (exoid, time_step, time_value, ierr)
+ write (iout, '(/"after exgtim, error = ", i3)' ) ierr
+
+ write (iout, '("time value at time step ",i2," = ", f5.3)')
+ 1 time_step, time_value
+c
+c read time values at all time steps
+c
+ call exgatm (exoid, time_values, ierr)
+ write (iout, '(/"after exgatm, error = ", i3)' ) ierr
+
+ write (iout, '("time values at all time steps are:")')
+
+ do 370 i = 1, num_time_steps
+ write (iout, '(f5.3)') time_values(i)
+370 continue
+
+ var_index = 1
+ beg_time = 1
+ end_time = -1
+c
+c read all global variables at one time step
+c
+ call exggv (exoid, time_step, num_glo_vars, var_values, ierr)
+ write (iout, '(/"after exggv, error = ", i3)' ) ierr
+
+ write (iout, '("global variable values at time step ",i2)')
+ 1 time_step
+
+ do 400 i = 1, num_glo_vars
+ write (iout, '(f5.3)') var_values(i)
+400 continue
+
+c
+c read a single global variable through time
+c
+ call exggvt (exoid, var_index, beg_time, end_time, var_values,
+ 1 ierr)
+ write (iout, '(/"after exggvt, error = ", i3)' ) ierr
+
+ write (iout, '("global variable ",i2," values through time:")')
+ 1 var_index
+
+ do 410 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+410 continue
+
+c
+c read a nodal variable at one time step
+c
+ call exgnv (exoid, time_step, var_index, num_nodes, var_values,
+ 1 ierr)
+ write (iout, '(/"after exgnv, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values at time step ",i2)')
+ 1 var_index, time_step
+
+ do 420 i = 1, num_nodes
+ write (iout, '(f5.3)') var_values(i)
+420 continue
+
+c
+c read a nodal variable through time
+c
+ node_num = 1
+
+ call exgnvt (exoid, var_index, node_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgnvt, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values for node ",i2,
+ 1 " through time:")') var_index, node_num
+
+ do 430 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+430 continue
+
+c
+c read an element variable at one time step
+c
+ call exgebi (exoid, ids, ierr)
+ write (iout, '(/"after exgebi, error = ", i3)' ) ierr
+
+ do 450 i = 1, num_elem_blk
+
+ call exgev (exoid, time_step, var_index, ids(i),
+ 1 num_elem_in_block(i), var_values, ierr)
+ write (iout, '(/"after exgev, error = ", i3)' ) ierr
+
+ if (ierr .eq. 0) then
+ write (iout, '("element variable ",i2," values of element ",
+ 1 "block ",i2," at time step ",i2)')
+ 2 var_index, ids(i), time_step
+ endif
+
+ do 440 j = 1, num_elem_in_block(i)
+ write (iout, '(f5.3)') var_values(j)
+440 continue
+
+450 continue
+
+c
+c read an element variable through time
+c
+ var_index = 2
+ elem_num = 2
+
+ call exgevt (exoid, var_index, elem_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgevt, error = ", i3)' ) ierr
+
+ write (iout, '("element variable ",i2," values for element ",i2,
+ 1 " through time:")') var_index, elem_num
+
+ do 460 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+460 continue
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testrd1.dmp b/forbind/test/testrd1.dmp
new file mode 100644
index 0000000..4f0c5b2
--- /dev/null
+++ b/forbind/test/testrd1.dmp
@@ -0,0 +1,919 @@
+
+after exopen, error = 0
+test.exo is an EXODUSII file; version 3.05
+ I/O word size 4
+
+after exgini, error = 0
+database parameters:
+title = This is testwt1
+num_dim = 3
+num_nodes = 28
+num_elem = 8
+num_elem_blk = 7
+num_node_sets = 2
+num_side_sets = 5
+
+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
+100.0
+ 50.0
+ 3.0
+ 6.0
+ 0.0
+ 3.0
+ 6.0
+ 0.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
+100.0
+ 50.0
+ 0.0
+ 0.0
+ 0.0
+ 2.0
+ 2.0
+ 2.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
+ 0.0
+ 20.0
+ 6.0
+ 0.0
+ 0.0
+ 6.0
+ 2.0
+ 0.0
+
+after exgcon, error = 0
+x coord name = xcoor
+y coord name = ycoor
+
+after exgmp, error = 0
+
+after exgpa, error = 0
+
+after exgem, error = 0
+
+element map id = 111
+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
+elem_map( 8) = 8
+
+after exgem, error = 0
+
+element map id = 222
+elem_map( 1) = 2
+elem_map( 2) = 4
+elem_map( 3) = 6
+elem_map( 4) = 8
+elem_map( 5) = 10
+elem_map( 6) = 12
+elem_map( 7) = 14
+elem_map( 8) = 16
+
+after exinq, error = 0
+
+There are 3 properties for each element map
+after exgpn, error = 0
+elem map 1 property( 1): ID = 111
+elem map 2 property( 1): ID = 222
+elem map 1 property( 2): ORDER = 1
+elem map 2 property( 2): ORDER = 0
+elem map 1 property( 3): NUMBER = 0
+elem map 2 property( 3): NUMBER = 1
+
+after exgpa, error = 0
+
+after exgnm, error = 0
+
+node map id = 333
+node_map( 1) = 3
+node_map( 2) = 6
+node_map( 3) = 9
+node_map( 4) = 12
+node_map( 5) = 15
+node_map( 6) = 18
+node_map( 7) = 21
+node_map( 8) = 24
+node_map( 9) = 27
+node_map( 10) = 30
+node_map( 11) = 33
+node_map( 12) = 36
+node_map( 13) = 39
+node_map( 14) = 42
+node_map( 15) = 45
+node_map( 16) = 48
+node_map( 17) = 51
+node_map( 18) = 54
+node_map( 19) = 57
+node_map( 20) = 60
+node_map( 21) = 63
+node_map( 22) = 66
+node_map( 23) = 69
+node_map( 24) = 72
+node_map( 25) = 75
+node_map( 26) = 78
+node_map( 27) = 81
+node_map( 28) = 84
+
+after exinq, error = 0
+
+There are 2 properties for each node map
+after exgpn, error = 0
+node map 1 property( 1): ID = 333
+node map 1 property( 2): NUMBER = 1
+
+after exgebi, error = 0
+
+after exgelb, error = 0
+element block id = 10
+element type = quad
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 11
+element type = quad
+num_elem_in_block = 2
+num_nodes_per_elem = 4
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 12
+element type = hex
+num_elem_in_block = 1
+num_nodes_per_elem = 8
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 13
+element type = tetra
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 14
+element type = circle
+num_elem_in_block = 1
+num_nodes_per_elem = 1
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 15
+element type = sphere
+num_elem_in_block = 1
+num_nodes_per_elem = 1
+num_attr = 3
+
+after exgelb, error = 0
+element block id = 16
+element type = wedge
+num_elem_in_block = 1
+num_nodes_per_elem = 6
+num_attr = 3
+
+after exinq, error = 0
+
+There are 3 properties for each element block
+after exgpn, error = 0
+elem block 1 property( 1): ID = 10
+elem block 2 property( 1): ID = 11
+elem block 3 property( 1): ID = 12
+elem block 4 property( 1): ID = 13
+elem block 5 property( 1): ID = 14
+elem block 6 property( 1): ID = 15
+elem block 7 property( 1): ID = 16
+elem block 1 property( 2): MATL = 10
+elem block 2 property( 2): MATL = 20
+elem block 3 property( 2): MATL = 30
+elem block 4 property( 2): MATL = 40
+elem block 5 property( 2): MATL = 50
+elem block 6 property( 2): MATL = 60
+elem block 7 property( 2): MATL = 70
+elem block 1 property( 3): DENSITY = 0
+elem block 2 property( 3): DENSITY = 0
+elem block 3 property( 3): DENSITY = 0
+elem block 4 property( 3): DENSITY = 0
+elem block 5 property( 3): DENSITY = 0
+elem block 6 property( 3): DENSITY = 0
+elem block 7 property( 3): DENSITY = 0
+
+after exgelc, error = 0
+connect array for elem block 10
+ 1
+ 2
+ 3
+ 4
+
+after exgelc, error = 0
+connect array for elem block 11
+ 1
+ 2
+ 3
+ 4
+
+after exgelc, error = 0
+connect array for elem block 12
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+ 15
+ 16
+
+after exgelc, error = 0
+connect array for elem block 13
+ 17
+ 18
+ 19
+ 20
+
+after exgelc, error = 0
+connect array for elem block 14
+ 21
+
+after exgelc, error = 0
+connect array for elem block 15
+ 22
+
+after exgelc, error = 0
+connect array for elem block 16
+ 23
+ 24
+ 25
+ 26
+ 27
+ 28
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 10 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.0000
+attribute_2 = 2.0000
+attribute_3 = 3.0000
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 11 has 3 attribute(s) and 2 element(s):
+attribute_1 = 1.1100 1.1200
+attribute_2 = 2.1100 2.1200
+attribute_3 = 3.1100 3.1200
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 12 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.2000
+attribute_2 = 2.2000
+attribute_3 = 3.2000
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 13 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.3000
+attribute_2 = 2.3000
+attribute_3 = 3.3000
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 14 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.4000
+attribute_2 = 2.4000
+attribute_3 = 3.4000
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 15 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.5000
+attribute_2 = 2.5000
+attribute_3 = 3.5000
+
+after exgeat, error = 0
+
+after exgean, error = 0
+element block 16 has 3 attribute(s) and 1 element(s):
+attribute_1 = 1.6000
+attribute_2 = 2.6000
+attribute_3 = 3.6000
+
+after exgnsi, error = 0
+
+after exgnp, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after exgnp, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after exinq, error = 0
+
+There are 3 properties for each node set
+after exgpn, error = 0
+node set 1 property( 1): ID = 20
+node set 2 property( 1): ID = 21
+node set 1 property( 2): FACE = 4
+node set 2 property( 2): FACE = 5
+node set 1 property( 3): VELOCITY = 1000
+node set 2 property( 3): VELOCITY = 2000
+
+after exinq, error = 0
+
+after EXNSNL = 8 exinq, error = 0
+
+after EXNSDF = 8 exinq, error = 0
+
+after exgcns, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 1
+ 6
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after exgssi, error = 0
+
+after exgsp, error = 0
+side set 30 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+after exgssd, error = 0
+
+element list for side set 30
+ 3
+ 3
+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
+30.200
+30.300
+
+after exgsp, error = 0
+side set 31 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+after exgssd, error = 0
+
+element list for side set 31
+ 1
+ 3
+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
+31.200
+31.300
+
+after exgsp, error = 0
+side set 32 parameters:
+num_sides = 7
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 32
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+side list for side set 32
+ 5
+ 3
+ 3
+ 2
+ 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 exgsp, error = 0
+side set 33 parameters:
+num_sides = 4
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 33
+ 5
+ 5
+ 5
+ 5
+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
+no dist factors for side set 33
+
+after exgsp, error = 0
+side set 34 parameters:
+num_sides = 2
+num_dist_factors = 0
+
+after exgss, error = 0
+
+after exgssn, error = 0
+
+element list for side set 34
+ 6
+ 7
+side list for side set 34
+ 1
+ 1
+node list for side set 34
+ 21
+ 22
+no dist factors for side set 34
+
+after exinq, error = 0
+
+There are 2 properties for each side set
+after exgpn, error = 0
+side set 1 property( 1): ID = 30
+side set 2 property( 1): ID = 31
+side set 3 property( 1): ID = 32
+side set 4 property( 1): ID = 33
+side set 5 property( 1): ID = 34
+side set 1 property( 2): COLOR = 100
+side set 2 property( 2): COLOR = 101
+side set 3 property( 2): COLOR = 0
+side set 4 property( 2): COLOR = 0
+side set 5 property( 2): COLOR = 0
+
+after exinq: EXSIDS = 5, error = 0
+
+after exinq: EXSSEL = 17, error = 0
+
+after exinq: EXSSNL = 50, error = 0
+
+after exinq: EXSSDF = 8, error = 0
+
+after exgcss, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+ 32
+ 33
+ 34
+num_elem_per_set =
+ 2
+ 2
+ 7
+ 4
+ 2
+num_df_per_set =
+ 4
+ 4
+ 0
+ 0
+ 0
+elem_ind =
+ 1
+ 3
+ 5
+ 12
+ 16
+df_ind =
+ 1
+ 5
+ 9
+ 9
+ 9
+elem_list =
+ 3
+ 3
+ 1
+ 3
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 4
+ 5
+ 5
+ 5
+ 5
+ 6
+ 7
+side_list =
+ 4
+ 2
+ 2
+ 3
+ 5
+ 3
+ 3
+ 2
+ 4
+ 1
+ 6
+ 1
+ 2
+ 3
+ 4
+ 1
+ 1
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after exinq, error = 0
+
+after exgqa, error = 0
+QA records =
+TESTWT1 fortran version
+testwt1
+03/16/94
+15:41:33
+FASTQ
+fastq
+07/07/93
+16:41:33
+
+after exinq, error = 0
+
+after exginf, error = 0
+info records =
+ This is the first information record.
+ This is the second information record.
+ This is the third information record.
+
+after exgvp, error = 0
+
+after exgvnm, error = 0
+There are 1 global variables; their names are :
+glo vars
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 2 nodal variables; their names are :
+nod_var0
+nod_var1
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 3 element variables; their names are :
+ele_var0
+ele_var1
+ele_var2
+
+after exgvtt, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 0
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after exinq, error = 0
+There are 10 time steps in the database.
+
+after exgtim, error = 0
+time value at time step 3 = 0.030
+
+after exgatm, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after exggv, error = 0
+global variable values at time step 3
+0.060
+
+after exggvt, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after exgnv, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+1.270
+1.300
+1.330
+1.360
+1.390
+1.420
+1.450
+1.480
+1.510
+1.540
+1.570
+1.600
+1.630
+1.660
+1.690
+1.720
+1.750
+1.780
+1.810
+1.840
+
+after exgnvt, error = 0
+nodal variable 1 values for node 1 through time:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+after exgebi, error = 0
+
+after exgev, error = 0
+element variable 1 values of element block 10 at time step 3
+ 4.030
+
+after exgev, error = 0
+element variable 1 values of element block 11 at time step 3
+ 5.030
+ 5.060
+
+after exgev, error = -1
+ 5.030
+
+after exgev, error = 0
+element variable 1 values of element block 13 at time step 3
+ 7.030
+
+after exgev, error = 0
+element variable 1 values of element block 14 at time step 3
+ 8.030
+
+after exgev, error = 0
+element variable 1 values of element block 15 at time step 3
+ 9.030
+
+after exgev, error = 0
+element variable 1 values of element block 16 at time step 3
+10.030
+
+after exgevt, 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
+
+after exclos, error = 0
diff --git a/forbind/test/testrd1.f b/forbind/test/testrd1.f
new file mode 100644
index 0000000..5f64198
--- /dev/null
+++ b/forbind/test/testrd1.f
@@ -0,0 +1,827 @@
+ program testrd1
+
+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
+ 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(10), connect(10), node_list(100)
+ integer elem_list(100), side_list(100), ids(10), node_map(100)
+ 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,7)
+ 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
+ integer num_props, prop_value, n_node_map, n_elem_map
+ integer ival
+ integer ioff
+
+ 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 typ*(MXSTLN), cdum*1
+ character*(MXSTLN) prop_names(3)
+ character*(MXSTLN) attrib_names(100)
+ data iin /5/, iout /6/
+
+c call exopts (EXVRBS, ierr)
+c write (iout, '(/"after exopts, error = ", i3)' ) ierr
+
+c
+c open EXODUS II files
+c
+
+ cpu_ws = 0
+ io_ws = 0
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size",i2)') io_ws
+
+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 map parameters
+c
+
+ call exgmp (exoid, n_node_map, n_elem_map, ierr)
+ write (iout, '(/"after exgmp, error = ", i3)' ) ierr
+
+c
+c read element maps
+c
+
+ call exgpa (exoid, EXEMAP, "ID", ids, ierr)
+ write (iout, '(/"after exgpa, error = ", i3)' ) ierr
+
+ do 26 j = 1,n_elem_map
+
+ call exgem (exoid, ids(j), elem_map, ierr)
+ write (iout, '(/"after exgem, error = ", i3)' ) ierr
+
+ write (iout, '(/"element map id = ", i3)' ) ids(j)
+
+ do 24 i = 1, num_elem
+ write (iout, '("elem_map(",i3,") = ", i3)') i, elem_map(i)
+C .. test reading partial element maps...
+ call exgpem(exoid, ids(j), i, 1, ival, ierr)
+ if (ival .ne. elem_map(i)) then
+ write (iout, '("bad value found for map ",
+ * " element ", i3)') i, elem_map(i)
+ end if
+24 continue
+
+26 continue
+
+c
+c read element map properties
+c
+
+ call exinq (exoid, EXNEMP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each element map")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXEMAP, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 30 i = 1, num_props
+ do 28 j = 1, n_elem_map
+ call exgp(exoid, EXEMAP,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("elem map ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+28 continue
+30 continue
+
+c
+c read node maps
+c
+
+ call exgpa (exoid, EXNMAP, "ID", ids, ierr)
+ write (iout, '(/"after exgpa, error = ", i3)' ) ierr
+
+ do 34 j = 1,n_node_map
+
+ call exgnm (exoid, ids(j), node_map, ierr)
+ write (iout, '(/"after exgnm, error = ", i3)' ) ierr
+
+ write (iout, '(/"node map id = ", i3)' ) ids(j)
+
+ do 32 i = 1, num_nodes
+ write (iout, '("node_map(",i3,") = ", i3)') i, node_map(i)
+32 continue
+
+34 continue
+
+c
+c read node map properties
+c
+
+ call exinq (exoid, EXNNMP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each node map")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXNMAP, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 38 i = 1, num_props
+ do 36 j = 1, n_node_map
+ call exgp(exoid, EXNMAP,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("node map ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+36 continue
+38 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), typ, 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), typ, num_elem_in_block(i),
+ 6 num_nodes_per_elem(i), num_attr(i)
+
+40 continue
+
+c read element block properties
+
+ call exinq (exoid, EXNEBP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each element block")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXEBLK, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 47 i = 1, num_props
+ do 45 j = 1, num_elem_blk
+ call exgp(exoid, EXEBLK,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("elem block ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+45 continue
+47 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
+
+ write (iout, '("connect array for elem block ", i2)') ids(i)
+
+ do 50 j = 1, num_nodes_per_elem(i)
+ write (iout, '(i3)') connect(j)
+50 continue
+
+60 continue
+
+c
+c read element block attributes
+c
+
+ do 70 i = 1, num_elem_blk
+
+ call exgeat (exoid, ids(i), attrib, ierr)
+ write (iout, '(/"after exgeat, error = ", i3)' ) ierr
+
+ call exgean (exoid, ids(i), num_attr(i), attrib_names, ierr)
+ write (iout, '(/"after exgean, error = ", i3)' ) ierr
+
+ write (iout,
+ * '("element block ", i2, " has ",i2," attribute(s) and ",
+ * i2, " element(s):")')
+ 1 ids(i), num_attr(i), num_elem_in_block(i)
+ do j=1, num_attr(i)
+ write (iout, 69) attrib_names(j),
+ * (attrib(k),k= j, num_attr(i)*num_elem_in_block(i),
+ * num_attr(i))
+ end do
+ 69 format(A32," = ", 10(f6.4,2x))
+70 continue
+
+c
+c read individual node sets
+c
+ if (num_node_sets .gt. 0) then
+ call exgnsi (exoid, ids, ierr)
+ write (iout, '(/"after exgnsi, error = ", i3)' ) ierr
+ endif
+
+ do 100 i = 1, num_node_sets
+
+ call exgnp (exoid, ids(i), num_nodes_in_set,
+ 1 num_df_in_set, ierr)
+ write (iout, '(/"after exgnp, error = ", i3)' ) ierr
+
+ write (iout, '(/"node set ", i2, " parameters: ",/
+ 2 "num_nodes = ", i2)') ids(i), num_nodes_in_set
+
+ call exgns (exoid, ids(i), node_list, ierr)
+ write (iout, '(/"after exgns, error = ", i3)' ) ierr
+
+ if (num_df_in_set .gt. 0) then
+ call exgnsd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgnsd, error = ", i3)' ) ierr
+ endif
+
+ write (iout, '(/"node list for node set ", i2)') ids(i)
+
+ do 80 j = 1, num_nodes_in_set
+ write (iout, '(i3)') node_list(j)
+80 continue
+
+ if (num_df_in_set .gt. 0) then
+ write (iout, '("dist factors for node set ", i2)') ids(i)
+ do 90 j = 1, num_nodes_in_set
+ write (iout, '(f5.2)') dist_fact(j)
+90 continue
+ else
+ write (iout, '("no dist factors for node set ", i2)') ids(i)
+ endif
+
+100 continue
+
+c read node set properties
+
+ call exinq (exoid, EXNNSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each node set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXNSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 107 i = 1, num_props
+ do 105 j = 1, num_node_sets
+ call exgp(exoid,EXNSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("node set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+105 continue
+107 continue
+
+c
+c read concatenated node sets; this produces the same information as
+c the above code which reads individual node sets
+c
+ call exinq (exoid, EXNODS, num_node_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ if (num_node_sets .gt. 0) then
+ call exinq (exoid, EXNSNL, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSNL =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exinq (exoid, EXNSDF, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSDF =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exgcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+ 1 node_ind, df_ind, node_list, dist_fact, ierr)
+ write (iout, '(/"after exgcns, error = ", i3)' ) ierr
+
+ write (iout, '(/"concatenated node set info")')
+
+ write (iout, '("ids = ")')
+
+ do 110 i = 1, num_node_sets
+ write (iout, '(i3)') ids(i)
+110 continue
+
+ write (iout, '("num_nodes_per_set = ")')
+
+ do 120 i = 1, num_node_sets
+ write (iout, '(i3)') num_nodes_per_set(i)
+120 continue
+
+ write (iout, '("node_ind = ")')
+
+ do 130 i = 1, num_node_sets
+ write (iout, '(i3)') node_ind(i)
+130 continue
+
+ write (iout, '("node_list = ")')
+
+ do 140 i = 1, list_len
+ write (iout, '(i3)') node_list(i)
+140 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 150 i = 1, list_len
+ write (iout, '(f5.3)') dist_fact(i)
+150 continue
+ endif
+
+c
+c read individual side sets
+c
+ if (num_side_sets .gt. 0) then
+ call exgssi (exoid, ids, ierr)
+ write (iout, '(/"after exgssi, error = ", i3)' ) ierr
+ endif
+
+ do 190 i = 1, num_side_sets
+
+ call exgsp (exoid, ids(i), num_sides_in_set, num_df_in_set,
+ 1 ierr)
+ write (iout, '(/"after exgsp, error = ", i3)' ) ierr
+
+ write (iout, '("side set ", i2, " parameters:",/
+ 2 "num_sides = ", i3,/
+ 3 "num_dist_factors = ", i3)')
+ 4 ids(i), num_sides_in_set, num_df_in_set
+
+ call exgss (exoid, ids(i), elem_list, side_list, ierr)
+ write (iout, '(/"after exgss, error = ", i3)' ) ierr
+
+ call exgssn (exoid, ids(i), node_ctr_list, node_list, ierr)
+ write (iout, '(/"after exgssn, error = ", i3)' ) ierr
+
+ if (num_df_in_set .gt. 0) then
+ call exgssd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgssd, error = ", i3)' ) ierr
+ endif
+
+ write (iout, '(/"element list for side set ", i2)') ids(i)
+
+ num_elem_in_set = num_sides_in_set
+ do 160 j = 1, num_elem_in_set
+ write (iout, '(i3)') elem_list(j)
+160 continue
+
+ write (iout, '("side list for side set ", i2)') ids(i)
+
+ do 170 j = 1, num_sides_in_set
+ write (iout, '(i3)') side_list(j)
+170 continue
+
+ node_ctr = 0
+ write (iout, '("node list for side set ", i2)') ids(i)
+ do 178 k=1, num_elem_in_set
+ do 175 j=1, node_ctr_list(k)
+ write (iout, '(i3)') node_list(j+node_ctr)
+175 continue
+ node_ctr = node_ctr+node_ctr_list(k)
+178 continue
+
+ if (num_df_in_set .gt. 0) then
+ write (iout, '("dist factors for side set ", i2)') ids(i)
+ do 180 j = 1, num_df_in_set
+ write (iout, '(f6.3)') dist_fact(j)
+180 continue
+ else
+ write (iout, '("no dist factors for side set ", i2)') ids(i)
+ endif
+
+190 continue
+
+c read side set properties
+
+ call exinq (exoid, EXNSSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each side set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXSSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 197 i = 1, num_props
+ do 195 j = 1, num_side_sets
+ call exgp(exoid, EXSSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("side set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+195 continue
+197 continue
+
+ call exinq (exoid, EXSIDS, num_side_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSIDS =",i3,", error = ",i3)')
+ 1 num_side_sets,ierr
+
+ if (num_side_sets .gt. 0) then
+ call exinq (exoid, EXSSEL, elem_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSEL =",i3,", error = ",i3)')
+ 1 elem_list_len,ierr
+
+ call exinq (exoid, EXSSNL, node_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSNL =",i3,", error = ",i3)')
+ 1 node_list_len,ierr
+
+ call exinq (exoid, EXSSDF, df_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSDF =",i3,", error = ",i3)')
+ 1 df_list_len,ierr
+c
+c read concatenated side sets; this produces the same information as
+c the above code which reads individual side sets
+c
+ call exgcss (exoid, ids, num_elem_per_set, num_df_per_set,
+ 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+ 2 ierr)
+ write (iout, '(/"after exgcss, error = ", i3)' ) ierr
+
+ write (iout, '("concatenated side set info")')
+
+ write (iout, '("ids = ")')
+
+ do 200 i = 1, num_side_sets
+ write (iout, '(i3)') ids(i)
+200 continue
+
+ write (iout, '("num_elem_per_set = ")')
+
+ do 210 i = 1, num_side_sets
+ write (iout, '(i3)') num_elem_per_set(i)
+210 continue
+
+ write (iout, '("num_df_per_set = ")')
+
+ do 220 i = 1, num_side_sets
+ write (iout, '(i3)') num_df_per_set(i)
+220 continue
+
+ write (iout, '("elem_ind = ")')
+
+ do 230 i = 1, num_side_sets
+ write (iout, '(i3)') elem_ind(i)
+230 continue
+
+ write (iout, '("df_ind = ")')
+
+ do 240 i = 1, num_side_sets
+ write (iout, '(i3)') df_ind(i)
+240 continue
+
+ write (iout, '("elem_list = ")')
+
+ do 250 i = 1, elem_list_len
+ write (iout, '(i3)') elem_list(i)
+250 continue
+
+ write (iout, '("side_list = ")')
+
+ do 260 i = 1, elem_list_len
+ write (iout, '(i3)') side_list(i)
+260 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 270 i = 1, df_list_len
+ write (iout, '(f6.3)') dist_fact(i)
+270 continue
+ endif
+
+275 continue
+
+c
+c read QA records
+c
+ call exinq (exoid, EXQA, num_qa_rec, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exgqa (exoid, qa_record, ierr)
+ write (iout, '(/"after exgqa, error = ", i3)' ) ierr
+
+ write (iout, '("QA records = ")')
+
+ do 290 i = 1, num_qa_rec
+ do 280 j = 1, 4
+ write (iout, '(a)') qa_record(j,i)
+280 continue
+290 continue
+
+c
+c read information records
+c
+ call exinq (exoid, EXINFO, num_info, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exginf (exoid, inform, ierr)
+ write (iout, '(/"after exginf, error = ", i3)' ) ierr
+
+ write (iout, '("info records = ")')
+
+ do 300 i = 1, num_info
+ write (iout, '(a81)') inform(i)
+300 continue
+
+c
+c read global variables parameters and names
+c
+ call exgvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvnm (exoid, "g", 1, var_names(1), ierr)
+ write (iout, '(/"after exgvnm, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," global variables; their names ",
+ 1 "are :")') num_glo_vars
+
+ do 320 i = 1, num_glo_vars
+ write (iout, '(a9)') var_names(i)
+320 continue
+
+c
+c read nodal variables parameters and names
+c
+ call exgvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," nodal variables; their names ",
+ 1 "are :")') num_nod_vars
+
+ do 330 i = 1, num_nod_vars
+ write (iout, '(a9)') var_names(i)
+330 continue
+
+c
+c read element variables parameters and names
+c
+ call exgvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," element variables; their names ",
+ 1 "are :")') num_ele_vars
+
+ do 340 i = 1, num_ele_vars
+ write (iout, '(a9)') var_names(i)
+340 continue
+
+c
+c read element variable truth table
+c
+ call exgvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '(/"after exgvtt, error = ", i3)' ) ierr
+
+ write (iout, '("This is the element variable truth table:")')
+
+ do 360 i = 1, num_elem_blk
+ do 350 j = 1, num_ele_vars
+ write (iout, '(i2)') truth_tab(j,i)
+350 continue
+360 continue
+
+c
+c determine how many time steps are stored
+c
+ call exinq (exoid, EXTIMS, num_time_steps, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," time steps in the database.")')
+ 1 num_time_steps
+c
+c read time value at one time step
+c
+ time_step = 3
+ call exgtim (exoid, time_step, time_value, ierr)
+ write (iout, '(/"after exgtim, error = ", i3)' ) ierr
+
+ write (iout, '("time value at time step ",i2," = ", f5.3)')
+ 1 time_step, time_value
+c
+c read time values at all time steps
+c
+ call exgatm (exoid, time_values, ierr)
+ write (iout, '(/"after exgatm, error = ", i3)' ) ierr
+
+ write (iout, '("time values at all time steps are:")')
+
+ do 370 i = 1, num_time_steps
+ write (iout, '(f5.3)') time_values(i)
+370 continue
+
+ var_index = 1
+ beg_time = 1
+ end_time = -1
+c
+c read all global variables at one time step
+c
+ call exggv (exoid, time_step, num_glo_vars, var_values, ierr)
+ write (iout, '(/"after exggv, error = ", i3)' ) ierr
+
+ write (iout, '("global variable values at time step ",i2)')
+ 1 time_step
+
+ do 400 i = 1, num_glo_vars
+ write (iout, '(f5.3)') var_values(i)
+400 continue
+
+c
+c read a single global variable through time
+c
+ call exggvt (exoid, var_index, beg_time, end_time, var_values,
+ 1 ierr)
+ write (iout, '(/"after exggvt, error = ", i3)' ) ierr
+
+ write (iout, '("global variable ",i2," values through time:")')
+ 1 var_index
+
+ do 410 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+410 continue
+
+c
+c read a nodal variable at one time step
+c
+ call exgnv (exoid, time_step, var_index, num_nodes, var_values,
+ 1 ierr)
+ write (iout, '(/"after exgnv, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values at time step ",i2)')
+ 1 var_index, time_step
+
+ do 420 i = 1, num_nodes
+ write (iout, '(f5.3)') var_values(i)
+420 continue
+
+c
+c read a nodal variable through time
+c
+ node_num = 1
+
+ call exgnvt (exoid, var_index, node_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgnvt, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values for node ",i2,
+ 1 " through time:")') var_index, node_num
+
+ do 430 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+430 continue
+
+c
+c read an element variable at one time step
+c
+ call exgebi (exoid, ids, ierr)
+ write (iout, '(/"after exgebi, error = ", i3)' ) ierr
+
+ do 450 i = 1, num_elem_blk
+
+ call exgev (exoid, time_step, var_index, ids(i),
+ 1 num_elem_in_block(i), var_values, ierr)
+ write (iout, '(/"after exgev, error = ", i3)' ) ierr
+
+ if (ierr .eq. 0) then
+ write (iout, '("element variable ",i2," values of element ",
+ 1 "block ",i2," at time step ",i2)')
+ 2 var_index, ids(i), time_step
+ endif
+
+ do 440 j = 1, num_elem_in_block(i)
+ write (iout, '(f6.3)') var_values(j)
+440 continue
+
+450 continue
+
+c
+c read an element variable through time
+c
+ var_index = 2
+ elem_num = 2
+
+ call exgevt (exoid, var_index, elem_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgevt, error = ", i3)' ) ierr
+
+ write (iout, '("element variable ",i2," values for element ",i2,
+ 1 " through time:")') var_index, elem_num
+
+ do 460 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+460 continue
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testrdd.dmp b/forbind/test/testrdd.dmp
new file mode 100644
index 0000000..afdefb2
--- /dev/null
+++ b/forbind/test/testrdd.dmp
@@ -0,0 +1,411 @@
+
+after exopen, error = 0
+test.exo is an EXODUSII file; version 3.05
+ I/O word size 8
+
+after exgini, error = 0
+database parameters:
+title = This is a test
+num_dim = 2
+num_nodes = 8
+num_elem = 2
+num_elem_blk = 2
+num_node_sets = 2
+num_side_sets = 2
+
+after exgcor, error = 0
+x coords =
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 1.0
+ 2.0
+ 2.0
+ 1.0
+y coords =
+ 0.0
+ 0.0
+ 1.0
+ 1.0
+ 0.0
+ 0.0
+ 1.0
+ 1.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
+
+after exgebi, error = 0
+
+after exgelb, error = 0
+element block id = 10
+element type = quad
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after exgelb, error = 0
+element block id = 11
+element type = quad
+num_elem_in_block = 1
+num_nodes_per_elem = 4
+num_attr = 1
+
+after exinq, error = 0
+
+There are 3 properties for each element block
+after exgpn, error = 0
+elem block 1 property( 1): ID = 10
+elem block 2 property( 1): ID = 11
+elem block 1 property( 2): MATL = 10
+elem block 2 property( 2): MATL = 20
+elem block 1 property( 3): DENSITY = 0
+elem block 2 property( 3): DENSITY = 0
+
+after exgelc, error = 0
+connect array for elem block 10
+ 1
+ 2
+ 3
+ 4
+
+after exgelc, error = 0
+connect array for elem block 11
+ 5
+ 6
+ 7
+ 8
+
+after exgeat, error = 0
+element block 10 attributes = 3.1416
+
+after exgeat, error = 0
+element block 11 attributes = 6.1416
+
+after exgnsi, error = 0
+
+after exgnp, error = 0
+
+node set 20 parameters:
+num_nodes = 5
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 20
+100
+101
+102
+103
+104
+dist factors for node set 20
+ 1.00
+ 2.00
+ 3.00
+ 4.00
+ 5.00
+
+after exgnp, error = 0
+
+node set 21 parameters:
+num_nodes = 3
+
+after exgns, error = 0
+
+after exgnsd, error = 0
+
+node list for node set 21
+200
+201
+202
+dist factors for node set 21
+ 1.10
+ 2.10
+ 3.10
+
+after exinq, error = 0
+
+There are 3 properties for each node set
+after exgpn, error = 0
+node set 1 property( 1): ID = 20
+node set 2 property( 1): ID = 21
+node set 1 property( 2): FACE = 4
+node set 2 property( 2): FACE = 5
+node set 1 property( 3): VELOCITY = 1000
+node set 2 property( 3): VELOCITY = 2000
+
+after exinq, error = 0
+
+after EXNSNL = 8 exinq, error = 0
+
+after EXNSDF = 8 exinq, error = 0
+
+after exgcns, error = 0
+
+concatenated node set info
+ids =
+ 20
+ 21
+num_nodes_per_set =
+ 5
+ 3
+node_ind =
+ 1
+ 6
+node_list =
+100
+101
+102
+103
+104
+200
+201
+202
+dist_fact =
+1.000
+2.000
+3.000
+4.000
+5.000
+1.100
+2.100
+3.100
+
+after exgssi, error = 0
+
+after exgsp, error = 0
+side set 30 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssd, error = 0
+
+element list for side set 30
+ 11
+ 12
+side list for side set 30
+ 1
+ 2
+dist factors for side set 30
+30.000
+30.100
+30.200
+30.300
+
+after exgsp, error = 0
+side set 31 parameters:
+num_sides = 2
+num_dist_factors = 4
+
+after exgss, error = 0
+
+after exgssd, error = 0
+
+element list for side set 31
+ 13
+ 14
+side list for side set 31
+ 3
+ 4
+dist factors for side set 31
+31.000
+31.100
+31.200
+31.300
+
+after exinq, error = 0
+
+There are 2 properties for each side set
+after exgpn, error = 0
+side set 1 property( 1): ID = 30
+side set 2 property( 1): ID = 31
+side set 1 property( 2): COLOR = 100
+side set 2 property( 2): COLOR = 101
+
+after exinq: EXSIDS = 2, error = 0
+
+after exinq: EXSSEL = 4, error = 0
+
+after exinq: EXSSDF = 8, error = 0
+
+after exgcss, error = 0
+concatenated side set info
+ids =
+ 30
+ 31
+num_elem_per_set =
+ 2
+ 2
+num_df_per_set =
+ 4
+ 4
+elem_ind =
+ 1
+ 3
+df_ind =
+ 1
+ 5
+elem_list =
+ 11
+ 12
+ 13
+ 14
+side_list =
+ 1
+ 2
+ 3
+ 4
+dist_fact =
+30.000
+30.100
+30.200
+30.300
+31.000
+31.100
+31.200
+31.300
+
+after exinq, error = 0
+
+after exgqa, error = 0
+QA records =
+TESTWTD fortran version
+testwtd
+07/07/93
+15:41:33
+FASTQ
+fastq
+07/07/93
+16:41:33
+
+after exinq, error = 0
+
+after exginf, error = 0
+info records =
+ This is the first information record.
+ This is the second information record.
+ This is the third information record.
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 1 global variables; their names are :
+glo_vars
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 2 nodal variables; their names are :
+nod_var0
+nod_var1
+
+after exgvp, error = 0
+
+after exgvan, error = 0
+There are 3 element variables; their names are :
+ele_var0
+ele_var1
+ele_var2
+
+after exgvtt, error = 0
+This is the element variable truth table:
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+
+after exinq, error = 0
+There are 10 time steps in the database.
+
+after exgtim, error = 0
+time value at time step 3 = 0.030
+
+after exgatm, error = 0
+time values at all time steps are:
+0.010
+0.020
+0.030
+0.040
+0.050
+0.060
+0.070
+0.080
+0.090
+0.100
+
+after exggv, error = 0
+global variable values at time step 3
+0.060
+
+after exggvt, error = 0
+global variable 1 values through time:
+0.020
+0.040
+0.060
+0.080
+0.100
+0.120
+0.140
+0.160
+0.180
+0.200
+
+after exgnv, error = 0
+nodal variable 1 values at time step 3
+1.030
+1.060
+1.090
+1.120
+1.150
+1.180
+1.210
+1.240
+
+after exgnvt, error = 0
+nodal variable 1 values for node 1 through time:
+1.010
+1.020
+1.030
+1.040
+1.050
+1.060
+1.070
+1.080
+1.090
+1.100
+
+after exgebi, error = 0
+
+after exgev, error = 0
+element variable 1 values of element block 10 at time step 3
+4.030
+
+after exgev, error = 0
+element variable 1 values of element block 11 at time step 3
+5.030
+
+after exgevt, 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
+
+after exclos, error = 0
diff --git a/forbind/test/testrdd.f b/forbind/test/testrdd.f
new file mode 100644
index 0000000..a409dec
--- /dev/null
+++ b/forbind/test/testrdd.f
@@ -0,0 +1,691 @@
+ program testrdd
+
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database read routines with double precision
+c
+c 09/07/93 V.R. Yarberry - Modified for API 2.00
+ implicit none
+
+ include 'exodusII.inc'
+
+ integer iin, iout, ierr
+ integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
+ integer num_node_sets
+ integer num_side_sets
+ integer i, j, elem_map(2), connect(4), node_list(10)
+ integer elem_list(10), side_list(10), ids(5)
+ integer num_elem_per_set(2), num_nodes_per_set(2)
+ integer num_df_per_set(2)
+ integer num_df_in_set, num_sides_in_set
+ integer df_ind(2), node_ind(2), elem_ind(2), num_qa_rec, num_info
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer truth_tab(3,2)
+ integer num_time_steps
+ integer num_elem_in_block(2), num_nodes_per_elem(2)
+ integer num_attr(2)
+ integer num_nodes_in_set, num_elem_in_set
+ integer df_list_len, list_len, elem_list_len
+ integer node_num, time_step, var_index, beg_time, end_time
+ integer elem_num
+ integer cpu_ws,io_ws
+ integer num_props, prop_value
+
+ real*8 time_value, time_values(10), var_values(10)
+ real*8 x(8), y(8), dummy(1)
+ real*8 attrib(1), dist_fact(8)
+ real vers, fdum
+
+ character*(MXSTLN) coord_names(3), qa_record(4,2), var_names(3)
+ character*(MXLNLN) inform(3), titl
+ character typ*(MXSTLN), cdum*1
+ character*(MXSTLN) prop_names(3)
+
+ data iin /5/, iout /6/
+
+
+c
+c open EXODUS II files
+c
+
+ cpu_ws = 8
+ io_ws = 0
+
+ exoid = exopen ("test.exo", EXREAD, cpu_ws, io_ws, vers, ierr)
+ write (iout, '(/"after exopen, error = ",i3)')
+ 1 ierr
+
+ write (iout, '("test.exo is an EXODUSII file; version ",
+ 1 f4.2)') vers
+ write (iout, '(" I/O word size",i2)') io_ws
+
+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, dummy, 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
+
+ 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), typ, 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), typ, num_elem_in_block(i),
+ 6 num_nodes_per_elem(i), num_attr(i)
+
+40 continue
+
+c read element block properties */
+
+ call exinq (exoid, EXNEBP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each element block")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXEBLK, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 47 i = 1, num_props
+ do 45 j = 1, num_elem_blk
+ call exgp(exoid, EXEBLK,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("elem block ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+45 continue
+47 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
+
+ write (iout, '("connect array for elem block ", i2)') ids(i)
+
+ do 50 j = 1, num_nodes_per_elem(i)
+ write (iout, '(i3)') connect(j)
+50 continue
+
+60 continue
+
+c
+c read element block attributes
+c
+
+ do 70 i = 1, num_elem_blk
+
+ call exgeat (exoid, ids(i), attrib, ierr)
+ write (iout, '(/"after exgeat, error = ", i3)' ) ierr
+
+ write (iout, '("element block ", i2, " attributes = ", f6.4)')
+ 1 ids(i), attrib
+
+70 continue
+
+c
+c read individual node sets
+c
+ if (num_node_sets .gt. 0) then
+ call exgnsi (exoid, ids, ierr)
+ write (iout, '(/"after exgnsi, error = ", i3)' ) ierr
+ endif
+
+ do 100 i = 1, num_node_sets
+
+ call exgnp (exoid, ids(i), num_nodes_in_set,
+ 1 num_df_in_set, ierr)
+ write (iout, '(/"after exgnp, error = ", i3)' ) ierr
+
+ write (iout, '(/"node set ", i2, " parameters: ",/
+ 2 "num_nodes = ", i2)') ids(i), num_nodes_in_set
+
+ call exgns (exoid, ids(i), node_list, ierr)
+ write (iout, '(/"after exgns, error = ", i3)' ) ierr
+ call exgnsd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgnsd, error = ", i3)' ) ierr
+
+ write (iout, '(/"node list for node set ", i2)') ids(i)
+
+ do 80 j = 1, num_nodes_in_set
+ write (iout, '(i3)') node_list(j)
+80 continue
+
+ write (iout, '("dist factors for node set ", i2)') ids(i)
+
+ do 90 j = 1, num_nodes_in_set
+ write (iout, '(f5.2)') dist_fact(j)
+90 continue
+
+100 continue
+
+c read node set properties
+
+ call exinq (exoid, EXNNSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each node set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXNSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 107 i = 1, num_props
+ do 105 j = 1, num_node_sets
+ call exgp(exoid,EXNSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("node set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+105 continue
+107 continue
+
+c
+c read concatenated node sets; this produces the same information as
+c the above code which reads individual node sets
+c
+ call exinq (exoid, EXNODS, num_node_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ if (num_node_sets .gt. 0) then
+ call exinq (exoid, EXNSNL, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSNL =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exinq (exoid, EXNSDF, list_len, fdum, cdum, ierr)
+ write(iout,'(/"after EXNSDF =",i3," exinq, error = ",i3)')
+ 1 list_len,ierr
+
+ call exgcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+ 1 node_ind, df_ind, node_list, dist_fact, ierr)
+ write (iout, '(/"after exgcns, error = ", i3)' ) ierr
+
+ write (iout, '(/"concatenated node set info")')
+
+ write (iout, '("ids = ")')
+
+ do 110 i = 1, num_node_sets
+ write (iout, '(i3)') ids(i)
+110 continue
+
+ write (iout, '("num_nodes_per_set = ")')
+
+ do 120 i = 1, num_node_sets
+ write (iout, '(i3)') num_nodes_per_set(i)
+120 continue
+
+ write (iout, '("node_ind = ")')
+
+ do 130 i = 1, num_node_sets
+ write (iout, '(i3)') node_ind(i)
+130 continue
+
+ write (iout, '("node_list = ")')
+
+ do 140 i = 1, list_len
+ write (iout, '(i3)') node_list(i)
+140 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 150 i = 1, list_len
+ write (iout, '(f5.3)') dist_fact(i)
+150 continue
+ endif
+
+c
+c read individual side sets
+c
+ if (num_side_sets .gt. 0) then
+ call exgssi (exoid, ids, ierr)
+ write (iout, '(/"after exgssi, error = ", i3)' ) ierr
+ endif
+
+ do 190 i = 1, num_side_sets
+
+ call exgsp (exoid, ids(i), num_sides_in_set, num_df_in_set,
+ 1 ierr)
+ write (iout, '(/"after exgsp, error = ", i3)' ) ierr
+
+ write (iout, '("side set ", i2, " parameters:",/
+ 2 "num_sides = ", i3,/
+ 3 "num_dist_factors = ", i3)')
+ 4 ids(i), num_sides_in_set, num_df_in_set
+
+ call exgss (exoid, ids(i), elem_list, side_list, ierr)
+ write (iout, '(/"after exgss, error = ", i3)' ) ierr
+
+ call exgssd (exoid, ids(i), dist_fact, ierr)
+ write (iout, '(/"after exgssd, error = ", i3)' ) ierr
+
+ write (iout, '(/"element list for side set ", i2)') ids(i)
+
+ num_elem_in_set = num_sides_in_set
+ do 160 j = 1, num_elem_in_set
+ write (iout, '(i3)') elem_list(j)
+160 continue
+
+ write (iout, '("side list for side set ", i2)') ids(i)
+
+ do 170 j = 1, num_sides_in_set
+ write (iout, '(i3)') side_list(j)
+170 continue
+
+
+ write (iout, '("dist factors for side set ", i2)') ids(i)
+
+ do 180 j = 1, num_df_in_set
+ write (iout, '(f6.3)') dist_fact(j)
+180 continue
+
+190 continue
+
+c read side set properties
+
+ call exinq (exoid, EXNSSP, num_props, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+ write (iout,
+ 1 '(/"There are ",i2," properties for each side set")')
+ 2 num_props
+
+
+ call exgpn(exoid, EXSSET, prop_names, ierr)
+ write (iout, '("after exgpn, error = ", i3)' ) ierr
+
+ do 197 i = 1, num_props
+ do 195 j = 1, num_side_sets
+ call exgp(exoid, EXSSET,ids(j),prop_names(i),prop_value,ierr)
+ if (ierr .eq. 0) then
+ write( iout,
+ 1 '("side set ",i2," property(",i2,"): ",a," = ",i5)' )
+ 2 j, i, prop_names(i), prop_value
+ else
+ write (iout, '(/"after exgp, error = ", i3)' ) ierr
+ endif
+195 continue
+197 continue
+
+ call exinq (exoid, EXSIDS, num_side_sets, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSIDS =",i3,", error = ",i3)')
+ 1 num_side_sets,ierr
+
+ if (num_side_sets .gt. 0) then
+ call exinq (exoid, EXSSEL, elem_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSEL =",i3,", error = ",i3)')
+ 1 elem_list_len,ierr
+
+c call exinq (exoid, EXSSNL, node_list_len, fdum, cdum, ierr)
+c write (iout, '(/"after exinq: EXSSNL =",i3,", error = ",i3)')
+c 1 node_list_len,ierr
+
+ call exinq (exoid, EXSSDF, df_list_len, fdum, cdum, ierr)
+ write (iout, '(/"after exinq: EXSSDF =",i3,", error = ",i3)')
+ 1 df_list_len,ierr
+c
+c read concatenated side sets; this produces the same information as
+c the above code which reads individual side sets
+c
+c NOTE: SKIP concatenated side set until routine exgcss has been redefined
+c if (.TRUE.) goto 275
+c
+ call exgcss (exoid, ids, num_elem_per_set, num_df_per_set,
+ 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+ 2 ierr)
+ write (iout, '(/"after exgcss, error = ", i3)' ) ierr
+
+ write (iout, '("concatenated side set info")')
+
+ write (iout, '("ids = ")')
+
+ do 200 i = 1, num_side_sets
+ write (iout, '(i3)') ids(i)
+200 continue
+
+ write (iout, '("num_elem_per_set = ")')
+
+ do 210 i = 1, num_side_sets
+ write (iout, '(i3)') num_elem_per_set(i)
+210 continue
+
+ write (iout, '("num_df_per_set = ")')
+
+ do 220 i = 1, num_side_sets
+ write (iout, '(i3)') num_df_per_set(i)
+220 continue
+
+ write (iout, '("elem_ind = ")')
+
+ do 230 i = 1, num_side_sets
+ write (iout, '(i3)') elem_ind(i)
+230 continue
+
+ write (iout, '("df_ind = ")')
+
+ do 240 i = 1, num_side_sets
+ write (iout, '(i3)') df_ind(i)
+240 continue
+
+ write (iout, '("elem_list = ")')
+
+ do 250 i = 1, elem_list_len
+ write (iout, '(i3)') elem_list(i)
+250 continue
+
+ write (iout, '("side_list = ")')
+
+ do 260 i = 1, elem_list_len
+ write (iout, '(i3)') side_list(i)
+260 continue
+
+ write (iout, '("dist_fact = ")')
+
+ do 270 i = 1, df_list_len
+ write (iout, '(f6.3)') dist_fact(i)
+270 continue
+ endif
+
+275 continue
+
+c
+c read QA records
+c
+ call exinq (exoid, EXQA, num_qa_rec, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exgqa (exoid, qa_record, ierr)
+ write (iout, '(/"after exgqa, error = ", i3)' ) ierr
+
+ write (iout, '("QA records = ")')
+
+ do 290 i = 1, num_qa_rec
+ do 280 j = 1, 4
+ write (iout, '(a)') qa_record(j,i)
+280 continue
+290 continue
+
+c
+c read information records
+c
+ call exinq (exoid, EXINFO, num_info, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ call exginf (exoid, inform, ierr)
+ write (iout, '(/"after exginf, error = ", i3)' ) ierr
+
+ write (iout, '("info records = ")')
+
+ do 300 i = 1, num_info
+ write (iout, '(a81)') inform(i)
+300 continue
+
+c
+c read global variables parameters and names
+c
+ call exgvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," global variables; their names ",
+ 1 "are :")') num_glo_vars
+
+ do 320 i = 1, num_glo_vars
+ write (iout, '(a9)') var_names(i)
+320 continue
+
+c
+c read nodal variables parameters and names
+c
+ call exgvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," nodal variables; their names ",
+ 1 "are :")') num_nod_vars
+
+ do 330 i = 1, num_nod_vars
+ write (iout, '(a9)') var_names(i)
+330 continue
+
+c
+c read element variables parameters and names
+c
+ call exgvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '(/"after exgvp, error = ", i3)' ) ierr
+
+ call exgvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '(/"after exgvan, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," element variables; their names ",
+ 1 "are :")') num_ele_vars
+
+ do 340 i = 1, num_ele_vars
+ write (iout, '(a9)') var_names(i)
+340 continue
+
+c
+c read element variable truth table
+c
+ call exgvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '(/"after exgvtt, error = ", i3)' ) ierr
+
+ write (iout, '("This is the element variable truth table:")')
+
+ do 360 i = 1, num_elem_blk
+ do 350 j = 1, num_ele_vars
+ write (iout, '(i2)') truth_tab(j,i)
+350 continue
+360 continue
+
+c
+c determine how many time steps are stored
+c
+ call exinq (exoid, EXTIMS, num_time_steps, fdum, cdum, ierr)
+ write (iout, '(/"after exinq, error = ", i3)' ) ierr
+
+ write (iout, '("There are ",i2," time steps in the database.")')
+ 1 num_time_steps
+c
+c read time value at one time step
+c
+ time_step = 3
+ call exgtim (exoid, time_step, time_value, ierr)
+ write (iout, '(/"after exgtim, error = ", i3)' ) ierr
+
+ write (iout, '("time value at time step ",i2," = ", f5.3)')
+ 1 time_step, time_value
+c
+c read time values at all time steps
+c
+ call exgatm (exoid, time_values, ierr)
+ write (iout, '(/"after exgatm, error = ", i3)' ) ierr
+
+ write (iout, '("time values at all time steps are:")')
+
+ do 370 i = 1, num_time_steps
+ write (iout, '(f5.3)') time_values(i)
+370 continue
+
+ var_index = 1
+ beg_time = 1
+ end_time = -1
+c
+c read all global variables at one time step
+c
+ call exggv (exoid, time_step, num_glo_vars, var_values, ierr)
+ write (iout, '(/"after exggv, error = ", i3)' ) ierr
+
+ write (iout, '("global variable values at time step ",i2)')
+ 1 time_step
+
+ do 400 i = 1, num_glo_vars
+ write (iout, '(f5.3)') var_values(i)
+400 continue
+
+c
+c read a single global variable through time
+c
+ call exggvt (exoid, var_index, beg_time, end_time, var_values,
+ 1 ierr)
+ write (iout, '(/"after exggvt, error = ", i3)' ) ierr
+
+ write (iout, '("global variable ",i2," values through time:")')
+ 1 var_index
+
+ do 410 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+410 continue
+
+c
+c read a nodal variable at one time step
+c
+ call exgnv (exoid, time_step, var_index, num_nodes, var_values,
+ 1 ierr)
+ write (iout, '(/"after exgnv, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values at time step ",i2)')
+ 1 var_index, time_step
+
+ do 420 i = 1, num_nodes
+ write (iout, '(f5.3)') var_values(i)
+420 continue
+
+c
+c read a nodal variable through time
+c
+ node_num = 1
+
+ call exgnvt (exoid, var_index, node_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgnvt, error = ", i3)' ) ierr
+
+ write (iout, '("nodal variable ",i2," values for node ",i2,
+ 1 " through time:")') var_index, node_num
+
+ do 430 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+430 continue
+
+c
+c read an element variable at one time step
+c
+ call exgebi (exoid, ids, ierr)
+ write (iout, '(/"after exgebi, error = ", i3)' ) ierr
+
+ do 450 i = 1, num_elem_blk
+
+ call exgev (exoid, time_step, var_index, ids(i),
+ 1 num_elem_in_block(i), var_values, ierr)
+ write (iout, '(/"after exgev, error = ", i3)' ) ierr
+
+ if (ierr .eq. 0) then
+ write (iout, '("element variable ",i2," values of element ",
+ 1 "block ",i2," at time step ",i2)')
+ 2 var_index, ids(i), time_step
+ endif
+
+ do 440 j = 1, num_elem_in_block(i)
+ write (iout, '(f5.3)') var_values(j)
+440 continue
+
+450 continue
+
+c
+c read an element variable through time
+c
+ var_index = 2
+ elem_num = 2
+
+ call exgevt (exoid, var_index, elem_num, beg_time, end_time,
+ 1 var_values, ierr)
+ write (iout, '(/"after exgevt, error = ", i3)' ) ierr
+
+ write (iout, '("element variable ",i2," values for element ",i2,
+ 1 " through time:")') var_index, elem_num
+
+ do 460 i = 1, num_time_steps
+ write (iout, '(f5.3)') var_values(i)
+460 continue
+
+ call exclos (exoid, ierr)
+ write (iout, '(/"after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testwt.f b/forbind/test/testwt.f
new file mode 100644
index 0000000..65bbb0b
--- /dev/null
+++ b/forbind/test/testwt.f
@@ -0,0 +1,1158 @@
+ program testwt
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines.
+c
+
+c history -
+c Original L.A. Schoof
+c 02/25/93 V.R. Yarberry - Added error checks for file creation.
+c 03/04/93 V.R. Yarberry - Fixed bug in expvtt test, ebids was not passed
+c 08/31/93 VRY - updated to match API version 2.00
+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(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.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.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 = 26
+ num_elem = 5
+ num_elem_blk = 5
+ num_node_sets = 2
+ num_side_sets = 5
+
+ 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
+ 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) = 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_nodes_per_elem(1) = 4
+ num_nodes_per_elem(2) = 4
+ num_nodes_per_elem(3) = 8
+ num_nodes_per_elem(4) = 4
+ num_nodes_per_elem(5) = 6
+
+ ebids(1) = 10
+ ebids(2) = 11
+ ebids(3) = 12
+ ebids(4) = 13
+ ebids(5) = 14
+
+ numattr(1) = 1
+ numattr(2) = 1
+ numattr(3) = 1
+ numattr(4) = 1
+ numattr(5) = 1
+
+ cname = "quad"
+ 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
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),
+ 1 num_nodes_per_elem(2),numattr(2),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ cname = "hex"
+ call expelb (exoid,ebids(3),cname,num_elem_in_block(3),
+ 1 num_nodes_per_elem(3),numattr(3),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ cname = "tetra"
+ call expelb (exoid,ebids(4),cname,num_elem_in_block(4),
+ 1 num_nodes_per_elem(4),numattr(4),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ cname = "wedge"
+ call expelb (exoid,ebids(5),cname,num_elem_in_block(5),
+ 1 num_nodes_per_elem(5),numattr(5),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expp(exoid, EXEBLK, ebids(3), "MATL", 30, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expp(exoid, EXEBLK, ebids(4), "MATL", 40, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expp(exoid, EXEBLK, ebids(5), "MATL", 50, ierr)
+ write (iout, '("after expp, 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
+
+ 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
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ connect(1) = 9
+ connect(2) = 10
+ connect(3) = 11
+ connect(4) = 12
+ connect(5) = 13
+ connect(6) = 14
+ connect(7) = 15
+ connect(8) = 16
+
+ call expelc (exoid, ebids(3), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ connect(1) = 17
+ connect(2) = 18
+ connect(3) = 19
+ connect(4) = 20
+
+ call expelc (exoid, ebids(4), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ connect(1) = 21
+ connect(2) = 22
+ connect(3) = 23
+ connect(4) = 24
+ connect(5) = 25
+ connect(6) = 26
+
+ call expelc (exoid, ebids(5), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write element block attributes
+c
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expeat (exoid, ebids(3), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expeat (exoid, ebids(4), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expeat (exoid, ebids(5), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ attrib_names(1) = 'THICKNESS'
+ do i=1, 5
+ call expean (exoid, ebids(i), 1, attrib_names, ierr)
+ write (iout, '("after expean, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ end do
+c
+c write individual node sets
+c
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+ call expnp (exoid, 20, 5, 5, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expns (exoid, 20, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expnsd (exoid, 20, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+ call expnp (exoid, 21, 3, 3, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expns (exoid, 21, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expnsd (exoid, 21, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ num_df_per_set(1) = 5
+ num_df_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ df_ind(1) = 1
+ df_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+c call expcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+c 1 node_ind, df_ind, node_list, dist_fact, ierr)
+c write (iout, '("after expcns, error = ", i4)' ) ierr
+
+c write node set properties
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write individual side sets
+c
+
+c side set #1 - quad
+
+ elem_list(1) = 2
+ elem_list(2) = 2
+
+ side_list(1) = 4
+ side_list(2) = 2
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+ call expsp (exoid, 30, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expss (exoid, 30, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expssd (exoid, 30, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c side set #2 - quad, spanning 2 elements
+
+ elem_list(1) = 1
+ elem_list(2) = 2
+
+ side_list(1) = 2
+ side_list(2) = 3
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+ call expsp (exoid, 31, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expss (exoid, 31, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expssd (exoid, 31, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c side set #3 - hex
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 3
+ elem_list(4) = 3
+ elem_list(5) = 3
+ elem_list(6) = 3
+ elem_list(7) = 3
+
+ side_list(1) = 5
+ side_list(2) = 3
+ side_list(3) = 3
+ side_list(4) = 2
+ side_list(5) = 4
+ side_list(6) = 1
+ side_list(7) = 6
+
+ call expsp (exoid, 32, 7, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expss (exoid, 32, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c side set #4 - tetras
+
+ elem_list(1) = 4
+ elem_list(2) = 4
+ elem_list(3) = 4
+ elem_list(4) = 4
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+
+ call expsp (exoid, 33, 4, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expss (exoid, 33, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c side set #5 - wedges
+
+ elem_list(1) = 5
+ elem_list(2) = 5
+ elem_list(3) = 5
+ elem_list(4) = 5
+ elem_list(5) = 5
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+ side_list(5) = 5
+
+ call expsp (exoid, 34, 5, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expss (exoid, 34, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+ ids(1) = 30
+ ids(2) = 31
+ ids(3) = 32
+ ids(4) = 33
+ ids(5) = 34
+
+c side set #1
+ node_list(1) = 8
+ node_list(2) = 5
+ node_list(3) = 6
+ node_list(4) = 7
+
+c side set #2
+ node_list(5) = 2
+ node_list(6) = 3
+ node_list(7) = 7
+ node_list(8) = 8
+
+c side set #3
+ node_list(9) = 9
+ node_list(10) = 12
+ node_list(11) = 11
+ node_list(12) = 10
+
+ node_list(13) = 11
+ node_list(14) = 12
+ node_list(15) = 16
+ node_list(16) = 15
+
+ node_list(17) = 16
+ node_list(18) = 15
+ node_list(19) = 11
+ node_list(20) = 12
+
+ node_list(21) = 10
+ node_list(22) = 11
+ node_list(23) = 15
+ node_list(24) = 14
+
+ node_list(25) = 13
+ node_list(26) = 16
+ node_list(27) = 12
+ node_list(28) = 9
+
+ node_list(29) = 14
+ node_list(30) = 13
+ node_list(31) = 9
+ node_list(32) = 10
+
+ node_list(33) = 16
+ node_list(34) = 13
+ node_list(35) = 14
+ node_list(36) = 15
+
+c side set #4
+ node_list(37) = 17
+ node_list(38) = 18
+ node_list(39) = 20
+
+ node_list(40) = 18
+ node_list(41) = 19
+ node_list(42) = 20
+
+ node_list(43) = 20
+ node_list(44) = 19
+ node_list(45) = 17
+
+ node_list(46) = 19
+ node_list(47) = 18
+ node_list(48) = 17
+
+c side set #5
+ node_list(49) = 25
+ node_list(50) = 24
+ node_list(51) = 21
+ node_list(52) = 22
+
+ node_list(53) = 26
+ node_list(54) = 25
+ node_list(55) = 22
+ node_list(56) = 23
+
+ node_list(57) = 26
+ node_list(58) = 23
+ node_list(59) = 21
+ node_list(60) = 24
+
+ node_list(61) = 23
+ node_list(62) = 22
+ node_list(63) = 21
+
+ node_list(64) = 24
+ node_list(65) = 25
+ node_list(66) = 26
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+ num_elem_per_set(3) = 7
+ num_elem_per_set(4) = 4
+ num_elem_per_set(5) = 5
+
+ num_nodes_per_set(1) = 4
+ num_nodes_per_set(2) = 4
+ num_nodes_per_set(3) = 28
+ num_nodes_per_set(4) = 12
+ num_nodes_per_set(5) = 20
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+ elem_ind(3) = 5
+ elem_ind(4) = 12
+ elem_ind(5) = 16
+
+ node_ind(1) = 1
+ node_ind(2) = 5
+ node_ind(3) = 9
+ node_ind(4) = 37
+ node_ind(5) = 48
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 1
+ elem_list(4) = 3
+ elem_list(5) = 4
+ elem_list(6) = 4
+ elem_list(7) = 4
+ elem_list(8) = 4
+ elem_list(9) = 4
+ elem_list(10) = 4
+ elem_list(11) = 4
+ elem_list(12) = 5
+ elem_list(13) = 5
+ elem_list(14) = 5
+ elem_list(15) = 5
+ elem_list(16) = 6
+ elem_list(17) = 6
+ elem_list(18) = 6
+ elem_list(19) = 6
+ elem_list(20) = 6
+
+c side_list(1) = 1
+c side_list(2) = 2
+c side_list(3) = 3
+c side_list(4) = 4
+
+c call excn2s(exoid, num_elem_per_set, num_nodes_per_set, elem_ind,
+c 1 node_ind, elem_list, node_list, side_list, ierr)
+c write (iout, '("after excn2s, error = ", i4)' ) ierr
+
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+ num_df_per_set(3) = 0
+ num_df_per_set(4) = 0
+ num_df_per_set(5) = 0
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+c call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss, error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, 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 write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = real(i)/100.
+c
+c write time value
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+c write(iout,*)'elem_var_val(',m,'): ',elem_var_vals(m)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+ if (ierr .ne. 0) then
+ call exclos(exoid,ierr)
+ call exit (0)
+ endif
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ stop
+ end
diff --git a/forbind/test/testwt1.f b/forbind/test/testwt1.f
new file mode 100644
index 0000000..91448e1
--- /dev/null
+++ b/forbind/test/testwt1.f
@@ -0,0 +1,997 @@
+ program testwt1
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines.
+c
+
+c history -
+c Original L.A. Schoof
+c 02/25/93 V.R. Yarberry - Added error checks for file creation.
+c 03/04/93 V.R. Yarberry - Fixed bug in expvtt test, ebids was not passed
+c 08/31/93 VRY - updated to match API version 2.00
+c
+ include 'exodusII.inc'
+
+ integer iin, iout
+ integer exoid, num_dim, num_nodes, 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, elem_map(10), node_map(100), connect(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,7)
+ 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(3)
+
+ data iin /5/, iout /6/
+
+ cpu_word_size = 0
+ io_word_size = 0
+c
+c create EXODUS II files
+c
+ exoid = excre ("test.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.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 = 28
+ num_elem = 8
+ num_elem_blk = 7
+ num_node_sets = 2
+ num_side_sets = 5
+c Uncomment the following line to test NULL side sets
+c num_side_sets = 6
+
+ call expini (exoid, "This is testwt1", 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
+
+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 Circle #1
+ x(21) = 100.0
+ y(21) = 100.0
+ z(21) = 0.0
+
+c Sphere #1
+ x(22) = 50.0
+ y(22) = 50.0
+ z(22) = 20.0
+
+c Wedge #1
+ x(23) = 3.0
+ x(24) = 6.0
+ x(25) = 0.0
+ x(26) = 3.0
+ x(27) = 6.0
+ x(28) = 0.0
+
+ y(23) = 0.0
+ y(24) = 0.0
+ y(25) = 0.0
+ y(26) = 2.0
+ y(27) = 2.0
+ y(28) = 2.0
+
+ z(23) = 6.0
+ z(24) = 0.0
+ z(25) = 0.0
+ z(26) = 6.0
+ z(27) = 2.0
+ z(28) = 0.0
+ call expcor (exoid, x, y, z, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+
+ 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
+
+c
+c write node and element map parameters
+c
+
+ n_node_maps = 1
+ n_elem_maps = 2
+
+ call expmp (exoid, n_node_maps, n_elem_maps, ierr)
+ write (iout, '("after expmp, error = ", i4)' ) ierr
+
+c
+c write element map properties
+c
+
+ prop_names(1) = "ORDER"
+ prop_names(2) = "NUMBER"
+ call exppn(exoid,EXEMAP,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+c
+c write element order map
+c
+
+ do 10 i = 1, num_elem
+ elem_map(i) = i
+10 continue
+
+ id = 111
+ call expem (exoid, id, elem_map, ierr)
+ write (iout, '("after expem, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEMAP, id, "ORDER", 1, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write element numbering map
+c
+ id = 222
+C write map an element at a time...
+ do 11 i = 1, num_elem
+ elem_map(i) = i*2
+ call exppem (exoid, id, i, 1, elem_map(i), ierr)
+ write (iout, '("after exppem, error = ", i4)' ) ierr
+11 continue
+
+ call expp(exoid, EXEMAP, id, "NUMBER", 1, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write node map properties
+c
+
+ prop_names(1) = "NUMBER"
+ call exppn(exoid,EXNMAP,1,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+c
+c write node numbering map
+c
+
+ do 13 i = 1, num_nodes
+ node_map(i) = i*3
+ 13 continue
+
+ id = 333
+ call expnm (exoid, id, node_map, ierr)
+ write (iout, '("after expnm, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNMAP, id, "NUMBER", 1, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write element block parameters
+c
+
+ num_elem_in_block(1) = 1
+ num_elem_in_block(2) = 2
+ 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_elem_in_block(7) = 1
+
+ num_nodes_per_elem(1) = 4
+ num_nodes_per_elem(2) = 4
+ num_nodes_per_elem(3) = 8
+ num_nodes_per_elem(4) = 4
+ num_nodes_per_elem(5) = 1
+ num_nodes_per_elem(6) = 1
+ num_nodes_per_elem(7) = 6
+
+ ebids(1) = 10
+ ebids(2) = 11
+ ebids(3) = 12
+ ebids(4) = 13
+ ebids(5) = 14
+ ebids(6) = 15
+ ebids(7) = 16
+
+ numattr(1) = 3
+ numattr(2) = 3
+ numattr(3) = 3
+ numattr(4) = 3
+ numattr(5) = 3
+ numattr(6) = 3
+ numattr(7) = 3
+
+ cname = "quad"
+ 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
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),
+ 1 num_nodes_per_elem(2),numattr(2),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "hex"
+ call expelb (exoid,ebids(3),cname,num_elem_in_block(3),
+ 1 num_nodes_per_elem(3),numattr(3),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "tetra"
+ call expelb (exoid,ebids(4),cname,num_elem_in_block(4),
+ 1 num_nodes_per_elem(4),numattr(4),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "circle"
+ call expelb (exoid,ebids(5),cname,num_elem_in_block(5),
+ 1 num_nodes_per_elem(5),numattr(5),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "sphere"
+ call expelb (exoid,ebids(6),cname,num_elem_in_block(6),
+ 1 num_nodes_per_elem(6),numattr(6),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "wedge"
+ call expelb (exoid,ebids(7),cname,num_elem_in_block(7),
+ 1 num_nodes_per_elem(7),numattr(7),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(3), "MATL", 30, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(4), "MATL", 40, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(5), "MATL", 50, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(6), "MATL", 60, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(7), "MATL", 70, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+ connect(5) = 5
+ connect(6) = 6
+ connect(7) = 7
+ connect(8) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 9
+ connect(2) = 10
+ connect(3) = 11
+ connect(4) = 12
+ connect(5) = 13
+ connect(6) = 14
+ connect(7) = 15
+ connect(8) = 16
+
+ call expelc (exoid, ebids(3), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 17
+ connect(2) = 18
+ connect(3) = 19
+ connect(4) = 20
+
+ call expelc (exoid, ebids(4), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 21
+
+ call expelc (exoid, ebids(5), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 22
+
+ call expelc (exoid, ebids(6), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 23
+ connect(2) = 24
+ connect(3) = 25
+ connect(4) = 26
+ connect(5) = 27
+ connect(6) = 28
+
+ call expelc (exoid, ebids(7), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+c
+c write element block attributes
+c
+ attrib(1) = 1.0 ! block 1
+ attrib(2) = 2.0
+ attrib(3) = 3.0
+ attrib(4) = 1.11 ! block 2, element 1
+ attrib(5) = 2.11
+ attrib(6) = 3.11
+ attrib(7) = 1.12 ! block 2, element 2
+ attrib(8) = 2.12
+ attrib(9) = 3.12
+ attrib(10) = 1.2 ! block 3
+ attrib(11) = 2.2
+ attrib(12) = 3.2
+ attrib(13) = 1.3 ! block 4
+ attrib(14) = 2.3
+ attrib(15) = 3.3
+ attrib(16) = 1.4 ! block 5
+ attrib(17) = 2.4
+ attrib(18) = 3.4
+ attrib(19) = 1.5 ! block 6
+ attrib(20) = 2.5
+ attrib(21) = 3.5
+ attrib(22) = 1.6 ! block 7
+ attrib(23) = 2.6
+ attrib(24) = 3.6
+
+ call expeat (exoid, ebids(1), attrib(1), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(2), attrib(4), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(3), attrib(10), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(4), attrib(13), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(5), attrib(16), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(6), attrib(19), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(7), attrib(22), ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib_names(1) = "attribute_1"
+ attrib_names(2) = "attribute_2"
+ attrib_names(3) = "attribute_3"
+ do i=1, num_elem_blk
+ call expean (exoid, ebids(i), numattr(i), attrib_names, ierr)
+ write (iout, '("after expean, error = ", i4)' ) ierr
+ end do
+
+c
+c write individual node sets
+c
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+c call expnp (exoid, 20, 5, 5, ierr)
+c write (iout, '("after expnp, error = ", i4)' ) ierr
+c call expns (exoid, 20, node_list, ierr)
+c write (iout, '("after expns, error = ", i4)' ) ierr
+c call expnsd (exoid, 20, dist_fact, ierr)
+c write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+c call expnp (exoid, 21, 3, 3, ierr)
+c write (iout, '("after expnp, error = ", i4)' ) ierr
+c call expns (exoid, 21, node_list, ierr)
+c write (iout, '("after expns, error = ", i4)' ) ierr
+c call expnsd (exoid, 21, dist_fact, ierr)
+c write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ num_df_per_set(1) = 5
+ num_df_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ df_ind(1) = 1
+ df_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+ call expcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+ 1 node_ind, df_ind, node_list, dist_fact, ierr)
+ write (iout, '("after expcns, error = ", i4)' ) ierr
+
+c write node set properties
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+
+c
+c write individual side sets
+c
+
+ elem_list(1) = 11
+ elem_list(2) = 12
+
+ side_list(1) = 1
+ side_list(2) = 2
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+c call expsp (exoid, 30, 2, 4, ierr)
+c write (iout, '("after expsp, error = ", i4)' ) ierr
+
+c call expss (exoid, 30, elem_list, side_list, ierr)
+c write (iout, '("after expss, error = ", i4)' ) ierr
+
+c call expssd (exoid, 30, dist_fact, ierr)
+c write (iout, '("after expssd, error = ", i4)' ) ierr
+
+ elem_list(1) = 13
+ elem_list(2) = 14
+
+ side_list(1) = 3
+ side_list(2) = 4
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+c call expsp (exoid, 31, 2, 4, ierr)
+c write (iout, '("after expsp, error = ", i4)' ) ierr
+
+c call expss (exoid, 31, elem_list, side_list, ierr)
+c write (iout, '("after expss, error = ", i4)' ) ierr
+
+c call expssd (exoid, 31, dist_fact, ierr)
+c write (iout, '("after expssd, error = ", i4)' ) ierr
+
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+ ids(1) = 30
+ ids(2) = 31
+ ids(3) = 32
+ ids(4) = 33
+ ids(5) = 34
+ ids(6) = 35
+
+c side set #1 - quad
+ node_list(1) = 8
+ node_list(2) = 5
+ node_list(3) = 6
+ node_list(4) = 7
+
+c side set #2 - quad/hex, spanning 2 element types
+ node_list(5) = 2
+ node_list(6) = 3
+ node_list(7) = 7
+ node_list(8) = 8
+
+c side set #3 - hex
+ node_list(9) = 9
+ node_list(10) = 12
+ node_list(11) = 11
+ node_list(12) = 10
+
+ node_list(13) = 11
+ node_list(14) = 12
+ node_list(15) = 16
+ node_list(16) = 15
+
+ node_list(17) = 16
+ node_list(18) = 15
+ node_list(19) = 11
+ node_list(20) = 12
+
+ node_list(21) = 10
+ node_list(22) = 11
+ node_list(23) = 15
+ node_list(24) = 14
+
+ node_list(25) = 13
+ node_list(26) = 16
+ node_list(27) = 12
+ node_list(28) = 9
+
+ node_list(29) = 14
+ node_list(30) = 13
+ node_list(31) = 9
+ node_list(32) = 10
+
+ node_list(33) = 16
+ node_list(34) = 13
+ node_list(35) = 14
+ node_list(36) = 15
+
+c side set #4 - Tetra
+ node_list(37) = 17
+ node_list(38) = 18
+ node_list(39) = 20
+
+ node_list(40) = 18
+ node_list(41) = 19
+ node_list(42) = 20
+
+ node_list(43) = 20
+ node_list(44) = 19
+ node_list(45) = 17
+
+ node_list(46) = 19
+ node_list(47) = 18
+ node_list(48) = 17
+
+c side set #5 - Circle/Sphere
+ node_list(49) = 21
+ node_list(50) = 22
+
+c side set #6 - Wedges
+ node_list(51) = 27
+ node_list(52) = 26
+ node_list(53) = 23
+ node_list(54) = 24
+
+ node_list(55) = 28
+ node_list(56) = 27
+ node_list(57) = 24
+ node_list(58) = 25
+
+ node_list(59) = 28
+ node_list(60) = 25
+ node_list(61) = 23
+ node_list(62) = 26
+
+ node_list(63) = 25
+ node_list(64) = 24
+ node_list(65) = 23
+
+ node_list(66) = 26
+ node_list(67) = 27
+ node_list(68) = 28
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+ num_elem_per_set(3) = 7
+ num_elem_per_set(4) = 4
+ num_elem_per_set(5) = 2
+ num_elem_per_set(6) = 6
+c Uncomment following line to test NULL side sets
+c num_elem_per_set(6) = 0
+
+ num_nodes_per_set(1) = 4
+ num_nodes_per_set(2) = 4
+ num_nodes_per_set(3) = 28
+ num_nodes_per_set(4) = 12
+ num_nodes_per_set(5) = 2
+ num_nodes_per_set(6) = 18
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+ elem_ind(3) = 5
+ elem_ind(4) = 12
+ elem_ind(5) = 16
+ elem_ind(6) = 18
+
+ node_ind(1) = 1
+ node_ind(2) = 5
+ node_ind(3) = 9
+ node_ind(4) = 37
+ node_ind(5) = 48
+ node_ind(6) = 50
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 1
+ elem_list(4) = 3
+ elem_list(5) = 4
+ elem_list(6) = 4
+ elem_list(7) = 4
+ elem_list(8) = 4
+ elem_list(9) = 4
+ elem_list(10) = 4
+ elem_list(11) = 4
+ elem_list(12) = 5
+ elem_list(13) = 5
+ elem_list(14) = 5
+ elem_list(15) = 5
+ elem_list(16) = 6
+ elem_list(17) = 7
+ elem_list(18) = 8
+ elem_list(19) = 8
+ elem_list(20) = 8
+ elem_list(21) = 8
+ elem_list(22) = 8
+
+c side_list(1) = 1
+c side_list(2) = 2
+c side_list(3) = 3
+c side_list(4) = 4
+
+ call excn2s(exoid, num_elem_per_set, num_nodes_per_set, elem_ind,
+ 1 node_ind, elem_list, node_list, side_list, ierr)
+ write (iout, '("after excn2s, error = ", i4)' ) ierr
+
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+ num_df_per_set(3) = 0
+ num_df_per_set(4) = 0
+ num_df_per_set(5) = 0
+ num_df_per_set(6) = 0
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+ df_ind(3) = 9
+ df_ind(4) = 9
+ df_ind(5) = 9
+ df_ind(6) = 9
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+ call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+ 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+ 2 ierr)
+ write (iout, '("after expcss, error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+c
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "TESTWT1 fortran version"
+ qa_record(2,1) = "testwt1"
+ qa_record(3,1) = "03/16/94"
+ 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
+
+
+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
+
+
+c write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvnm (exoid, "g", 1, var_names(1), ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ truth_tab(1,3) = 0
+
+c call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+c write (iout, '("after expvtt, error = ", i4)' ) ierr
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = real(i)/100.
+c
+c write time value
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+c write(iout,*)'elem_var_val(',m,'): ',elem_var_vals(m)
+
+80 continue
+
+ if (k .eq. 1 .and. j .eq. 3) then
+ continue ! skip element block 3, variable 1
+ else
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+ endif
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ stop
+ end
diff --git a/forbind/test/testwt2.f b/forbind/test/testwt2.f
new file mode 100644
index 0000000..6e31660
--- /dev/null
+++ b/forbind/test/testwt2.f
@@ -0,0 +1,1432 @@
+ program testwt2
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines. It tests multiple simultaneous output files.
+c
+c 09/07/93 V.R. Yarberry - Revised for 2.00 API
+
+ include 'exodusII.inc'
+
+ integer iin, iout
+ integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
+ integer exoid2, num_dim2, num_nodes2, num_elem2, num_elem_blk2
+ integer num_elem_in_block(10), num_node_sets
+ integer num_elem_in_block2(10), num_node_sets2
+ integer num_side_sets, num_nodes_per_elem(10), numattr(10)
+ integer num_side_sets2, num_nodes_per_elem2(10), numattr2(10)
+ integer i, j, k, m, elem_map(5), connect(10)
+ integer elem_map2(5), connect2(10)
+ integer node_list(100), elem_list(100), side_list(100)
+ integer node_list2(100), elem_list2(100), side_list2(100)
+ integer ebids(10),ids(10),num_nodes_per_set(10)
+ integer num_elem_per_set(10), num_df_per_set(10)
+ integer ebids2(10)
+ integer df_ind(10), node_ind(10), elem_ind(10)
+ integer num_qa_rec, num_info
+ integer num_qa_rec2,num_info2
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer num_glo_vars2, num_nod_vars2, num_ele_vars2
+ 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 time_value2
+ real x(100), y(100), z(100)
+ real x2(100), y2(100), z2(100)
+ real attrib(100), dist_fact(100)
+ real attrib2(100), dist_fact2(100)
+
+ character*(MXLNLN) title
+ character*(MXLNLN) title2
+ character*(MXSTLN) coord_names(3)
+ character*(MXSTLN) coord_names2(3)
+ character*(MXSTLN) cname
+ character*(MXSTLN) cname2
+ character*(MXSTLN) var_names(3)
+ character*(MXSTLN) var_names2(3)
+ character*(MXSTLN) qa_record(4,2)
+ character*(MXSTLN) qa_record2(4,2)
+ character*(MXLNLN) inform(3)
+ character*(MXLNLN) inform2(3)
+ character*(MXSTLN) prop_names(2)
+
+ data iin /5/, iout /6/
+
+c
+c create EXODUS II files
+c
+ cpu_word_size = 0
+ io_word_size = 4
+c
+c first create a "regular" file that contains everything except
+c history variable info
+c
+ exoid = excre ("test.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.exo,id: ",i4,", err=",i3)')
+ 1 exoid, ierr
+ write (iout,'(" cpu word size: ",i4," io word size: ",i4)')
+ 1 cpu_word_size, io_word_size
+ write (iout, '("after excre, error = ", i4)' ) ierr
+
+ exoid2= excre ("test2.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test2.exo,id: ",i4,", err=",i3)')
+ 1 exoid2, ierr
+ write (iout, '("after excre (2), error = ", i4)' ) ierr
+
+c
+c initialize file with parameters
+c
+
+ title = "This is test 2"
+ num_dim = 3
+ num_nodes = 26
+ num_elem = 5
+ num_elem_blk = 5
+ num_node_sets = 2
+ num_side_sets = 5
+
+ call expini (exoid, title, 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
+
+ title2 = "This is test 2"
+ num_dim2 = 3
+ num_nodes2 = 26
+ num_elem2 = 5
+ num_elem_blk2 = 5
+ num_node_sets2 = 2
+ num_side_sets2 = 5
+
+ call expini (exoid2, title2, num_dim2, num_nodes2,
+ 1 num_elem2, num_elem_blk2, num_node_sets2,
+ 2 num_side_sets2, ierr)
+
+ write (iout, '("after expini (2), error = ", i4)' ) ierr
+
+
+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
+
+ call expcor (exoid, x, y, z, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+
+c Quad #1
+ x2(1) = 0.0
+ x2(2) = 1.0
+ x2(3) = 1.0
+ x2(4) = 0.0
+
+ y2(1) = 0.0
+ y2(2) = 0.0
+ y2(3) = 1.0
+ y2(4) = 1.0
+
+ z2(1) = 0.0
+ z2(2) = 0.0
+ z2(3) = 0.0
+ z2(4) = 0.0
+
+c Quad #2
+ x2(5) = 1.0
+ x2(6) = 2.0
+ x2(7) = 2.0
+ x2(8) = 1.0
+
+ y2(5) = 0.0
+ y2(6) = 0.0
+ y2(7) = 1.0
+ y2(8) = 1.0
+
+ z2(5) = 0.0
+ z2(6) = 0.0
+ z2(7) = 0.0
+ z2(8) = 0.0
+
+c Hex #1
+ x2(9) = 0.0
+ x2(10) = 10.0
+ x2(11) = 10.0
+ x2(12) = 1.0
+ x2(13) = 1.0
+ x2(14) = 10.0
+ x2(15) = 10.0
+ x2(16) = 1.0
+
+ y2(9) = 0.0
+ y2(10) = 0.0
+ y2(11) = 0.0
+ y2(12) = 0.0
+ y2(13) = 10.0
+ y2(14) = 10.0
+ y2(15) = 10.0
+ y2(16) = 10.0
+
+ z2(9) = 0.0
+ z2(10) = 0.0
+ z2(11) =-10.0
+ z2(12) =-10.0
+ z2(13) = 0.0
+ z2(14) = 0.0
+ z2(15) =-10.0
+ z2(16) =-10.0
+
+c Tetra #1
+ x2(17) = 0.0
+ x2(18) = 1.0
+ x2(19) = 10.0
+ x2(20) = 7.0
+
+ y2(17) = 0.0
+ y2(18) = 0.0
+ y2(19) = 0.0
+ y2(20) = 5.0
+
+ z2(17) = 0.0
+ z2(18) = 5.0
+ z2(19) = 2.0
+ z2(20) = 3.0
+
+c Wedge #1
+ x2(21) = 3.0
+ x2(22) = 6.0
+ x2(23) = 0.0
+ x2(24) = 3.0
+ x2(25) = 6.0
+ x2(26) = 0.0
+
+ y2(21) = 0.0
+ y2(22) = 0.0
+ y2(23) = 0.0
+ y2(24) = 2.0
+ y2(25) = 2.0
+ y2(26) = 2.0
+
+ z2(21) = 6.0
+ z2(22) = 0.0
+ z2(23) = 0.0
+ z2(24) = 6.0
+ z2(25) = 2.0
+ z2(26) = 0.0
+
+
+ call expcor (exoid2, x2, y2, z2, ierr)
+ write (iout, '("after expcor (2), error = ", i4)' ) ierr
+
+ 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
+
+ coord_names2(1) = "xcoor"
+ coord_names2(2) = "ycoor"
+ coord_names2(3) = "zcoor"
+
+ call expcon (exoid2, coord_names2, ierr)
+ write (iout, '("after expcon (2), error = ", i4)' ) ierr
+
+
+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
+
+ do 12 i = 1, num_elem2
+ elem_map2(i) = i
+12 continue
+
+ call expmap (exoid2, elem_map2, ierr)
+ write (iout, '("after expmap (2), error = ", i4)' ) ierr
+
+c
+c write element block parameters
+c
+
+ 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_nodes_per_elem(1) = 4
+ num_nodes_per_elem(2) = 4
+ num_nodes_per_elem(3) = 8
+ num_nodes_per_elem(4) = 4
+ num_nodes_per_elem(5) = 6
+
+ ebids(1) = 10
+ ebids(2) = 11
+ ebids(3) = 12
+ ebids(4) = 13
+ ebids(5) = 14
+
+ numattr(1) = 1
+ numattr(2) = 1
+ numattr(3) = 1
+ numattr(4) = 1
+ numattr(5) = 1
+
+ cname = "quad"
+
+ 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
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),
+ 1 num_nodes_per_elem(2),numattr(2),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "hex"
+ call expelb (exoid,ebids(3),cname,num_elem_in_block(3),
+ 1 num_nodes_per_elem(3),numattr(3),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "tetra"
+ call expelb (exoid,ebids(4),cname,num_elem_in_block(4),
+ 1 num_nodes_per_elem(4),numattr(4),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ cname = "wedge"
+ call expelb (exoid,ebids(5),cname,num_elem_in_block(5),
+ 1 num_nodes_per_elem(5),numattr(5),ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ num_elem_in_block2(1) = 1
+ num_elem_in_block2(2) = 1
+ num_elem_in_block2(3) = 1
+ num_elem_in_block2(4) = 1
+ num_elem_in_block2(5) = 1
+
+ num_nodes_per_elem2(1) = 4
+ num_nodes_per_elem2(2) = 4
+ num_nodes_per_elem2(3) = 8
+ num_nodes_per_elem2(4) = 4
+ num_nodes_per_elem2(5) = 6
+
+ ebids2(1) = 10
+ ebids2(2) = 11
+ ebids2(3) = 12
+ ebids2(4) = 13
+ ebids2(5) = 14
+
+ numattr2(1) = 1
+ numattr2(2) = 1
+ numattr2(3) = 1
+ numattr2(4) = 1
+ numattr2(5) = 1
+
+ cname2 = "quad"
+
+ call expelb(exoid2,ebids2(1),cname2,num_elem_in_block2(1),
+ 1 num_nodes_per_elem2(1),numattr2(1),ierr)
+ write (iout, '("after expelb (2), error = ", i4)' ) ierr
+
+ call expelb(exoid2,ebids2(2),cname2,num_elem_in_block2(2),
+ 1 num_nodes_per_elem2(2),numattr2(2),ierr)
+ write (iout, '("after expelb (2), error = ", i4)' ) ierr
+
+ cname2 = "hex"
+ call expelb(exoid2,ebids2(3),cname2,num_elem_in_block2(3),
+ 1 num_nodes_per_elem(3),numattr(3),ierr)
+ write (iout, '("after expelb (2), error = ", i4)' ) ierr
+
+ cname2 = "tetra"
+ call expelb(exoid2,ebids2(4),cname2,num_elem_in_block2(4),
+ 1 num_nodes_per_elem2(4),numattr2(4),ierr)
+ write (iout, '("after expelb (2), error = ", i4)' ) ierr
+
+ cname2 = "wedge"
+ call expelb(exoid2,ebids2(5),cname2,num_elem_in_block2(5),
+ 1 num_nodes_per_elem2(5),numattr2(5),ierr)
+ write (iout, '("after expelb (2), error = ", i4)' ) ierr
+
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(3), "MATL", 30, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(4), "MATL", 40, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(5), "MATL", 50, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call exppn(exoid2,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn (2), error = ", i4)' ) ierr
+
+ call expp(exoid2, EXEBLK, ebids(1), "MATL", 100, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+ call expp(exoid2, EXEBLK, ebids(2), "MATL", 200, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+ call expp(exoid2, EXEBLK, ebids(3), "MATL", 300, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+ call expp(exoid2, EXEBLK, ebids(4), "MATL", 400, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+ call expp(exoid2, EXEBLK, ebids(5), "MATL", 500, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 9
+ connect(2) = 10
+ connect(3) = 11
+ connect(4) = 12
+ connect(5) = 13
+ connect(6) = 14
+ connect(7) = 15
+ connect(8) = 16
+
+ call expelc (exoid, ebids(3), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 17
+ connect(2) = 18
+ connect(3) = 19
+ connect(4) = 20
+
+ call expelc (exoid, ebids(4), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 21
+ connect(2) = 22
+ connect(3) = 23
+ connect(4) = 24
+ connect(5) = 25
+ connect(6) = 26
+
+ call expelc (exoid, ebids(5), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect2(1) = 1
+ connect2(2) = 2
+ connect2(3) = 3
+ connect2(4) = 4
+
+ call expelc (exoid2, ebids2(1), connect2, ierr)
+ write (iout, '("after expelc (2), error = ", i4)' ) ierr
+
+ connect2(1) = 5
+ connect2(2) = 6
+ connect2(3) = 7
+ connect2(4) = 8
+
+ call expelc (exoid2, ebids2(2), connect2, ierr)
+ write (iout, '("after expelc (2), error = ", i4)' ) ierr
+
+ connect2(1) = 9
+ connect2(2) = 10
+ connect2(3) = 11
+ connect2(4) = 12
+ connect2(5) = 13
+ connect2(6) = 14
+ connect2(7) = 15
+ connect2(8) = 16
+
+ call expelc (exoid2, ebids2(3), connect2, ierr)
+ write (iout, '("after expelc (2), error = ", i4)' ) ierr
+
+ connect2(1) = 17
+ connect2(2) = 18
+ connect2(3) = 19
+ connect2(4) = 20
+
+ call expelc (exoid2, ebids2(4), connect2, ierr)
+ write (iout, '("after expelc (2), error = ", i4)' ) ierr
+
+ connect2(1) = 21
+ connect2(2) = 22
+ connect2(3) = 23
+ connect2(4) = 24
+ connect2(5) = 25
+ connect2(6) = 26
+
+ call expelc (exoid2, ebids2(5), connect2, ierr)
+ write (iout, '("after expelc (2), error = ", i4)' ) ierr
+
+c
+c write element block attributes
+c
+
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(3), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(4), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ call expeat (exoid, ebids(5), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+
+ attrib2(1) = 3.
+ call expeat (exoid2, ebids2(1), attrib2, ierr)
+ write (iout, '("after expeat (2), error = ", i4)' ) ierr
+
+ attrib2(1) = 6.
+ call expeat (exoid2, ebids2(2), attrib2, ierr)
+ write (iout, '("after expeat (2), error = ", i4)' ) ierr
+
+ call expeat (exoid2, ebids2(3), attrib2, ierr)
+ write (iout, '("after expeat (2), error = ", i4)' ) ierr
+
+ call expeat (exoid2, ebids2(4), attrib2, ierr)
+ write (iout, '("after expeat (2), error = ", i4)' ) ierr
+
+ call expeat (exoid2, ebids(5), attrib2, ierr)
+ write (iout, '("after expeat (2), error = ", i4)' ) ierr
+
+
+c
+c write individual node sets
+c
+
+ call expnp (exoid, 20, 5, 5, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+ call expns (exoid, 20, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 20, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ call expnp (exoid, 21, 3, 3, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+ call expns (exoid, 21, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 21, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+
+C**** file 2
+
+ call expnp (exoid2, 20, 5, 5, ierr)
+ write (iout, '("after expnp (2), error = ", i4)' ) ierr
+
+ node_list2(1) = 100
+ node_list2(2) = 101
+ node_list2(3) = 102
+ node_list2(4) = 103
+ node_list2(5) = 104
+
+ dist_fact2(1) = 1.0
+ dist_fact2(2) = 2.0
+ dist_fact2(3) = 3.0
+ dist_fact2(4) = 4.0
+ dist_fact2(5) = 5.0
+
+ call expns (exoid2, 20, node_list2, ierr)
+ write (iout, '("after expns (2), error = ", i4)' ) ierr
+ call expnsd (exoid2, 20, dist_fact2, ierr)
+ write (iout, '("after expnsd (2), error = ", i4)' ) ierr
+
+ call expnp (exoid2, 21, 3, 3, ierr)
+ write (iout, '("after expnp (2), error = ", i4)' ) ierr
+
+ node_list2(1) = 200
+ node_list2(2) = 201
+ node_list2(3) = 202
+
+ dist_fact2(1) = 1.1
+ dist_fact2(2) = 2.1
+ dist_fact2(3) = 3.1
+
+ call expns (exoid2, 21, node_list2, ierr)
+ write (iout, '("after expns (2), error = ", i4)' ) ierr
+ call expnsd (exoid2, 21, dist_fact2, ierr)
+ write (iout, '("after expnsd (2), error = ", i4)' ) ierr
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+c call expcns (exoid, ids, num_nodes_per_set, node_ind, node_list,
+c 1 dist_fact, ierr)
+c write (iout, '("after expcns, error = ", i4)' ) ierr
+c
+
+ prop_names(1) = "FACE"
+ call expp(exoid2, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+
+ prop_names(1) = "FACE"
+ call expp(exoid2, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid2, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa (2), error = ", i4)' ) ierr
+
+c write individual side sets
+c
+
+c side set #1 - quad
+
+ elem_list(1) = 2
+ elem_list(2) = 2
+
+ side_list(1) = 4
+ side_list(2) = 2
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+ call expsp (exoid, 30, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 30, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+ call expssd (exoid, 30, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+
+c side set #2 - quad, spanning 2 elements
+
+ elem_list(1) = 1
+ elem_list(2) = 2
+
+ side_list(1) = 2
+ side_list(2) = 3
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+ call expsp (exoid, 31, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i3)' ) ierr
+
+ call expss (exoid, 31, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i3)' ) ierr
+
+ call expssd (exoid, 31, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i3)' ) ierr
+
+c side set #3 - hex
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 3
+ elem_list(4) = 3
+ elem_list(5) = 3
+ elem_list(6) = 3
+ elem_list(7) = 3
+
+ side_list(1) = 5
+ side_list(2) = 3
+ side_list(3) = 3
+ side_list(4) = 2
+ side_list(5) = 4
+ side_list(6) = 1
+ side_list(7) = 6
+
+ call expsp (exoid, 32, 7, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 32, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+c side set #4 - tetras
+
+ elem_list(1) = 4
+ elem_list(2) = 4
+ elem_list(3) = 4
+ elem_list(4) = 4
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+
+ call expsp (exoid, 33, 4, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 33, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+c side set #5 - wedges
+
+ elem_list(1) = 5
+ elem_list(2) = 5
+ elem_list(3) = 5
+ elem_list(4) = 5
+ elem_list(5) = 5
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+ side_list(5) = 5
+
+ call expsp (exoid, 34, 5, 0, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 34, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+
+c side set #1 - quad
+
+ elem_list2(1) = 2
+ elem_list2(2) = 2
+
+ side_list2(1) = 4
+ side_list2(2) = 2
+
+ dist_fact2(1) = 30.0
+ dist_fact2(2) = 30.1
+ dist_fact2(3) = 30.2
+ dist_fact2(4) = 30.3
+
+ call expsp (exoid2, 30, 2, 4, ierr)
+ write (iout, '("after expsp (2), error = ", i4)' ) ierr
+
+ call expss (exoid2, 30, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (2), error = ", i4)' ) ierr
+
+ call expssd (exoid2, 30, dist_fact2, ierr)
+ write (iout, '("after expssd (2), error = ", i4)' ) ierr
+
+c side set #2 - quad, spanning 2 elements
+
+ elem_list2(1) = 1
+ elem_list2(2) = 2
+
+ side_list2(1) = 2
+ side_list2(2) = 3
+
+ dist_fact2(1) = 31.0
+ dist_fact2(2) = 31.1
+ dist_fact2(3) = 31.2
+ dist_fact2(4) = 31.3
+
+ call expsp (exoid2, 31, 2, 4, ierr)
+ write (iout, '("after expsp (2), error = ", i3)' ) ierr
+
+ call expss (exoid2, 31, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (2), error = ", i3)' ) ierr
+
+ call expssd (exoid2, 31, dist_fact2, ierr)
+ write (iout, '("after expssd (2), error = ", i3)' ) ierr
+
+c side set #3 - hex
+
+ elem_list2(1) = 3
+ elem_list2(2) = 3
+ elem_list2(3) = 3
+ elem_list2(4) = 3
+ elem_list2(5) = 3
+ elem_list2(6) = 3
+ elem_list2(7) = 3
+
+ side_list2(1) = 5
+ side_list2(2) = 3
+ side_list2(3) = 3
+ side_list2(4) = 2
+ side_list2(5) = 4
+ side_list2(6) = 1
+ side_list2(7) = 6
+
+ call expsp (exoid2, 32, 7, 0, ierr)
+ write (iout, '("after expsp (2), error = ", i4)' ) ierr
+
+ call expss (exoid2, 32, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (2), error = ", i4)' ) ierr
+
+c side set #4 - tetras
+
+ elem_list2(1) = 4
+ elem_list2(2) = 4
+ elem_list2(3) = 4
+ elem_list2(4) = 4
+
+ side_list2(1) = 1
+ side_list2(2) = 2
+ side_list2(3) = 3
+ side_list2(4) = 4
+
+ call expsp (exoid2, 33, 4, 0, ierr)
+ write (iout, '("after expsp (2), error = ", i4)' ) ierr
+
+ call expss (exoid2, 33, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (2), error = ", i4)' ) ierr
+
+c side set #5 - wedges
+
+ elem_list2(1) = 5
+ elem_list2(2) = 5
+ elem_list2(3) = 5
+ elem_list2(4) = 5
+ elem_list2(5) = 5
+
+ side_list2(1) = 1
+ side_list2(2) = 2
+ side_list2(3) = 3
+ side_list2(4) = 4
+ side_list2(5) = 5
+
+ call expsp (exoid2, 34, 5, 0, ierr)
+ write (iout, '("after expsp (2), error = ", i4)' ) ierr
+
+ call expss (exoid2, 34, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (2), error = ", i4)' ) ierr
+
+c
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+ ids(1) = 30
+ ids(2) = 31
+ ids(3) = 32
+ ids(4) = 33
+ ids(5) = 34
+
+c side set #1
+ node_list(1) = 8
+ node_list(2) = 5
+ node_list(3) = 6
+ node_list(4) = 7
+
+c side set #2
+ node_list(5) = 2
+ node_list(6) = 3
+ node_list(7) = 7
+ node_list(8) = 8
+
+c side set #3
+ node_list(9) = 9
+ node_list(10) = 12
+ node_list(11) = 11
+ node_list(12) = 10
+
+ node_list(13) = 11
+ node_list(14) = 12
+ node_list(15) = 16
+ node_list(16) = 15
+
+ node_list(17) = 16
+ node_list(18) = 15
+ node_list(19) = 11
+ node_list(20) = 12
+
+ node_list(21) = 10
+ node_list(22) = 11
+ node_list(23) = 15
+ node_list(24) = 14
+
+ node_list(25) = 13
+ node_list(26) = 16
+ node_list(27) = 12
+ node_list(28) = 9
+
+ node_list(29) = 14
+ node_list(30) = 13
+ node_list(31) = 9
+ node_list(32) = 10
+
+ node_list(33) = 16
+ node_list(34) = 13
+ node_list(35) = 14
+ node_list(36) = 15
+
+c side set #4
+ node_list(37) = 17
+ node_list(38) = 18
+ node_list(39) = 20
+
+ node_list(40) = 18
+ node_list(41) = 19
+ node_list(42) = 20
+
+ node_list(43) = 20
+ node_list(44) = 19
+ node_list(45) = 17
+
+ node_list(46) = 19
+ node_list(47) = 18
+ node_list(48) = 17
+
+c side set #5
+ node_list(49) = 25
+ node_list(50) = 24
+ node_list(51) = 21
+ node_list(52) = 22
+
+ node_list(53) = 26
+ node_list(54) = 25
+ node_list(55) = 22
+ node_list(56) = 23
+
+ node_list(57) = 26
+ node_list(58) = 23
+ node_list(59) = 21
+ node_list(60) = 24
+
+ node_list(61) = 23
+ node_list(62) = 22
+ node_list(63) = 21
+
+ node_list(64) = 24
+ node_list(65) = 25
+ node_list(66) = 26
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+ num_elem_per_set(3) = 7
+ num_elem_per_set(4) = 4
+ num_elem_per_set(5) = 5
+
+ num_nodes_per_set(1) = 4
+ num_nodes_per_set(2) = 4
+ num_nodes_per_set(3) = 28
+ num_nodes_per_set(4) = 12
+ num_nodes_per_set(5) = 20
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+ elem_ind(3) = 5
+ elem_ind(4) = 12
+ elem_ind(5) = 16
+
+ node_ind(1) = 1
+ node_ind(2) = 5
+ node_ind(3) = 9
+ node_ind(4) = 37
+ node_ind(5) = 48
+
+ elem_list(1) = 3
+ elem_list(2) = 3
+ elem_list(3) = 1
+ elem_list(4) = 3
+ elem_list(5) = 4
+ elem_list(6) = 4
+ elem_list(7) = 4
+ elem_list(8) = 4
+ elem_list(9) = 4
+ elem_list(10) = 4
+ elem_list(11) = 4
+ elem_list(12) = 5
+ elem_list(13) = 5
+ elem_list(14) = 5
+ elem_list(15) = 5
+ elem_list(16) = 6
+ elem_list(17) = 6
+ elem_list(18) = 6
+ elem_list(19) = 6
+ elem_list(20) = 6
+
+c side_list(1) = 1
+c side_list(2) = 2
+c side_list(3) = 3
+c side_list(4) = 4
+
+
+c call excn2s(exoid, num_elem_per_set, num_nodes_per_set, elem_ind,
+c 1 node_ind, elem_list, node_list, side_list, ierr)
+c write (iout, '("after excn2s, error = ", i4)' ) ierr
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+ num_df_per_set(3) = 0
+ num_df_per_set(4) = 0
+ num_df_per_set(5) = 0
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+c call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss, error = ", i4)' ) ierr
+
+c call expcss (exoid2, ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss (2), error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+
+ prop_names(1) = "COLOR"
+ call expp(exoid2, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+
+ call expp(exoid2, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp (2), error = ", i4)' ) ierr
+
+
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "TESTWT2 fortran version"
+ qa_record(2,1) = "testwt2"
+ 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
+
+ num_qa_rec2 = 2
+
+ qa_record2(1,1) = "TESTWT2 fortran version"
+ qa_record2(2,1) = "testwt2"
+ qa_record2(3,1) = "07/07/93"
+ qa_record2(4,1) = "15:41:33"
+ qa_record2(1,2) = "FASTQ"
+ qa_record2(2,2) = "fastq"
+ qa_record2(3,2) = "07/07/93"
+ qa_record2(4,2) = "16:41:33"
+
+ call expqa (exoid2, num_qa_rec2, qa_record2, ierr)
+ write (iout, '("after expqa (2), error = ", i4)' ) ierr
+
+
+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
+
+ num_info2 = 3
+
+ inform2(1) = "This is the first information record."
+ inform2(2) = "This is the second information record."
+ inform2(3) = "This is the third information record."
+
+ call expinf (exoid2, num_info2, inform2, ierr)
+ write (iout, '("after expinf (2), error = ", i4)' ) ierr
+
+
+c write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_glo_vars2 = 1
+
+ var_names2(1) = "glo_vars"
+
+ call expvp (exoid2, "g", num_glo_vars2, ierr)
+ write (iout, '("after expvp (2), error = ", i4)' ) ierr
+ call expvan (exoid2, "g", num_glo_vars2, var_names2, ierr)
+ write (iout, '("after expvan (2), error = ", i4)' ) ierr
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_nod_vars2 = 2
+
+ var_names2(1) = "nod_var0"
+ var_names2(2) = "nod_var1"
+
+ call expvp (exoid2, "n", num_nod_vars2, ierr)
+ write (iout, '("after expvp (2), error = ", i4)' ) ierr
+ call expvan (exoid2, "n", num_nod_vars2, var_names2, ierr)
+ write (iout, '("after expvan (2), error = ", i4)' ) ierr
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_ele_vars2 = 3
+
+ var_names2(1) = "ele_var0"
+ var_names2(2) = "ele_var1"
+ var_names2(3) = "ele_var2"
+
+ call expvp (exoid2, "e", num_ele_vars2, ierr)
+ write (iout, '("after expvp (2), error = ", i4)' ) ierr
+ call expvan (exoid2, "e", num_ele_vars2, var_names2, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ call exgebi (exoid, ebids, ierr)
+ write (iout, '("after exgebi, error = ", i4)' ) ierr
+ call exgebi (exoid2, ebids2, ierr)
+ write (iout, '("after exgebi (2), error = ", i4)' ) ierr
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+ call expvtt (exoid2, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = real(i)/100
+ time_value2 = real(i)/100
+c
+c write time value to regular file
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+
+ call exptim (exoid2, whole_time_step, time_value2, ierr)
+ write (iout, '("after exptim (2), error = ", i4)' ) ierr
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+
+ call expgv (exoid2, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv (2), error = ", i4)' ) ierr
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+
+ call expnv (exoid2, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv (2), error = ", i4)' ) ierr
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+ call expev (exoid2, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev (2), error = ", i4)' ) ierr
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+ call exupda (exoid2, ierr)
+ write (iout, '("after exupda (2), error = ", i4)' ) ierr
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ call exclos (exoid2, ierr)
+ write (iout, '("after exclos (2), error = ", i4)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testwt3.f b/forbind/test/testwt3.f
new file mode 100644
index 0000000..0e052aa
--- /dev/null
+++ b/forbind/test/testwt3.f
@@ -0,0 +1,594 @@
+ program testwt3
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines. This test writes GENISIS (geometry)
+c data to the history file.
+c
+c 08/10/93 V.R. Yarberry - Updated for use with 2.01 API
+
+ include 'exodus_app.inc'
+
+ integer iin, iout
+ integer exoid, exoidh, num_dim, num_nodes, num_elem, num_elem_blk
+ integer num_elem_in_block(2), num_node_sets
+ integer num_side_sets, error
+ integer i, j, k, m, elem_map(2), connect(4)
+ integer node_list(10), elem_list(10)
+ integer ebids(2),ids(2), num_nodes_per_set(2), num_elem_per_set(1)
+ integer node_ind(2), elem_ind(1), num_qa_rec, num_info
+ integer num_his_vars, num_glo_vars, num_nod_vars, num_ele_vars
+ integer truth_tab(3,2)
+ integer hist_time_step, whole_time_step, num_time_steps
+ integer cpu_word_size, io_word_size
+
+ real hist_var_vals(10), glob_var_vals(10), nodal_var_vals(8)
+ real time_value, elem_var_vals(20)
+ real x(8), y(8), dummy(1)
+ real attrib(1), dist_fact(8)
+
+ character*(MXLNLN) title
+ character*(MXSTLN) coord_names(3)
+ character*(MXSTLN) cname
+ character*(MXSTLN) var_names(3)
+ character*(MXSTLN) qa_record(4,2)
+ character*(MXLNLN) inform(3)
+
+ logical whole
+
+ data iin /5/, iout /6/
+
+c
+c create EXODUS II files
+c
+ cpu_word_size = 4
+ io_word_size = 4
+c
+c first create a "regular" file that contains everything except
+c history variable info
+c
+ exoid = excre ("test.exo",
+ 1 "r", EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.exo, id: ", i3)') exoid
+ write (iout,'("after excre, error = ", i3)') ierr
+
+c
+c create a "history" file if you will output history variables
+c
+ exoidh = excre ("testh.exo",
+ 1 "h", EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for testh.exo, id: ", i3)') exoidh
+ write (iout,'("after excre, error = ", i3)') ierr
+
+c
+c initialize file with parameters
+c
+
+ title = "This is test 3 - genisis data in history file"
+ num_dim = 2
+ num_nodes = 8
+ num_elem = 2
+ num_elem_blk = 2
+ num_node_sets = 2
+ num_side_sets = 1
+
+ call expini (exoid, title, num_dim, num_nodes,
+ 1 num_elem, num_elem_blk, num_node_sets,
+ 2 num_side_sets, ierr)
+
+ write (iout, '("after expini, error = ", i3)' ) ierr
+
+ call expini (exoidh, title, num_dim, num_nodes,
+ 1 num_elem, num_elem_blk, num_node_sets,
+ 2 num_side_sets, ierr)
+
+ write (iout, '("after expini (h), error = ", i3)' ) ierr
+
+c
+c write nodal coordinates values and names to database
+c
+
+ x(1) = 0.0
+ x(2) = 1.0
+ x(3) = 1.0
+ x(4) = 0.0
+ x(5) = 1.0
+ x(6) = 2.0
+ x(7) = 2.0
+ x(8) = 1.0
+ y(1) = 0.0
+ y(2) = 0.0
+ y(3) = 1.0
+ y(4) = 1.0
+ y(5) = 0.0
+ y(6) = 0.0
+ y(7) = 1.0
+ y(8) = 1.0
+
+ call expcor (exoid, x, y, dummy, ierr)
+ write (iout, '("after expcor, error = ", i3)' ) ierr
+
+ call expcor (exoidh, x, y, dummy, ierr)
+ write (iout, '("after expcor (h), error = ", i3)' ) ierr
+
+ coord_names(1) = "xcoorjun"
+ coord_names(2) = "ycoorjun"
+
+ call expcon (exoid, coord_names, ierr)
+ write (iout, '("after expcon, error = ", i3)' ) ierr
+
+ call expcon (exoidh, coord_names, ierr)
+ write (iout, '("after expcon (h), error = ", i3)' ) ierr
+
+
+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 = ", i3)' ) ierr
+
+ call expmap (exoidh, elem_map, ierr)
+ write (iout, '("after expmap (h), error = ", i3)' ) ierr
+
+c
+c write element block parameters
+c
+
+ num_elem_in_block(1) = 1
+ num_elem_in_block(2) = 1
+
+ ebids(1) = 10
+ ebids(2) = 11
+
+ cname = "quadjunk"
+
+ call expelb (exoid, ebids(1), cname, num_elem_in_block(1),
+ 1 4,1,ierr)
+ write (iout, '("after expelb, error = ", i3)' ) ierr
+
+ call expelb (exoid, ebids(2), cname, num_elem_in_block(2),
+ 1 4,1,ierr)
+ write (iout, '("after expelb, error = ", i3)' ) ierr
+
+ call expelb (exoidh, ebids(1), cname, num_elem_in_block(1),
+ 1 4,1,ierr)
+ write (iout, '("after expelb (h), error = ", i3)' ) ierr
+
+ call expelb (exoidh, ebids(2), cname, num_elem_in_block(2),
+ 1 4,1,ierr)
+ write (iout, '("after expelbi(h), error = ", i3)' ) ierr
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i3)' ) ierr
+
+ call expelc (exoidh, ebids(1), connect, ierr)
+ write (iout, '("after expelci (h), error = ", i3)' ) ierr
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i3)' ) ierr
+
+ call expelc (exoidh, ebids(2), connect, ierr)
+ write (iout, '("after expelc (h), error = ", i3)' ) ierr
+
+c
+c write element block attributes
+c
+
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i3)' ) ierr
+
+ call expeat (exoidh, ebids(1), attrib, ierr)
+ write (iout, '("after expeat (h), error = ", i3)' ) ierr
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i3)' ) ierr
+
+ call expeat (exoidh, ebids(2), attrib, ierr)
+ write (iout, '("after expeat (h), error = ", i3)' ) ierr
+
+c
+c write individual node sets
+c
+
+ call expnp (exoid, 20, 5, ierr)
+ write (iout, '("after expnp, error = ", i3)' ) ierr
+
+ call expnp (exoidh, 20, 5, ierr)
+ write (iout, '("after expnp (h), error = ", i3)' ) ierr
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+ call expns (exoid, 20, node_list, dist_fact, ierr)
+ write (iout, '("after expns, error = ", i3)' ) ierr
+
+ call expns (exoidh, 20, node_list, dist_fact, ierr)
+ write (iout, '("after expns (h), error = ", i3)' ) ierr
+
+ call expnp (exoid, 21, 3, ierr)
+ write (iout, '("after expnp, error = ", i3)' ) ierr
+
+ call expnp (exoidh, 21, 3, ierr)
+ write (iout, '("after expnp (h), error = ", i3)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+ call expns (exoid, 21, node_list, dist_fact, ierr)
+ write (iout, '("after expns, error = ", i3)' ) ierr
+
+ call expns (exoidh, 21, node_list, dist_fact, ierr)
+ write (iout, '("after expns (h), error = ", i3)' ) ierr
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+c ids(1) = 20
+c ids(2) = 21
+
+c num_nodes_per_set(1) = 5
+c num_nodes_per_set(2) = 3
+
+c node_ind(1) = 1
+c node_ind(2) = 6
+
+c node_list(1) = 100
+c node_list(2) = 101
+c node_list(3) = 102
+c node_list(4) = 103
+c node_list(5) = 104
+c node_list(6) = 200
+c node_list(7) = 201
+c node_list(8) = 202
+
+c dist_fact(1) = 1.0
+c dist_fact(2) = 2.0
+c dist_fact(3) = 3.0
+c dist_fact(4) = 4.0
+c dist_fact(5) = 5.0
+c dist_fact(6) = 1.1
+c dist_fact(7) = 2.1
+c dist_fact(8) = 3.1
+
+c call expcns (exoid, ids, num_nodes_per_set, node_ind, node_list,
+c 1 dist_fact, ierr)
+c write (iout, '("after expcns, error = ", i3)' ) ierr
+
+c
+c write individual side sets
+c
+
+ call expsp (exoid, 30, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i3)' ) ierr
+
+ call expsp (exoidh, 30, 2, 4, ierr)
+ write (iout, '("after expsp (h), error = ", i3)' ) ierr
+
+ elem_list(1) = 1
+ elem_list(2) = 2
+
+ node_list(1) = 1
+ node_list(2) = 2
+ node_list(3) = 3
+ node_list(4) = 4
+
+ dist_fact(1) = 0.0
+ dist_fact(2) = 0.0
+ dist_fact(3) = 0.0
+ dist_fact(4) = 0.0
+
+ call expss (exoid, 30, elem_list, node_list, ierr)
+ write (iout, '("after expss, error = ", i3)' ) ierr
+
+ call expssd (exoid, 30, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i3)' ) ierr
+
+ call expss (exoidh, 30, elem_list, node_list, ierr)
+ write (iout, '("after expss (h), error = ", i3)' ) ierr
+
+ call expssd (exoidh, 30, dist_fact, ierr)
+ write (iout, '("after expssd (h), error = ", i3)' ) ierr
+
+c
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+c ids(1) = 30
+
+c num_elem_per_set(1) = 2
+
+c num_nodes_per_set(1) = 4
+
+c elem_ind(1) = 1
+
+c node_ind(1) = 1
+
+c elem_list(1) = 1
+c elem_list(2) = 2
+
+c node_list(1) = 1
+c node_list(2) = 2
+c node_list(3) = 3
+c node_list(4) = 4
+
+c dist_fact(1) = 0.0
+c dist_fact(2) = 0.0
+c dist_fact(3) = 0.0
+c dist_fact(4) = 0.0
+
+c call expcss (exoid, ids, num_elem_per_set, num_nodes_per_set,
+c 1 elem_ind, node_ind, elem_list, node_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss, error = ", i3)' ) ierr
+
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "PRONTO2D"
+ qa_record(2,1) = "pronto2d"
+ qa_record(3,1) = "3/10/92"
+ qa_record(4,1) = "15:41:33"
+ qa_record(1,2) = "FASTQ"
+ qa_record(2,2) = "fastq"
+ qa_record(3,2) = "2/10/92"
+ qa_record(4,2) = "11:41:33"
+
+ call expqa (exoid, num_qa_rec, qa_record, ierr)
+ write (iout, '("after expqa, error = ", i3)' ) ierr
+
+ call expqa (exoidh, num_qa_rec, qa_record, ierr)
+ write (iout, '("after expqa (h), error = ", i3)' ) ierr
+
+
+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 = ", i3)' ) ierr
+
+ call expinf (exoidh, num_info, inform, ierr)
+ write (iout, '("after expinf (h), error = ", i3)' ) ierr
+
+
+c write results variables parameters and names
+
+ num_his_vars = 1
+
+ var_names(1) = "his_vars"
+
+ call expvp (exoidh, "h", num_his_vars, ierr)
+ write (iout, '("after expvp, error = ", i3)' ) ierr
+ call expvan (exoidh, "h", num_his_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i3)' ) ierr
+
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i3)' ) ierr
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i3)' ) ierr
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i3)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i3)' ) ierr
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i3)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i3)' ) ierr
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ call exgebi (exoid, ebids, ierr)
+ write (iout, '("after exgebi, error = ", i3)' ) ierr
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ebids,
+ & ierr)
+ write (iout, '("after expvtt, error = ", i3)' ) ierr
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays hist_var_vals, glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole = .true.
+ hist_time_step = 1
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = real(i)/100
+
+c
+c if history time step
+c
+
+c
+c write time value to history file
+c
+
+ call exptim (exoidh, hist_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i3)' ) ierr
+
+c
+c write history variables to history file
+c
+
+ do 40 j = 1, num_his_vars
+ hist_var_vals(j) = real(j+1) * time_value
+40 continue
+
+ call exphv (exoidh, hist_time_step, num_his_vars,
+ 1 hist_var_vals, ierr)
+ write (iout, '("after exphv, error = ", i3)' ) ierr
+
+ hist_time_step = hist_time_step + 1
+c
+c update the history file
+c
+
+ call exupda (exoidh, ierr)
+ write (iout, '("after exupda, error = ", i3)' ) ierr
+
+c
+c if whole time step
+c
+
+ if (whole) then
+
+c
+c write time value to regular file
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i3)' ) ierr
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i3)' ) ierr
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i3)' ) ierr
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i3)' ) ierr
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i3)' ) ierr
+
+ endif
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i3)' ) ierr
+
+ call exclos (exoidh, ierr)
+ write (iout, '("after exclos, error = ", i3)' ) ierr
+
+ stop
+ end
+
diff --git a/forbind/test/testwtd.f b/forbind/test/testwtd.f
new file mode 100644
index 0000000..1e71c86
--- /dev/null
+++ b/forbind/test/testwtd.f
@@ -0,0 +1,539 @@
+ program testwtd
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines using double precision reals.
+c
+
+c history -
+c Original L.A. Schoof
+c 02/25/93 V.R. Yarberry - Added error checks for file creation.
+c 03/04/93 V.R. Yarberry - Fixed bug in expvtt test, ebids was not passed
+c 08/31/93 VRY - updated to match API version 2.00
+c
+ include 'exodusII.inc'
+
+ integer iin, iout
+ integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
+ integer num_elem_in_block(2), num_node_sets
+ integer num_side_sets
+ integer i, j, k, m, elem_map(2), connect(4)
+ integer node_list(10), elem_list(10), side_list(10)
+ integer ebids(2),ids(2), num_nodes_per_set(2), num_elem_per_set(2)
+ integer num_df_per_set(2)
+ integer df_ind(2), node_ind(2), elem_ind(2), num_qa_rec, num_info
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer truth_tab(3,2)
+ integer whole_time_step, num_time_steps
+ integer cpu_word_size, io_word_size
+ integer prop_array(2)
+
+ real*8 glob_var_vals(10), nodal_var_vals(8)
+ real*8 time_value, elem_var_vals(20)
+ real*8 x(8), y(8), dummy(1)
+ real*8 attrib(1), dist_fact(8)
+
+ 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)
+
+ logical whole
+
+ data iin /5/, iout /6/
+
+ cpu_word_size = 8
+ io_word_size = 8
+c
+c create EXODUS II files
+c
+ exoid = excre ("test.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.exo,id: ",i4,", err=",i3)')
+ 1 exoid, ierr
+ 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 = 2
+ num_nodes = 8
+ num_elem = 2
+ num_elem_blk = 2
+ num_node_sets = 2
+ num_side_sets = 2
+
+ 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
+
+c
+c write nodal coordinates values and names to database
+c
+
+ x(1) = 0.0
+ x(2) = 1.0
+ x(3) = 1.0
+ x(4) = 0.0
+ x(5) = 1.0
+ x(6) = 2.0
+ x(7) = 2.0
+ x(8) = 1.0
+ y(1) = 0.0
+ y(2) = 0.0
+ y(3) = 1.0
+ y(4) = 1.0
+ y(5) = 0.0
+ y(6) = 0.0
+ y(7) = 1.0
+ y(8) = 1.0
+
+ call expcor (exoid, x, y, dummy, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+
+ coord_names(1) = "xcoor"
+ coord_names(2) = "ycoor"
+
+ call expcon (exoid, coord_names, ierr)
+ write (iout, '("after expcon, error = ", i4)' ) ierr
+
+
+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
+
+c
+c write element block parameters
+c
+
+ num_elem_in_block(1) = 1
+ num_elem_in_block(2) = 1
+
+ ebids(1) = 10
+ ebids(2) = 11
+
+ cname = "quad"
+
+ call expelb (exoid,ebids(1),cname,num_elem_in_block(1),4,1,ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),4,1,ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+c
+c write element block attributes
+c
+
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+c
+c write individual node sets
+c
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+c call expnp (exoid, 20, 5, 5, ierr)
+c write (iout, '("after expnp, error = ", i4)' ) ierr
+c call expns (exoid, 20, node_list, ierr)
+c write (iout, '("after expns, error = ", i4)' ) ierr
+c call expnsd (exoid, 20, dist_fact, ierr)
+c write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+c call expnp (exoid, 21, 3, 3, ierr)
+c write (iout, '("after expnp, error = ", i4)' ) ierr
+c call expns (exoid, 21, node_list, ierr)
+c write (iout, '("after expns, error = ", i4)' ) ierr
+c call expnsd (exoid, 21, dist_fact, ierr)
+c write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ num_df_per_set(1) = 5
+ num_df_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ df_ind(1) = 1
+ df_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+ call expcns (exoid, ids, num_nodes_per_set, num_df_per_set,
+ 1 node_ind, df_ind, node_list, dist_fact, ierr)
+ write (iout, '("after expcns, error = ", i4)' ) ierr
+
+c write node set properties
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+
+c
+c write individual side sets
+c
+
+ elem_list(1) = 11
+ elem_list(2) = 12
+
+ side_list(1) = 1
+ side_list(2) = 2
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+c call expsp (exoid, 30, 2, 4, ierr)
+c write (iout, '("after expsp, error = ", i4)' ) ierr
+
+c call expss (exoid, 30, elem_list, side_list, ierr)
+c write (iout, '("after expss, error = ", i4)' ) ierr
+
+c call expssd (exoid, 30, dist_fact, ierr)
+c write (iout, '("after expssd, error = ", i4)' ) ierr
+
+ elem_list(1) = 13
+ elem_list(2) = 14
+
+ side_list(1) = 3
+ side_list(2) = 4
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+c call expsp (exoid, 31, 2, 4, ierr)
+c write (iout, '("after expsp, error = ", i4)' ) ierr
+
+c call expss (exoid, 31, elem_list, side_list, ierr)
+c write (iout, '("after expss, error = ", i4)' ) ierr
+
+c call expssd (exoid, 31, dist_fact, ierr)
+c write (iout, '("after expssd, error = ", i4)' ) ierr
+
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+ ids(1) = 30
+ ids(2) = 31
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+
+ elem_list(1) = 11
+ elem_list(2) = 12
+ elem_list(3) = 13
+ elem_list(4) = 14
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+ call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+ 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+ 2 ierr)
+ write (iout, '("after expcss, error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+c
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "TESTWTD fortran version"
+ qa_record(2,1) = "testwtd"
+ 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
+
+
+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
+
+
+c write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays hist_var_vals, glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole = .true.
+ hist_time_step = 1
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 i = 1, num_time_steps
+ time_value = dble(i)/100
+c
+c write time value
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+c write(iout,*)'elem_var_val(',m,'): ',elem_var_vals(m)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ stop
+ end
diff --git a/forbind/test/testwtm.f b/forbind/test/testwtm.f
new file mode 100644
index 0000000..e59ad31
--- /dev/null
+++ b/forbind/test/testwtm.f
@@ -0,0 +1,946 @@
+ program testwtm
+c
+c This is a test program for the Fortran binding of the EXODUS II
+c database write routines. It tests multiple simultaneous output files.
+c
+c 09/07/93 V.R. Yarberry - Revised for 2.00 API
+
+ include 'exodusII.inc'
+
+ integer iin, iout
+ integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
+ integer exoidm(10),num_dim2,num_nodes2,num_elem2,num_elem_blk2
+ integer num_elem_in_block(2), num_node_sets
+ integer num_elem_in_block2(2), num_node_sets2
+ integer num_side_sets
+ integer num_side_sets2
+ integer nexofiles
+ integer i, j, k, m, elem_map(2), connect(4)
+ integer elem_map2(2), connect2(4)
+ integer node_list(10), elem_list(10), side_list(10)
+ integer node_list2(10), elem_list2(10), side_list2(10)
+ integer ebids(2),ids(2), num_nodes_per_set(2), num_elem_per_set(2)
+ integer ebids2(2)
+ integer num_df_per_set(2)
+ integer df_ind(2), node_ind(2), elem_ind(2), num_qa_rec, num_info
+ integer num_qa_rec2,num_info2
+ integer num_glo_vars, num_nod_vars, num_ele_vars
+ integer num_glo_vars2, num_nod_vars2, num_ele_vars2
+ integer truth_tab(3,2)
+ integer whole_time_step, num_time_steps
+ integer cpu_word_size, io_word_size
+ integer prop_array(2)
+
+ real glob_var_vals(10), nodal_var_vals(8)
+ real time_value, elem_var_vals(20)
+ real time_value2
+ real x(8), y(8), dummy(1)
+ real x2(8), y2(8)
+ real attrib(1), dist_fact(8)
+ real attrib2(1), dist_fact2(8)
+
+ character*(MXLNLN) title
+ character*(MXLNLN) title2
+ character*(MXSTLN) coord_names(3)
+ character*(MXSTLN) coord_names2(3)
+ character*(MXSTLN) cname
+ character*(MXSTLN) cname2
+ character*(MXSTLN) var_names(3)
+ character*(MXSTLN) var_names2(3)
+ character*(MXSTLN) qa_record(4,2)
+ character*(MXSTLN) qa_record2(4,2)
+ character*(MXLNLN) inform(3)
+ character*(MXLNLN) inform2(3)
+ character*(MXSTLN) prop_names(2)
+ character*(MXSTLN) exofname
+
+ data iin /5/, iout /6/, nexofiles /5/
+
+c
+c create EXODUS II files
+c
+ cpu_word_size = 0
+ io_word_size = 4
+c
+ exoid = excre ("test.exo",
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,'("after excre for test.exo,id: ",i4,", err=",i3)')
+ 1 exoid, ierr
+ write (iout,'(" cpu word size: ",i4," io word size: ",i4)')
+ 1 cpu_word_size, io_word_size
+ write (iout, '("after excre, error = ", i4)' ) ierr
+
+ do 1000 i=1,nexofiles
+ write(exofname,'("test",i1,".exo")')i
+ exoidm(i)= excre (exofname,
+ 1 EXCLOB, cpu_word_size, io_word_size, ierr)
+ write (iout,
+ 1 '("after excre for test",i1,".exo,id: ",i4,", err=",i3)')
+ 2 i, exoidm(i), ierr
+ write (iout, '("after excre (",i1,"), error = ", i4)' )
+ 1 i, ierr
+1000 continue
+
+c
+c initialize file with parameters
+c
+
+ title = "This is test m"
+ num_dim = 2
+ num_nodes = 8
+ num_elem = 2
+ num_elem_blk = 2
+ num_node_sets = 2
+ num_side_sets = 2
+
+ call expini (exoid, title, 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
+
+ title2 = "This is test m"
+ num_dim2 = 2
+ num_nodes2 = 8
+ num_elem2 = 2
+ num_elem_blk2 = 2
+ num_node_sets2 = 2
+ num_side_sets2 = 2
+
+ do 1001 i=1,nexofiles
+ call expini (exoidm(i), title2, num_dim2, num_nodes2,
+ 1 num_elem2, num_elem_blk2, num_node_sets2,
+ 2 num_side_sets2, ierr)
+
+ write (iout, '("after expini (",i1,"), error = ", i4)' )
+ 1 i, ierr
+1001 continue
+
+
+c
+c write nodal coordinates values and names to database
+c
+
+ x(1) = 0.0
+ x(2) = 1.0
+ x(3) = 1.0
+ x(4) = 0.0
+ x(5) = 1.0
+ x(6) = 2.0
+ x(7) = 2.0
+ x(8) = 1.0
+ y(1) = 0.0
+ y(2) = 0.0
+ y(3) = 1.0
+ y(4) = 1.0
+ y(5) = 0.0
+ y(6) = 0.0
+ y(7) = 1.0
+ y(8) = 1.0
+
+ call expcor (exoid, x, y, dummy, ierr)
+ write (iout, '("after expcor, error = ", i4)' ) ierr
+
+ x2(1) = 0.0
+ x2(2) = 1.0
+ x2(3) = 1.0
+ x2(4) = 0.0
+ x2(5) = 1.0
+ x2(6) = 2.0
+ x2(7) = 2.0
+ x2(8) = 1.0
+ y2(1) = 0.0
+ y2(2) = 0.0
+ y2(3) = 1.0
+ y2(4) = 1.0
+ y2(5) = 0.0
+ y2(6) = 0.0
+ y2(7) = 1.0
+ y2(8) = 1.0
+
+ do 1002 i=1,nexofiles
+ call expcor (exoidm(i), x2, y2, dummy, ierr)
+ write (iout, '("after expcor (",i1,"), error = ", i4)')
+ 1 i, ierr
+1002 continue
+
+ coord_names(1) = "xcoor"
+ coord_names(2) = "ycoor"
+
+ call expcon (exoid, coord_names, ierr)
+ write (iout, '("after expcon, error = ", i4)' ) ierr
+
+ coord_names2(1) = "xcoor"
+ coord_names2(2) = "ycoor"
+
+ do 1003 i=1,nexofiles
+ call expcon (exoidm(i), coord_names2, ierr)
+ write (iout, '("after expcon (",i1,"), error = ", i4)')
+ 1 i, ierr
+1003 continue
+
+
+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
+
+ do 12 i = 1, num_elem2
+ elem_map2(i) = i
+12 continue
+
+ do 1004 i=1,nexofiles
+ call expmap (exoidm(i), elem_map2, ierr)
+ write (iout, '("after expmap (",i1,"), error = ", i4)')
+ 1 i, ierr
+1004 continue
+
+c
+c write element block parameters
+c
+
+ num_elem_in_block(1) = 1
+ num_elem_in_block(2) = 1
+
+ ebids(1) = 10
+ ebids(2) = 11
+
+ cname = "quad"
+
+ call expelb (exoid,ebids(1),cname,num_elem_in_block(1)
+ 1 ,4,1,ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ call expelb (exoid,ebids(2),cname,num_elem_in_block(2),
+ 1 4,1,ierr)
+ write (iout, '("after expelb, error = ", i4)' ) ierr
+
+ num_elem_in_block2(1) = 1
+ num_elem_in_block2(2) = 1
+
+ ebids2(1) = 10
+ ebids2(2) = 11
+
+ cname2 = "quad2"
+
+ do 1005 i=1,nexofiles
+ call expelb(exoidm(i),ebids2(1),cname2,num_elem_in_block2(1),
+ 1 4,1,ierr)
+ write (iout, '("after expelb (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expelb(exoidm(i),ebids2(2),cname2,num_elem_in_block2(2),
+ 1 4,1,ierr)
+ write (iout, '("after expelb (",i1,"), error = ", i4)')
+ 1 i, ierr
+1005 continue
+
+c write element block properties
+
+ prop_names(1) = "MATL"
+ prop_names(2) = "DENSITY"
+ call exppn(exoid,EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn, error = ", i4)' ) ierr
+
+ call expp(exoid, EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+ call expp(exoid, EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ do 1006 i=1,nexofiles
+ call exppn(exoidm(i),EXEBLK,2,prop_names,ierr)
+ write (iout, '("after exppn (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expp(exoidm(i), EXEBLK, ebids(1), "MATL", 10, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expp(exoidm(i), EXEBLK, ebids(2), "MATL", 20, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+1006 continue
+
+c
+c write element connectivity
+c
+
+ connect(1) = 1
+ connect(2) = 2
+ connect(3) = 3
+ connect(4) = 4
+
+ call expelc (exoid, ebids(1), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect(1) = 5
+ connect(2) = 6
+ connect(3) = 7
+ connect(4) = 8
+
+ call expelc (exoid, ebids(2), connect, ierr)
+ write (iout, '("after expelc, error = ", i4)' ) ierr
+
+ connect2(1) = 1
+ connect2(2) = 2
+ connect2(3) = 3
+ connect2(4) = 4
+
+ do 1007 i=1,nexofiles
+ call expelc (exoidm(i), ebids2(1), connect2, ierr)
+ write (iout, '("after expelc (",i1,"), error = ", i4)')
+ 1 i, ierr
+1007 continue
+
+ connect2(1) = 5
+ connect2(2) = 6
+ connect2(3) = 7
+ connect2(4) = 8
+
+ do 1008 i=1,nexofiles
+ call expelc (exoidm(i), ebids2(2), connect2, ierr)
+ write (iout, '("after expelc (",i1,"), error = ", i4)')
+ 1 i, ierr
+1008 continue
+
+c
+c write element block attributes
+c
+
+ attrib(1) = 3.14159
+ call expeat (exoid, ebids(1), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib(1) = 6.14159
+ call expeat (exoid, ebids(2), attrib, ierr)
+ write (iout, '("after expeat, error = ", i4)' ) ierr
+
+ attrib2(1) = 3.
+ do 1009 i=1,nexofiles
+ call expeat (exoidm(i), ebids2(1), attrib2, ierr)
+ write (iout, '("after expeat (",i1,"), error = ", i4)')
+ 1 i, ierr
+1009 continue
+
+ attrib2(1) = 6.
+ do 1010 i=1,nexofiles
+ call expeat (exoidm(i), ebids2(2), attrib2, ierr)
+ write (iout, '("after expeat (",i1,"), error = ", i4)')
+ 1 i, ierr
+1010 continue
+
+c
+c write individual node sets
+c
+
+ call expnp (exoid, 20, 5, 5, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+
+ call expns (exoid, 20, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 20, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ call expnp (exoid, 21, 3, 3, ierr)
+ write (iout, '("after expnp, error = ", i4)' ) ierr
+
+ node_list(1) = 200
+ node_list(2) = 201
+ node_list(3) = 202
+
+ dist_fact(1) = 1.1
+ dist_fact(2) = 2.1
+ dist_fact(3) = 3.1
+
+ call expns (exoid, 21, node_list, ierr)
+ write (iout, '("after expns, error = ", i4)' ) ierr
+ call expnsd (exoid, 21, dist_fact, ierr)
+ write (iout, '("after expnsd, error = ", i4)' ) ierr
+
+ prop_names(1) = "FACE"
+ call expp(exoid, EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoid, EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa, error = ", i4)' ) ierr
+
+C**** file 2
+
+ node_list2(1) = 2100
+ node_list2(2) = 2101
+ node_list2(3) = 2102
+ node_list2(4) = 2103
+ node_list2(5) = 2104
+
+ dist_fact2(1) = 21.0
+ dist_fact2(2) = 22.0
+ dist_fact2(3) = 23.0
+ dist_fact2(4) = 24.0
+ dist_fact2(5) = 25.0
+
+ do 1011 i=1,nexofiles
+ call expnp (exoidm(i), 20, 5, 5, ierr)
+ write (iout, '("after expnp (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expns (exoidm(i), 20, node_list, ierr)
+ write (iout, '("after expns (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expnsd (exoidm(i), 20, dist_fact, ierr)
+ write (iout, '("after expnsd (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expnp (exoidm(i), 21, 3, 3, ierr)
+ write (iout, '("after expnp (",i1,"), error = ", i4)')
+ 1 i, ierr
+1011 continue
+
+ node_list2(1) = 2200
+ node_list2(2) = 2201
+ node_list2(3) = 2202
+
+ dist_fact2(1) = 21.1
+ dist_fact2(2) = 22.1
+ dist_fact2(3) = 23.1
+
+ do 1012 i=1,nexofiles
+ call expns (exoidm(i), 21, node_list, ierr)
+ write (iout, '("after expns (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expnsd (exoidm(i), 21, dist_fact, ierr)
+ write (iout, '("after expnsd (",i1,"), error = ", i4)')
+ 1 i, ierr
+1012 continue
+
+c
+c write concatenated node sets; this produces the same information as
+c the above code which writes individual node sets
+c
+
+ ids(1) = 20
+ ids(2) = 21
+
+ num_nodes_per_set(1) = 5
+ num_nodes_per_set(2) = 3
+
+ node_ind(1) = 1
+ node_ind(2) = 6
+
+ node_list(1) = 100
+ node_list(2) = 101
+ node_list(3) = 102
+ node_list(4) = 103
+ node_list(5) = 104
+ node_list(6) = 200
+ node_list(7) = 201
+ node_list(8) = 202
+
+ dist_fact(1) = 1.0
+ dist_fact(2) = 2.0
+ dist_fact(3) = 3.0
+ dist_fact(4) = 4.0
+ dist_fact(5) = 5.0
+ dist_fact(6) = 1.1
+ dist_fact(7) = 2.1
+ dist_fact(8) = 3.1
+
+c call expcns (exoid, ids, num_nodes_per_set, node_ind, node_list,
+c 1 dist_fact, ierr)
+c write (iout, '("after expcns, error = ", i4)' ) ierr
+c
+
+ do 1013 i=1,nexofiles
+ prop_names(1) = "FACE"
+ call expp(exoidm(i), EXNSET, 20, prop_names(1), 4, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expp(exoidm(i), EXNSET, 21, prop_names(1), 5, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ prop_array(1) = 1000
+ prop_array(2) = 2000
+
+ prop_names(1) = "VELOCITY"
+ call exppa(exoidm(i), EXNSET, prop_names(1), prop_array, ierr)
+ write (iout, '("after exppa (",i1,"), error = ", i4)')
+ 1 i, ierr
+1013 continue
+
+c write individual side sets
+c
+
+ elem_list(1) = 11
+ elem_list(2) = 12
+
+ node_list(1) = 1
+ node_list(2) = 2
+ node_list(3) = 3
+ node_list(4) = 4
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+
+ call expsp (exoid, 30, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i4)' ) ierr
+
+ call expss (exoid, 30, elem_list, node_list, ierr)
+ write (iout, '("after expss, error = ", i4)' ) ierr
+
+ call expssd (exoid, 30, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i4)' ) ierr
+
+ elem_list(1) = 13
+ elem_list(2) = 14
+
+ side_list(1) = 3
+ side_list(2) = 4
+
+ dist_fact(1) = 31.0
+ dist_fact(2) = 31.1
+ dist_fact(3) = 31.2
+ dist_fact(4) = 31.3
+
+ call expsp (exoid, 31, 2, 4, ierr)
+ write (iout, '("after expsp, error = ", i3)' ) ierr
+
+ call expss (exoid, 31, elem_list, side_list, ierr)
+ write (iout, '("after expss, error = ", i3)' ) ierr
+
+ call expssd (exoid, 31, dist_fact, ierr)
+ write (iout, '("after expssd, error = ", i3)' ) ierr
+
+
+ elem_list2(1) = 11
+ elem_list2(2) = 12
+
+ node_list2(1) = 1
+ node_list2(2) = 2
+ node_list2(3) = 3
+ node_list2(4) = 4
+
+ dist_fact2(1) = 1.1
+ dist_fact2(2) = 2.1
+ dist_fact2(3) = 3.1
+ dist_fact2(4) = 4.1
+
+ do 1014 i=1,nexofiles
+ call expsp (exoidm(i), 30, 2, 4, ierr)
+ write (iout, '("after expsp (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expss (exoidm(i), 30, elem_list2, node_list2, ierr)
+ write (iout, '("after expss (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expssd (exoidm(i), 30, dist_fact2, ierr)
+ write (iout, '("after expssd (",i1,"), error = ", i4)')
+ 1 i, ierr
+1014 continue
+
+ elem_list2(1) = 13
+ elem_list2(2) = 14
+
+ side_list2(1) = 3
+ side_list2(2) = 4
+
+ dist_fact2(1) = 31.0
+ dist_fact2(2) = 31.1
+ dist_fact2(3) = 31.2
+ dist_fact2(4) = 31.3
+
+ do 1015 i=1,nexofiles
+ call expsp (exoidm(i), 31, 2, 4, ierr)
+ write (iout, '("after expsp (",i1,"), error = ", i3)')
+ 1 i, ierr
+
+ call expss (exoidm(i), 31, elem_list2, side_list2, ierr)
+ write (iout, '("after expss (",i1,"), error = ", i3)')
+ 1 i, ierr
+
+ call expssd (exoidm(i), 31, dist_fact2, ierr)
+ write (iout, '("after expssd (",i1,"), error = ", i3)')
+ 1 i, ierr
+1015 continue
+
+c
+c write concatenated side sets; this produces the same information as
+c the above code which writes individual side sets
+c
+
+ ids(1) = 30
+ ids(2) = 31
+
+ num_elem_per_set(1) = 2
+ num_elem_per_set(2) = 2
+
+ num_df_per_set(1) = 4
+ num_df_per_set(2) = 4
+
+ elem_ind(1) = 1
+ elem_ind(2) = 3
+
+ df_ind(1) = 1
+ df_ind(2) = 5
+
+ elem_list(1) = 11
+ elem_list(2) = 12
+ elem_list(3) = 13
+ elem_list(4) = 14
+
+ side_list(1) = 1
+ side_list(2) = 2
+ side_list(3) = 3
+ side_list(4) = 4
+
+ dist_fact(1) = 30.0
+ dist_fact(2) = 30.1
+ dist_fact(3) = 30.2
+ dist_fact(4) = 30.3
+ dist_fact(5) = 31.0
+ dist_fact(6) = 31.1
+ dist_fact(7) = 31.2
+ dist_fact(8) = 31.3
+
+c call expcss (exoid, ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss, error = ", i4)' ) ierr
+
+c call expcss (exoidm(i), ids, num_elem_per_set, num_df_per_set,
+c 1 elem_ind, df_ind, elem_list, side_list, dist_fact,
+c 2 ierr)
+c write (iout, '("after expcss (",i1,"), error = ", i4)' ) ierr
+
+ prop_names(1) = "COLOR"
+ call expp(exoid, EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+ call expp(exoid, EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp, error = ", i4)' ) ierr
+
+
+ do 1016 i=1,nexofiles
+ prop_names(1) = "COLOR"
+ call expp(exoidm(i), EXSSET, 30, prop_names(1), 100, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+
+ call expp(exoidm(i), EXSSET, 31, prop_names(1), 101, ierr)
+ write (iout, '("after expp (",i1,"), error = ", i4)')
+ 1 i, ierr
+1016 continue
+
+
+c
+c write QA records
+c
+
+ num_qa_rec = 2
+
+ qa_record(1,1) = "TESTWTM fortran version"
+ qa_record(2,1) = "testwtm"
+ 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
+
+ num_qa_rec2 = 2
+
+ qa_record2(1,1) = "TESTWTM fortran version"
+ qa_record2(2,1) = "testwtm"
+ qa_record2(3,1) = "07/07/93"
+ qa_record2(4,1) = "15:41:33"
+ qa_record2(1,2) = "FASTQ"
+ qa_record2(2,2) = "fastq"
+ qa_record2(3,2) = "07/07/93"
+ qa_record2(4,2) = "16:41:33"
+
+ do 1017 i=1,nexofiles
+ call expqa (exoidm(i), num_qa_rec2, qa_record2, ierr)
+ write (iout, '("after expqa (",i1,"), error = ", i4)')
+ 1 i, ierr
+1017 continue
+
+
+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
+
+ num_info2 = 3
+
+ inform2(1) = "This is the first info record."
+ inform2(2) = "This is the second info record."
+ inform2(3) = "This is the third info record."
+
+ do 1018 i=1,nexofiles
+ call expinf (exoidm(i), num_info2, inform2, ierr)
+ write (iout, '("after expinf (",i1,"), error = ", i4)')
+ 1 i, ierr
+1018 continue
+
+c write results variables parameters and names
+
+ num_glo_vars = 1
+
+ var_names(1) = "glo_vars"
+
+ call expvp (exoid, "g", num_glo_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "g", num_glo_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_glo_vars2 = 1
+
+ var_names2(1) = "glovars2"
+
+ do 1019 i=1,nexofiles
+ call expvp (exoidm(i), "g", num_glo_vars2, ierr)
+ write (iout, '("after expvp (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expvan (exoidm(i), "g", num_glo_vars2, var_names2, ierr)
+ write (iout, '("after expvan (",i1,"), error = ", i4)')
+ 1 i, ierr
+1019 continue
+
+ num_nod_vars = 2
+
+ var_names(1) = "nod_var0"
+ var_names(2) = "nod_var1"
+
+ call expvp (exoid, "n", num_nod_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "n", num_nod_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_nod_vars2 = 2
+
+ var_names2(1) = "nodvar20"
+ var_names2(2) = "nodvar21"
+
+ do 1020 i=1,nexofiles
+ call expvp (exoidm(i), "n", num_nod_vars2, ierr)
+ write (iout, '("after expvp (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expvan (exoidm(i), "n", num_nod_vars2, var_names2, ierr)
+ write (iout, '("after expvan (",i1,"), error = ", i4)')
+ 1 i, ierr
+1020 continue
+
+ num_ele_vars = 3
+
+ var_names(1) = "ele_var0"
+ var_names(2) = "ele_var1"
+ var_names(3) = "ele_var2"
+
+ call expvp (exoid, "e", num_ele_vars, ierr)
+ write (iout, '("after expvp, error = ", i4)' ) ierr
+ call expvan (exoid, "e", num_ele_vars, var_names, ierr)
+ write (iout, '("after expvan, error = ", i4)' ) ierr
+
+ num_ele_vars2 = 3
+
+ var_names2(1) = "elevar20"
+ var_names2(2) = "elevar21"
+ var_names2(3) = "elevar22"
+
+ do 1021 i=1,nexofiles
+ call expvp (exoidm(i), "e", num_ele_vars2, ierr)
+ write (iout, '("after expvp (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expvan (exoidm(i), "e", num_ele_vars2, var_names2, ierr)
+ write (iout, '("after expvan (",i1,"), error = ", i4)')
+ 1 i, ierr
+1021 continue
+c
+c write element variable truth table
+c
+
+ k = 0
+
+ do 30 i = 1,num_elem_blk
+ do 20 j = 1,num_ele_vars
+ truth_tab(j,i) = 1
+20 continue
+30 continue
+
+ call exgebi (exoid, ebids, ierr)
+ write (iout, '("after exgebi, error = ", i4)' ) ierr
+ call expvtt (exoid, num_elem_blk, num_ele_vars, truth_tab, ierr)
+ write (iout, '("after expvtt, error = ", i4)' ) ierr
+
+ do 1022 i=1,nexofiles
+ call exgebi (exoidm(i), ebids2, ierr)
+ write (iout, '("after exgebi (",i1,"), error = ", i4)')
+ 1 i, ierr
+ call expvtt (exoidm(i),num_elem_blk,num_ele_vars,truth_tab,ierr)
+ write (iout, '("after expvtt (",i1,"), error = ", i4)')
+ 1 i, ierr
+1022 continue
+c
+c for each time step, write the analysis results;
+c the code below fills the arrays glob_var_vals,
+c nodal_var_vals, and elem_var_vals with values for debugging purposes;
+c obviously the analysis code will populate these arrays
+c
+
+ whole_time_step = 1
+ num_time_steps = 10
+
+ do 110 iii = 1, num_time_steps
+ time_value = real(iii)/100
+ time_value2 = real(iii)/100
+c
+c write time value to regular file
+c
+
+ call exptim (exoid, whole_time_step, time_value, ierr)
+ write (iout, '("after exptim, error = ", i4)' ) ierr
+
+ do 1023 i=1,nexofiles
+ call exptim (exoidm(i), whole_time_step, time_value2, ierr)
+ write (iout, '("after exptim (",i1,"), error = ", i4)')
+ 1 i, ierr
+1023 continue
+
+c
+c write global variables
+c
+
+ do 50 j = 1, num_glo_vars
+ glob_var_vals(j) = real(j+1) * time_value
+50 continue
+
+ call expgv (exoid, whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv, error = ", i4)' ) ierr
+
+ do 1024 i=1,nexofiles
+ call expgv (exoidm(i), whole_time_step, num_glo_vars,
+ 1 glob_var_vals, ierr)
+ write (iout, '("after expgv (",i1,"), error = ", i4)')
+ 1 i, ierr
+1024 continue
+
+c
+c write nodal variables
+c
+
+ do 70 k = 1, num_nod_vars
+ do 60 j = 1, num_nodes
+
+ nodal_var_vals(j) = real(k) + (real(j) * time_value)
+
+60 continue
+
+ call expnv (exoid, whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv, error = ", i4)' ) ierr
+
+ do 1025 i=1,nexofiles
+ call expnv (exoidm(i), whole_time_step, k, num_nodes,
+ 1 nodal_var_vals, ierr)
+ write (iout, '("after expnv (",i1,"), error = ", i4)')
+ 1 i, ierr
+1025 continue
+
+70 continue
+
+c
+c write element variables
+c
+
+ do 100 k = 1, num_ele_vars
+ do 90 j = 1, num_elem_blk
+ do 80 m = 1, num_elem_in_block(j)
+
+ elem_var_vals(m) = real(k+1) + real(j+1) +
+ 1 (real(m)*time_value)
+
+80 continue
+
+ call expev (exoid, whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev, error = ", i4)' ) ierr
+ do 1026 i=1,nexofiles
+ call expev (exoidm(i), whole_time_step, k, ebids(j),
+ 1 num_elem_in_block(j), elem_var_vals, ierr)
+ write (iout, '("after expev (",i1,"), error = ", i4)')
+ 1 i, ierr
+1026 continue
+
+90 continue
+100 continue
+
+ whole_time_step = whole_time_step + 1
+
+c
+c update the data file; this should be done at the end of every time
+c step to ensure that no data is lost if the analysis dies
+c
+ call exupda (exoid, ierr)
+ write (iout, '("after exupda, error = ", i4)' ) ierr
+ do 1027 i=1,nexofiles
+ call exupda (exoidm(i), ierr)
+ write (iout, '("after exupda (",i1,"), error = ", i4)')
+ 1 i, ierr
+1027 continue
+
+110 continue
+
+c
+c close the EXODUS files
+c
+ call exclos (exoid, ierr)
+ write (iout, '("after exclos, error = ", i4)' ) ierr
+
+ do 1028 i=1,nexofiles
+ call exclos (exoidm(i), ierr)
+ write (iout, '("after exclos (",i1,"), error = ", i4)')
+ 1 i, ierr
+1028 continue
+
+ 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