pax_global_header00006660000000000000000000000064122531221310014502gustar00rootroot0000000000000052 comment=5ae7c58b7fe61dd0153b98136a5363d924c17568 exodusii-6.02.dfsg.1/000077500000000000000000000000001225312213100143435ustar00rootroot00000000000000exodusii-6.02.dfsg.1/ChangeLog000066400000000000000000000073461225312213100161270ustar00rootroot00000000000000======================================================================== *** Permit 0 as valid entity (block, set, map) id * Version 5.09 -- Modifications to let zero be a valid entity (element block, nodeset, sideset, map, other sets and blocks). There is a new define EX_INVALID_ID (-1) which now indicates that the id for an entity has not yet been set. All positive integers are now valid id values. ======================================================================== *** Long Name support. Exodus from version 5.08 and later can support names of length up to NC_MAXNAME which is currently 256. The internals of the exodus database have changed with the addition of a new 'dimension' and a new database attribute. This has the following implications: *. The old library can read a new database if the new database does not use names longer than 32 characters. *. If the new database uses longer names, the old library will crash. *. New library with old database will work fine. *. New library with new database, no code changes. If the database uses long names, they will be truncated (with message to stderr) at 32 characters. An output database will limit names to 32 characters by default. The following code changes are used to work with long names: ======================================== Reading a database: * Query a database for the maximum length of a name stored on the database. This does not include the space for the trailing null. int max_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH); * Tell the exodus API the maximum name length that your client code can handle. This is the size of the character strings that are passed to the ex_get_names() and similar calls. Note that the maximum_length does not include the trailing null. That means that if you tell the library to give you 32-character names, the memory buffer you pass to the library must be 33 characters. int status = ex_set_max_name_length(exoid, maximum_length); If this size is less than the length of a name on the database, the name will be truncated and a message printed to stderr. * Inquire the size set for the max_name_length. Will return 32 by default, or if ex_set_max_name_length was called, it will return the size set in that call. int max_name_length = ex_inquire_int(exoid, EX_INQ_CUR_MAX_ALLOWED_NAME_LENGTH); * Inquire the size that the database used at creation time for the maximum name size. This is the value used for ex_set_max_name_length() when the database was created. This isn't really needed unless you are appending to an existing database and want to know how long of names it will support. ======================================== Writing a database: * After the ex_create() call and before the call to ex_put_init() or ex_put_init_ext(), call ex_set_max_name_length(exoid, max_length); to tell the database the maximum size names that you will be outputting. If this isn't called, then it will default to 32 character names. * The code will keep track of the maximum length that was written and will update an attribute on the database with that length. This is queryable via the following function: int max_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH); ======================================== Names that are included: * Entity names (element block, nodeset, sideset, faceblock, ...) * Attribute names * Map names * Results variable names Still 32 characters: * QA strings * element type in ex_get_block, ex_put_block calls. Still 80 characters: * info records * title. ======================================== Questions / Concerns / Problems: Greg Sjaardema. gdsjaar@sandia.gov or gsjaardema@gmail.com exodusii-6.02.dfsg.1/README.NEMESIS000066400000000000000000000015601225312213100163270ustar00rootroot00000000000000NOTE: All nemesis api functions are now included in the exodus library. For almost all functions, the "ne_" portion of the function name is replaced by "ex_". For example, "ne_put_init_info" in the nemesis API is now "ex_put_init_info" in the exodus API. The exceptions are: * "ne_put_version" is "ex_put_nemesis_version" * "ne_get_node_map" is "ex_get_processor_node_maps" * "ne_put_node_map" is "ex_put_processor_node_maps" * "ne_get_elem_map" is "ex_get_processor_elem_maps" * "ne_put_elem_map" is "ex_put_processor_elem_maps" The nemesis library can still be used, but all functions are simply implemented as wrappers that call the corresponding exodus API function. Unless you are building a legacy code that uses the nemesis API, it is best to just use the exodus API and library. exodusii-6.02.dfsg.1/exodus/000077500000000000000000000000001225312213100156525ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/CMakeLists.txt000066400000000000000000000027061225312213100204170ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) PROJECT(ExodusII C CXX Fortran) SET(EXODUSII_VERSION_MAJOR "5") SET(EXODUSII_VERSION_MINOR "14") SET(EXODUSII_VERSION_PATCH "0") SET(EXODUSII_VERSION "${EXODUSII_VERSION_MAJOR}.${EXODUSII_VERSION_MINOR}") SET(EXODUSII_VERSION_FULL "${EXODUSII_VERSION}.${EXODUSII_VERSION_PATCH}") OPTION(BUILD_SHARED "Build the exodus libraries shared." OFF) IF(BUILD_SHARED) SET(EXODUS_LIBRARY_TYPE SHARED) ELSE(BUILD_SHARED) SET(EXODUS_LIBRARY_TYPE STATIC) ENDIF(BUILD_SHARED) SUBDIRS(cbind forbind) find_path( NETCDF_INCLUDE_DIR netcdf.h $ENV{ACCESS}/inc $ENV{NETCDF_DIR}/inc $ENV{NETCDF_DIR}/include $ENV{NETCDF_DIR}/libsrc ) find_library( NETCDF_LIBRARY NAMES netcdf PATHS "$ENV{ACCESS}/lib" "$ENV{NETCDF_DIR}/lib" "$ENV{NETCDF_DIR}/libsrc/.libs" ) find_program (NETCDF_NCDUMP ncdump $ENV{ACCESS}/bin $ENV{NETCDF_DIR}/bin $ENV{NETCDF_DIR}/ncdump ) # Hack for HDF5 find_library( HDF5_LIBRARY hdf5 $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) find_library( HDF5HL_LIBRARY hdf5_hl $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) # Check for ZLib, but only if using HDF5. FIND_PACKAGE(ZLIB) IF(NOT ZLIB_LIBRARY) MESSAGE(FATAL_ERROR "HDF5 Support specified, cannot find ZLib.") ENDIF() SET(USE_ZLIB ON) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS}) exodusii-6.02.dfsg.1/exodus/COPYRIGHT000066400000000000000000000031561225312213100171520ustar00rootroot00000000000000Copyright (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-6.02.dfsg.1/exodus/DartConfig.cmake000066400000000000000000000012411225312213100206720ustar00rootroot00000000000000# 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/" ) exodusii-6.02.dfsg.1/exodus/Doxyfile000066400000000000000000002141321225312213100173630ustar00rootroot00000000000000# Doxyfile 1.7.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = ExodusII # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 5.23 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 1 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = "func{1}=\1" \ "fparam{1}=\1" \ "file{1}=\1" \ "comment{1}=...\1" \ "undoc=\xrefitem undoc \"Undocumented\" \"Undocumented\"" # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penalty. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will roughly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. The create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = NO # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = cbind/include \ cbind/src \ forbind/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = ex_ #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! #HTML_STYLESHEET = customdoxygen.css # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 224 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 93 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [0,1..20]) # that doxygen will group on one line in the generated HTML documentation. # Note that a value of 0 will completely suppress the enum values from # appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = YES # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the # mathjax.org site, so you can quickly see the result without installing # MathJax, but it is strongly recommended to install a local copy of MathJax # before deployment. MATHJAX_RELPATH = http://www.mathjax.org/mathjax # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = letter # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = EXODUS_EXPORT # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will write a font called Helvetica to the output # directory and reference it in all dot files that doxygen generates. # When you want a differently looking font you can specify the font name # using DOT_FONTNAME. You need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = NO # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = NO # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = NO # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = NO # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, svg, gif or svg. # If left blank png will be used. DOT_IMAGE_FORMAT = gif # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = /opt/local/bin # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES exodusii-6.02.dfsg.1/exodus/Imakefile000066400000000000000000000071411225312213100174660ustar00rootroot00000000000000XCOMM 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 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 DEBUG=-g * */ #define IHaveSubdirs #define PassDebugFlags "DEBUG=$(DEBUG)" \ "CDEBUGFLAGS=$(CDEBUGFLAGS)" \ "CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)" \ "F90DEBUGFLAGS=$(F90DEBUGFLAGS)" \ "F77DEBUGFLAGS=$(F77DEBUGFLAGS)" #define ExtraOptions "CCOPTIONS=$(CCOPTIONS)" INCLIST1 = exodusII.h exodusII_int.h INCLIST2 = exodusII_int.inc exodusII.inc SUBDIRS = cbind/include \ cbind/src \ forbind/include \ forbind/src \ cbind/test \ forbind/test #if Build64BitAccess == YES AllTarget(libexodus.a libexoIIv2for.a libexoIIv2for32.a) #else AllTarget(libexodus.a libexoIIv2for.a) #endif InstallSubdirIncludeList(makeincludes,cbind/include,$(INCLIST1),$(INCDIR)) InstallSubdirIncludeList(makeincludes,forbind/include,$(INCLIST2),$(INCDIR)) /* Directory for exodusII c library */ NamedTargetSubdirs(libexodus.a,cbind/src,"making exodus ",PassDebugFlags ExtraOptions,all) /* 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(exodus,$(LIBDIR)) InstallLibrary(exoIIv2for,$(LIBDIR)) InstallLibraryAlias(exodus,exoIIv2c,$(LIBDIR)) #if Build64BitAccess == YES InstallLibrary(exoIIv2for32,$(LIBDIR)) #endif check: test test:: libexodus.a libexoIIv2for.a NamedMakeSubdirs(test,cbind/test) NamedMakeSubdirs(test,forbind/test) DependSubdirs($(SUBDIRS)) exodusii-6.02.dfsg.1/exodus/Makefile.standalone000066400000000000000000000137731225312213100214540ustar00rootroot00000000000000# 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: # # 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 # RANLIB == ranlib or 'true' if no ranlib # AR == command to build an archive library. # #======================================================================== SYSTEM := $(shell uname) # Set this to yes if your netcdf is compiled with the netcdf4 extensions # which require linking with hdf5. It is assumed that the netcdf and hdf5 # library and include paths are the same. #======================================================================== # Netcdf #======================================================================== USING_NETCDF4 = "YES" NETCDF = /Users/gdsjaar/src/SEACAS NETCDF_INC = -I$(NETCDF)/include NETCDF_LIB = -L$(NETCDF)/lib -lnetcdf NCDUMP = ${NETCDF}/bin/ncdump ifeq ($(USING_NETCDF4), "YES") LDFLAGS = -L$(NETCDF)/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz else NETCDF_YES_NO = -DNOT_NETCDF4 LDFLAGS = -L$(NETCDF)/lib -lnetcdf endif #======================================================================== # Darwin (Apple OSX) #======================================================================== ifeq ($(SYSTEM),Darwin) RANLIB = ranlib AR = ar -crsv CC = /opt/local/bin/gcc-mp-4.8 FC = /opt/local/bin/gfortran-mp-4.8 CCOPTIONS = -DADDC_ F77OPTIONS = F77PREC = -fdefault-real-8 -fdefault-integer-8 endif #======================================================================== #======================================================================== # Linux #======================================================================== ifeq ($(SYSTEM),Linux) # Default Compiler: COMPILER = GNU RANLIB = ranlib AR = ar -rcv ifeq ($(COMPILER),Portland) CC = pgcc FC = pgf77 CCOPTIONS = -Mframe -DADDC_ F77OPTIONS = -fast F77PREC = -r8 -i8 endif ifeq ($(COMPILER),Intel) CC = icc FC = ifort CCOPTIONS = -Xc -DADDC_ F77PREC = -r8 -i8 endif ifeq ($(COMPILER),GNU) CC = gcc FC = gfortran CCOPTIONS = -O2 -Wall -DADDC_ F77OPTIONS = -O2 F77PREC = -fdefault-real-8 -fdefault-integer-8 endif endif OPTIMIZE_FLAG = -O2 STD_DEFINES = -DVERBOSE CFLAGS = $(OPTIMIZE_FLAG) $(CCOPTIONS) $(STD_DEFINES) $(LOC_EXOII_INC) $(NETCDF_INC) $(NETCDF_YES_NO) FFLAGS = $(OPTIMIZE_FLAG) $(F77OPTIONS) $(LOC_EXOII_INC) # Use include files locates in exodusii/cbind/include LOC_EXOII_INC = -I../../cbind/include -I../../forbind/include SUBDIRS = cbind/src forbind/src cbind/test forbind/test all:: libexodus.a libexoIIv2for.a libexoIIv2for32.a libexodus.a:: echo "making exodus in cbind/src" (cd cbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "RANLIB=$(RANLIB)" libexodus.a) cp cbind/src/libexodus.a . $(RANLIB) libexodus.a libexoIIv2for.a:: echo "making exoIIv2for in forbind/src" (cd forbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "RANLIB=$(RANLIB)" "SYSTEM=$(SYSTEM)" libexoIIv2for.a) cp forbind/src/libexoIIv2for.a . $(RANLIB) libexoIIv2for.a libexoIIv2for32.a:: echo "making exoIIv2for32 in forbind/src" (cd forbind/src && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "RANLIB=$(RANLIB)" "SYSTEM=$(SYSTEM)" libexoIIv2for32.a) cp forbind/src/libexoIIv2for32.a . $(RANLIB) libexoIIv2for32.a check: test test:: libexodus.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)" "NCDUMP=$(NCDUMP)" all) test:: echo "making test in forbind/test" (cd forbind/test && $(MAKE) $(MFLAGS) -f Makefile.standalone "AR=$(AR)" "CC=$(CC)" "CFLAGS=$(CFLAGS)" "FC=$(FC)" "FFLAGS=$(FFLAGS)" "LDFLAGS=$(LDFLAGS)" "RANLIB=$(RANLIB)" "NCDUMP=$(NCDUMP)" 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 exodusii-6.02.dfsg.1/exodus/README000066400000000000000000000054621225312213100165410ustar00rootroot00000000000000======================================================================== CONTACT: Greg Sjaardema, Sandia National Laboratories, gdsjaar@sandia.gov ======================================================================== LICENSE: The Exodus 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 . Please identify the version of the package. ======================================================================== BUILDING There are 4 methods for building exodus. 1. SEAMS/SEACAS Build system which is based on imake. If you have a SEAMS or SEACAS installation, you can use its build system. In the top-level exodus directory, do 'accmkmf' followed by 'make Makefiles' and then 'make' 2. CMAKE: type 'cmake .' or 'cmake -i' to generate the Makefiles followed by 'make'. There is a cmake-script file which shows how I configure cmake. 3. Makefile.standalone. Edit the top-level Makefile.standalone file and specify the compiler and other options as detailed in the file. Then, do "make -f Makefile.standalone". 4. Building in the Trilinos system as part of the seacas package. See the Trilinos documentation for more details. Once you have built the library, you can test it by typing "make check" ======================================================================== NETCDF The exodus library uses the netcdf library for low-level data storage. Exodus requires NetCDF version 4.2.1.1 or later. The netcdf library must be modified slightly in order to handle the exodus datamodel. The specific changes are: 1. include/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 */ If these changes are not made, the exodus library will still function for "normal" size models, but it will fail for "large" models. The error message from exodus/netcdf should be somewhat clear when this happens... 2. I typically configure netcdf as follows: ./configure --enable-netcdf-4 --disable-fsync --disable-dap --disable-cdmremote Replace "--enable-netcdf-4" with "--disable-netcdf-4" to not use the netcdf4 extensions. They are not necessarily needed for exodus, but will provide compression, larger model sizes, and may be faster in some cases. 3. When running the netcdf tests, you may have to do "unlimit stacksize" (csh/tcsh) to avoid some failures due to the increased define sizes above. ======================================================================== exodusii-6.02.dfsg.1/exodus/cbind/000077500000000000000000000000001225312213100167315ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cbind/CMakeLists.txt000066400000000000000000000172541225312213100215020ustar00rootroot00000000000000 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" "${NETCDF_INCLUDE_DIR}" ) SET(cbind_SRCS src/ex_close.c src/ex_conv.c src/ex_copy.c src/ex_create.c src/ex_cvt_nodes_to_sides.c src/ex_err.c src/ex_get_all_times.c src/ex_get_attr.c src/ex_get_attr_names.c src/ex_get_attr_param.c src/ex_get_block.c src/ex_get_block_param.c src/ex_get_cmap_params.c src/ex_get_concat_node_sets.c src/ex_get_concat_sets.c src/ex_get_concat_side_set_node_count.c src/ex_get_concat_side_sets.c src/ex_get_conn.c src/ex_get_coord.c src/ex_get_coord_names.c src/ex_get_coordinate_frames.c src/ex_get_eb_info_global.c src/ex_get_elem_attr.c src/ex_get_elem_attr_names.c src/ex_get_elem_blk_ids.c src/ex_get_elem_block.c src/ex_get_elem_cmap.c src/ex_get_elem_conn.c src/ex_get_elem_map.c src/ex_get_elem_num_map.c src/ex_get_elem_type.c src/ex_get_elem_var.c src/ex_get_elem_var_tab.c src/ex_get_elem_var_time.c src/ex_get_entity_count_per_polyhedra.c src/ex_get_glob_var_time.c src/ex_get_glob_vars.c src/ex_get_id_map.c src/ex_get_ids.c src/ex_get_info.c src/ex_get_init.c src/ex_get_init_ext.c src/ex_get_init_global.c src/ex_get_init_info.c src/ex_get_loadbal_param.c src/ex_get_map.c src/ex_get_map_param.c src/ex_get_n_attr.c src/ex_get_n_conn.c src/ex_get_n_coord.c src/ex_get_n_elem_attr.c src/ex_get_n_elem_conn.c src/ex_get_n_elem_num_map.c src/ex_get_n_elem_var.c src/ex_get_n_nodal_var.c src/ex_get_n_node_num_map.c src/ex_get_n_node_set.c src/ex_get_n_node_set_df.c src/ex_get_n_one_attr.c src/ex_get_n_side_set.c src/ex_get_n_side_set_df.c src/ex_get_n_var.c src/ex_get_name.c src/ex_get_names.c src/ex_get_nodal_var.c src/ex_get_nodal_var_time.c src/ex_get_node_cmap.c src/ex_get_node_map.c src/ex_get_node_num_map.c src/ex_get_node_set.c src/ex_get_node_set_dist_fact.c src/ex_get_node_set_ids.c src/ex_get_node_set_param.c src/ex_get_ns_param_global.c src/ex_get_nset_var.c src/ex_get_nset_var_tab.c src/ex_get_num_map.c src/ex_get_object_truth_vector.c src/ex_get_one_attr.c src/ex_get_one_elem_attr.c src/ex_get_partial_attr.c src/ex_get_partial_conn.c src/ex_get_partial_coord.c src/ex_get_partial_elem_attr.c src/ex_get_partial_elem_conn.c src/ex_get_partial_elem_map.c src/ex_get_partial_elem_num_map.c src/ex_get_partial_elem_var.c src/ex_get_partial_id_map.c src/ex_get_partial_nodal_var.c src/ex_get_partial_node_num_map.c src/ex_get_partial_node_set.c src/ex_get_partial_node_set_df.c src/ex_get_partial_num_map.c src/ex_get_partial_one_attr.c src/ex_get_partial_set_dist_fact.c src/ex_get_partial_side_set.c src/ex_get_partial_side_set_df.c src/ex_get_partial_var.c src/ex_get_processor_elem_maps.c src/ex_get_processor_node_maps.c src/ex_get_prop.c src/ex_get_prop_array.c src/ex_get_prop_names.c src/ex_get_qa.c src/ex_get_set.c src/ex_get_set_dist_fact.c src/ex_get_set_param.c src/ex_get_sets.c src/ex_get_side_set.c src/ex_get_side_set_dist_fact.c src/ex_get_side_set_ids.c src/ex_get_side_set_node_count.c src/ex_get_side_set_node_list.c src/ex_get_side_set_node_list_len.c src/ex_get_side_set_param.c src/ex_get_ss_param_global.c src/ex_get_sset_var.c src/ex_get_sset_var_tab.c src/ex_get_time.c src/ex_get_truth_table.c src/ex_get_var.c src/ex_get_var_name.c src/ex_get_var_names.c src/ex_get_var_param.c src/ex_get_var_tab.c src/ex_get_var_time.c src/ex_get_variable_name.c src/ex_get_variable_names.c src/ex_get_variable_param.c src/ex_inquire.c src/ex_ne_util.c src/ex_open.c src/ex_opts.c src/ex_put_all_var_param.c src/ex_put_all_var_param_ext.c src/ex_put_attr.c src/ex_put_attr_names.c src/ex_put_attr_param.c src/ex_put_block.c src/ex_put_block_param.c src/ex_put_cmap_params.c src/ex_put_cmap_params_cc.c src/ex_put_concat_all_blocks.c src/ex_put_concat_elem_block.c src/ex_put_concat_node_sets.c src/ex_put_concat_sets.c src/ex_put_concat_side_sets.c src/ex_put_concat_var_param.c src/ex_put_conn.c src/ex_put_coord.c src/ex_put_coord_names.c src/ex_put_coordinate_frames.c src/ex_put_eb_info_global.c src/ex_put_elem_attr.c src/ex_put_elem_attr_names.c src/ex_put_elem_block.c src/ex_put_elem_cmap.c src/ex_put_elem_conn.c src/ex_put_elem_map.c src/ex_put_elem_num_map.c src/ex_put_elem_var.c src/ex_put_elem_var_slab.c src/ex_put_elem_var_tab.c src/ex_put_entity_count_per_polyhedra.c src/ex_put_glob_vars.c src/ex_put_id_map.c src/ex_put_info.c src/ex_put_init.c src/ex_put_init_ext.c src/ex_put_init_global.c src/ex_put_init_info.c src/ex_put_loadbal_param.c src/ex_put_loadbal_param_cc.c src/ex_put_map.c src/ex_put_map_param.c src/ex_put_n_attr.c src/ex_put_n_coord.c src/ex_put_n_elem_attr.c src/ex_put_n_elem_conn.c src/ex_put_n_elem_num_map.c src/ex_put_n_nodal_var.c src/ex_put_n_node_num_map.c src/ex_put_n_node_set.c src/ex_put_n_node_set_df.c src/ex_put_n_one_attr.c src/ex_put_n_side_set.c src/ex_put_n_side_set_df.c src/ex_put_n_var.c src/ex_put_name.c src/ex_put_names.c src/ex_put_nodal_var.c src/ex_put_nodal_var_slab.c src/ex_put_node_cmap.c src/ex_put_node_map.c src/ex_put_node_num_map.c src/ex_put_node_set.c src/ex_put_node_set_dist_fact.c src/ex_put_node_set_param.c src/ex_put_ns_param_global.c src/ex_put_nset_var.c src/ex_put_nset_var_tab.c src/ex_put_num_map.c src/ex_put_one_attr.c src/ex_put_one_elem_attr.c src/ex_put_partial_attr.c src/ex_put_partial_coord.c src/ex_put_partial_elem_attr.c src/ex_put_partial_elem_conn.c src/ex_put_partial_elem_map.c src/ex_put_partial_elem_num_map.c src/ex_put_partial_id_map.c src/ex_put_partial_nodal_var.c src/ex_put_partial_node_num_map.c src/ex_put_partial_node_set.c src/ex_put_partial_node_set_df.c src/ex_put_partial_num_map.c src/ex_put_partial_one_attr.c src/ex_put_partial_set.c src/ex_put_partial_set_dist_fact.c src/ex_put_partial_side_set.c src/ex_put_partial_side_set_df.c src/ex_put_partial_var.c src/ex_put_processor_elem_maps.c src/ex_put_processor_node_maps.c src/ex_put_prop.c src/ex_put_prop_array.c src/ex_put_prop_names.c src/ex_put_qa.c src/ex_put_set.c src/ex_put_set_dist_fact.c src/ex_put_set_param.c src/ex_put_sets.c src/ex_put_side_set.c src/ex_put_side_set_dist_fact.c src/ex_put_side_set_param.c src/ex_put_ss_param_global.c src/ex_put_sset_var.c src/ex_put_sset_var_tab.c src/ex_put_time.c src/ex_put_truth_table.c src/ex_put_var.c src/ex_put_var_name.c src/ex_put_var_names.c src/ex_put_var_param.c src/ex_put_var_tab.c src/ex_put_variable_name.c src/ex_put_variable_names.c src/ex_put_variable_param.c src/ex_update.c src/ex_utils.c ) SET(cbind_HEADERS include/exodusII.h include/exodusII_int.h ) IF(APPLE) SET_SOURCE_FILES_PROPERTIES( src/ex_utils.c PROPERTIES COMPILE_FLAGS -fno-common) ENDIF(APPLE) ADD_LIBRARY(exoIIv2c ${EXODUS_LIBRARY_TYPE} ${cbind_SRCS}) TARGET_LINK_LIBRARIES(exoIIv2c ${NETCDF_LIBRARY} ${HDF5_LIBRARY} ${HDF5HL_LIBRARY} ${ZLIB_LIBRARY}) IF(MSVC) set_target_properties(exoIIv2c PROPERTIES COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS) ENDIF(MSVC) IF(EXODUS_LIBRARY_PROPERTIES) SET_TARGET_PROPERTIES(exoIIv2c PROPERTIES ${EXODUS_LIBRARY_PROPERTIES}) ENDIF(EXODUS_LIBRARY_PROPERTIES) IF(NOT EXODUS_INSTALL_NO_LIBRARIES) INSTALL(TARGETS exoIIv2c RUNTIME DESTINATION lib COMPONENT Runtime LIBRARY DESTINATION lib COMPONENT Runtime ARCHIVE DESTINATION lib COMPONENT Development) INSTALL(FILES ${cbind_HEADERS} DESTINATION include COMPONENT Development) ENDIF(NOT EXODUS_INSTALL_NO_LIBRARIES) INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) IF (BUILD_TESTING) ENABLE_TESTING() SUBDIRS(test) ENDIF (BUILD_TESTING) exodusii-6.02.dfsg.1/exodus/cbind/include/000077500000000000000000000000001225312213100203545ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cbind/include/Imakefile000066400000000000000000000003141225312213100221630ustar00rootroot00000000000000 INCLIST=exodusII.h exodusII_int.h InstallIncludeList(install,$(INCLIST),$(INCDIR)) #if defined(BuildParallelAwareExodus) INCLISTP=exodusII_par.h InstallIncludeList(install,$(INCLISTP),$(INCDIR)) #endif exodusii-6.02.dfsg.1/exodus/cbind/include/doxygen.h000066400000000000000000000333761225312213100222160ustar00rootroot00000000000000/*! \mainpage ExodusII API Documentation \section intro Introduction EXODUS is the successor of the widely used finite element (FE) data file format EXODUS (henceforth referred to as EXODUS I) developed by Mills-Curran and Flanagan. It continues the concept of a common database for multiple application codes (mesh generators, analysis codes, visualization software, etc.) rather than code-specific utilities, affording flexibility and robustness for both the application code developer and application code user. By using the EXODUS data model, a user inherits the flexibility of using a large array of application codes (including vendor-supplied codes) which access this common data file directly or via translators. The uses of the EXODUS data model include the following: - Problem definition -- mesh generation, specification of locations of boundary conditions and load application, specification of material types. - Simulation -- model input and results output. - Visualization -- model verification, results postprocessing, data interrogation, and analysis tracking. \section avail License and Availability The EXODUS library is licensed under the BSD open source license. Copyright (c) 2005 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -Neither the name of Sandia Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The ExodusII library source code is available on Sourceforge at http://sourceforge.net/projects/exodusii For bug reports, documentation errors, and enhancement suggestions, contact: - Gregory D. Sjaardema - PHONE: (505) 844-2701 - EMAIL: gdsjaar@sandia.gov \section devel Development of EXODUS The evolution of the EXODUS data model has been steered by FE application code developers who desire the advantages of a common data format. The EXODUS model has been designed to overcome deficiencies in the EXODUS I file format and meet the following functional requirements as specified by these developers: - Random read/write access. - Application programming interface (API) -- provide routines callable from FORTRAN, C, and C++ application codes. - Extensible -- allow new data objects to be added without modifying the application programs that use the file format. - Machine independent -- data should be independent of the machine which generated it. - Real-time access during analysis -- allow access to the data in a file while the file is being created. To address these requirements, the open source database library etCDF (http://www.unidata.ucar.edu/software/netcdf/) was selected to handle the low-level data storage. The EXODUS II library functions provide the mapping between FE data objects and netCDF dimensions, attributes, and variables. Thus, the code developer interacts with the data model using the vocabulary of an FE analyst (element connectivity, nodal coordinates, etc.) and is relieved of the details of the data access mechanism. Because an EXODUS file is a netCDF file, an application program can access data via the EXODUS API or the netCDF API directly. Although accessing the data directly via the netCDF API requires more in-depth understanding of netCDF, this capability is a powerful feature that allows the development of auxiliary libraries of special purpose functions not offered in the standard EXODUS library. For example, if an application required access to the coordinates of a single node (the standard library function returns the coordinates for all of the nodes in the model), a simple function could be written that calls netCDF routines directly to read the data of interest. \section descrip Description of Data Objects The data in EXODUS files can be divided into three primary categories: initialization data, model, and results. Initialization data includes sizing parameters (number of nodes, number of elements, etc.), optional quality assurance information (names of codes that have operated on the data), and optional informational text. The model is described by data which are static (do not change through time). These data include nodal coordinates, element connectivity (node lists for each element), element attributes, and node sets and side sets (used to aid in applying loading conditions and boundary constraints). The results are optional and include five types of variables -- nodal, element, nodeset, sideset, and global -- each of which is stored through time. Nodal results are output (at each time step) for all the nodes in the model. An example of a nodal variable is displacement in the X direction. Element, nodeset, and sideset results are output (at each time step) for all entities (elements, nodes, sides) in one or more entity block. For example, stress may be an element variable. Another use of element variables is to record element status (a binary flag indicating whether each element is "alive" or "dead") through time. Global results are output (at each time step) for a single element or node, or for a single property. Linear momentum of a structure and the acceleration at a particular point are both examples of global variables. Although these examples correspond to typical FE applications, the data format is flexible enough to accommodate a spectrum of uses. A few conventions and limitations must be cited: - There are no restrictions on the frequency of results output except that the time value associated with each successive time step must increase monotonically. - To output results at different frequencies (i.e., variable A at every simulation time step, variable B at every other time step) multiple EXODUS files must be used. - There are no limits to the number of each type of results, but once declared, the number cannot change. - If the mesh geometry or topology changes in time (i.e., number of nodes increases, connectivity changes), then the new geometrymust be output to a new EXODUS file. \section int64 Integer Bulkdata Storage Details The EXODUS database can store integer bulk data, entity map data, and mesh entity (block/set) ids in either 32-bit or 64-bit integer format. The data considered "bulk data" are: - element, face, and edge connectivity lists, - element, face, edge, and node set entity lists, The entity map data is any data stored in one of the 'map' objects on the exodus file. This includes: - id maps - number maps - order maps - processor node maps - processor element maps. A mesh entity id is the id of any block (element block, edge block, ...); set (node set, face set, ...), coordinate frame, and communication map. When an EXODUS file is created via the ex_create() function, the 'mode' argument provides the mechanism for specifying how integer data will be passed as arguments to the API functions and also how the integer data will be stored on the database. The ex_open() function also provides a mechanism for specifying how integer data will be passed as arguments. The method uses the 'mode' argument to the ex_open() and ex_create() functions. The mode is a 32-bit integer in which certain bits are turned on by or'ing certain predefined constants. exoid = ex_create( EX_TEST_FILENAME, EX_CLOBBER|EX_MAPS_INT64_DB|EX_MAPS_INT64_API, &appWordSize, &diskWordSize ); The constants related to the integer size (32-bit or 64-bit) specification are: - EX_MAPS_INT64_DB -- entity map data - EX_IDS_INT64_DB -- mesh entity ids - EX_BULK_INT64_DB -- bulk data - EX_ALL_INT64_DB -- (the above 3 or'd together) - EX_MAPS_INT64_API -- entity map data - EX_IDS_INT64_API -- mesh entity ids - EX_BULK_INT64_API -- bulk data - EX_ALL_INT64_API -- (the above 3 or'd together) The constants that end with "_DB" specify that that particular integer data is stored on the database as 64-bit integers; the constants that end with "_API" specify that that particular integer data is passed to/from API functions as 64-bit integers. If the range of the data being transmitted is larger than the permitted integer range (for example, if the data is stored on the database as 64-bit ints and the application specifies passing data as 32-bit ints), the api function will return an error. The three types of integer data whose storage can be specified are - maps (EX_MAPS_INT64_), - "bulk data" including connectivity lists and entity lists (EX_BULK_INT64_), and - entity ids which are the ids of element, face, edge, and node sets and blocks; and map ids (EX_IDS_INT64_) The function ex_int64_status(exoid) is used to determine the integer storage types being used for the EXODUS database 'exoid'. It returns an integer which can be and'ed with the above flags to determine either the storage type or function parameter type. For example, if (EX_MAPS_INT64_DB \& ex_int64_status(exoid)) is true, then map data is being stored as 64-bit integers for that database. It is not possible to determine the integer data size on a database without opening the database via an ex_open() call. However, the integer size specification for API functions can be changed at any time via the ex_set_int64_status(exoid, mode) function. The mode is one or more of EX_MAPS_INT64_API, EX_IDS_INT64_API, or EX_BULK_INT64_API, or'd together. Any exodus function calls after that point will use the specified integer size. Note that a call to ex_set_int64_status(exoid, mode) overrides any previous setting for the integer sizes used in the API. The ex_create() function is the only way to specify the integer sizes specification for database integers. \subsection int64_fortran_api Fortran API The fortran api is uses the same mechanism as was described above for the C API. If using the "8-byte real and 8-byte int" fortran mode typically used by the SEACAS applications (the compiler automatically promotes all integers and reals to 8-byte quantities), then the fortran exodus library will automatically enable the *_API options; the client still needs to specify the *_DB options. \subsection int64_fortran_imp Fortran Implementation The new capability to pass 64-bit integer data through the fortran and C API functions simplifies the implementation of the "8-byte real 8-byte int" usage of the exodus library. Previously, the wrapper routines in addrwrap.F were required to convert the 8-byte integer data on the client side to/from 4-byte integers on the library side. This required extra memory allocation and complications that are now handled at the lowest level in the netcdf library. The map-related functions in the fortran api have all been converted to pass 64-bit integers down to the C API which has removed some code and simplified those functions. \section Database Options (Compression, Name Length, File Type) The ex_set_option() function call is used to set various options on the database. Valid values for 'option' are: | Option Name | Option Values -------------------------|--------------- | EX_OPT_MAX_NAME_LENGTH | Maximum length of names that will be returned/passed via api call. | EX_OPT_COMPRESSION_TYPE | Not currently used; default is gzip | EX_OPT_COMPRESSION_LEVEL | In the range [0..9]. A value of 0 indicates no compression | EX_OPT_COMPRESSION_SHUFFLE | 1 if enabled, 0 if disabled | EX_OPT_INTEGER_SIZE_API | 4 or 8 indicating byte size of integers used in api functions. | EX_OPT_INTEGER_SIZE_DB | Query only, returns 4 or 8 indicating byte size of integers stored on database. The compression-related options are only available on netcdf-4 files since the underlying hdf5 compression functionality is used for the implementation. The compression level indicates how much effort should be expended in the compression and the computational expense increases with higher levels; in many cases, a compression level of 1 is sufficient. \defgroup ResultsData Results Data @{ This section describes data file utility functions for creating / opening a file, initializing a file with global parameters, reading / writing information text, inquiring on parameters stored in the data file, and error reporting. @} \defgroup Utilities Data File Utilities @{ This section describes data file utility functions for creating / opening a file, initializing a file with global parameters, reading / writing information text, inquiring on parameters stored in the data file, and error reporting. @} \defgroup ModelDescription Model Description @{ The routines in this section read and write information which describe an exodus finite element model. This includes nodal coordinates, element order map, element connectivity arrays, element attributes, node sets, side sets, and object properties. @} */ exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII.h000066400000000000000000002247231225312213100222700ustar00rootroot00000000000000/* * 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 API include file * *****************************************************************************/ #ifndef EXODUS_II_HDR #define EXODUS_II_HDR #include "netcdf.h" #if defined(PARALLEL_AWARE_EXODUS) #include "netcdf_par.h" #endif #include #include #include #ifndef NC_INT64 #error "NetCDF version 4.1.2 or later is required." #endif /* EXODUS II version number */ #define EX_API_VERS 6.02f #define EX_API_VERS_NODOT 602 #define EX_VERS EX_API_VERS #define NEMESIS_API_VERSION EX_API_VERS #define NEMESIS_API_VERSION_NODOT EX_API_VERS_NODOT #define NEMESIS_FILE_VERSION 2.6 /* * 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. They should already be defined, but are left over from the * old days... */ #ifndef TRUE #define TRUE -1 #endif #ifndef FALSE #define FALSE 0 #endif /** * \defgroup FileVars Variables controlling the file creation mode. *@{ */ /* Modes for ex_open */ #define EX_READ 0x0000 /**< ex_open(): open file for reading (default) */ #define EX_WRITE 0x0001 /**< ex_open(): open existing file for appending. */ #define EX_NOCLOBBER 0x0004 /**< Don't overwrite existing database, default */ #define EX_CLOBBER 0x0008 /**< Overwrite existing database if it exists */ #define EX_NORMAL_MODEL 0x0010 /**< disable mods that permit storage of larger models */ #define EX_LARGE_MODEL 0x0020 /**< enable mods that permit storage of larger models */ #define EX_NETCDF4 0x0040 /**< use the hdf5-based netcdf4 output */ #define EX_NOSHARE 0x0080 /**< Do not open netcdf file in "share" mode */ #define EX_SHARE 0x0100 /**< Do open netcdf file in "share" mode */ #define EX_NOCLASSIC 0x0200 /**< Do not force netcdf to classic mode in netcdf4 mode */ /* Need to distinguish between storage on database (DB in name) and passed through the API functions (API in name). */ #define EX_MAPS_INT64_DB 0x0400 /**< All maps (id, order, ...) store int64_t values */ #define EX_IDS_INT64_DB 0x0800 /**< All entity ids (sets, blocks, maps) are int64_t values */ #define EX_BULK_INT64_DB 0x1000 /**< All integer bulk data (local indices, counts, maps); not ids */ #define EX_ALL_INT64_DB (EX_MAPS_INT64_DB|EX_IDS_INT64_DB|EX_BULK_INT64_DB) /**< All of the above... */ #define EX_MAPS_INT64_API 0x2000 /**< All maps (id, order, ...) store int64_t values */ #define EX_IDS_INT64_API 0x4000 /**< All entity ids (sets, blocks, maps) are int64_t values */ #define EX_BULK_INT64_API 0x8000 /**< All integer bulk data (local indices, counts, maps); not ids */ #define EX_INQ_INT64_API 0x10000 /**< Integers passed to/from ex_inquire are int64_t */ #define EX_ALL_INT64_API (EX_MAPS_INT64_API|EX_IDS_INT64_API|EX_BULK_INT64_API|EX_INQ_INT64_API) /**< All of the above... */ /* Parallel IO mode flags... */ #define EX_MPIIO 0x20000 #define EX_MPIPOSIX 0x40000 #define EX_PNETCDF 0x80000 /*@}*/ /*! \sa ex_inquire() */ enum ex_inquiry { EX_INQ_FILE_TYPE = 1, /**< inquire EXODUS II file type*/ EX_INQ_API_VERS = 2, /**< inquire API version number */ EX_INQ_DB_VERS = 3, /**< inquire database version number */ EX_INQ_TITLE = 4, /**< inquire database title */ EX_INQ_DIM = 5, /**< inquire number of dimensions */ EX_INQ_NODES = 6, /**< inquire number of nodes */ EX_INQ_ELEM = 7, /**< inquire number of elements */ EX_INQ_ELEM_BLK = 8, /**< inquire number of element blocks */ EX_INQ_NODE_SETS = 9, /**< inquire number of node sets*/ EX_INQ_NS_NODE_LEN = 10, /**< inquire length of node set node list */ EX_INQ_SIDE_SETS = 11, /**< inquire number of side sets*/ EX_INQ_SS_NODE_LEN = 12, /**< inquire length of side set node list */ EX_INQ_SS_ELEM_LEN = 13, /**< inquire length of side set element list */ EX_INQ_QA = 14, /**< inquire number of QA records */ EX_INQ_INFO = 15, /**< inquire number of info records */ EX_INQ_TIME = 16, /**< inquire number of time steps in the database */ EX_INQ_EB_PROP = 17, /**< inquire number of element block properties */ EX_INQ_NS_PROP = 18, /**< inquire number of node set properties */ EX_INQ_SS_PROP = 19, /**< inquire number of side set properties */ EX_INQ_NS_DF_LEN = 20, /**< inquire length of node set distribution factor list*/ EX_INQ_SS_DF_LEN = 21, /**< inquire length of side set distribution factor list*/ EX_INQ_LIB_VERS = 22, /**< inquire API Lib vers number*/ EX_INQ_EM_PROP = 23, /**< inquire number of element map properties */ EX_INQ_NM_PROP = 24, /**< inquire number of node map properties */ EX_INQ_ELEM_MAP = 25, /**< inquire number of element maps */ EX_INQ_NODE_MAP = 26, /**< inquire number of node maps*/ EX_INQ_EDGE = 27, /**< inquire number of edges */ EX_INQ_EDGE_BLK = 28, /**< inquire number of edge blocks */ EX_INQ_EDGE_SETS = 29, /**< inquire number of edge sets */ EX_INQ_ES_LEN = 30, /**< inquire length of concat edge set edge list */ EX_INQ_ES_DF_LEN = 31, /**< inquire length of concat edge set dist factor list*/ EX_INQ_EDGE_PROP = 32, /**< inquire number of properties stored per edge block */ EX_INQ_ES_PROP = 33, /**< inquire number of properties stored per edge set */ EX_INQ_FACE = 34, /**< inquire number of faces */ EX_INQ_FACE_BLK = 35, /**< inquire number of face blocks */ EX_INQ_FACE_SETS = 36, /**< inquire number of face sets */ EX_INQ_FS_LEN = 37, /**< inquire length of concat face set face list */ EX_INQ_FS_DF_LEN = 38, /**< inquire length of concat face set dist factor list*/ EX_INQ_FACE_PROP = 39, /**< inquire number of properties stored per face block */ EX_INQ_FS_PROP = 40, /**< inquire number of properties stored per face set */ EX_INQ_ELEM_SETS = 41, /**< inquire number of element sets */ EX_INQ_ELS_LEN = 42, /**< inquire length of concat element set element list */ EX_INQ_ELS_DF_LEN = 43, /**< inquire length of concat element set dist factor list*/ EX_INQ_ELS_PROP = 44, /**< inquire number of properties stored per elem set */ EX_INQ_EDGE_MAP = 45, /**< inquire number of edge maps */ EX_INQ_FACE_MAP = 46, /**< inquire number of face maps */ EX_INQ_COORD_FRAMES = 47, /**< inquire number of coordinate frames */ EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH = 48, /**< inquire size of MAX_NAME_LENGTH dimension on database */ EX_INQ_DB_MAX_USED_NAME_LENGTH = 49, /**< inquire size of MAX_NAME_LENGTH dimension on database */ EX_INQ_MAX_READ_NAME_LENGTH = 50, /**< inquire client-specified max size of returned names */ EX_INQ_DB_FLOAT_SIZE = 51, /**< inquire size of floating-point values stored on database */ EX_INQ_NUM_CHILD_GROUPS= 52, /**< inquire number of groups contained in this (exoid) group */ EX_INQ_GROUP_PARENT = 53, /**< inquire id of parent of this (exoid) group; returns exoid if at root */ EX_INQ_GROUP_ROOT = 54, /**< inquire id of root group "/" of this (exoid) group; returns exoid if at root */ EX_INQ_GROUP_NAME_LEN = 55, /**< inquire length of name of group exoid */ EX_INQ_GROUP_NAME = 56, /**< inquire name of group exoid. "/" returned for root group */ EX_INQ_FULL_GROUP_NAME_LEN = 57, /**< inquire length of full path name of this (exoid) group */ EX_INQ_FULL_GROUP_NAME = 58, /**< inquire full "/"-separated path name of this (exoid) group */ EX_INQ_INVALID = -1}; typedef enum ex_inquiry ex_inquiry; /* Options */ /** * \defgroup FileOptions Variables controlling the compression, name size, and integer size. *@{ */ /* Modes for ex_open */ /*! \sa ex_set_option() */ enum ex_option_type { EX_OPT_MAX_NAME_LENGTH = 1, EX_OPT_COMPRESSION_TYPE, /* Currently not used. GZip by default */ EX_OPT_COMPRESSION_LEVEL, /* 0 (disabled/fastest) ... 9 (best/slowest) */ EX_OPT_COMPRESSION_SHUFFLE, /* 0 (disabled); 1 (enabled) */ EX_OPT_INTEGER_SIZE_API, /* See *_INT64_* values above */ EX_OPT_INTEGER_SIZE_DB /* (query only) */ }; typedef enum ex_option_type ex_option_type; /*@}*/ enum ex_entity_type { EX_NODAL = 14, /**< nodal "block" for variables*/ EX_NODE_BLOCK = 14, /**< alias for EX_NODAL */ EX_NODE_SET = 2, /**< node set property code */ EX_EDGE_BLOCK = 6, /**< edge block property code */ EX_EDGE_SET = 7, /**< edge set property code */ EX_FACE_BLOCK = 8, /**< face block property code */ EX_FACE_SET = 9, /**< face set property code */ EX_ELEM_BLOCK = 1, /**< element block property code*/ EX_ELEM_SET = 10, /**< face set property code */ EX_SIDE_SET = 3, /**< side set property code */ EX_ELEM_MAP = 4, /**< element map property code */ EX_NODE_MAP = 5, /**< node map property code */ EX_EDGE_MAP = 11, /**< edge map property code */ EX_FACE_MAP = 12, /**< face map property code */ EX_GLOBAL = 13, /**< global "block" for variables*/ EX_COORDINATE = 15, /**< kluge so some internal wrapper functions work */ EX_INVALID = -1}; typedef enum ex_entity_type ex_entity_type; /** * ex_opts() function codes - codes are OR'ed into exopts */ enum ex_options { EX_DEFAULT = 0, EX_VERBOSE = 1, /**< verbose mode message flag */ EX_DEBUG = 2, /**< debug mode def */ EX_ABORT = 4, /**< abort mode flag def */ EX_NULLVERBOSE = 8 /**< verbose mode for null entity detection warning */ }; typedef enum ex_options ex_options; /** The value used to indicate that an entity (block, nset, sset) has not had its id set to a valid value */ #define EX_INVALID_ID -1 /** * \defgroup StringLengths maximum string lengths; * constants that are used as netcdf dimensions must be of type long * @{ */ /** Maximum length of QA record, element type name */ #define MAX_STR_LENGTH 32L /** Maximum length of an entity name, attribute name, variable name */ #define MAX_NAME_LENGTH MAX_STR_LENGTH /** Maximum length of the database title or an information record */ #define MAX_LINE_LENGTH 80L /** Maximum length of an error message passed to ex_err() function. Typically, internal use only */ #define MAX_ERR_LENGTH 256 /* @} */ /** Specifies that this argument is the id of an entity: element block, nodeset, sideset, ... */ typedef int64_t ex_entity_id; /** The mechanism for passing double/float and int/int64_t both use a void*; to avoid some confusion as to whether a function takes an integer or a float/double, the following typedef is used for the integer argument */ typedef void void_int; /** * \defgroup APIStructs Structures used by external API functions. * @{ */ typedef struct ex_init_params { char title[MAX_LINE_LENGTH + 1]; int64_t num_dim; int64_t num_nodes; int64_t num_edge; int64_t num_edge_blk; int64_t num_face; int64_t num_face_blk; int64_t num_elem; int64_t num_elem_blk; int64_t num_node_sets; int64_t num_edge_sets; int64_t num_face_sets; int64_t num_side_sets; int64_t num_elem_sets; int64_t num_node_maps; int64_t num_edge_maps; int64_t num_face_maps; int64_t num_elem_maps; } ex_init_params; typedef struct ex_block { int64_t id; ex_entity_type type; char topology[MAX_STR_LENGTH+1]; int64_t num_entry; int64_t num_nodes_per_entry; int64_t num_edges_per_entry; int64_t num_faces_per_entry; int64_t num_attribute; } ex_block; typedef struct ex_set { int64_t id; ex_entity_type type; int64_t num_entry; int64_t num_distribution_factor; void_int* entry_list; void_int* extra_list; void* distribution_factor_list; } ex_set; typedef struct ex_block_params { void_int* edge_blk_id; char** edge_type; int* num_edge_this_blk; int* num_nodes_per_edge; int* num_attr_edge; void_int* face_blk_id; char** face_type; int* num_face_this_blk; int* num_nodes_per_face; int* num_attr_face; void_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 { void_int* sets_ids; void_int* num_entries_per_set; void_int* num_dist_per_set; void_int* sets_entry_index; void_int* sets_dist_index; void_int* sets_entry_list; void_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 num_face; int num_elem; int num_nset; int num_eset; int num_fset; int num_sset; int num_elset; int* edge_var_tab; int* face_var_tab; int* elem_var_tab; int* nset_var_tab; int* eset_var_tab; int* fset_var_tab; int* sset_var_tab; int* elset_var_tab; } ex_var_params; /* @} */ #ifndef EXODUS_EXPORT #define EXODUS_EXPORT extern #endif /* EXODUS_EXPORT */ /* routines for file initialization i/o */ EXODUS_EXPORT int ex_close (int exoid); EXODUS_EXPORT int ex_copy (int in_exoid, int out_exoid); #define ex_create(path, mode, comp_ws, io_ws) ex_create_int(path, mode, comp_ws, io_ws, EX_API_VERS_NODOT) EXODUS_EXPORT int ex_create_int (const char *path, int cmode, int *comp_ws, int *io_ws, int my_version); EXODUS_EXPORT int ex_create_group (int parent_id, const char *group_name); EXODUS_EXPORT int ex_get_group_id(int exoid, const char *group_name, int *group_id); EXODUS_EXPORT int ex_get_group_ids(int exoid, int *num_children, int *child_ids); EXODUS_EXPORT int ex_get_all_times (int exoid, void *time_values); EXODUS_EXPORT int ex_get_coord_names (int exoid, char **coord_names); EXODUS_EXPORT int ex_get_coord (int exoid, void *x_coor, void *y_coor, void *z_coor); EXODUS_EXPORT int ex_get_n_coord (int exoid, int64_t start_node_num, int64_t num_nodes, void *x_coor, void *y_coor, void *z_coor); EXODUS_EXPORT int ex_get_partial_coord (int exoid, int64_t start_node_num, int64_t num_nodes, void *x_coor, void *y_coor, void *z_coor); EXODUS_EXPORT int ex_get_ids (int exoid, ex_entity_type obj_type, void_int *ids); EXODUS_EXPORT int ex_get_coordinate_frames(int exoid, int *nframes, void_int *cf_ids, void* pt_coordinates, char* tags); EXODUS_EXPORT int ex_get_glob_vars (int exoid, int time_step, int num_glob_vars, void *glob_var_vals); EXODUS_EXPORT int ex_get_glob_var_time (int exoid, int glob_var_index, int beg_time_step, int end_time_step, void *glob_var_vals); EXODUS_EXPORT int ex_get_info (int exoid, char **info); EXODUS_EXPORT int ex_put_init_ext (int exoid, const ex_init_params *param); EXODUS_EXPORT int ex_get_init_ext (int exoid, ex_init_params *param); EXODUS_EXPORT int ex_get_init (int exoid, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets); EXODUS_EXPORT int ex_put_init (int exoid, const char *title, int64_t num_dim, int64_t num_nodes, int64_t num_elem, int64_t num_elem_blk, int64_t num_node_sets, int64_t num_side_sets); EXODUS_EXPORT int ex_get_map_param (int exoid, int *num_node_maps, int *num_elem_maps); EXODUS_EXPORT int ex_get_name (int exoid, ex_entity_type obj_type, ex_entity_id entity_id, char *name); EXODUS_EXPORT int ex_get_names (int exoid, ex_entity_type obj_type, char **names); EXODUS_EXPORT int ex_get_nset_var_tab (int exoid, int num_nodesets, int num_nset_var, int *nset_var_tab); EXODUS_EXPORT int ex_get_n_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, void *nodal_var_vals); EXODUS_EXPORT int ex_get_partial_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, void *nodal_var_vals); EXODUS_EXPORT int ex_get_prop_array (int exoid, ex_entity_type obj_type, const char *prop_name, void_int *values); EXODUS_EXPORT int ex_get_prop (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, void_int *value); EXODUS_EXPORT int ex_get_partial_num_map (int exoid, ex_entity_type map_type, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, void_int *elem_map); EXODUS_EXPORT int ex_get_prop_names (int exoid, ex_entity_type obj_type, char **prop_names); EXODUS_EXPORT int ex_get_qa (int exoid, char *qa_record[][4]); EXODUS_EXPORT int ex_get_time (int exoid, int time_step, void *time_value); EXODUS_EXPORT int ex_get_variable_names (int exoid, ex_entity_type obj_type, int num_vars, char *var_names[]); EXODUS_EXPORT int ex_get_variable_name (int exoid, ex_entity_type obj_type, int var_num, char *var_name); EXODUS_EXPORT int ex_get_variable_param (int exoid, ex_entity_type obj_type, int *num_vars); EXODUS_EXPORT int ex_get_object_truth_vector (int exoid, ex_entity_type var_type, ex_entity_id object_id, int num_var, int *var_vector); EXODUS_EXPORT int ex_get_truth_table (int exoid, ex_entity_type obj_type, int num_blk, int num_var, int *var_tab); #define ex_open(path, mode, comp_ws, io_ws, version) ex_open_int(path, mode, comp_ws, io_ws, version, EX_API_VERS_NODOT) EXODUS_EXPORT int ex_open_int (const char *path, int mode, int *comp_ws, int *io_ws, float *version, int my_version); EXODUS_EXPORT int ex_put_attr_param (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int num_attrs); EXODUS_EXPORT int ex_get_attr_param (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int *num_attrs); EXODUS_EXPORT int ex_put_all_var_param (int exoid, int num_g, int num_n, int num_e, int *elem_var_tab, int num_m, int *nset_var_tab, int num_s, int *sset_var_tab); EXODUS_EXPORT int ex_put_concat_elem_block (int exoid, const void_int* elem_blk_id, char *elem_type[], const void_int* num_elem_this_blk, const void_int* num_nodes_per_elem, const void_int* num_attr, int define_maps); EXODUS_EXPORT int ex_put_coord_names (int exoid, char *coord_names[]); EXODUS_EXPORT int ex_put_coord (int exoid, const void *x_coor, const void *y_coor, const void *z_coor); EXODUS_EXPORT int ex_put_n_coord (int exoid, int64_t start_node_num, int64_t num_nodes, const void *x_coor, const void *y_coor, const void *z_coor); EXODUS_EXPORT int ex_put_partial_coord (int exoid, int64_t start_node_num, int64_t num_nodes, const void *x_coor, const void *y_coor, const void *z_coor); EXODUS_EXPORT int ex_put_id_map(int exoid, ex_entity_type obj_type, const void_int *map); EXODUS_EXPORT int ex_put_partial_id_map(int exoid, ex_entity_type obj_type, int64_t start_entity_num, int64_t num_entities, const void_int *map); EXODUS_EXPORT int ex_put_n_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *map); EXODUS_EXPORT int ex_put_n_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *map); EXODUS_EXPORT int ex_put_partial_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *map); EXODUS_EXPORT int ex_put_partial_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *map); EXODUS_EXPORT int ex_get_id_map(int exoid, ex_entity_type obj_type, void_int *map); EXODUS_EXPORT int ex_get_partial_id_map (int exoid, ex_entity_type map_type, int64_t start_entity_num, int64_t num_entities, void_int* map); EXODUS_EXPORT int ex_put_coordinate_frames(int exoid, int nframes, const void_int *cf_ids, void* pt_coordinates, const char* tags); EXODUS_EXPORT int ex_put_info (int exoid, int num_info, char *info[]); EXODUS_EXPORT int ex_put_map_param (int exoid, int num_node_maps, int num_elem_maps); EXODUS_EXPORT int ex_put_name (int exoid, ex_entity_type obj_type, ex_entity_id entity_id, const char *name); EXODUS_EXPORT int ex_put_names (int exoid, ex_entity_type obj_type, char *names[]); EXODUS_EXPORT int ex_put_n_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, const void *attrib ); EXODUS_EXPORT int ex_put_partial_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, const void *attrib ); EXODUS_EXPORT int ex_put_prop (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, ex_entity_id value); EXODUS_EXPORT int ex_put_prop_array (int exoid, ex_entity_type obj_type, const char *prop_name, const void_int *values); EXODUS_EXPORT int ex_put_prop_names (int exoid, ex_entity_type obj_type, int num_props, char **prop_names); EXODUS_EXPORT int ex_put_qa (int exoid, int num_qa_records, char* qa_record[][4]); EXODUS_EXPORT int ex_put_time (int exoid, int time_step, const void *time_value); EXODUS_EXPORT int ex_put_variable_name (int exoid, ex_entity_type obj_type, int var_num, const char *var_name); EXODUS_EXPORT int ex_put_variable_names (int exoid, ex_entity_type obj_type, int num_vars, char* var_names[]); EXODUS_EXPORT int ex_put_variable_param (int exoid, ex_entity_type obj_type, int num_vars); EXODUS_EXPORT int ex_put_truth_table (int exoid, ex_entity_type obj_type, int num_blk, int num_var, int *var_tab); EXODUS_EXPORT int ex_update (int exoid); EXODUS_EXPORT int ex_get_num_props (int exoid, ex_entity_type obj_type); EXODUS_EXPORT int ex_large_model(int exoid); EXODUS_EXPORT size_t ex_header_size(int exoid); EXODUS_EXPORT void ex_err(const char *module_name, const char *message, int err_num); EXODUS_EXPORT void ex_get_err(const char** msg, const char** func, int* errcode); EXODUS_EXPORT int ex_opts(int options); EXODUS_EXPORT int ex_inquire(int exoid, int inquiry, void_int*, float*, char*); EXODUS_EXPORT int64_t ex_inquire_int(int exoid, int inquiry); EXODUS_EXPORT int ex_int64_status(int exoid); EXODUS_EXPORT int ex_set_int64_status(int exoid, int mode); /** Note that the max name length setting is global at this time; not specific * to a particular database; however, the exoid option is passed to give * flexibility in the future to implement this on a database-by-database basis. */ EXODUS_EXPORT int ex_set_max_name_length(int exoid, int length); EXODUS_EXPORT int ex_set_option(int exoid, ex_option_type option, int option_value); /* Write Node Edge Face or Element Number Map */ EXODUS_EXPORT int ex_put_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_id, const void_int *map); /* Read Number Map */ EXODUS_EXPORT int ex_get_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_id, void_int *map); /* Write Edge Face or Element Block Parameters */ EXODUS_EXPORT int ex_put_block(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const char *entry_descrip, int64_t num_entries_this_blk, int64_t num_nodes_per_entry, int64_t num_edges_per_entry, int64_t num_faces_per_entry, int64_t num_attr_per_entry); /*! \deprecated Use ex_get_block_param() */ EXODUS_EXPORT int ex_get_block(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char *elem_type, void_int *num_entries_this_blk, void_int *num_nodes_per_entry, void_int *num_edges_per_entry, void_int *num_faces_per_entry, void_int *num_attr_per_entry); /* Read Edge Face or Element Block Parameters */ EXODUS_EXPORT int ex_get_block_param(int exoid, ex_block *block); EXODUS_EXPORT int ex_put_block_param(int exoid, const ex_block block); /* Write All Edge Face and Element Block Parameters */ EXODUS_EXPORT int ex_put_concat_all_blocks(int exoid, const ex_block_params *param); EXODUS_EXPORT int ex_put_entity_count_per_polyhedra(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const int *entity_counts); EXODUS_EXPORT int ex_get_entity_count_per_polyhedra(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int *entity_counts); /* Write Edge Face or Element Block Connectivity */ EXODUS_EXPORT int ex_put_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void_int *node_conn, const void_int *elem_edge_conn, const void_int *elem_face_conn); /* Read Edge Face or Element Block Connectivity */ EXODUS_EXPORT int ex_get_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, void_int *nodeconn, void_int *edgeconn, void_int *faceconn); /* Read Partial Edge Face or Element Block Connectivity */ EXODUS_EXPORT int ex_get_n_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_num, int64_t num_ent, void_int *nodeconn, void_int *edgeconn, void_int *faceconn); EXODUS_EXPORT int ex_get_partial_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_num, int64_t num_ent, void_int *nodeconn, void_int *edgeconn, void_int *faceconn); /* Write Edge Face or Element Block Attributes */ EXODUS_EXPORT int ex_put_attr(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void *attrib); EXODUS_EXPORT int ex_put_partial_attr (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_entity, int64_t num_entity, const void *attrib); /* Read Edge Face or Element Block Attributes */ EXODUS_EXPORT int ex_get_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, void *attrib); EXODUS_EXPORT int ex_get_n_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, void *attrib); EXODUS_EXPORT int ex_get_partial_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, void *attrib); /* Write One Edge Face or Element Block Attribute */ EXODUS_EXPORT int ex_put_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int attrib_index, const void *attrib); /* Read One Edge Face or Element Block Attribute */ EXODUS_EXPORT int ex_get_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int attrib_index, void *attrib); /* Read One Edge Face or Element Block Attribute */ EXODUS_EXPORT int ex_get_n_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, void *attrib); EXODUS_EXPORT int ex_get_partial_one_attr(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, void *attrib); /* Write Edge Face or Element Block Attribute Names */ EXODUS_EXPORT int ex_put_attr_names(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char **names); /* Read Edge Face or Element Block Attribute Names */ EXODUS_EXPORT int ex_get_attr_names(int exoid, ex_entity_type obj_type, ex_entity_id obj_id, char **names); /* Write Node Edge Face or Side Set Parameters */ EXODUS_EXPORT int ex_put_set_param(int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t num_entries_in_set, int64_t num_dist_fact_in_set); /* Read Node Edge Face or Side Set Parameters */ EXODUS_EXPORT int ex_get_set_param(int exoid, ex_entity_type set_type, ex_entity_id set_id, void_int *num_entry_in_set, void_int *num_dist_fact_in_set); /* Write a Node Edge Face or Side Set */ EXODUS_EXPORT int ex_put_set(int exoid, ex_entity_type set_type, ex_entity_id set_id, const void_int *set_entry_list, const void_int *set_extra_list); EXODUS_EXPORT int ex_put_partial_set(int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t count, const void_int *set_entry_list, const void_int *set_extra_list); /* Read a Node Edge Face or Side Set */ EXODUS_EXPORT int ex_get_set(int exoid, ex_entity_type set_type, ex_entity_id set_id, void_int *set_entry_list, void_int *set_extra_list); /* Write Node Edge Face or Side Set Distribution Factors */ EXODUS_EXPORT int ex_put_set_dist_fact(int exoid, ex_entity_type set_type, ex_entity_id set_id, const void *set_dist_fact); /* Read Node Edge Face or Side Set Distribution Factors */ EXODUS_EXPORT int ex_get_set_dist_fact(int exoid, ex_entity_type set_type, ex_entity_id set_id, void *set_dist_fact); EXODUS_EXPORT int ex_get_partial_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t num_to_put, void *set_dist_fact); /* Write Concatenated Node Edge Face or Side Sets */ EXODUS_EXPORT int ex_put_concat_sets(int exoid, ex_entity_type set_type, const struct ex_set_specs *set_specs); /* Read Concatenated Node Edge Face or Side Sets */ EXODUS_EXPORT int ex_get_concat_sets(int exoid, ex_entity_type set_type, struct ex_set_specs *set_specs); /* Write Concatenated Node Edge Face or Side Sets */ EXODUS_EXPORT int ex_put_sets(int exoid, size_t set_count, const struct ex_set *sets); /* Read Concatenated Node Edge Face or Side Sets */ EXODUS_EXPORT int ex_get_sets(int exoid, size_t set_count, struct ex_set *sets); /* (MODIFIED) Write All Results Variables Parameters */ EXODUS_EXPORT int ex_put_all_var_param_ext(int exoid, const ex_var_params *vp); /* Write Edge Face or Element Variable Values on Blocks or Sets at a Time Step */ EXODUS_EXPORT int ex_put_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t num_entries_this_obj, const void *var_vals); /* Write Partial Edge Face or Element Variable Values on Blocks or Sets at a Time Step */ EXODUS_EXPORT int ex_put_n_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, const void *var_vals); EXODUS_EXPORT int ex_put_partial_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, const void *var_vals); /* Read Edge Face or Element Variable Values Defined On Blocks or Sets at a Time Step */ EXODUS_EXPORT int ex_get_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t num_entry_this_obj, void *var_vals); /* Read Partial Edge Face or Element Variable Values on Blocks or Sets at a Time Step */ EXODUS_EXPORT int ex_get_n_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, void *var_vals); EXODUS_EXPORT int ex_get_n_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, int64_t start_elem_num, int64_t num_elem, void *elem_var_vals); EXODUS_EXPORT int ex_get_partial_var(int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, void *var_vals); EXODUS_EXPORT int ex_get_partial_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, int64_t start_elem_num, int64_t num_elem, void *elem_var_vals); /* Read Edge Face or Element Variable Values Defined On Blocks or Sets Through Time */ EXODUS_EXPORT int ex_get_var_time(int exoid, ex_entity_type var_type, int var_index, int64_t id, int beg_time_step, int end_time_step, void *var_vals); EXODUS_EXPORT int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, void_int *side_sets_node_index, void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list); /* Can be replaced by ex_put_var ... */ EXODUS_EXPORT int ex_put_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t num_nodes, const void *nodal_var_vals); EXODUS_EXPORT int ex_put_n_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, const void *nodal_var_vals); EXODUS_EXPORT int ex_put_partial_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, const void *nodal_var_vals); EXODUS_EXPORT int ex_get_partial_elem_map (int exoid, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, void_int *elem_map); EXODUS_EXPORT int ex_put_partial_elem_map (int exoid, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, const void_int *elem_map); EXODUS_EXPORT int ex_put_partial_num_map (int exoid, ex_entity_type map_type, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, const void_int *map); EXODUS_EXPORT int ex_put_partial_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t num_to_put, const void *set_dist_fact); /* TODO */ EXODUS_EXPORT int ex_get_concat_side_set_node_count(int exoid, int *side_set_node_cnt_list); /* TODO */ EXODUS_EXPORT int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, void_int *side_set_node_list_len); /* TODO */ EXODUS_EXPORT int ex_get_side_set_node_count(int exoid, ex_entity_id side_set_id, int *side_set_node_cnt_list); /* TODO */ EXODUS_EXPORT int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *side_set_node_cnt_list, void_int *side_set_node_list); /* ======================================================================== Functions pulled from nemesis library and incorporated into exodus... */ /*============================================================================= * Initial Information Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_init_info(int exoid, /* NemesisI file ID */ int *num_proc, /* Number of processors */ int *num_proc_in_f, /* Number of procs in this file */ char *ftype ); EXODUS_EXPORT int ex_put_init_info(int exoid, /* NemesisI file ID */ int num_proc, /* Number of processors */ int num_proc_in_f, /* Number of procs in this file */ char *ftype ); EXODUS_EXPORT int ex_get_init_global(int exoid, /* NemesisI file ID */ void_int *num_nodes_g, /* Number of global FEM nodes */ void_int *num_elems_g, /* Number of global FEM elements */ void_int *num_elem_blks_g, /* Number of global elem blocks */ void_int *num_node_sets_g, /* Number of global node sets */ void_int *num_side_sets_g /* Number of global side sets */ ); EXODUS_EXPORT int ex_put_init_global(int exoid, /* NemesisI file ID */ int64_t num_nodes_g, /* Number of global FEM nodes */ int64_t num_elems_g, /* Number of global FEM elements */ int64_t num_elem_blks_g, /* Number of global elem blocks */ int64_t num_node_sets_g, /* Number of global node sets */ int64_t num_side_sets_g /* Number of global side sets */ ); /*============================================================================= * Loadbalance Parameter Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_loadbal_param(int exoid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal FEM nodes */ void_int *num_bor_nodes, /* Number of border FEM nodes */ void_int *num_ext_nodes, /* Number of external FEM nodes */ void_int *num_int_elems, /* Number of internal FEM elems */ void_int *num_bor_elems, /* Number of border FEM elems */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps, /* Number of elemental comm maps */ int processor /* Processor ID */ ); EXODUS_EXPORT int ex_put_loadbal_param(int exoid, /* NemesisI file ID */ int64_t num_int_nodes, /* Number of internal FEM nodes */ int64_t num_bor_nodes, /* Number of border FEM nodes */ int64_t num_ext_nodes, /* Number of external FEM nodes */ int64_t num_int_elems, /* Number of internal FEM elems */ int64_t num_bor_elems, /* Number of border FEM elems */ int64_t num_node_cmaps,/* Number of nodal comm maps */ int64_t num_elem_cmaps,/* Number of elemental comm maps */ int processor /* Processor ID */ ); EXODUS_EXPORT int ex_put_loadbal_param_cc(int exoid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal node IDs */ void_int *num_bor_nodes, /* Number of border node IDs */ void_int *num_ext_nodes, /* Number of external node IDs */ void_int *num_int_elems, /* Number of internal elem IDs */ void_int *num_bor_elems, /* Number of border elem IDs */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps /* Number of elem comm maps */ ); /*============================================================================= * NS, SS & EB Global Parameter Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_ns_param_global(int exoid, /* NetCDF/Exodus file ID */ void_int *ns_ids_glob, /* Global IDs of node sets */ void_int *ns_n_cnt_glob, /* Count of nodes in node sets */ void_int *ns_df_cnt_glob /* Count of dist. factors in ns */ ); EXODUS_EXPORT int ex_put_ns_param_global(int exoid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global node-set IDs */ void_int *global_n_cnts, /* Vector of node counts in node-sets */ void_int *global_df_cnts /* Vector of dist factor counts in node-sets */ ); EXODUS_EXPORT int ex_get_ss_param_global(int exoid, /* NetCDF/Exodus file ID */ void_int *ss_ids_glob, /* Global side-set IDs */ void_int *ss_s_cnt_glob, /* Global side count */ void_int *ss_df_cnt_glob /* Global dist. factor count */ ); EXODUS_EXPORT int ex_put_ss_param_global(int exoid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global side-set IDs */ void_int *global_el_cnts, /* Vector of element/side */ /* counts in each side set */ void_int *global_df_cnts /* Vector of dist. factor */ /* counts in each side set */ ); EXODUS_EXPORT int ex_get_eb_info_global(int exoid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ); EXODUS_EXPORT int ex_put_eb_info_global(int exoid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ); /*============================================================================= * NS, SS & EB Subset Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_n_side_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to read */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to read */ void_int *side_set_elem_list, /* List of element IDs */ void_int *side_set_side_list /* List of side IDs */ ); EXODUS_EXPORT int ex_put_n_side_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to write */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to write */ const void_int *side_set_elem_list, /* List of element IDs */ const void_int *side_set_side_list /* List of side IDs */ ); EXODUS_EXPORT int ex_get_n_side_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *side_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_put_n_side_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *side_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_get_n_node_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start reading at */ int64_t num_node, /* Number of nodes to read */ void_int *node_set_node_list /* List of nodes in node set */ ); EXODUS_EXPORT int ex_put_n_node_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start writing at */ int64_t num_node, /* Number of nodes to write */ const void_int *node_set_node_list /* List of nodes in node set */ ); EXODUS_EXPORT int ex_get_n_node_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *node_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_put_n_node_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *node_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_get_n_elem_conn (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void_int *connect /* Connectivity vector */ ); EXODUS_EXPORT int ex_put_n_elem_conn (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ const void_int *connect /* Connectivity vector */ ); EXODUS_EXPORT int ex_get_n_elem_attr (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void *attrib /* Attribute */ ); EXODUS_EXPORT int ex_put_n_elem_attr (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ void *attrib /* Attribute */ ); EXODUS_EXPORT int ex_get_partial_side_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to read */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to read */ void_int *side_set_elem_list, /* List of element IDs */ void_int *side_set_side_list /* List of side IDs */ ); EXODUS_EXPORT int ex_put_partial_side_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to write */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to write */ const void_int *side_set_elem_list, /* List of element IDs */ const void_int *side_set_side_list /* List of side IDs */ ); EXODUS_EXPORT int ex_get_partial_side_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *side_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_put_partial_side_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *side_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_get_partial_node_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start reading at */ int64_t num_node, /* Number of nodes to read */ void_int *node_set_node_list /* List of nodes in node set */ ); EXODUS_EXPORT int ex_put_partial_node_set(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start writing at */ int64_t num_node, /* Number of nodes to write */ const void_int *node_set_node_list /* List of nodes in node set */ ); EXODUS_EXPORT int ex_get_partial_node_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *node_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_put_partial_node_set_df(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *node_set_df /* Distribution factors */ ); EXODUS_EXPORT int ex_get_partial_elem_conn (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void_int *connect /* Connectivity vector */ ); EXODUS_EXPORT int ex_put_partial_elem_conn (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ const void_int *connect /* Connectivity vector */ ); EXODUS_EXPORT int ex_get_partial_elem_attr (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void *attrib /* Attribute */ ); EXODUS_EXPORT int ex_put_partial_elem_attr (int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ void *attrib /* Attribute */ ); EXODUS_EXPORT int ex_get_elem_type(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ char *elem_type /* The name of the element type */ ); /*============================================================================= * Variable Routines *===========================================================================*/ EXODUS_EXPORT int ex_put_elem_var_slab (int exoid, /* NetCDF/Exodus file ID */ int time_step, /* time index */ int elem_var_index, /* elemental variable index */ ex_entity_id elem_blk_id, /* elemental block id */ int64_t start_pos, /* Starting position to write to */ int64_t num_vals, /* Number of elements to write */ void *elem_var_vals /* variable values */ ); EXODUS_EXPORT int ex_put_nodal_var_slab(int exoid, /* NetCDF/Exodus file ID */ int time_step, /* The time step index */ int nodal_var_index, /* Nodal variable index */ int64_t start_pos, /* Start position for write */ int64_t num_vals, /* Number of nodal variables */ void *nodal_var_vals /* Nodal variable values */ ); /*============================================================================= * Number Map Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_n_elem_num_map (int exoid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ void_int *elem_map /* element map numbers */ ); EXODUS_EXPORT int ex_get_n_node_num_map(int exoid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ void_int *node_map /* vector for node map */ ); EXODUS_EXPORT int ex_get_partial_elem_num_map (int exoid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ void_int *elem_map /* element map numbers */ ); EXODUS_EXPORT int ex_get_partial_node_num_map(int exoid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ void_int *node_map /* vector for node map */ ); EXODUS_EXPORT int ex_get_processor_node_maps(int exoid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* Processor IDs */ ); EXODUS_EXPORT int ex_put_processor_node_maps(int exoid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* This processor ID */ ); EXODUS_EXPORT int ex_get_processor_elem_maps(int exoid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal element IDs */ void_int *elem_mapb, /* Border element IDs */ int processor /* Processor ID */ ); EXODUS_EXPORT int ex_put_processor_elem_maps(int exoid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal FEM element IDs */ void_int *elem_mapb, /* Border FEM element IDs */ int processor /* This processor ID */ ); /*============================================================================= * Communications Maps Routines *===========================================================================*/ EXODUS_EXPORT int ex_get_cmap_params(int exoid, /* NetCDF/Exodus file ID */ void_int *node_cmap_ids, /* Nodal comm. map IDs */ void_int *node_cmap_node_cnts, /* Number of nodes in each map */ void_int *elem_cmap_ids, /* Elemental comm. map IDs */ void_int *elem_cmap_elem_cnts, /* Number of elems in each map */ int processor /* This processor ID */ ); EXODUS_EXPORT int ex_put_cmap_params(int exoid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts,/* Nodes in nodal comm */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts,/* Elems in elemental comm */ int64_t processor /* This processor ID */ ); EXODUS_EXPORT int ex_put_cmap_params_cc(int exoid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts, /* Nodes in nodal comm */ void_int *node_proc_ptrs, /* Pointer into array for */ /* node maps */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts, /* Elems in elemental comm */ void_int *elem_proc_ptrs /* Pointer into array for */ /* elem maps */ ); EXODUS_EXPORT int ex_get_node_cmap(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); EXODUS_EXPORT int ex_put_node_cmap(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Nodal comm map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); EXODUS_EXPORT int ex_get_elem_cmap(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Element IDs */ void_int *side_ids, /* Element side IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); EXODUS_EXPORT int ex_put_elem_cmap(int exoid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Vector of element IDs */ void_int *side_ids, /* Vector of side IDs */ void_int *proc_ids, /* Vector of processor IDs */ int processor /* This processor ID */ ); /* ======================================================================== * Deprecated functiona */ EXODUS_EXPORT int ex_get_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t num_nodes, void *nodal_var_vals); EXODUS_EXPORT int ex_get_nodal_var_time (int exoid, int nodal_var_index, int64_t node_number, int beg_time_step, int end_time_step, void *nodal_var_vals); /* Use ex_get_concat_sets() */ EXODUS_EXPORT int ex_get_concat_node_sets (int exoid, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_df_per_set, void_int *node_sets_node_index, void_int *node_sets_df_index, void_int *node_sets_node_list, void *node_sets_dist_fact); EXODUS_EXPORT int ex_get_concat_side_sets (int exoid, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, void *side_sets_dist_fact); EXODUS_EXPORT int ex_get_elem_attr (int exoid, ex_entity_id elem_blk_id, void *attrib); EXODUS_EXPORT int ex_get_elem_attr_names (int exoid, ex_entity_id elem_blk_id, char **names); EXODUS_EXPORT int ex_get_elem_blk_ids (int exoid, void_int *ids); EXODUS_EXPORT int ex_get_elem_block (int exoid, ex_entity_id elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr); EXODUS_EXPORT int ex_get_elem_conn (int exoid, ex_entity_id elem_blk_id, void_int *connect); EXODUS_EXPORT int ex_get_elem_map (int exoid, ex_entity_id map_id, void_int *elem_map); EXODUS_EXPORT int ex_get_elem_num_map (int exoid, void_int *elem_map); EXODUS_EXPORT int ex_get_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, void *elem_var_vals); EXODUS_EXPORT int ex_get_elem_var_tab (int exoid, int num_elem_blk, int num_elem_var, int *elem_var_tab); EXODUS_EXPORT int ex_get_elem_var_time (int exoid, int elem_var_index, int64_t elem_number, int beg_time_step, int end_time_step, void *elem_var_vals); EXODUS_EXPORT int ex_get_map (int exoid, void_int *elem_map); EXODUS_EXPORT int ex_get_node_map (int exoid, ex_entity_id map_id, void_int *node_map); EXODUS_EXPORT int ex_get_node_num_map (int exoid, void_int *node_map); EXODUS_EXPORT int ex_get_node_set_param (int exoid, ex_entity_id node_set_id, void_int *num_nodes_in_set, void_int *num_df_in_set); EXODUS_EXPORT int ex_get_node_set (int exoid, ex_entity_id node_set_id, void_int *node_set_node_list); EXODUS_EXPORT int ex_get_node_set_dist_fact (int exoid, ex_entity_id node_set_id, void *node_set_dist_fact); EXODUS_EXPORT int ex_get_node_set_ids (int exoid, void_int *ids); EXODUS_EXPORT int ex_get_nset_var_tab (int exoid, int num_nodesets, int num_nset_var, int *nset_var_tab); EXODUS_EXPORT int ex_get_nset_var (int exoid, int time_step, int nset_var_index, ex_entity_id nset_id, int64_t num_node_this_nset, void *nset_var_vals); EXODUS_EXPORT int ex_get_one_elem_attr (int exoid, ex_entity_id elem_blk_id, int attrib_index, void *attrib); EXODUS_EXPORT int ex_get_side_set (int exoid, ex_entity_id side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list); EXODUS_EXPORT int ex_get_side_set_dist_fact (int exoid, ex_entity_id side_set_id, void *side_set_dist_fact); EXODUS_EXPORT int ex_get_side_set_ids (int exoid, void_int *ids); EXODUS_EXPORT int ex_get_side_set_param (int exoid, ex_entity_id side_set_id, void_int *num_side_in_set, void_int *num_dist_fact_in_set); EXODUS_EXPORT int ex_get_sset_var (int exoid, int time_step, int sset_var_index, ex_entity_id sset_id, int64_t num_side_this_sset, void *sset_var_vals); EXODUS_EXPORT int ex_get_sset_var_tab (int exoid, int num_sidesets, int num_sset_var, int *sset_var_tab); EXODUS_EXPORT int ex_get_var_names (int exoid, const char *var_type, int num_vars, char *var_names[]); EXODUS_EXPORT int ex_get_var_name (int exoid, const char *var_type, int var_num, char *var_name); EXODUS_EXPORT int ex_get_var_param (int exoid, const char *var_type, int *num_vars); EXODUS_EXPORT int ex_get_var_tab (int exoid, const char *var_type, int num_blk, int num_var, int *var_tab); EXODUS_EXPORT int ex_put_concat_node_sets (int exoid, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_df_index, void_int *node_sets_node_list, void *node_sets_dist_fact); EXODUS_EXPORT int ex_put_concat_side_sets (int exoid, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, void *side_sets_dist_fact); EXODUS_EXPORT int ex_put_concat_var_param (int exoid, int num_g, int num_n, int num_e, int num_elem_blk, int *elem_var_tab); EXODUS_EXPORT int ex_put_elem_attr_names(int exoid, ex_entity_id elem_blk_id, char *names[]); EXODUS_EXPORT int ex_put_elem_attr (int exoid, ex_entity_id elem_blk_id, const void *attrib); EXODUS_EXPORT int ex_put_elem_block (int exoid, ex_entity_id elem_blk_id, const char *elem_type, int64_t num_elem_this_blk, int64_t num_nodes_per_elem, int64_t num_attr); EXODUS_EXPORT int ex_put_elem_conn (int exoid, ex_entity_id elem_blk_id, const void_int *connect); EXODUS_EXPORT int ex_put_elem_map (int exoid, ex_entity_id map_id, const void_int *elem_map); EXODUS_EXPORT int ex_put_elem_num_map (int exoid, const void_int *elem_map); EXODUS_EXPORT int ex_put_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, const void *elem_var_vals); EXODUS_EXPORT int ex_put_elem_var_tab (int exoid, int num_elem_blk, int num_elem_var, int *elem_var_tab); EXODUS_EXPORT int ex_put_glob_vars (int exoid, int time_step, int num_glob_vars, const void *glob_var_vals); EXODUS_EXPORT int ex_put_map (int exoid, const void_int *elem_map); EXODUS_EXPORT int ex_put_node_map (int exoid, ex_entity_id map_id, const void_int *node_map); EXODUS_EXPORT int ex_put_node_num_map (int exoid, const void_int *node_map); EXODUS_EXPORT int ex_put_node_set (int exoid, ex_entity_id node_set_id, const void_int *node_set_node_list); EXODUS_EXPORT int ex_put_node_set_dist_fact (int exoid, ex_entity_id node_set_id, const void *node_set_dist_fact); EXODUS_EXPORT int ex_put_node_set_param (int exoid, ex_entity_id node_set_id, int64_t num_nodes_in_set, int64_t num_dist_in_set); EXODUS_EXPORT int ex_put_nset_var (int exoid, int time_step, int nset_var_index, ex_entity_id nset_id, int64_t num_nodes_this_nset, const void *nset_var_vals); EXODUS_EXPORT int ex_put_nset_var_tab (int exoid, int num_nset, int num_nset_var, int *nset_var_tab); EXODUS_EXPORT int ex_put_one_elem_attr (int exoid, ex_entity_id elem_blk_id, int attrib_index, const void *attrib); EXODUS_EXPORT int ex_put_side_set (int exoid, ex_entity_id side_set_id, const void_int *side_set_elem_list, const void_int *side_set_side_list); EXODUS_EXPORT int ex_put_side_set_dist_fact (int exoid, ex_entity_id side_set_id, const void *side_set_dist_fact); EXODUS_EXPORT int ex_put_side_set_param (int exoid, ex_entity_id side_set_id, int64_t num_side_in_set, int64_t num_dist_fact_in_set); EXODUS_EXPORT int ex_put_sset_var (int exoid, int time_step, int sset_var_index, ex_entity_id sset_id, int64_t num_faces_this_sset, const void *sset_var_vals); EXODUS_EXPORT int ex_put_sset_var_tab (int exoid, int num_sset, int num_sset_var, int *sset_var_tab); EXODUS_EXPORT int ex_put_var_name (int exoid, const char *var_type, int var_num, const char *var_name); EXODUS_EXPORT int ex_put_var_names (int exoid, const char *var_type, int num_vars, char *var_names[]); EXODUS_EXPORT int ex_put_var_param (int exoid, const char *var_type, int num_vars); EXODUS_EXPORT int ex_put_var_tab (int exoid, const char *var_type, int num_blk, int num_var, int *var_tab); /* End of Deprecated functions and their replacements * ======================================================================== */ /* ERROR CODE DEFINITIONS AND STORAGE */ extern int exerrval; /**< shared error return value */ extern int exoptval; /**< error reporting flag (default is quiet) */ char* ex_name_of_object(ex_entity_type obj_type); ex_entity_type ex_var_type_to_ex_entity_type(char var_type); /* Should be internal use only, but was in external include file for nemesis and some codes are using the function */ int ex_get_idx(int neid, /* NetCDF/Exodus file ID */ const char *ne_var_name, /* Nemesis index variable name */ int64_t *index, /* array of length 2 to hold results */ int pos /* position of this proc/cmap in index */ ); #ifdef __cplusplus } /* close brackets on extern "C" declaration */ #endif /** * \defgroup ErrorReturnCodes Exodus error return codes - exerrval return values * @{ */ #define EX_MEMFAIL 1000 /**< memory allocation failure flag def */ #define EX_BADFILEMODE 1001 /**< bad file mode def */ #define EX_BADFILEID 1002 /**< bad file id def */ #define EX_WRONGFILETYPE 1003 /**< wrong file type for function */ #define EX_LOOKUPFAIL 1004 /**< id table lookup failed */ #define EX_BADPARAM 1005 /**< bad parameter passed */ #define EX_MSG -1000 /**< message print code - no error implied */ #define EX_PRTLASTMSG -1001 /**< print last error message msg code */ #define EX_NOTROOTID -1002 /**< file id is not the root id; it is a subgroup id */ #define EX_NULLENTITY -1006 /**< null entity found */ /* @} */ #endif exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII_cfg.h000077500000000000000000000010601225312213100230750ustar00rootroot00000000000000#ifndef __exodusII_cfg_h #define __exodusII_cfg_h #define EXODUSII_VERSION_MAJOR 5 #define EXODUSII_VERSION_MINOR 14 #define EXODUSII_VERSION_PATCH 0 #define EXODUSII_VERSION "5.14.0" #if defined(_WIN32) && !defined(WIN32) # define WIN32 #endif /* #undef 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 exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII_cfg.h.in000077500000000000000000000012701225312213100235050ustar00rootroot00000000000000#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@.@EXODUSII_VERSION_MINOR@.@EXODUSII_VERSION_PATCH@" #if defined(_WIN32) && !defined(WIN32) # define WIN32 #endif #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 exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII_int.h000066400000000000000000001235271225312213100231420ustar00rootroot00000000000000/* * 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 * */ #ifndef EXODUS_II_INT_HDR #define EXODUS_II_INT_HDR #include "netcdf.h" #include #ifndef __APPLE__ #if defined __STDC__ || defined __cplusplus #include #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 /* A format string for outputting size_t ... */ #define ST_ZU "zu" #define MAX_VAR_NAME_LENGTH 32 /**< Internal use only */ /* this should be defined in ANSI C and C++, but just in case ... */ #ifndef NULL #define NULL 0 #endif /* 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 1 /* 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 */ /* Used to map between root (file id) and group ids when using groups */ #define EX_FILE_ID_MASK (0xffff0000) /* Must match FILE_ID_MASK in netcdf nc4internal.h */ #define EX_GRP_ID_MASK (0x0000ffff) /* Must match GRP_ID_MASK in netcdf nc4internal.h */ /* * 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 ATT_MAX_NAME_LENGTH "maximum_name_length" #define ATT_INT64_STATUS "int64_status" #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" /* edge block ids props */ #define VAR_ID_FA_BLK "fa_prop1" /* face block ids props */ #define ATT_NAME_ELB "elem_type" /* element type names for */ /* each element block */ #define DIM_NUM_EL_IN_BLK(num) ex_catstr("num_el_in_blk",num) /* # 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_blk",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_EBEPEC(num) ex_catstr("ebepecnt",num) /* array containing number of entity per */ /* entity for n-sided face/element blocks */ #define VAR_ATTRIB(num) ex_catstr("attrib",num) /* list of attributes for */ /* element block num */ #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_NATTRIB "nattrb" #define VAR_NAME_NATTRIB "nattrib_name" #define DIM_NUM_ATT_IN_NBLK "num_att_in_nblk" #define VAR_NSATTRIB(num) ex_catstr("nsattrb",num) #define VAR_NAME_NSATTRIB(num) ex_catstr("nsattrib_name",num) #define DIM_NUM_ATT_IN_NS(num) ex_catstr("num_att_in_ns",num) #define VAR_SSATTRIB(num) ex_catstr("ssattrb",num) #define VAR_NAME_SSATTRIB(num) ex_catstr("ssattrib_name",num) #define DIM_NUM_ATT_IN_SS(num) ex_catstr("num_att_in_ss",num) #define VAR_ESATTRIB(num) ex_catstr("esattrb",num) #define VAR_NAME_ESATTRIB(num) ex_catstr("esattrib_name",num) #define DIM_NUM_ATT_IN_ES(num) ex_catstr("num_att_in_es",num) #define VAR_FSATTRIB(num) ex_catstr("fsattrb",num) #define VAR_NAME_FSATTRIB(num) ex_catstr("fsattrib_name",num) #define DIM_NUM_ATT_IN_FS(num) ex_catstr("num_att_in_fs",num) #define VAR_ELSATTRIB(num) ex_catstr("elsattrb",num) #define VAR_NAME_ELSATTRIB(num) ex_catstr("elsattrib_name",num) #define DIM_NUM_ATT_IN_ELS(num) ex_catstr("num_att_in_els",num) #define VAR_ED_PROP(num) ex_catstr("ed_prop",num) /* list of the numth property*/ /* for all edge blocks */ #define VAR_FCONN(num) ex_catstr("facconn",num) /* face connectivity for */ /* element block num */ #define VAR_FBCONN(num) ex_catstr("fbconn",num) /* face connectivity for */ /* face block num */ #define VAR_FBEPEC(num) ex_catstr("fbepecnt",num) /* array containing number of entity per */ /* entity for n-sided face/element blocks */ #define VAR_FATTRIB(num) ex_catstr("fattrb",num) /* list of attributes for */ /* face block num */ #define VAR_NAME_FATTRIB(num) ex_catstr("fattrib_name",num) /* list of attribute names */ /* for face block num */ #define VAR_FA_PROP(num) ex_catstr("fa_prop",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 some string lengths */ #define DIM_STR_NAME "len_name" /* general dimension of */ /* length MAX_NAME_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_FACE_NUM_MAP "face_num_map" /* face numbering map */ /* obsolete, replaced by */ /* VAR_FACE_MAP(num) */ #define VAR_EDGE_NUM_MAP "edge_num_map" /* edge numbering map */ /* obsolete, replaced by */ /* VAR_EDGE_MAP(num) */ #define VAR_NODE_NUM_MAP "node_num_map" /* node numbering map */ /* obsolete, replaced by */ /* VAR_NODE_MAP(num) */ #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 DIM_NUM_CFRAMES "num_cframes" #define DIM_NUM_CFRAME9 "num_cframes_9" #define VAR_FRAME_COORDS "frame_coordinates" #define VAR_FRAME_IDS "frame_ids" #define VAR_FRAME_TAGS "frame_tags" #define VAR_ELBLK_IDS_GLOBAL "el_blk_ids_global" #define VAR_ELBLK_CNT_GLOBAL "el_blk_cnt_global" #define VAR_NS_IDS_GLOBAL "ns_ids_global" #define VAR_NS_NODE_CNT_GLOBAL "ns_node_cnt_global" #define VAR_NS_DF_CNT_GLOBAL "ns_df_cnt_global" #define VAR_SS_IDS_GLOBAL "ss_ids_global" #define VAR_SS_SIDE_CNT_GLOBAL "ss_side_cnt_global" #define VAR_SS_DF_CNT_GLOBAL "ss_df_cnt_global" #define VAR_FILE_TYPE "nem_ftype" #define VAR_COMM_MAP "comm_map" #define VAR_NODE_MAP_INT "node_mapi" #define VAR_NODE_MAP_INT_IDX "node_mapi_idx" #define VAR_NODE_MAP_BOR "node_mapb" #define VAR_NODE_MAP_BOR_IDX "node_mapb_idx" #define VAR_NODE_MAP_EXT "node_mape" #define VAR_NODE_MAP_EXT_IDX "node_mape_idx" #define VAR_ELEM_MAP_INT "elem_mapi" #define VAR_ELEM_MAP_INT_IDX "elem_mapi_idx" #define VAR_ELEM_MAP_BOR "elem_mapb" #define VAR_ELEM_MAP_BOR_IDX "elem_mapb_idx" #define VAR_INT_N_STAT "int_n_stat" #define VAR_BOR_N_STAT "bor_n_stat" #define VAR_EXT_N_STAT "ext_n_stat" #define VAR_INT_E_STAT "int_e_stat" #define VAR_BOR_E_STAT "bor_e_stat" #define VAR_N_COMM_IDS "n_comm_ids" #define VAR_N_COMM_STAT "n_comm_stat" #define VAR_N_COMM_INFO_IDX "n_comm_info_idx" #define VAR_E_COMM_IDS "e_comm_ids" #define VAR_E_COMM_STAT "e_comm_stat" #define VAR_E_COMM_INFO_IDX "e_comm_info_idx" #define VAR_N_COMM_NIDS "n_comm_nids" #define VAR_N_COMM_PROC "n_comm_proc" #define VAR_N_COMM_DATA_IDX "n_comm_data_idx" #define VAR_E_COMM_EIDS "e_comm_eids" #define VAR_E_COMM_SIDS "e_comm_sids" #define VAR_E_COMM_PROC "e_comm_proc" #define VAR_E_COMM_DATA_IDX "e_comm_data_idx" #define DIM_NUM_INT_NODES "num_int_node" #define DIM_NUM_BOR_NODES "num_bor_node" #define DIM_NUM_EXT_NODES "num_ext_node" #define DIM_NUM_INT_ELEMS "num_int_elem" #define DIM_NUM_BOR_ELEMS "num_bor_elem" #define DIM_NUM_PROCS "num_processors" #define DIM_NUM_PROCS_F "num_procs_file" #define DIM_NUM_NODES_GLOBAL "num_nodes_global" #define DIM_NUM_ELEMS_GLOBAL "num_elems_global" #define DIM_NUM_NS_GLOBAL "num_ns_global" #define DIM_NUM_SS_GLOBAL "num_ss_global" #define DIM_NUM_ELBLK_GLOBAL "num_el_blk_global" #define DIM_NUM_N_CMAPS "num_n_cmaps" #define DIM_NUM_E_CMAPS "num_e_cmaps" #define DIM_NCNT_CMAP "ncnt_cmap" #define DIM_ECNT_CMAP "ecnt_cmap" enum ex_element_type { EX_EL_UNK = -1, /**< unknown entity */ EX_EL_NULL_ELEMENT= 0, EX_EL_TRIANGLE = 1, /**< Triangle entity */ EX_EL_QUAD = 2, /**< Quad entity */ EX_EL_HEX = 3, /**< Hex entity */ EX_EL_WEDGE = 4, /**< Wedge entity */ EX_EL_TETRA = 5, /**< Tetra entity */ EX_EL_TRUSS = 6, /**< Truss entity */ EX_EL_BEAM = 7, /**< Beam entity */ EX_EL_SHELL = 8, /**< Shell entity */ EX_EL_SPHERE = 9, /**< Sphere entity */ EX_EL_CIRCLE = 10, /**< Circle entity */ EX_EL_TRISHELL = 11, /**< Triangular Shell entity */ EX_EL_PYRAMID = 12 /**< Pyramid entity */ }; typedef enum ex_element_type ex_element_type; enum ex_coordinate_frame_type { EX_CF_RECTANGULAR = 1, EX_CF_CYLINDRICAL = 2, EX_CF_SPHERICAL = 3 }; typedef enum ex_coordinate_frame_type ex_coordinate_frame_type; /* Internal structure declarations */ struct ex_file_item { int file_id; nc_type netcdf_type_code; int int64_status; int maximum_name_length; unsigned int compression_level:4; /* 0 (disabled) to 9 (maximum) compression level; netcdf-4 only */ unsigned int user_compute_wordsize:1; /* 0 for 4 byte or 1 for 8 byte reals */ unsigned int shuffle:1; /* 1 true, 0 false */ unsigned int file_type:2; /* 0 - classic, 1 -- 64 bit classic, 2 --netcdf4, 3 --netcdf4 classic */ unsigned int is_parallel:1; /* 1 true, 0 false */ struct ex_file_item* next; }; struct elem_blk_parm { char elem_type[33]; int64_t elem_blk_id; int64_t num_elem_in_blk; int num_nodes_per_elem; int num_sides; int num_nodes_per_side[6]; int num_attr; int64_t elem_ctr; ex_element_type elem_type_val; }; struct list_item { /* for use with ex_get_file_item */ int exo_id; int value; struct list_item* next; }; struct obj_stats { int64_t *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 ); void ex_iqsort64(int64_t v[], int64_t iv[], int64_t count ); char* ex_catstr(const char*, int); char* ex_catstr2(const char*, int, const char*, int); char* ex_dim_num_entries_in_object(ex_entity_type, int); char* ex_dim_num_objects(ex_entity_type obj_type); char* ex_name_var_of_object( ex_entity_type, int, int ); char* ex_name_of_map( ex_entity_type, int ); int ex_conv_ini (int exoid, int* comp_wordsize, int* io_wordsize, int file_wordsize, int int64_status, int is_parallel); void ex_conv_exit (int exoid); nc_type nc_flt_code (int exoid); int ex_comp_ws (int exoid); int ex_get_cpu_ws(void); int ex_is_parallel(int exoid); struct list_item** ex_get_counter_list(ex_entity_type obj_type); int ex_get_file_item (int, struct list_item**); int ex_inc_file_item (int, struct list_item**); void ex_rm_file_item (int, struct list_item**); extern struct obj_stats* exoII_eb; extern struct obj_stats* exoII_ed; extern struct obj_stats* exoII_fa; extern struct obj_stats* exoII_ns; extern struct obj_stats* exoII_es; extern struct obj_stats* exoII_fs; extern struct obj_stats* exoII_ss; extern struct obj_stats* exoII_els; extern struct obj_stats* exoII_em; extern struct obj_stats* exoII_edm; extern struct obj_stats* exoII_fam; extern struct obj_stats* exoII_nm; struct ex_file_item* ex_find_file_item(int exoid); struct ex_file_item* ex_add_file_item(int exoid); struct obj_stats *ex_get_stat_ptr ( int exoid, struct obj_stats** obj_ptr); void ex_rm_stat_ptr (int exoid, struct obj_stats** obj_ptr); void ex_compress_variable(int exoid, int varid, int type); int ex_id_lkup (int exoid, ex_entity_type id_type, ex_entity_id num); int ex_check_file_type(const char *path, int *type); int ex_get_dimension(int exoid, const char *dimtype, const char *label, size_t *count, int *dimid, const char *routine); int ex_get_name_internal(int exoid, int varid, size_t index, char *name, int name_size, ex_entity_type type, const char *routine); int ex_get_names_internal(int exoid, int varid, size_t count, char**names, ex_entity_type type, const char *routine); int ex_put_name_internal(int exoid, int varid, size_t index, const char *name, ex_entity_type type, const char *subtype, const char *routine); int ex_put_names_internal(int exoid, int varid, size_t count, char**names, ex_entity_type type, const char *subtype, const char *routine); void ex_trim_internal(char *name); void ex_update_max_name_length(int exoid, int length); int ex_leavedef(int neid, /* NemesisI file ID */ const char *func_name /* Name of calling function */ ); int ex_get_file_type(int neid, /* NetCDF/Exodus file ID */ char *ftype /* Nemesis file type */ ); int ex_put_nemesis_version(int neid); /* NetCDF/Exodus file ID */ int ne_check_file_version(int neid /* NetCDF/Exodus file ID */ ); char *ex_catstrn12(char *name, int num1, int num2); int ne_id_lkup(int neid, /* NetCDF/Exodus file ID */ const char *var_name, /* Nemesis variable name */ int64_t *idx, /* index variable for variable, length 2 */ ex_entity_id ne_var_id /* NetCDF variable ID */ ); /** * For output databases, the maximum length of any entity, variable, * property, attribute, or coordinate name to be written (not * including the NULL terminator). If a name is longer than this * value, a warning message will be output to stderr and the name * will be truncated. Must be set (via call to * 'ex_set_max_name_length(exoid, int len)' prior to calling ex_create. * * For input databases, the size of the name arrays that the client * code will be passing to API routines that retrieve names (not * including the NULL terminator). This defaults to 32 for * compatibility with older clients. The value used at the time of * creation of the database can be queried by ex_inquire with the * EX_INQ_DB_MAX_NAME_LENGTH argument. The current value for this * variable can be queried with EX_INQ_CUR_MAX_NAME_LENGTH argument. * * Note that this is a global setting for all databases. If you are * accessing multiple databases, they will all use the same value. */ extern int ex_default_max_name_length; #endif exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII_par.h000066400000000000000000000061071225312213100231240ustar00rootroot00000000000000/* * Copyright (c) 2012 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_par.h - Exodus II parallel-aware API include file * *****************************************************************************/ #ifndef EXODUS_II_PAR_HDR #define EXODUS_II_PAR_HDR #if !defined(PARALLEL_NETCDF) #include "exodusII.h" /* * 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 #define ex_open_par(path, mode, comp_ws, io_ws, version, comm, info) ex_open_par_int(path, mode, comp_ws, io_ws, version, comm, info, EX_API_VERS_NODOT) #define ex_create_par(path, mode, comp_ws, io_ws, comm, info) ex_create_par_int(path, mode, comp_ws, io_ws, comm, info, EX_API_VERS_NODOT) EXODUS_EXPORT int ex_open_par_int (const char *path, int mode, int *comp_ws, int *io_ws, float *version, MPI_Comm comm, MPI_Info info, int my_version); EXODUS_EXPORT int ex_create_par_int (const char *path, int cmode, int *comp_ws, int *io_ws, MPI_Comm comm, MPI_Info info, int my_version); #else #error "Parallel-aware exodusII_par.h included in non-parallel context" #endif #ifdef __cplusplus } /* close brackets on extern "C" declaration */ #endif #endif exodusii-6.02.dfsg.1/exodus/cbind/include/exodusII_test.h000066400000000000000000000007361225312213100233230ustar00rootroot00000000000000#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 */ exodusii-6.02.dfsg.1/exodus/cbind/parallel/000077500000000000000000000000001225312213100205255ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cbind/parallel/Imakefile000066400000000000000000000045331225312213100223430ustar00rootroot00000000000000# 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 Use include files locates in exodusii/cbind/include INCLUDES = IncRef-I../include REQUIREDLIBS = -L$(SHLIBDIR) $(EXODUS) $(NETCDF) #ifndef BuildSharedExodusLibrary #define BuildSharedExodusLibrary NO #endif #define DoNormalLib YES #define DoSharedLib BuildSharedExodusLibrary #define LibName exodus_par SOREV = 5 #define SoRev SOREV CC = $(CCPAR) #define LibraryCcCmd $(CCPAR) DEFINES = $(PICFLAGS) SRCS = ex_open_par.c ex_create_par.c OBJS = ${SRCS:.c=.o} #include LibraryTargetSubdirsCopy(libexodus_par.a,$(OBJS),../../) $(OBJS): ../include/exodusII.h ../include/exodusII_int.h ../include/exodusII_par.h DependTarget() LibraryObjectRule() exodusii-6.02.dfsg.1/exodus/cbind/parallel/ex_create_par.c000066400000000000000000000355671225312213100235120ustar00rootroot00000000000000/* * 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. * */ /*! \note The ex_create_int() is an internal function called by ex_create(). The user should call ex_create() and not ex_create_int(). The function ex_create() creates a new exodus file and returns an ID that can subsequently be used to refer to the file. All floating point values in an exodus file are stored as either 4-byte (\c float) or 8-byte (\c double) numbers; no mixing of 4- and 8-byte numbers in a single file is allowed. An application code can compute either 4- or 8-byte values and can designate that the values be stored in the exodus file as either 4- or 8-byte numbers; conversion between the 4- and 8-byte values is performed automatically by the API routines. Thus, there are four possible combinations of compute word size and storage (or I/O) word size. \return In case of an error, ex_create() returns a negative number. Possible causes of errors include: - Passing a file name that includes a directory that does not exist. - Specifying a file name of a file that exists and also specifying a no clobber option. - Attempting to create a file in a directory without permission to create files there. - Passing an invalid file clobber mode. \param path The file name of the new exodus file. This can be given as either an absolute path name (from the root of the file system) or a relative path name (from the current directory). \param cmode Mode. Use one of the following predefined constants: \arg \c EX_NOCLOBBER To create the new file only if the given file name does not refer to a file that already exists. \arg \c EX_CLOBBER To create the new file, regardless of whether a file with the same name already exists. If a file with the same name does exist, its contents will be erased. \arg \c EX_LARGE_MODEL To create a model that can store individual datasets larger than 2 gigabytes. This modifies the internal storage used by exodusII and also puts the underlying NetCDF file into the \e 64-bit offset' mode. See largemodel for more details on this mode. A large model file will also be created if the environment variable \c EXODUS_LARGE_MODEL is defined in the users environment. A message will be printed to standard output if this environment variable is found. \arg \c EX_NORMAL_MODEL Create a standard model. \arg \c EX_NETCDF4 To create a model using the HDF5-based NetCDF-4 output. An HDF5-based NetCDF-4 file will also be created if the environment variable \c EXODUS_NETCDF4 is defined in the users environment. A message will be printed to standard output if this environment variable is found. \arg \c EX_NOSHARE Do not open the underlying NetCDF file in \e share mode. See the NetCDF documentation for more details. \arg \c EX_SHARE Do open the underlying NetCDF file in \e share mode. See the NetCDF documentation for more details. \param[in,out] comp_ws The word size in bytes (0, 4 or 8) of the floating point variables used in the application program. If 0 (zero) is passed, the default sizeof(float) will be used and returned in this variable. WARNING: all exodus functions requiring floats must be passed floats declared with this passed in or returned compute word size (4 or 8).} \param io_ws The word size in bytes (4 or 8) of the floating point data as they are to be stored in the exodus file. \param run_version (internally generated) used to verify compatability of libary and include files. The following code segment creates an exodus file called \file{test.exo}: \code #include "exodusII.h" int CPU_word_size, IO_word_size, exoid; CPU_word_size = sizeof(float); \comment{use float or double} IO_word_size = 8; \comment{store variables as doubles} \comment{create exodus file} exoid = ex_create ("test.exo" \comment{filename path} EX_CLOBBER, \comment{create mode} &CPU_word_size, \comment{CPU float word size in bytes} &IO_word_size); \comment{I/O float word size in bytes} \endcode */ #include #include #include #include "netcdf_par.h" #include "exodusII.h" #include "exodusII_int.h" static int warning_output = 0; int ex_create_par_int (const char *path, int cmode, int *comp_ws, int *io_ws, MPI_Comm comm, MPI_Info info, int run_version) { int exoid, dims[1]; int status; int dimid, time_dim; int old_fill; int lio_ws; int filesiz; float vers; char errmsg[MAX_ERR_LENGTH]; char *mode_name; int mode = 0; #if defined(NC_NETCDF4) static int netcdf4_mode = -1; char *option; #endif /* NC_NETCDF4 */ int int64_status; int pariomode = NC_MPIPOSIX; unsigned int my_mode = cmode; assert(my_mode == cmode); exerrval = 0; /* clear error code */ if (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodusII version %d.%02d,\n but was linked with exodusII library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } /* * See if any integer data is to be stored as int64 (long long). If * so, then need to set NC_NETCDF4 and unset NC_CLASSIC_MODEL (or * set EX_NOCLASSIC. Output meaningful error message if the library * is not NetCDF-4 enabled... */ int64_status = my_mode & (EX_ALL_INT64_DB | EX_ALL_INT64_API); if ((int64_status & EX_ALL_INT64_DB) != 0) { #if defined(NC_NETCDF4) /* Library DOES support netcdf4... Set modes required to use * netcdf-4 in non-classic mode */ my_mode |= EX_NOCLASSIC; my_mode |= EX_NETCDF4; #else /* Library does NOT support netcdf4 */ exerrval = EX_BADPARAM; sprintf(errmsg, "EXODUS: Error: 64-bit integer storage requested, but the netcdf library does not support the required netcdf-4 extensions.\n"); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); #endif } #if defined(NC_NETCDF4) if (my_mode & EX_NETCDF4) { mode |= (NC_NETCDF4); } else { if (netcdf4_mode == -1) { option = getenv("EXODUS_NETCDF4"); if (option != NULL) { fprintf(stderr, "EXODUS: Using netcdf version 4 selected via EXODUS_NETCDF4 environment variable\n"); netcdf4_mode = NC_NETCDF4; } else { netcdf4_mode = 0; } } mode |= netcdf4_mode; } if (! (my_mode & EX_NOCLASSIC)) { mode |= NC_CLASSIC_MODEL; } #endif /* Check parallel io mode. Valid is NC_MPIPOSIX or NC_MPIIO or NC_PNETCDF * Exodus uses different flag values; map to netcdf values */ if (mode & EX_MPIPOSIX) pariomode = NC_MPIPOSIX; else if (mode & EX_MPIIO) pariomode = NC_MPIIO; else if (mode & EX_PNETCDF) pariomode = NC_PNETCDF; /* * See if "large file" mode was specified in a ex_create my_mode. If * so, then pass the NC_64BIT_OFFSET flag down to netcdf. * If netcdf4 mode specified, don't use NC_64BIT_OFFSET mode. */ if ( (my_mode & EX_LARGE_MODEL) && (my_mode & EX_NORMAL_MODEL)) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: conflicting mode specification for file %s, mode %d. Using normal", path, (int)my_mode); ex_err("ex_create",errmsg,exerrval); } if (my_mode & EX_NORMAL_MODEL) filesiz = 0; #if defined(NC_NETCDF4) else if (mode & NC_NETCDF4) filesiz = 1; #endif else filesiz = (int)((my_mode & EX_LARGE_MODEL) || (ex_large_model(-1) == 1)); if ( #if defined(NC_NETCDF4) !(mode & NC_NETCDF4) && #endif filesiz == 1) { mode |= NC_64BIT_OFFSET; } if (my_mode & 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 (my_mode & EX_CLOBBER) { mode |= NC_CLOBBER; mode_name = "CLOBBER"; } else { mode |= NC_NOCLOBBER; mode_name = "NOCLOBBER"; } if ((status = nc_create_par (path, mode|pariomode, comm, info, &exoid)) != NC_NOERR) { exerrval = status; if (my_mode & EX_NETCDF4) { sprintf(errmsg, "Error: file create failed for %s in NETCDF4 and %s mode.\n\tThis library probably does not support netcdf-4 files.", path, mode_name); } else { 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); 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, int64_status ) != 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 ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_API_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II API version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file version # as an attribute */ vers = EX_VERS; if ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file float word size as an attribute */ lio_ws = (int)(*io_ws); if ((status=nc_put_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, NC_INT, 1, &lio_ws)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file float word size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file size (1=large, 0=normal) as an attribute */ if ((status = nc_put_att_int (exoid, NC_GLOBAL, ATT_FILESIZE, NC_INT, 1, &filesiz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* define some dimensions and variables */ /* create string length dimension */ if ((status=nc_def_dim (exoid, DIM_STR, (MAX_STR_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define string length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* The name string length dimension is delayed until the ex_put_init function */ /* create line length dimension */ if ((status = nc_def_dim(exoid, DIM_LIN, (MAX_LINE_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define line length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* create number "4" dimension; must be of type long */ if ((status = nc_def_dim(exoid, DIM_N4, 4L, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number \"4\" dimension in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_def_dim(exoid, DIM_TIME, NC_UNLIMITED, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define time dimension in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } dims[0] = time_dim; if ((status = nc_def_var(exoid, VAR_WHOLE_TIME, nc_flt_code(exoid), 1, dims, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define whole time step variable in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } ex_compress_variable(exoid, dimid, 2); { int int64_db_status = int64_status & EX_ALL_INT64_DB; if ((status=nc_put_att_int(exoid, NC_GLOBAL, ATT_INT64_STATUS, NC_INT, 1, &int64_db_status)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add int64_status attribute in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/parallel/ex_open_par.c000066400000000000000000000275011225312213100231750ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include #include "netcdf_par.h" #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_open() opens an existing exodus file and returns an ID that can subsequently be used to refer to the file, the word size of the floating point values stored in the file, and the version of the exodus database (returned as a ``float'', regardless of the compute or I/O word size). Multiple files may be ``open'' simultaneously. \return In case of an error, ex_open() returns a negative number. Possible causes of errors include: - The specified file does not exist. - The mode specified is something other than the predefined constant \fparam{EX_READ} or \fparam{EX_WRITE}. - Database version is earlier than 2.0. \param path The file name of the exodus file. This can be given as either an absolute path name (from the root of the file system) or a relative path name (from the current directory). \param mode Access mode. Use one of the following predefined constants: - \fparam{EX_READ} To open the file just for reading. - \fparam{EX_WRITE} To open the file for writing and reading. \param[in,out] comp_ws The word size in bytes (0, 4 or 8) of the floating point variables used in the application program. If 0 (zero) is passed, the default size of floating point values for the machine will be used and returned in this variable. WARNING: all exodus functions requiring reals must be passed reals declared with this passed in or returned compute word size (4 or 8). \param[in,out] io_ws The word size in bytes (0, 4 or 8) of the floating point data as they are stored in the exodus file. If the word size does not match the word size of data stored in the file, a fatal error is returned. If this argument is 0, the word size of the floating point data already stored in the file is returned. \param[out] version Returned exodus database version number. The following opens an exodus file named \file{test.exo} for read only, using default settings for compute and I/O word sizes: \code #include "exodusII.h" int CPU_word_size,IO_word_size, exoid; float version; CPU_word_size = sizeof(float); \co{float or double} IO_word_size = 0; \co{use what is stored in file} \comment{open exodus files} exoid = ex_open ("test.exo", \co{filename path} EX_READ, \co{access mode = READ} &CPU_word_size, \co{CPU word size} &IO_word_size, \co{IO word size} &version); \co{ExodusII library version} \endcode */ static int warning_output = 0; int ex_open_par_int (const char *path, int mode, int *comp_ws, int *io_ws, float *version, MPI_Comm comm, MPI_Info info, int run_version) { int exoid; int status, stat_att, stat_dim; nc_type att_type = NC_NAT; size_t att_len = 0; int old_fill; int file_wordsize; int dim_str_name; int int64_status = 0; int pariomode = NC_MPIPOSIX; 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 (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodus version %d.%02d,\n but was linked with exodus library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } if ((mode & EX_READ) && (mode & EX_WRITE)) { exerrval = EX_BADFILEMODE; sprintf(errmsg,"Error: Cannot specify both EX_READ and EX_WRITE"); ex_err("ex_open",errmsg,exerrval); return (EX_FATAL); } /* Check parallel io mode. Valid is NC_MPIPOSIX or NC_MPIIO or NC_PNETCDF * Exodus uses different flag values; map to netcdf values */ if (mode & EX_MPIPOSIX) pariomode = NC_MPIPOSIX; else if (mode & EX_MPIIO) pariomode = NC_MPIIO; else if (mode & EX_PNETCDF) pariomode = NC_PNETCDF; /* The EX_READ mode is the default if EX_WRITE is not specified... */ if (!(mode & EX_WRITE)) { /* READ ONLY */ if ((status = nc_open_par (path, NC_NOWRITE|NC_SHARE|pariomode, comm, info, &exoid)) != NC_NOERR) { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) { exerrval = EX_FATAL; } else { /* It is possible that the user is trying to open a netcdf4 file, but the netcdf4 capabilities aren't available in the netcdf linked to this library. Note that we can't just use a compile-time define since we could be using a shareable netcdf library, so the netcdf4 capabilities aren't known until runtime... Netcdf-4.X does not (yet?) have a function that can be queried to determine whether the library being used was compiled with --enable-netcdf4, so that isn't very helpful.. At this time, query the beginning of the file and see if it is an HDF-5 file and if it is assume that the open failure is due to the netcdf library not enabling netcdf4 features... */ int type = 0; ex_check_file_type(path, &type); if (type == 5) { /* This is an hdf5 (netcdf4) file. Since the nc_open failed, the assumption is that the netcdf doesn't have netcdf4 capabilities enabled. Tell the user... */ fprintf(stderr, "EXODUS: Error: Attempting to open the netcdf-4 file:\n\t'%s'\n\twith a netcdf library that does not support netcdf-4\n", path); } exerrval = status; } sprintf(errmsg,"Error: failed to open %s read only",path); ex_err("ex_open",errmsg,exerrval); return(EX_FATAL); } } else /* (mode & EX_WRITE) READ/WRITE */ { if ((status = nc_open_par (path, NC_WRITE|NC_SHARE|pariomode, comm, info, &exoid)) != NC_NOERR) { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) exerrval = EX_FATAL; else exerrval = status; 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } stat_att = nc_inq_att(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, &att_type, &att_len); stat_dim = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name); if(stat_att != NC_NOERR || stat_dim != NC_NOERR) { nc_redef(exoid); if (stat_att != NC_NOERR) { int max_so_far = 32; nc_put_att_int(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &max_so_far); } /* If the DIM_STR_NAME variable does not exist on the database, we need to add it now. */ if(stat_dim != NC_NOERR) { /* Not found; set to default value of 32+1. */ int max_name = ex_default_max_name_length < 32 ? 32 : ex_default_max_name_length; nc_def_dim(exoid, DIM_STR_NAME, max_name+1, &dim_str_name); } nc_enddef (exoid); } } /* determine version of EXODUS II file, and the word size of * floating point and integer values stored in the file */ if ((status = nc_get_att_float(exoid, NC_GLOBAL, ATT_VERSION, version)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to get database version for file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); 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 (nc_get_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) != NC_NOERR) { /* try old (prior to db version 2.02) attribute name */ if (nc_get_att_int (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) != NC_NOERR) { exerrval = EX_FATAL; sprintf(errmsg,"Error: failed to get file wordsize from file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); return(exerrval); } } /* See if int64 status attribute exists and if so, what data is stored as int64 * Older files don't have the attribute, so it is not an error if it is missing */ if (nc_get_att_int (exoid, NC_GLOBAL, ATT_INT64_STATUS, &int64_status) != NC_NOERR) { int64_status = 0; /* Just in case it gets munged by a failed get_att_int call */ } /* Merge in API int64 status flags as specified by caller of function... */ int64_status |= (mode & EX_ALL_INT64_API); /* initialize floating point and integer size conversion. */ if (ex_conv_ini( exoid, comp_ws, io_ws, file_wordsize, int64_status ) != EX_NOERR ) { exerrval = EX_FATAL; sprintf(errmsg, "Error: failed to initialize conversion routines in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/000077500000000000000000000000001225312213100175205ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cbind/src/Imakefile000066400000000000000000000207071225312213100213370ustar00rootroot00000000000000# 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 Use include files locates in exodusii/cbind/include INCLUDES = IncRef-I../include REQUIREDLIBS = -L$(SHLIBDIR) $(NETCDF) #if UseNetcdf4 == NO NET_DEF = -DNOT_NETCDF4 #endif #ifndef BuildSharedExodusLibrary #define BuildSharedExodusLibrary NO #endif #define DoNormalLib YES #define DoSharedLib BuildSharedExodusLibrary #define LibName exodus SOREV = 5 #define SoRev SOREV DEFINES = $(PICFLAGS) $(NET_DEF) #if defined(BuildParallelAwareExodus) PARSRCS = ex_create_par.c ex_open_par.c PAROBJS = ${PARSRCS:.c=.o} $(PAROBJS): ../include/exodusII.h ../include/exodusII_int.h ../include/exodusII_par.h CC = $(CCPAR) #define LibraryCcCmd $(CCPAR) #endif SRCS = ex_close.c \ ex_conv.c \ ex_copy.c \ ex_create.c \ ex_create_group.c \ ex_get_group_id.c \ ex_get_group_ids.c \ ex_cvt_nodes_to_sides.c \ ex_err.c \ ex_get_all_times.c \ ex_get_attr.c \ ex_get_attr_names.c \ ex_get_attr_param.c \ ex_get_block.c \ ex_get_block_param.c \ ex_get_cmap_params.c \ ex_get_concat_node_sets.c \ ex_get_concat_sets.c \ ex_get_concat_side_set_node_count.c \ ex_get_concat_side_sets.c \ ex_get_conn.c \ ex_get_coord.c \ ex_get_coordinate_frames.c \ ex_get_coord_names.c \ ex_get_eb_info_global.c \ ex_get_elem_attr.c \ ex_get_elem_attr_names.c \ ex_get_elem_blk_ids.c \ ex_get_elem_block.c \ ex_get_elem_cmap.c \ ex_get_elem_conn.c \ ex_get_elem_map.c \ ex_get_elem_num_map.c \ ex_get_elem_type.c \ ex_get_elem_var.c \ ex_get_elem_var_tab.c \ ex_get_elem_var_time.c \ ex_get_entity_count_per_polyhedra.c \ ex_get_glob_vars.c \ ex_get_glob_var_time.c \ ex_get_id_map.c \ ex_get_ids.c \ ex_get_info.c \ ex_get_init.c \ ex_get_init_ext.c \ ex_get_init_global.c \ ex_get_init_info.c \ ex_get_loadbal_param.c \ ex_get_map.c \ ex_get_map_param.c \ ex_get_name.c \ ex_get_names.c \ ex_get_n_attr.c \ ex_get_n_conn.c \ ex_get_n_coord.c \ ex_get_n_elem_attr.c \ ex_get_n_elem_conn.c \ ex_get_n_elem_num_map.c \ ex_get_n_elem_var.c \ ex_get_n_nodal_var.c \ ex_get_n_node_num_map.c \ ex_get_n_node_set.c \ ex_get_n_node_set_df.c \ ex_get_nodal_var.c \ ex_get_nodal_var_time.c \ ex_get_node_cmap.c \ ex_get_node_map.c \ ex_get_node_num_map.c \ ex_get_node_set.c \ ex_get_node_set_dist_fact.c \ ex_get_node_set_ids.c \ ex_get_node_set_param.c \ ex_get_n_one_attr.c \ ex_get_nset_var.c \ ex_get_nset_var_tab.c \ ex_get_n_side_set.c \ ex_get_n_side_set_df.c \ ex_get_ns_param_global.c \ ex_get_num_map.c \ ex_get_n_var.c \ ex_get_object_truth_vector.c \ ex_get_one_attr.c \ ex_get_one_elem_attr.c \ ex_get_partial_attr.c \ ex_get_partial_conn.c \ ex_get_partial_coord.c \ ex_get_partial_elem_attr.c \ ex_get_partial_elem_conn.c \ ex_get_partial_elem_map.c \ ex_get_partial_elem_num_map.c \ ex_get_partial_elem_var.c \ ex_get_partial_id_map.c \ ex_get_partial_nodal_var.c \ ex_get_partial_node_num_map.c \ ex_get_partial_node_set.c \ ex_get_partial_node_set_df.c \ ex_get_partial_num_map.c \ ex_get_partial_one_attr.c \ ex_get_partial_set_dist_fact.c \ ex_get_partial_side_set.c \ ex_get_partial_side_set_df.c \ ex_get_partial_var.c \ ex_get_processor_elem_maps.c \ ex_get_processor_node_maps.c \ ex_get_prop_array.c \ ex_get_prop.c \ ex_get_prop_names.c \ ex_get_qa.c \ ex_get_set.c \ ex_get_set_dist_fact.c \ ex_get_set_param.c \ ex_get_sets.c \ ex_get_side_set.c \ ex_get_side_set_dist_fact.c \ ex_get_side_set_ids.c \ ex_get_side_set_node_count.c \ ex_get_side_set_node_list.c \ ex_get_side_set_node_list_len.c \ ex_get_side_set_param.c \ ex_get_sset_var.c \ ex_get_sset_var_tab.c \ ex_get_ss_param_global.c \ ex_get_time.c \ ex_get_truth_table.c \ ex_get_var.c \ ex_get_variable_name.c \ ex_get_variable_names.c \ ex_get_variable_param.c \ ex_get_var_name.c \ ex_get_var_names.c \ ex_get_var_param.c \ ex_get_var_tab.c \ ex_get_var_time.c \ ex_inquire.c \ ex_ne_util.c \ ex_open.c \ ex_opts.c \ ex_put_all_var_param.c \ ex_put_all_var_param_ext.c \ ex_put_attr.c \ ex_put_attr_names.c \ ex_put_attr_param.c \ ex_put_block.c \ ex_put_block_param.c \ ex_put_cmap_params.c \ ex_put_cmap_params_cc.c \ ex_put_concat_all_blocks.c \ ex_put_concat_elem_block.c \ ex_put_concat_node_sets.c \ ex_put_concat_sets.c \ ex_put_concat_side_sets.c \ ex_put_concat_var_param.c \ ex_put_conn.c \ ex_put_coord.c \ ex_put_coordinate_frames.c \ ex_put_coord_names.c \ ex_put_eb_info_global.c \ ex_put_elem_attr.c \ ex_put_elem_attr_names.c \ ex_put_elem_block.c \ ex_put_elem_cmap.c \ ex_put_elem_conn.c \ ex_put_elem_map.c \ ex_put_elem_num_map.c \ ex_put_elem_var.c \ ex_put_elem_var_slab.c \ ex_put_elem_var_tab.c \ ex_put_entity_count_per_polyhedra.c \ ex_put_glob_vars.c \ ex_put_id_map.c \ ex_put_info.c \ ex_put_init.c \ ex_put_init_ext.c \ ex_put_init_global.c \ ex_put_init_info.c \ ex_put_loadbal_param.c \ ex_put_loadbal_param_cc.c \ ex_put_map.c \ ex_put_map_param.c \ ex_put_name.c \ ex_put_names.c \ ex_put_n_coord.c \ ex_put_n_elem_attr.c \ ex_put_n_elem_conn.c \ ex_put_n_elem_num_map.c \ ex_put_n_nodal_var.c \ ex_put_n_node_num_map.c \ ex_put_n_node_set.c \ ex_put_n_node_set_df.c \ ex_put_nodal_var.c \ ex_put_nodal_var_slab.c \ ex_put_node_cmap.c \ ex_put_node_map.c \ ex_put_node_num_map.c \ ex_put_node_set.c \ ex_put_node_set_dist_fact.c \ ex_put_node_set_param.c \ ex_put_n_one_attr.c \ ex_put_nset_var.c \ ex_put_nset_var_tab.c \ ex_put_n_side_set.c \ ex_put_n_side_set_df.c \ ex_put_ns_param_global.c \ ex_put_num_map.c \ ex_put_n_var.c \ ex_put_one_attr.c \ ex_put_one_elem_attr.c \ ex_put_partial_attr.c \ ex_put_partial_coord.c \ ex_put_partial_elem_attr.c \ ex_put_partial_elem_conn.c \ ex_put_partial_elem_map.c \ ex_put_partial_elem_num_map.c \ ex_put_partial_id_map.c \ ex_put_partial_nodal_var.c \ ex_put_partial_node_num_map.c \ ex_put_partial_node_set.c \ ex_put_partial_node_set_df.c \ ex_put_partial_num_map.c \ ex_put_partial_one_attr.c \ ex_put_partial_set.c \ ex_put_partial_set_dist_fact.c \ ex_put_partial_side_set.c \ ex_put_partial_side_set_df.c \ ex_put_partial_var.c \ ex_put_processor_elem_maps.c \ ex_put_processor_node_maps.c \ ex_put_prop_array.c \ ex_put_prop.c \ ex_put_prop_names.c \ ex_put_qa.c \ ex_put_set.c \ ex_put_set_dist_fact.c \ ex_put_set_param.c \ ex_put_sets.c \ ex_put_side_set.c \ ex_put_side_set_dist_fact.c \ ex_put_side_set_param.c \ ex_put_sset_var.c \ ex_put_sset_var_tab.c \ ex_put_ss_param_global.c \ ex_put_time.c \ ex_put_truth_table.c \ ex_put_var.c \ ex_put_variable_name.c \ ex_put_variable_names.c \ ex_put_variable_param.c \ ex_put_var_name.c \ ex_put_var_names.c \ ex_put_var_param.c \ ex_put_var_tab.c \ ex_update.c \ ex_utils.c OBJS = ${SRCS:.c=.o} #include LibraryTargetSubdirsCopy(libexodus.a,$(OBJS) $(PAROBJS),../../) $(OBJS): ../include/exodusII.h ../include/exodusII_int.h DependTarget() LibraryObjectRule() exodusii-6.02.dfsg.1/exodus/cbind/src/Makefile.standalone000066400000000000000000000164011225312213100233110ustar00rootroot00000000000000PARSRCS = ex_create_par.c \ ex_open_par.c SRCS = \ ex_close.c \ ex_conv.c \ ex_copy.c \ ex_create.c \ ex_create_group.c \ ex_cvt_nodes_to_sides.c \ ex_err.c \ ex_get_all_times.c \ ex_get_attr.c \ ex_get_attr_names.c \ ex_get_attr_param.c \ ex_get_block.c \ ex_get_block_param.c \ ex_get_cmap_params.c \ ex_get_concat_node_sets.c \ ex_get_concat_sets.c \ ex_get_concat_side_set_node_count.c \ ex_get_concat_side_sets.c \ ex_get_conn.c \ ex_get_coord.c \ ex_get_coord_names.c \ ex_get_coordinate_frames.c \ ex_get_eb_info_global.c \ ex_get_elem_attr.c \ ex_get_elem_attr_names.c \ ex_get_elem_blk_ids.c \ ex_get_elem_block.c \ ex_get_elem_cmap.c \ ex_get_elem_conn.c \ ex_get_elem_map.c \ ex_get_elem_num_map.c \ ex_get_elem_type.c \ ex_get_elem_var.c \ ex_get_elem_var_tab.c \ ex_get_elem_var_time.c \ ex_get_entity_count_per_polyhedra.c \ ex_get_glob_var_time.c \ ex_get_glob_vars.c \ ex_get_group_id.c \ ex_get_group_ids.c \ ex_get_id_map.c \ ex_get_ids.c \ ex_get_info.c \ ex_get_init.c \ ex_get_init_ext.c \ ex_get_init_global.c \ ex_get_init_info.c \ ex_get_loadbal_param.c \ ex_get_map.c \ ex_get_map_param.c \ ex_get_n_attr.c \ ex_get_n_conn.c \ ex_get_n_coord.c \ ex_get_n_elem_attr.c \ ex_get_n_elem_conn.c \ ex_get_n_elem_num_map.c \ ex_get_n_elem_var.c \ ex_get_n_nodal_var.c \ ex_get_n_node_num_map.c \ ex_get_n_node_set.c \ ex_get_n_node_set_df.c \ ex_get_n_one_attr.c \ ex_get_n_side_set.c \ ex_get_n_side_set_df.c \ ex_get_n_var.c \ ex_get_name.c \ ex_get_names.c \ ex_get_nodal_var.c \ ex_get_nodal_var_time.c \ ex_get_node_cmap.c \ ex_get_node_map.c \ ex_get_node_num_map.c \ ex_get_node_set.c \ ex_get_node_set_dist_fact.c \ ex_get_node_set_ids.c \ ex_get_node_set_param.c \ ex_get_ns_param_global.c \ ex_get_nset_var.c \ ex_get_nset_var_tab.c \ ex_get_num_map.c \ ex_get_object_truth_vector.c \ ex_get_one_attr.c \ ex_get_one_elem_attr.c \ ex_get_partial_attr.c \ ex_get_partial_conn.c \ ex_get_partial_coord.c \ ex_get_partial_elem_attr.c \ ex_get_partial_elem_conn.c \ ex_get_partial_elem_map.c \ ex_get_partial_elem_num_map.c \ ex_get_partial_elem_var.c \ ex_get_partial_id_map.c \ ex_get_partial_nodal_var.c \ ex_get_partial_node_num_map.c \ ex_get_partial_node_set.c \ ex_get_partial_node_set_df.c \ ex_get_partial_num_map.c \ ex_get_partial_one_attr.c \ ex_get_partial_set_dist_fact.c \ ex_get_partial_side_set.c \ ex_get_partial_side_set_df.c \ ex_get_partial_var.c \ ex_get_processor_elem_maps.c \ ex_get_processor_node_maps.c \ ex_get_prop.c \ ex_get_prop_array.c \ ex_get_prop_names.c \ ex_get_qa.c \ ex_get_set.c \ ex_get_set_dist_fact.c \ ex_get_set_param.c \ ex_get_sets.c \ ex_get_side_set.c \ ex_get_side_set_dist_fact.c \ ex_get_side_set_ids.c \ ex_get_side_set_node_count.c \ ex_get_side_set_node_list.c \ ex_get_side_set_node_list_len.c \ ex_get_side_set_param.c \ ex_get_ss_param_global.c \ ex_get_sset_var.c \ ex_get_sset_var_tab.c \ ex_get_time.c \ ex_get_truth_table.c \ ex_get_var.c \ ex_get_var_name.c \ ex_get_var_names.c \ ex_get_var_param.c \ ex_get_var_tab.c \ ex_get_var_time.c \ ex_get_variable_name.c \ ex_get_variable_names.c \ ex_get_variable_param.c \ ex_inquire.c \ ex_ne_util.c \ ex_open.c \ ex_opts.c \ ex_put_all_var_param.c \ ex_put_all_var_param_ext.c \ ex_put_attr.c \ ex_put_attr_names.c \ ex_put_attr_param.c \ ex_put_block.c \ ex_put_block_param.c \ ex_put_cmap_params.c \ ex_put_cmap_params_cc.c \ ex_put_concat_all_blocks.c \ ex_put_concat_elem_block.c \ ex_put_concat_node_sets.c \ ex_put_concat_sets.c \ ex_put_concat_side_sets.c \ ex_put_concat_var_param.c \ ex_put_conn.c \ ex_put_coord.c \ ex_put_coord_names.c \ ex_put_coordinate_frames.c \ ex_put_eb_info_global.c \ ex_put_elem_attr.c \ ex_put_elem_attr_names.c \ ex_put_elem_block.c \ ex_put_elem_cmap.c \ ex_put_elem_conn.c \ ex_put_elem_map.c \ ex_put_elem_num_map.c \ ex_put_elem_var.c \ ex_put_elem_var_slab.c \ ex_put_elem_var_tab.c \ ex_put_entity_count_per_polyhedra.c \ ex_put_glob_vars.c \ ex_put_id_map.c \ ex_put_info.c \ ex_put_init.c \ ex_put_init_ext.c \ ex_put_init_global.c \ ex_put_init_info.c \ ex_put_loadbal_param.c \ ex_put_loadbal_param_cc.c \ ex_put_map.c \ ex_put_map_param.c \ ex_put_n_attr.c \ ex_put_n_coord.c \ ex_put_n_elem_attr.c \ ex_put_n_elem_conn.c \ ex_put_n_elem_num_map.c \ ex_put_n_nodal_var.c \ ex_put_n_node_num_map.c \ ex_put_n_node_set.c \ ex_put_n_node_set_df.c \ ex_put_n_one_attr.c \ ex_put_n_side_set.c \ ex_put_n_side_set_df.c \ ex_put_n_var.c \ ex_put_name.c \ ex_put_names.c \ ex_put_nodal_var.c \ ex_put_nodal_var_slab.c \ ex_put_node_cmap.c \ ex_put_node_map.c \ ex_put_node_num_map.c \ ex_put_node_set.c \ ex_put_node_set_dist_fact.c \ ex_put_node_set_param.c \ ex_put_ns_param_global.c \ ex_put_nset_var.c \ ex_put_nset_var_tab.c \ ex_put_num_map.c \ ex_put_one_attr.c \ ex_put_one_elem_attr.c \ ex_put_partial_attr.c \ ex_put_partial_coord.c \ ex_put_partial_elem_attr.c \ ex_put_partial_elem_conn.c \ ex_put_partial_elem_map.c \ ex_put_partial_elem_num_map.c \ ex_put_partial_id_map.c \ ex_put_partial_nodal_var.c \ ex_put_partial_node_num_map.c \ ex_put_partial_node_set.c \ ex_put_partial_node_set_df.c \ ex_put_partial_num_map.c \ ex_put_partial_one_attr.c \ ex_put_partial_set.c \ ex_put_partial_set_dist_fact.c \ ex_put_partial_side_set.c \ ex_put_partial_side_set_df.c \ ex_put_partial_var.c \ ex_put_processor_elem_maps.c \ ex_put_processor_node_maps.c \ ex_put_prop.c \ ex_put_prop_array.c \ ex_put_prop_names.c \ ex_put_qa.c \ ex_put_set.c \ ex_put_set_dist_fact.c \ ex_put_set_param.c \ ex_put_sets.c \ ex_put_side_set.c \ ex_put_side_set_dist_fact.c \ ex_put_side_set_param.c \ ex_put_ss_param_global.c \ ex_put_sset_var.c \ ex_put_sset_var_tab.c \ ex_put_time.c \ ex_put_truth_table.c \ ex_put_var.c \ ex_put_var_name.c \ ex_put_var_names.c \ ex_put_var_param.c \ ex_put_var_tab.c \ ex_put_variable_name.c \ ex_put_variable_names.c \ ex_put_variable_param.c \ ex_update.c \ ex_utils.c \ OBJS = ${SRCS:.c=.o} all:: libexodus.a libexodus.a: $(OBJS) $(AR) $@ $? $(RANLIB) $@ cp libexodus.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 exodusii-6.02.dfsg.1/exodus/cbind/src/ex_close.c000066400000000000000000000120631225312213100214670ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" extern char *ret_string; /* cf ex_utils.c */ /*! The function ex_close() updates and then closes an open exodus file. \return In case of an error, ex_close() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() \param exoid exodus file ID returned from a previous call to ex_create() or ex_open(). The following code segment closes an open exodus file: \code int error,exoid; error = ex_close (exoid); \endcode */ int ex_close (int exoid) { char errmsg[MAX_ERR_LENGTH]; int status; int parent_id = 0; exerrval = 0; /* clear error code */ /* * NOTE: If using netcdf-4, exoid must refer to the root group. * Need to determine whether there are any groups and if so, * call ex_rm_file_item and ex_rm_stat_ptr on each group. */ #if !defined(NOT_NETCDF4) /* nc_inq_grp_parent() will return NC_ENOGRP error if exoid * refers to the root group (which is what we want) */ if ((status = nc_inq_grp_parent(exoid, &parent_id)) != NC_ENOGRP) { exerrval = EX_NOTROOTID; sprintf(errmsg,"Error: file id %d does not refer to root group.",exoid); ex_err("ex_close",errmsg,exerrval); return(EX_FATAL); } #endif if ((status = nc_sync(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to update file id %d",exoid); ex_err("ex_close",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_close (exoid)) == NC_NOERR) { ex_conv_exit(exoid); ex_rm_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK)); ex_rm_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK)); ex_rm_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK)); ex_rm_file_item(exoid, ex_get_counter_list(EX_NODE_SET)); ex_rm_file_item(exoid, ex_get_counter_list(EX_EDGE_SET)); ex_rm_file_item(exoid, ex_get_counter_list(EX_FACE_SET)); ex_rm_file_item(exoid, ex_get_counter_list(EX_SIDE_SET)); ex_rm_file_item(exoid, ex_get_counter_list(EX_ELEM_SET)); ex_rm_file_item(exoid, ex_get_counter_list(EX_NODE_MAP)); ex_rm_file_item(exoid, ex_get_counter_list(EX_EDGE_MAP)); ex_rm_file_item(exoid, ex_get_counter_list(EX_FACE_MAP)); ex_rm_file_item(exoid, ex_get_counter_list(EX_ELEM_MAP)); ex_rm_stat_ptr (exoid, &exoII_ed); ex_rm_stat_ptr (exoid, &exoII_fa); ex_rm_stat_ptr (exoid, &exoII_eb); ex_rm_stat_ptr (exoid, &exoII_ns); ex_rm_stat_ptr (exoid, &exoII_es); ex_rm_stat_ptr (exoid, &exoII_fs); ex_rm_stat_ptr (exoid, &exoII_ss); ex_rm_stat_ptr (exoid, &exoII_els); ex_rm_stat_ptr (exoid, &exoII_nm); ex_rm_stat_ptr (exoid, &exoII_edm); ex_rm_stat_ptr (exoid, &exoII_fam); ex_rm_stat_ptr (exoid, &exoII_em); } else { exerrval = status; sprintf(errmsg, "Error: failed to close file id %d",exoid); ex_err("ex_close",errmsg, status); return(EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_conv.c000066400000000000000000000355031225312213100213330ustar00rootroot00000000000000/* * 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 * * entry conditions - * * exit conditions - * * revision history - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! \file * this file contains code needed to support the various floating point word * size combinations for computation and i/o that applications might want to * use. See the netcdf documentation for more details on the floating point * conversion capabilities. * * netCDF supports two floating point word sizes for its files: * - NC_FLOAT - 32 bit IEEE * - NC_DOUBLE - 64 bit IEEE * */ #define NC_FLOAT_WORDSIZE 4 #define NC_DOUBLE_WORDSIZE 8 static struct ex_file_item* file_list = NULL; struct ex_file_item* ex_find_file_item(int exoid) { /* Find base filename in case exoid refers to a group */ int base_exoid = (unsigned)exoid & EX_FILE_ID_MASK; struct ex_file_item *ptr = file_list; while (ptr) { \ if( ptr->file_id == base_exoid ) break; \ ptr = ptr->next; \ } \ return ptr; } int ex_conv_ini( int exoid, int* comp_wordsize, int* io_wordsize, int file_wordsize, int int64_status, int is_parallel) { char errmsg[MAX_ERR_LENGTH]; struct ex_file_item* new_file; int filetype = 0; /*! ex_conv_ini() initializes the floating point conversion process. * * \param exoid an integer uniquely identifying the file of interest. * * \param comp_wordsize compute floating point word size in the user's code. * a zero value indicates that the user is requesting the * default float size for the machine. The appropriate * value is chosen and returned in comp_wordsize, and used * in subsequent conversions. a valid but inappropriate * for this parameter cannot be detected. * * \param io_wordsize the desired floating point word size for a netCDF file. * for an existing file, if this parameter doesn't match * the word size of data already stored in the file, a * fatal error is generated. a value of 0 for an existing * file indicates that the word size of the file was not * known a priori, so use whatever is in the file. a value * of 0 for a new file means to use the default size, an * NC_FLOAT (4 bytes). when a value of 0 is specified the * actual value used is returned in io_wordsize. * * \param file_wordsize floating point word size in an existing netCDF file. * a value of 0 should be passed in for a new netCDF file. * * \param int64_status the flags specifying how integer values should be stored * on the database and how they should be passes through the * api functions. See #FileVars for more information. * * word size parameters are specified in bytes. valid values are 0, 4, and 8: */ /* check to make sure machine word sizes aren't weird */ if ((sizeof(float) != 4 && sizeof(float) != 8) || (sizeof(double) != 4 && sizeof(double) != 8 ) ) { sprintf(errmsg,"Error: unsupported compute word size for file id: %d", exoid); ex_err("ex_conv_ini",errmsg,EX_FATAL); return(EX_FATAL); } /* 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); } /* Check that the int64_status contains only valid bits... */ { int valid_int64 = EX_ALL_INT64_API | EX_ALL_INT64_DB; if ((int64_status & valid_int64) != int64_status) { sprintf(errmsg, "Warning: invalid int64_status flag (%d) specified for existing file id: %d. Ignoring invalids", int64_status, exoid); ex_err("ex_conv_ini",errmsg,EX_MSG); } int64_status &= valid_int64; } /* Verify filetype * 0 -- classic format (NC_FORMAT_CLASSIC -1) * 1 -- 64 bit classic (NC_FORMAT_64BIT -1) * 2 -- netcdf4 (NC_FORMAT_NETCDF4 -1) * 3 -- netcdf4 classic (NC_FORMAT_NETCDF4_CLASSIC -1) */ nc_inq_format(exoid, &filetype); new_file = malloc(sizeof(struct ex_file_item)); new_file->file_id = exoid; new_file->user_compute_wordsize = *comp_wordsize == 4 ? 0 : 1; new_file->int64_status = int64_status; new_file->maximum_name_length = ex_default_max_name_length; new_file->compression_level = 0; new_file->shuffle = 0; new_file->file_type = filetype-1; new_file->is_parallel = is_parallel; new_file->next = file_list; file_list = new_file; if (*io_wordsize == NC_FLOAT_WORDSIZE) new_file->netcdf_type_code = NC_FLOAT; else new_file->netcdf_type_code = NC_DOUBLE; 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_exit() to be called after * ncclose(), if the parameter used as "exoid" is the id returned from * an ncopen() or nccreate() call, as netCDF reuses file ids! * the best place to do this is ex_close(), which is where I did it. * * \param exoid integer which uniquely identifies the file of interest. */ char errmsg[MAX_ERR_LENGTH]; struct ex_file_item* file = file_list; struct ex_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 ); } /*............................................................................*/ /*............................................................................*/ 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. */ struct ex_file_item* file = ex_find_file_item(exoid); exerrval = 0; /* clear error code */ if (!file ) { char errmsg[MAX_ERR_LENGTH]; 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_int64_status(int exoid) { /* ex_int64_status() returns an int that can be tested against the defines listed below to determine which, if any, 'types' in the database are to be stored as int64 types and which, if any, types are passed/returned as int64 types in the API Defines: EX_MAPS_INT64_DB All maps (id, order, ...) store int64_t values EX_IDS_INT64_DB All entity ids (sets, blocks, maps) are int64_t values EX_BULK_INT64_DB EX_ALL_INT64_DB (EX_MAPS_INT64_DB|EX_IDS_INT64_DB|EX_BULK_INT64_DB) EX_MAPS_INT64_API All maps (id, order, ...) passed as int64_t values EX_IDS_INT64_API All entity ids (sets, blocks, maps) are passed as int64_t values EX_BULK_INT64_API EX_ALL_INT64_API (EX_MAPS_INT64_API|EX_IDS_INT64_API|EX_BULK_INT64_API) */ struct ex_file_item* file = ex_find_file_item(exoid); exerrval = 0; /* clear error code */ if (!file ) { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADFILEID; sprintf(errmsg,"Error: unknown file id %d for ex_int64_status().",exoid); ex_err("ex_int64_status",errmsg,exerrval); return 0; } return file->int64_status; } int ex_set_int64_status(int exoid, int mode) { /* ex_set_int64_status() sets the value of the INT64_API flags which specify how integer types are passed/returned as int64 types in the API Mode can be one of: 0 All are passed as int32_t values. EX_MAPS_INT64_API All maps (id, order, ...) passed as int64_t values EX_IDS_INT64_API All entity ids (sets, blocks, maps) are passed as int64_t values EX_BULK_INT64_API EX_ALL_INT64_API (EX_MAPS_INT64_API|EX_IDS_INT64_API|EX_BULK_INT64_API) */ int api_mode = 0; int db_mode = 0; struct ex_file_item* file = ex_find_file_item(exoid); exerrval = 0; /* clear error code */ if (!file ) { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADFILEID; sprintf(errmsg,"Error: unknown file id %d for ex_int64_status().",exoid); ex_err("ex_int64_status",errmsg,exerrval); return 0; } /* Strip of all non-INT64_API values */ api_mode = mode & EX_ALL_INT64_API; db_mode = file->int64_status & EX_ALL_INT64_DB; file->int64_status = api_mode | db_mode; return file->int64_status; } int ex_set_option(int exoid, ex_option_type option, int option_value) { struct ex_file_item* file = ex_find_file_item(exoid); if (!file ) { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADFILEID; sprintf(errmsg,"Error: unknown file id %d for ex_set_option().",exoid); ex_err("ex_set_option",errmsg,exerrval); return EX_FATAL; } exerrval = 0; /* clear error code */ switch (option) { case EX_OPT_MAX_NAME_LENGTH: file->maximum_name_length = option_value; break; case EX_OPT_COMPRESSION_TYPE: /* Currently not used. GZip by default */ break; case EX_OPT_COMPRESSION_LEVEL: /* 0 (disabled/fastest) ... 9 (best/slowest) */ /* Check whether file type supports compression... */ if (file->file_type == 2 || file->file_type == 3) { int value = option_value; if (value > 9) value = 9; if (value < 0) value = 0; file->compression_level = value; } else { file->compression_level = 0; } break; case EX_OPT_COMPRESSION_SHUFFLE: /* 0 (disabled); 1 (enabled) */ file->shuffle = option_value != 0 ? 1 : 0; break; case EX_OPT_INTEGER_SIZE_API: /* See *_INT64_* values above */ ex_set_int64_status(exoid, option_value); break; case EX_OPT_INTEGER_SIZE_DB: /* (query only) */ break; default: { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_FATAL; sprintf(errmsg,"Error: invalid option %d for ex_set_option().",(int)option); ex_err("ex_set_option",errmsg,exerrval); return EX_FATAL; } } return EX_NOERR; } int ex_comp_ws( int exoid ) { /*! * ex_comp_ws() returns 4 (i.e. sizeof(float)) or 8 (i.e. sizeof(double)), * depending on the value of floating point word size used to initialize * the conversion facility for this file id (exoid). * \param exoid integer which uniquely identifies the file of interest. */ struct ex_file_item* file = ex_find_file_item(exoid); exerrval = 0; /* clear error code */ if (!file ) { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADFILEID; sprintf(errmsg,"Error: unknown file id %d",exoid); ex_err("ex_comp_ws",errmsg,exerrval); return(EX_FATAL); } /* Stored as 0 for 4-byte; 1 for 8-byte */ return (file->user_compute_wordsize+1)*4; } int ex_is_parallel(int exoid) { /*! ex_is_parallel() returns 1 (true) or 0 (false) depending on whether * the file was opened in parallel or serial/file-per-processor mode. * Note that in this case parallel assumes the output of a single file, * not a parallel run using file-per-processor. */ struct ex_file_item* file = ex_find_file_item(exoid); exerrval = 0; /* clear error code */ if (!file ) { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADFILEID; sprintf(errmsg,"Error: unknown file id %d",exoid); ex_err("ex_is_parallel",errmsg,exerrval); return(EX_FATAL); } /* Stored as 1 for parallel, 0 for serial or file-per-processor */ return file->is_parallel; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_copy.c000066400000000000000000000707361225312213100213470ustar00rootroot00000000000000/* * 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. * */ #include #include #include #include "exodusII.h" #include "exodusII_int.h" /*! \cond INTERNAL */ struct ncdim { /* dimension */ char name[MAX_VAR_NAME_LENGTH]; size_t size; }; struct ncvar { /* variable */ char name[MAX_VAR_NAME_LENGTH]; nc_type type; int ndims; int dims[NC_MAX_VAR_DIMS]; int natts; }; struct ncatt { /* attribute */ int var; char name[MAX_VAR_NAME_LENGTH]; nc_type type; size_t len; void *val; }; static size_t type_size(nc_type type); static int cpy_att (int, int, int, int); static int cpy_var_def(int, int, int, char*); static int cpy_var_val(int, int, char*); static int cpy_coord_def(int in_id,int out_id,int rec_dim_id, char *var_nm, int in_large, int out_large); static int cpy_coord_val(int in_id,int out_id,char *var_nm, int in_large, int out_large); static void update_internal_structs( int, ex_inquiry, struct list_item** ); /*! \endcond */ /*! \undoc * efficiently copies all non-transient information (attributes, * dimensions, and variables from an opened EXODUS file to another * opened EXODUS file. Will not overwrite a dimension or variable * already defined in the new file. * \param in_exoid exodus file id for input file * \param out_exoid exodus file id for output file */ int ex_copy (int in_exoid, int out_exoid) { int status; int ndims; /* number of dimensions */ int nvars; /* number of variables */ int ngatts; /* number of global attributes */ 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 */ nc_type att_type = NC_NAT; size_t att_len = 0; size_t i; size_t numrec; size_t dim_sz; char dim_nm[NC_MAX_NAME]; int in_large, out_large; 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 */ nc_inq(in_exoid, &ndims, &nvars, &ngatts, &recdimid); nc_inq_dimlen(in_exoid, recdimid, &numrec); /* put output file into define mode */ nc_redef(out_exoid); /* copy global attributes */ for (i = 0; i < (size_t)ngatts; i++) { nc_inq_attname(in_exoid, NC_GLOBAL, i, att.name); /* if attribute exists in output file, don't overwrite it; compute * word size, I/O word size etc. are global attributes stored when * file is created with ex_create; we don't want to overwrite those */ if ((status = nc_inq_att(out_exoid, NC_GLOBAL, att.name, &att.type, &att.len)) != NC_NOERR) { /* The "last_written_time" attribute is a special attribute used by the Sierra IO system to determine whether a 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 */ nc_copy_att(in_exoid,NC_GLOBAL,att.name,out_exoid,NC_GLOBAL); } } } /* copy dimensions */ /* Get the dimension sizes and names */ for(dimid = 0; dimid < ndims; dimid++){ nc_inq_dim(in_exoid,dimid,dim_nm,&dim_sz); /* If the dimension isn't one we specifically don't want * to copy (ie, number of QA or INFO records) and it * hasn't been defined, copy it */ if ( ( strcmp(dim_nm,DIM_NUM_QA) != 0) && ( strcmp(dim_nm,DIM_NUM_INFO) != 0) && ( strcmp(dim_nm,DIM_NUM_NOD_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_EDG_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_FAC_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_ELE_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_NSET_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_ESET_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_FSET_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_SSET_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_ELSET_VAR) != 0) && ( strcmp(dim_nm,DIM_NUM_GLO_VAR) != 0) ) { /* See if the dimension has already been defined */ status = nc_inq_dimid(out_exoid, dim_nm, &dim_out_id); if(status != NC_NOERR) { if(dimid != recdimid) { nc_def_dim(out_exoid, dim_nm, dim_sz, &dim_out_id); } else { nc_def_dim(out_exoid, dim_nm, NC_UNLIMITED, &dim_out_id); } /* end else */ } /* end if */ } /* end if */ } /* end loop over dim */ /* DIM_STR_NAME is a newly added dimension required by current API. * If it doesn't exist on the source database, we need to add it to * the target... */ status = nc_inq_dimid(in_exoid, DIM_STR_NAME, &dim_out_id); if (status != NC_NOERR) { /* Not found; set to default value of 32+1. */ nc_def_dim(out_exoid, DIM_STR_NAME, 33, &dim_out_id); } status = nc_inq_att(in_exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, &att_type, &att_len); if (status != NC_NOERR) { int max_so_far = 32; nc_put_att_int(out_exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &max_so_far); } /* copy variable definitions and variable attributes */ for (varid = 0; varid < nvars; varid++) { nc_inq_var(in_exoid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts); /* we don't want to copy some variables because there is not a * simple way to add to them; * 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 */ nc_enddef (out_exoid); /* output variable data */ for (varid = 0; varid < nvars; varid++) { nc_inq_var(in_exoid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts); /* we don't want to copy some variable values; * QA records and info records shouldn't be copied because there * 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, ex_get_counter_list(EX_EDGE_BLOCK)); update_internal_structs( out_exoid, EX_INQ_FACE_BLK, ex_get_counter_list(EX_FACE_BLOCK)); update_internal_structs( out_exoid, EX_INQ_ELEM_BLK, ex_get_counter_list(EX_ELEM_BLOCK)); /* if number of sets > 0 */ update_internal_structs( out_exoid, EX_INQ_NODE_SETS, ex_get_counter_list(EX_NODE_SET)); update_internal_structs( out_exoid, EX_INQ_EDGE_SETS, ex_get_counter_list(EX_EDGE_SET)); update_internal_structs( out_exoid, EX_INQ_FACE_SETS, ex_get_counter_list(EX_FACE_SET)); update_internal_structs( out_exoid, EX_INQ_SIDE_SETS, ex_get_counter_list(EX_SIDE_SET)); update_internal_structs( out_exoid, EX_INQ_ELEM_SETS, ex_get_counter_list(EX_ELEM_SET)); /* if number of maps > 0 */ update_internal_structs( out_exoid, EX_INQ_NODE_MAP, ex_get_counter_list(EX_NODE_MAP)); update_internal_structs( out_exoid, EX_INQ_EDGE_MAP, ex_get_counter_list(EX_EDGE_MAP)); update_internal_structs( out_exoid, EX_INQ_FACE_MAP, ex_get_counter_list(EX_FACE_MAP)); update_internal_structs( out_exoid, EX_INQ_ELEM_MAP, ex_get_counter_list(EX_ELEM_MAP)); return(EX_NOERR); } /*! \cond INTERNAL */ 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) { nc_inq_natts(in_id,&nbr_att); } else { nc_inq_varnatts(in_id, var_in_id, &nbr_att); } /* Get the attributes names, types, lengths, and values */ for (idx=0; idx 1) { nc_def_var(out_id, VAR_COORD_Y, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id); ex_compress_variable(out_id, var_out_id, 2); } if (spatial_dim > 2) { nc_def_var(out_id, VAR_COORD_Z, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id); ex_compress_variable(out_id, var_out_id, 2); } } 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. */ status = nc_inq_varid(out_id, VAR_COORD, &var_out_id); if (status == NC_NOERR) return NC_NOERR; /* already defined in output file */ /* Get dimid of the spatial dimension and num_nodes dimensions in output file... */ nc_inq_dimid(out_id, DIM_NUM_DIM, &dim_out_id[0]); nc_inq_dimid(out_id, DIM_NUM_NODES, &dim_out_id[1]); /* Define the variable in the output file */ /* Define according to the EXODUS file's IO_word_size */ nbr_dim = 2; nc_def_var(out_id, VAR_COORD, nc_flt_code(out_id), nbr_dim, dim_out_id, &var_out_id); } return var_out_id; } /*! \internal */ 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 status; int *dim_in_id; int *dim_out_id; int idx; int nbr_dim; int var_in_id; int var_out_id; nc_type var_type; /* See if the requested variable is already in the output file. */ status = nc_inq_varid(out_id, var_nm, &var_out_id); if(status == NC_NOERR) return var_out_id; /* See if the requested variable is in the input file. */ nc_inq_varid(in_id, var_nm, &var_in_id); /* Get the type of the variable and the number of dimensions. */ nc_inq_vartype (in_id, var_in_id, &var_type); nc_inq_varndims(in_id, var_in_id, &nbr_dim); /* Recall: 1. The dimensions must be defined before the variable. 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 */ nc_inq_vardimid(in_id, var_in_id, dim_in_id); /* Get the dimension sizes and names */ for(idx=0;idx 0) { for (i=0; i #include static int warning_output = 0; int ex_create_int (const char *path, int cmode, int *comp_ws, int *io_ws, int run_version) { int exoid; int status; int dimid; int old_fill; int lio_ws; int filesiz; float vers; char errmsg[MAX_ERR_LENGTH]; char *mode_name; int mode = 0; #if defined(NC_NETCDF4) static int netcdf4_mode = -1; char *option; #endif /* NC_NETCDF4 */ int int64_status; unsigned int my_mode = cmode; assert(my_mode == cmode); exerrval = 0; /* clear error code */ if (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodusII version %d.%02d,\n but was linked with exodusII library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } /* * See if any integer data is to be stored as int64 (long long). If * so, then need to set NC_NETCDF4 and unset NC_CLASSIC_MODEL (or * set EX_NOCLASSIC. Output meaningful error message if the library * is not NetCDF-4 enabled... */ int64_status = my_mode & (EX_ALL_INT64_DB | EX_ALL_INT64_API); if ((int64_status & EX_ALL_INT64_DB) != 0) { #if defined(NC_NETCDF4) /* Library DOES support netcdf4... Set modes required to use * netcdf-4 in non-classic mode */ my_mode |= EX_NOCLASSIC; my_mode |= EX_NETCDF4; #else /* Library does NOT support netcdf4 */ exerrval = EX_BADPARAM; sprintf(errmsg, "EXODUS: Error: 64-bit integer storage requested, but the netcdf library does not support the required netcdf-4 extensions.\n"); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); #endif } #if defined(NC_NETCDF4) if (my_mode & EX_NETCDF4) { mode |= (NC_NETCDF4); } else { if (netcdf4_mode == -1) { option = getenv("EXODUS_NETCDF4"); if (option != NULL) { fprintf(stderr, "EXODUS: Using netcdf version 4 selected via EXODUS_NETCDF4 environment variable\n"); netcdf4_mode = NC_NETCDF4; } else { netcdf4_mode = 0; } } mode |= netcdf4_mode; } if (! (my_mode & EX_NOCLASSIC)) { mode |= NC_CLASSIC_MODEL; } #endif /* * See if "large file" mode was specified in a ex_create my_mode. If * so, then pass the NC_64BIT_OFFSET flag down to netcdf. * If netcdf4 mode specified, don't use NC_64BIT_OFFSET mode. */ if ( (my_mode & EX_LARGE_MODEL) && (my_mode & EX_NORMAL_MODEL)) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: conflicting mode specification for file %s, mode %d. Using normal", path, (int)my_mode); ex_err("ex_create",errmsg,exerrval); } if (my_mode & EX_NORMAL_MODEL) filesiz = 0; #if defined(NC_NETCDF4) else if (mode & NC_NETCDF4) filesiz = 1; #endif else filesiz = (int)((my_mode & EX_LARGE_MODEL) || (ex_large_model(-1) == 1)); if ( #if defined(NC_NETCDF4) !(mode & NC_NETCDF4) && #endif filesiz == 1) { mode |= NC_64BIT_OFFSET; } if (my_mode & 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 (my_mode & EX_CLOBBER) { mode |= NC_CLOBBER; mode_name = "CLOBBER"; } else { mode |= NC_NOCLOBBER; mode_name = "NOCLOBBER"; } if ((status = nc_create (path, mode, &exoid)) != NC_NOERR) { exerrval = status; if (my_mode & EX_NETCDF4) { sprintf(errmsg, "Error: file create failed for %s in NETCDF4 and %s mode.\n\tThis library probably does not support netcdf-4 files.", path, mode_name); } else { 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); 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, int64_status, 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 ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_API_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II API version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file version # as an attribute */ vers = EX_VERS; if ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file float word size as an attribute */ lio_ws = (int)(*io_ws); if ((status=nc_put_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, NC_INT, 1, &lio_ws)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file float word size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file size (1=large, 0=normal) as an attribute */ if ((status = nc_put_att_int (exoid, NC_GLOBAL, ATT_FILESIZE, NC_INT, 1, &filesiz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } { int max_so_far = 32; if ((status=nc_put_att_int(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &max_so_far)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add maximum_name_length attribute in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } } /* define some dimensions and variables */ /* create string length dimension */ if ((status=nc_def_dim (exoid, DIM_STR, (MAX_STR_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define string length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* The name string length dimension is delayed until the ex_put_init function */ /* create line length dimension */ if ((status = nc_def_dim(exoid, DIM_LIN, (MAX_LINE_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define line length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* create number "4" dimension; must be of type long */ if ((status = nc_def_dim(exoid, DIM_N4, 4L, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number \"4\" dimension in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } { int int64_db_status = int64_status & EX_ALL_INT64_DB; if ((status=nc_put_att_int(exoid, NC_GLOBAL, ATT_INT64_STATUS, NC_INT, 1, &int64_db_status)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add int64_status attribute in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_create_group.c000066400000000000000000000057161225312213100230500ustar00rootroot00000000000000/* * Copyright (c) 2013 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include #include int ex_create_group (int parent_id, const char *group_name) { int exoid = -1; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ #if defined(NOT_NETCDF4) exerrval = NC_ENOTNC4; sprintf(errmsg, "Error: Group capabilities are not available in this netcdf version--not netcdf4"); ex_err("ex_create_group",errmsg,exerrval); return (EX_FATAL); #else if ((status = nc_redef (parent_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", parent_id); ex_err("ex_create_group",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_def_grp (parent_id, group_name, &exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: group create failed for %s in file id %d", group_name, parent_id); ex_err("ex_create_group",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_enddef (parent_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } #endif return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_create_par.c000066400000000000000000000343241225312213100224730ustar00rootroot00000000000000/* * 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. * */ /*! \note The ex_create_int() is an internal function called by ex_create(). The user should call ex_create() and not ex_create_int(). The function ex_create() creates a new exodus file and returns an ID that can subsequently be used to refer to the file. All floating point values in an exodus file are stored as either 4-byte (\c float) or 8-byte (\c double) numbers; no mixing of 4- and 8-byte numbers in a single file is allowed. An application code can compute either 4- or 8-byte values and can designate that the values be stored in the exodus file as either 4- or 8-byte numbers; conversion between the 4- and 8-byte values is performed automatically by the API routines. Thus, there are four possible combinations of compute word size and storage (or I/O) word size. \return In case of an error, ex_create() returns a negative number. Possible causes of errors include: - Passing a file name that includes a directory that does not exist. - Specifying a file name of a file that exists and also specifying a no clobber option. - Attempting to create a file in a directory without permission to create files there. - Passing an invalid file clobber mode. \param path The file name of the new exodus file. This can be given as either an absolute path name (from the root of the file system) or a relative path name (from the current directory). \param cmode Mode. Use one of the following predefined constants: \arg \c EX_NOCLOBBER To create the new file only if the given file name does not refer to a file that already exists. \arg \c EX_CLOBBER To create the new file, regardless of whether a file with the same name already exists. If a file with the same name does exist, its contents will be erased. \arg \c EX_LARGE_MODEL To create a model that can store individual datasets larger than 2 gigabytes. This modifies the internal storage used by exodusII and also puts the underlying NetCDF file into the \e 64-bit offset' mode. See largemodel for more details on this mode. A large model file will also be created if the environment variable \c EXODUS_LARGE_MODEL is defined in the users environment. A message will be printed to standard output if this environment variable is found. \arg \c EX_NORMAL_MODEL Create a standard model. \arg \c EX_NETCDF4 To create a model using the HDF5-based NetCDF-4 output. An HDF5-based NetCDF-4 file will also be created if the environment variable \c EXODUS_NETCDF4 is defined in the users environment. A message will be printed to standard output if this environment variable is found. \arg \c EX_NOSHARE Do not open the underlying NetCDF file in \e share mode. See the NetCDF documentation for more details. \arg \c EX_SHARE Do open the underlying NetCDF file in \e share mode. See the NetCDF documentation for more details. \param[in,out] comp_ws The word size in bytes (0, 4 or 8) of the floating point variables used in the application program. If 0 (zero) is passed, the default sizeof(float) will be used and returned in this variable. WARNING: all exodus functions requiring floats must be passed floats declared with this passed in or returned compute word size (4 or 8).} \param io_ws The word size in bytes (4 or 8) of the floating point data as they are to be stored in the exodus file. \param run_version (internally generated) used to verify compatability of libary and include files. The following code segment creates an exodus file called \file{test.exo}: \code #include "exodusII.h" int CPU_word_size, IO_word_size, exoid; CPU_word_size = sizeof(float); \comment{use float or double} IO_word_size = 8; \comment{store variables as doubles} \comment{create exodus file} exoid = ex_create ("test.exo" \comment{filename path} EX_CLOBBER, \comment{create mode} &CPU_word_size, \comment{CPU float word size in bytes} &IO_word_size); \comment{I/O float word size in bytes} \endcode */ #include #include #include #include "netcdf_par.h" #include "exodusII.h" #include "exodusII_int.h" static int warning_output = 0; int ex_create_par_int (const char *path, int cmode, int *comp_ws, int *io_ws, MPI_Comm comm, MPI_Info info, int run_version) { int exoid, dims[1]; int status; int dimid, time_dim; int old_fill; int lio_ws; int filesiz; float vers; char errmsg[MAX_ERR_LENGTH]; char *mode_name; int mode = 0; int int64_status; int pariomode = 0; unsigned int my_mode = cmode; assert(my_mode == cmode); exerrval = 0; /* clear error code */ #if !defined(NC_NETCDF4) /* Library does NOT support netcdf4 */ exerrval = EX_BADPARAM; sprintf(errmsg, "EXODUS: Error: Parallel output requires the netcdf-4 library format, but this netcdf library does not support that.\n"); ex_err("ex_create_par",errmsg,exerrval); return (EX_FATAL); #endif if (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodusII version %d.%02d,\n but was linked with exodusII library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } /* * See if any integer data is to be stored as int64 (long long). If * so, then need to set NC_NETCDF4 and unset NC_CLASSIC_MODEL (or * set EX_NOCLASSIC. Output meaningful error message if the library * is not NetCDF-4 enabled... */ int64_status = my_mode & (EX_ALL_INT64_DB | EX_ALL_INT64_API); if ((int64_status & EX_ALL_INT64_DB) != 0) { /* Library DOES support netcdf4... Set modes required to use * netcdf-4 in non-classic mode */ my_mode |= EX_NOCLASSIC; my_mode |= EX_NETCDF4; } /* Check parallel io mode. Valid is NC_MPIPOSIX or NC_MPIIO or NC_PNETCDF * Exodus uses different flag values; map to netcdf values */ if (my_mode & EX_MPIPOSIX) { pariomode = NC_MPIPOSIX; my_mode |= EX_NETCDF4; } else if (my_mode & EX_MPIIO) { pariomode = NC_MPIIO; my_mode |= EX_NETCDF4; } else if (my_mode & EX_PNETCDF) { pariomode = NC_PNETCDF; mode |= NC_64BIT_OFFSET; } if (my_mode & EX_NETCDF4) { mode |= NC_NETCDF4; } if (! (my_mode & EX_NOCLASSIC)) { mode |= NC_CLASSIC_MODEL; } /* * See if "large file" mode was specified in a ex_create my_mode. If * so, then pass the NC_64BIT_OFFSET flag down to netcdf. * If netcdf4 mode specified, don't use NC_64BIT_OFFSET mode. */ if ( (my_mode & EX_LARGE_MODEL) && (my_mode & EX_NORMAL_MODEL)) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: conflicting mode specification for file %s, mode %d. Using normal", path, (int)my_mode); ex_err("ex_create",errmsg,exerrval); } filesiz = 1; if (my_mode & 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 (my_mode & EX_CLOBBER) { mode |= NC_CLOBBER; mode_name = "CLOBBER"; } else { mode |= NC_NOCLOBBER; mode_name = "NOCLOBBER"; } if ((status = nc_create_par (path, mode|pariomode, comm, info, &exoid)) != NC_NOERR) { exerrval = status; if (my_mode & EX_NETCDF4) { sprintf(errmsg, "Error: file create failed for %s in NETCDF4 and %s mode.\n\tThis library probably does not support netcdf-4 files.", path, mode_name); } else { 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); 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, int64_status,1) != 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 ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_API_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II API version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file version # as an attribute */ vers = EX_VERS; if ((status=nc_put_att_float(exoid, NC_GLOBAL, ATT_VERSION, NC_FLOAT, 1, &vers)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file version attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file float word size as an attribute */ lio_ws = (int)(*io_ws); if ((status=nc_put_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, NC_INT, 1, &lio_ws)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file float word size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* store Exodus file size (1=large, 0=normal) as an attribute */ if ((status = nc_put_att_int (exoid, NC_GLOBAL, ATT_FILESIZE, NC_INT, 1, &filesiz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store Exodus II file size attribute in file id %d", exoid); ex_err("ex_create",errmsg, exerrval); return (EX_FATAL); } /* define some dimensions and variables */ /* create string length dimension */ if ((status=nc_def_dim (exoid, DIM_STR, (MAX_STR_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define string length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* The name string length dimension is delayed until the ex_put_init function */ /* create line length dimension */ if ((status = nc_def_dim(exoid, DIM_LIN, (MAX_LINE_LENGTH+1), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define line length in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } /* create number "4" dimension; must be of type long */ if ((status = nc_def_dim(exoid, DIM_N4, 4L, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number \"4\" dimension in file id %d",exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_def_dim(exoid, DIM_TIME, NC_UNLIMITED, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define time dimension in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } dims[0] = time_dim; if ((status = nc_def_var(exoid, VAR_WHOLE_TIME, nc_flt_code(exoid), 1, dims, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define whole time step variable in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } ex_compress_variable(exoid, dimid, 2); { int int64_db_status = int64_status & EX_ALL_INT64_DB; if ((status=nc_put_att_int(exoid, NC_GLOBAL, ATT_INT64_STATUS, NC_INT, 1, &int64_db_status)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add int64_status attribute in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_cvt_nodes_to_sides.c000066400000000000000000001070021225312213100242350ustar00rootroot00000000000000/* * 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. * */ #include #include #include #include "exodusII.h" #include "exodusII_int.h" static void *safe_free(void *array) { if (array != 0) free(array); return 0; } static int64_t get_node(void_int *connect, size_t index, size_t int_size) { if (int_size == sizeof(int64_t)) { return ((int64_t*)connect)[index]; } else { return ((int*)connect)[index]; } } static void put_side(void_int *side_list, size_t index, size_t value, size_t int_size) { if (int_size == sizeof(int64_t)) { ((int64_t*)side_list)[index] = value; } else { ((int*)side_list)[index] = value; } } /*! The function ex_cvt_nodes_to_sides() is used to convert a side set node list to a side set side list. This routine is provided for application programs that utilize side sets defined by nodes (as was done previous to release 2.0) rather than local faces or edges. The application program must allocate memory for the returned array of sides. The length of this array is the same as the length of the concatenated side sets element list, which can be determined with a call to ex_inquire() or ex_inquire_int(). \return In case of an error, ex_cvt_nodes_to_sides() returns a negative number; a warning will return a positive number. Possible causes of errors include: - a warning value is returned if no side sets are stored in the file. - because the faces of a wedge require a different number of nodes to describe them (quadrilateral vs. triangular faces), the function will abort with a fatal return code if a wedge is encountered in the side set element list. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] num_elem_per_set Array containing the number of sides for each set. The number of sides is equal to the number of elements for each set. \param[in] num_nodes_per_set Array containing the number of nodes for each set. \param[in] side_sets_elem_index Array containing indices into the \c side_sets_elem_list which are the locations of the first element for each set. These indices are 0-based. Unused. \param[in] side_sets_node_index Array containing indices into the \c side_sets_node_list which are the locations of the first node for each set. These indices are 0-based. Unused. \param[in] side_sets_elem_list Array containing the elements for all side sets. Internal element IDs are used in this list (see Section LocalElementIds). \param[in] side_sets_node_list Array containing the nodes for all side sets. Internal node IDs are used in this list (see Section LocalNodeIds). \param[out] side_sets_side_list Returned array containing the sides for all side sets. The following code segment will convert side sets described by nodes to side sets described by local side numbers: \code int error, exoid, ids[2], num_side_per_set[2], num_nodes_per_set[2], elem_ind[2], node_ind[2], elem_list[4], node_list[8], el_lst_len, *side_list; ids[0] = 30 ; ids[1] = 31; num_side_per_set[0] = 2; num_side_per_set[1] = 2; num_nodes_per_set[0] = 4; num_nodes_per_set[1] = 4; elem_ind[0] = 0; elem_ind[1] = 2; node_ind[0] = 0; node_ind[1] = 4; \comment{side set #1} elem_list[0] = 2; elem_list[1] = 2; node_list[0] = 8; node_list[1] = 5; node_list[2] = 6; node_list[3] = 7; \comment{side set #2} elem_list[2] = 1; elem_list[3] = 2; node_list[4] = 2; node_list[5] = 3; node_list[6] = 7; node_list[7] = 8; el_lst_len = ex_inquire_int(exoid, EX_INQ_SS_ELEM_LEN); \comment{side set element list is same length as side list} side_list = (int *) calloc (el_lst_len, sizeof(int)); ex_cvt_nodes_to_sides(exoid, num_side_per_set, num_nodes_per_set, elem_ind, node_ind, elem_list, node_list, side_list); \endcode Algorithm: \verbatim 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 } } } } } \endverbatim */ int ex_cvt_nodes_to_sides(int exoid, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, /* unused */ void_int *side_sets_node_index, /* unused */ void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list) { size_t m; size_t i, j, k, n; int num_side_sets, num_elem_blks; int64_t tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0, ndim; void_int *elem_blk_ids = NULL; void_int *connect = NULL; void_int *ss_elem_ndx = NULL; void_int *ss_elem_node_ndx = NULL; void_int *ss_parm_ndx = NULL; size_t elem_ctr, node_ctr, elem_num_pos; int num_nodes_per_elem, num_node_per_side; int *same_elem_type = NULL; int el_type = 0; int int_size; int ids_size; struct elem_blk_parm *elem_blk_parms = NULL; int err_stat = EX_NOERR; /* 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 */ /* first check if any side sets are specified */ /* inquire how many side sets have been stored */ num_side_sets = ex_inquire_int(exoid, EX_INQ_SIDE_SETS); if (num_side_sets < 0) { 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); } num_elem_blks = ex_inquire_int(exoid, EX_INQ_ELEM_BLK); if (num_elem_blks < 0) { 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); } tot_num_elem = ex_inquire_int(exoid, EX_INQ_ELEM); if (tot_num_elem < 0) { 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 */ ndim = ex_inquire_int(exoid, EX_INQ_DIM); int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) int_size = sizeof(int64_t); /* First count up # of elements in the side sets*/ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { for (i=0;i= elem_ctr) { elem_ctr += ((int64_t*)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 = ((int64_t*)num_elem_per_set)[0]; for (i=0,k=0;i= elem_ctr) { /* skip over NULL side sets */ while ( ((int64_t*)num_elem_per_set)[++k] == 0); elem_ctr += ((int64_t*)num_elem_per_set)[k]; } /* determine number of nodes per side */ if (((((int64_t*)num_nodes_per_set)[k] % ((int64_t*)num_elem_per_set)[k]) == 0) && (same_elem_type[k])) { /* all side set elements are same type */ node_ctr += ((int64_t*)num_nodes_per_set)[k] /((int64_t*)num_elem_per_set)[k]; } else { node_ctr += elem_blk_parms[j].num_nodes_per_side[0]; } } ((int64_t*)ss_elem_node_ndx)[i] = node_ctr; /* assign node list index */ } else { elem_ctr = ((int*)num_elem_per_set)[0]; for (i=0,k=0;i= elem_ctr) { elem_ctr += ((int*)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 = ((int*)num_elem_per_set)[0]; for (i=0,k=0;i= elem_ctr) { /* skip over NULL side sets */ while ( ((int*)num_elem_per_set)[++k] == 0); elem_ctr += ((int*)num_elem_per_set)[k]; } /* determine number of nodes per side */ if (((((int*)num_nodes_per_set)[k] % ((int*)num_elem_per_set)[k]) == 0) && (same_elem_type[k])) { /* all side set elements are same type */ node_ctr += ((int*)num_nodes_per_set)[k] /((int*)num_elem_per_set)[k]; } else { node_ctr += elem_blk_parms[j].num_nodes_per_side[0]; } } ((int*)ss_elem_node_ndx)[i] = node_ctr; /* assign node list index */ } /* All setup, ready to go ... */ elem_ctr=0; for (j=0; j < tot_num_ss_elem; j++) { int64_t elem; int64_t idx; int64_t ss_node0, ss_node1; int64_t p_ndx; if (int_size == sizeof(int64_t)) { idx = ((int64_t*)ss_elem_ndx)[j]; elem = ((int64_t*)side_sets_elem_list)[idx]; ss_node0 = ((int64_t*)side_sets_node_list)[((int64_t*)ss_elem_node_ndx)[idx]]; ss_node1 = ((int64_t*)side_sets_node_list)[((int64_t*)ss_elem_node_ndx)[idx]+1]; p_ndx = ((int64_t*)ss_parm_ndx)[idx]; } else { idx = ((int*)ss_elem_ndx)[j]; elem = ((int*)side_sets_elem_list)[idx]; ss_node0 = ((int*)side_sets_node_list)[((int*)ss_elem_node_ndx)[idx]]; ss_node1 = ((int*)side_sets_node_list)[((int*)ss_elem_node_ndx)[idx]+1]; p_ndx = ((int*)ss_parm_ndx)[idx]; } elem_num = elem-1; if (elem > elem_ctr) { /* release connectivity array space and get next one */ if (elem_ctr > 0) safe_free(connect); /* Allocate space for the connectivity array for new element block */ if (!(connect= malloc(elem_blk_parms[p_ndx].num_elem_in_blk* elem_blk_parms[p_ndx].num_nodes_per_elem* int_size))) { 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); err_stat = EX_FATAL; goto cleanup; } /* get connectivity array */ if (ex_get_elem_conn( exoid, elem_blk_parms[p_ndx].elem_blk_id, connect) == -1) { sprintf(errmsg, "Error: failed to get connectivity array for elem blk %"PRId64" for file id %d", elem_blk_parms[p_ndx].elem_blk_id, exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } elem_ctr = elem_blk_parms[p_ndx].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. */ /* calculate the relative element number position in it's block*/ elem_num_pos = elem_num - (elem_blk_parms[p_ndx].elem_ctr - elem_blk_parms[p_ndx].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[p_ndx].num_nodes_per_elem; for (n=0; n= 4) /* 4- or 8-node side (front or back face) */ put_side(side_sets_side_list,idx,shell_table[1][2*n],int_size); else /* 2- or 3-node side (edge of shell) */ put_side(side_sets_side_list,idx,shell_edge_table[1][2*n],int_size); } else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (shell_table[0][2*n+1]-1),int_size)) { if (num_node_per_side >= 4) /* 4- or 8-node side (front or back face) */ put_side(side_sets_side_list,idx,shell_table[1][2*n+1],int_size); else /* 2- or 3-node side (edge of shell) */ put_side(side_sets_side_list,idx,shell_edge_table[1][2*n+1],int_size); } else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (shell_table[0][2*n+2]-1),int_size)) { if (num_node_per_side >= 4) /* 4- or 8-node side (front or back face) */ put_side(side_sets_side_list,idx,shell_table[1][2*n+2],int_size); else /* 2- or 3-node side (edge of shell) */ put_side(side_sets_side_list,idx,shell_edge_table[1][2*n+2],int_size); } else { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: failed to find SHELL element %"PRId64", node %"PRId64" in connectivity array %"PRId64" for file id %d", elem_num+1, ss_node1, elem_blk_parms[p_ndx].elem_blk_id, exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } break; } case EX_EL_HEX: { /* use table to find which node to compare to next */ if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (hex_table[0][3*n]-1),int_size)) put_side(side_sets_side_list,idx,hex_table[1][3*n],int_size); else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (hex_table[0][3*n+1]-1),int_size)) put_side(side_sets_side_list,idx,hex_table[1][3*n+1],int_size); else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (hex_table[0][3*n+2]-1),int_size)) put_side(side_sets_side_list,idx,hex_table[1][3*n+2],int_size); else { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: failed to find HEX element %"PRId64", node %"PRId64" in connectivity array %"PRId64" for file id %d", elem_num+1, ss_node1, elem_blk_parms[p_ndx].elem_blk_id, exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } break; } case EX_EL_TETRA: { /* use table to find which node to compare to next */ if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (tetra_table[0][3*n]-1),int_size)) put_side(side_sets_side_list,idx,tetra_table[1][3*n],int_size); else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (tetra_table[0][3*n+1]-1),int_size)) put_side(side_sets_side_list,idx,tetra_table[1][3*n+1],int_size); else if (ss_node1 == get_node(connect,num_nodes_per_elem*(elem_num_pos)+ (tetra_table[0][3*n+2]-1),int_size)) put_side(side_sets_side_list,idx,tetra_table[1][3*n+2],int_size); else { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: failed to find TETRA element %"PRId64", node %"PRId64" in connectivity array %"PRId64" for file id %d", elem_num+1, ss_node1, elem_blk_parms[p_ndx].elem_blk_id, exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } break; } case EX_EL_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); err_stat = EX_FATAL; goto cleanup; } case EX_EL_WEDGE: { /* 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); err_stat = EX_FATAL; goto cleanup; } default: { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: %s is an unsupported element type", elem_blk_parms[p_ndx].elem_type); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } } 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 %"PRId64", node %"PRId64" in element block %"PRId64" for file id %d", elem_num+1, ss_node0, elem_blk_parms[p_ndx].elem_blk_id, exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } } /* All done: release connectivity array space, element block ids array, element block parameters array, and side set element index array */ cleanup: safe_free(connect); safe_free(ss_elem_node_ndx); safe_free(ss_parm_ndx); safe_free(elem_blk_parms); safe_free(elem_blk_ids); safe_free(ss_elem_ndx); return (err_stat); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_err.c000066400000000000000000000217011225312213100211510ustar00rootroot00000000000000/* * 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. * */ #include #include #include #include "exodusII.h" #include "exodusII_int.h" /*! \fn{void ex_err(const char *module_name, const char *message, int err_num)} The function ex_err() logs an error to \c stderr. It is intended to provide explanatory messages for error codes returned from other exodus routines. The passed in error codes and corresponding messages are listed in ???. The programmer may supplement the error message printed for standard errors by providing an error message. If the error code is provided with no error message, the predefined message will be used. The error code \c EX_MSG is available to log application specific messages. \param[in] module_name This is a string containing the name of the calling function. \param[in] message This is a string containing a message explaining the error or problem. If \c EX_VERBOSE (see ex_opts()) is true, this message will be printed to \c stderr. Otherwise, nothing will be printed. Maximum length is \c MAX_ERR_LENGTH. \param[in] err_num This is an integer code identifying the error. exodus C functions place an error code value in \c exerrval, an external int. Negative values are considered fatal errors while positive values are warnings. There is a set of predefined values defined in \file{exodusII.h}. The predefined constant \c EX_PRTLASTMSG will cause the last error message to be output, regardless of the setting of the error reporting level (see ex_opts()). The following is an example of the use of this function: \code #include "exodusII.h" int exoid, CPU_word_size, IO_word_size, errval; float version; char errmsg[MAX_ERR_LENGTH]; CPU_word_size = sizeof(float); IO_word_size = 0; \comment{open exodus file} if (exoid = ex_open ("test.exo", EX_READ, &CPU_word_size, &IO_word_size, &version)) { errval = 999; sprintf(errmsg,"Error: cannot open file test.exo"); ex_err("prog_name", errmsg, errval); } \endcode */ 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_err_num; void ex_err(const char *module_name, const char *message, int err_num) { if (err_num == 0) /* zero is no error, ignore and return */ return; else if (err_num == EX_PRTLASTMSG) { fprintf(stderr, "[%s] %s\n",last_pname,last_errmsg); fprintf(stderr, " exerrval = %d\n",last_err_num); return; } else if (err_num == EX_NULLENTITY) { if (exoptval & EX_NULLVERBOSE) { fprintf(stderr, "Exodus Library Warning: [%s]\n\t%s\n",module_name,message); } } else if (exoptval & EX_VERBOSE) /* check see if we really want to hear this */ { fprintf(stderr, "Exodus Library Warning/Error: [%s]\n\t%s\n",module_name,message); switch (err_num) { case NC_SYSERR: fprintf (stderr,"\t[%d] System error -- Usually disk full or filesystem issue\n", err_num); break; case NC_ESTS: fprintf (stderr,"\t[%d] In FORTRAN interface, string too small\n", err_num); break; case NC_EMAXNAME: fprintf (stderr,"\t[%d] length of name exceeds NC_MAX_NAME\n", err_num); break; case NC_EMAXDIMS: fprintf (stderr,"\t[%d] netcdf constraint NC_MAX_DIMS exceeded\n", err_num); break; case NC_EMAXVARS: fprintf (stderr,"\t[%d] netcdf constraint NC_MAX_VARS exceeded\n", err_num); break; case NC_EBADID: fprintf (stderr,"\t[%d] Not a netcdf id\n", err_num); break; case NC_ENFILE: fprintf (stderr,"\t[%d] Too many exodus (netcdf) files open\n", err_num); break; case NC_EEXIST: fprintf (stderr,"\t[%d] exodus (netcdf) file exists && NC_NOCLOBBER\n", err_num); break; case NC_EINVAL: fprintf (stderr,"\t[%d] Invalid Argument\n", err_num); break; case NC_EPERM: fprintf (stderr,"\t[%d] Write to read only\n", err_num); break; case NC_ENOTINDEFINE: fprintf (stderr,"\t[%d] Operation not allowed in data mode\n", err_num); break; case NC_EINDEFINE: fprintf (stderr,"\t[%d] Operation not allowed in define mode\n", err_num); break; case NC_EINVALCOORDS: fprintf (stderr,"\t[%d] Index exceeds dimension bound\n", err_num); break; case NC_ENAMEINUSE: fprintf (stderr,"\t[%d] String match to name in use\n", err_num); break; case NC_ENOTATT: fprintf (stderr,"\t[%d] Attribute not found\n", err_num); break; case NC_EMAXATTS: fprintf (stderr,"\t[%d] NC_MAX_ATTRS exceeded\n", err_num); break; case NC_EBADTYPE: fprintf (stderr,"\t[%d] Not a netcdf data type\n", err_num); break; case NC_EBADDIM: fprintf (stderr,"\t[%d] Invalid dimension id or name\n", err_num); break; case NC_EUNLIMPOS: fprintf (stderr,"\t[%d] NC_UNLIMITED in the wrong index\n", err_num); break; case NC_ENOTVAR: fprintf (stderr,"\t[%d] Variable not found\n", err_num); break; case NC_EGLOBAL: fprintf (stderr,"\t[%d] Action prohibited on NC_GLOBAL varid\n", err_num); break; case NC_ENOTNC: fprintf (stderr,"\t[%d] Not an exodus (netcdf) file\n", err_num); break; case NC_EUNLIMIT: fprintf (stderr,"\t[%d] NC_UNLIMITED size already in use\n", err_num); break; case NC_ENORECVARS: fprintf (stderr,"\t[%d] nc_rec op when there are no record vars\n", err_num); break; case NC_ECHAR: fprintf (stderr,"\t[%d] Attempt to convert between text & numbers\n", err_num); break; case NC_EEDGE: fprintf (stderr,"\t[%d] Start+count exceeds dimension bound\n", err_num); break; case NC_ESTRIDE: fprintf (stderr,"\t[%d] Illegal stride\n", err_num); break; case NC_EBADNAME: fprintf (stderr,"\t[%d] Attribute or variable name contains illegal characters\n", err_num); break; case NC_ERANGE: fprintf (stderr,"\t[%d] Math result not representable\n", err_num); break; case NC_ENOMEM: fprintf (stderr,"\t[%d] Memory allocation (malloc) failure\n", err_num); break; case NC_EVARSIZE: fprintf (stderr,"\t[%d] One or more variable sizes violate format constraints\n", err_num); break; case NC_EDIMSIZE: fprintf (stderr,"\t[%d] Invalid dimension size\n", err_num); break; case NC_ETRUNC: fprintf (stderr,"\t[%d] File likely truncated or possibly corrupted\n", err_num); break; case NC_EAXISTYPE: fprintf (stderr,"\t[%d] Unknown axis type.\n", err_num); break; case EX_MSG: break; default: if (exoptval & EX_VERBOSE) fprintf(stderr, " exerrval = %d\n",err_num); } } /* save the error message for replays */ strcpy(last_errmsg, message); strcpy(last_pname, module_name); last_err_num = err_num; fflush(stderr); /* with netCDF 3.4, (fatal) system error codes are > 0; so all EXODUS fatal error codes are > 0 */ if ((err_num > 0) && (exoptval & EX_ABORT)) exit (err_num); } void ex_get_err( const char** msg, const char** func, int* err_num ) { (*msg) = last_errmsg; (*func) = last_pname; (*err_num) = last_err_num; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_all_times.c000066400000000000000000000100661225312213100231730ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_all_times() reads the time values for all time steps. Memory must be allocated for the time values array before this function is invoked. The storage requirements (equal to the number of time steps) can be determined by using the ex_inquire() or ex_inquire_int() routines. Because time values are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_all_times() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - no time steps have been stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] time_values Returned array of times. These are the time values at all time steps. The following code segment will read the time values for all time steps stored in the data file: \code #include "exodusII.h" int error, exoid, num_time_steps; float *time_values; \comment{determine how many time steps are stored} num_time_steps = ex_inquire_int(exoid, EX_INQ_TIME); \comment{read time values at all time steps} time_values = (float *) calloc(num_time_steps, sizeof(float)); error = ex_get_all_times(exoid, time_values); \endcode */ int ex_get_all_times (int exoid, void *time_values) { int varid; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to locate time variable %s in file id %d", VAR_WHOLE_TIME, exoid); ex_err("ex_get_all_times",errmsg,exerrval); return(EX_FATAL); } /*read time values */ if (ex_comp_ws(exoid) == 4) { status = nc_get_var_float(exoid, varid, time_values); } else { status = nc_get_var_double(exoid, varid, time_values); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get time values from file id %d", exoid); ex_err("ex_get_all_times",errmsg,exerrval); return(EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_attr.c000066400000000000000000000121511225312213100221710ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * \undoc reads the attributes for an edge, face, or element block */ int ex_get_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, void* attrib ) { int status; int attrid, obj_id_ndx; char errmsg[MAX_ERR_LENGTH]; const char* vattrbname; exerrval = 0; /* clear error code */ /* Determine index of obj_id in vobjids array */ if (obj_type == EX_NODAL) obj_id_ndx = 0; else { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this object */ } else { sprintf(errmsg, "Warning: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(obj_type),obj_id, exoid); ex_err("ex_get_attr",errmsg,exerrval); return (EX_WARN); } } } switch (obj_type) { case EX_SIDE_SET: vattrbname = VAR_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: vattrbname = VAR_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: vattrbname = VAR_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: vattrbname = VAR_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: vattrbname = VAR_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: vattrbname = VAR_NATTRIB; break; case EX_EDGE_BLOCK: vattrbname = VAR_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: vattrbname = VAR_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: vattrbname = VAR_ATTRIB(obj_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_get_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_get_attr",errmsg,exerrval); return (EX_FATAL); } /* read in the attributes */ if (ex_comp_ws(exoid) == 4) { status = nc_get_var_float(exoid, attrid, attrib); } else { status = nc_get_var_double(exoid, attrid, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_attr_names.c000066400000000000000000000143031225312213100233550ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! \undoc */ /* * reads the attribute names for an element block */ int ex_get_attr_names( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, char **names) { int status; int varid, numattrdim, obj_id_ndx; size_t num_attr, i; char errmsg[MAX_ERR_LENGTH]; const char* dnumobjatt; const char* vattrbname; exerrval = 0; /* clear error code */ /* Determine index of obj_id in vobjids array */ if (obj_type != EX_NODAL) { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_get_attr_names",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this object */ } else { sprintf(errmsg, "Warning: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_get_attr_names",errmsg,exerrval); return (EX_WARN); } } } switch (obj_type) { case EX_NODE_SET: dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vattrbname = VAR_NAME_NSATTRIB(obj_id_ndx); break; case EX_SIDE_SET: dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vattrbname = VAR_NAME_SSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vattrbname = VAR_NAME_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vattrbname = VAR_NAME_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vattrbname = VAR_NAME_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjatt = DIM_NUM_ATT_IN_NBLK; vattrbname = VAR_NAME_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vattrbname = VAR_NAME_EATTRIB(obj_id_ndx); 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; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_get_attr_names",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid(exoid, dnumobjatt, &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no attributes found for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_attr_names",errmsg,EX_MSG); return (EX_WARN); /* no attributes for this object */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),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. */ status = nc_inq_varid(exoid, vattrbname, &varid); /* read in the attributes */ if (status == NC_NOERR) { /* read the names */ status = ex_get_names_internal(exoid, varid, num_attr, names, obj_type, "ex_get_attr_names"); if (status != NC_NOERR) { return (EX_FATAL); } } 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 #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the parameters used to describe an edge, face, or element block */ int ex_get_block( int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char* elem_type, void_int* num_entries_this_blk, void_int* num_nodes_per_entry, void_int* num_edges_per_entry, void_int* num_faces_per_entry, void_int* num_attr_per_entry ) { int err; ex_block block; block.id = blk_id; block.type = blk_type; err = ex_get_block_param(exoid, &block); if (ex_int64_status(exoid) & EX_BULK_INT64_API) { int64_t* n_entries_this_blk = num_entries_this_blk; int64_t* n_nodes_per_entry = num_nodes_per_entry; int64_t* n_edges_per_entry = num_edges_per_entry; int64_t* n_faces_per_entry = num_faces_per_entry; int64_t* n_attr_per_entry = num_attr_per_entry; if (n_entries_this_blk) *n_entries_this_blk = block.num_entry; if (n_nodes_per_entry) *n_nodes_per_entry = block.num_nodes_per_entry; if (n_edges_per_entry) *n_edges_per_entry = block.num_edges_per_entry; if (n_faces_per_entry) *n_faces_per_entry = block.num_faces_per_entry; if (n_attr_per_entry) *n_attr_per_entry = block.num_attribute; } else { int* n_entries_this_blk = num_entries_this_blk; int* n_nodes_per_entry = num_nodes_per_entry; int* n_edges_per_entry = num_edges_per_entry; int* n_faces_per_entry = num_faces_per_entry; int* n_attr_per_entry = num_attr_per_entry; if (n_entries_this_blk) *n_entries_this_blk = block.num_entry; if (n_nodes_per_entry) *n_nodes_per_entry = block.num_nodes_per_entry; if (n_edges_per_entry) *n_edges_per_entry = block.num_edges_per_entry; if (n_faces_per_entry) *n_faces_per_entry = block.num_faces_per_entry; if (n_attr_per_entry) *n_attr_per_entry = block.num_attribute; } if (elem_type) strcpy(elem_type, block.topology); return err; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_block_param.c000066400000000000000000000226571225312213100235050ustar00rootroot00000000000000/* * 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. * */ /*! * * \undoc exgblk - read block parameters * * 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 - * * */ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the parameters used to describe an edge, face, or element block */ int ex_get_block_param( int exoid, ex_block *block ) { int dimid, connid, blk_id_ndx; size_t len, i; char errmsg[MAX_ERR_LENGTH]; int status; const char* dnument; const char* dnumnod; const char* dnumedg; const char* dnumfac; const char* dnumatt; const char* ablknam; const char* vblkcon; exerrval = 0; /* First, locate index of element block id in VAR_ID_EL_BLK array */ blk_id_ndx = ex_id_lkup(exoid,block->type,block->id); if (exerrval != 0) { strcpy(block->topology, "NULL"); /* NULL element type name */ block->num_entry = 0; /* no elements */ block->num_nodes_per_entry = 0; /* no nodes */ block->num_edges_per_entry = 0; block->num_faces_per_entry = 0; block->num_attribute = 0; /* no attributes */ if (exerrval == EX_NULLENTITY) { /* NULL element block? */ return (EX_NOERR); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(block->type), block->id,exoid); ex_err("ex_get_block_param",errmsg,exerrval); return (EX_FATAL); } } switch (block->type) { case EX_EDGE_BLOCK: dnument = DIM_NUM_ED_IN_EBLK(blk_id_ndx); dnumnod = DIM_NUM_NOD_PER_ED(blk_id_ndx); dnumedg = 0; dnumfac = 0; dnumatt = DIM_NUM_ATT_IN_EBLK(blk_id_ndx); vblkcon = VAR_EBCONN(blk_id_ndx); ablknam = ATT_NAME_ELB; break; case EX_FACE_BLOCK: dnument = DIM_NUM_FA_IN_FBLK(blk_id_ndx); dnumnod = DIM_NUM_NOD_PER_FA(blk_id_ndx); dnumedg = 0; /* it is possible this might be non-NULL some day */ dnumfac = 0; dnumatt = DIM_NUM_ATT_IN_FBLK(blk_id_ndx); vblkcon = VAR_FBCONN(blk_id_ndx); ablknam = ATT_NAME_ELB; break; case EX_ELEM_BLOCK: dnument = DIM_NUM_EL_IN_BLK(blk_id_ndx); dnumnod = DIM_NUM_NOD_PER_EL(blk_id_ndx); dnumedg = DIM_NUM_EDG_PER_EL(blk_id_ndx); dnumfac = DIM_NUM_FAC_PER_EL(blk_id_ndx); dnumatt = DIM_NUM_ATT_IN_BLK(blk_id_ndx); vblkcon = VAR_CONN(blk_id_ndx); ablknam = ATT_NAME_ELB; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Bad block type parameter (%d) specified for file id %d.", block->type, exoid ); return (EX_FATAL); } /* inquire values of some dimensions */ if ((status = nc_inq_dimid (exoid, dnument, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of entities in %s %"PRId64" in file id %d", ex_name_of_object(block->type),block->id,exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %ss in block %"PRId64" in file id %d", ex_name_of_object(block->type),block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } block->num_entry = len; if ((status = nc_inq_dimid (exoid, dnumnod, &dimid)) != NC_NOERR) { /* undefined => no node entries per element */ len = 0; } else { if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes/entity in %s %"PRId64" in file id %d", ex_name_of_object(block->type),block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } } block->num_nodes_per_entry = len; if ( block->type != EX_ELEM_BLOCK ) { block->num_edges_per_entry = 0; } else { if ((status = nc_inq_dimid (exoid, dnumedg, &dimid)) != NC_NOERR) { /* undefined => no edge entries per element */ len = 0; } else { if ((status = nc_inq_dimlen (exoid, dimid, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of edges/entry in %s %"PRId64" in file id %d", ex_name_of_object(block->type),block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } } block->num_edges_per_entry = len; } if ( block->type != EX_ELEM_BLOCK ) { block->num_faces_per_entry = 0; } else { if ((status = nc_inq_dimid (exoid, dnumfac, &dimid)) != NC_NOERR) { /* undefined => no face entries per element */ len = 0; } else { if ((status = nc_inq_dimlen(exoid, dimid, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of faces/entity in %s %"PRId64" in file id %d", ex_name_of_object(block->type),block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } } block->num_faces_per_entry = len; } if ((status = nc_inq_dimid (exoid, dnumatt, &dimid)) != NC_NOERR) { /* dimension is undefined */ block->num_attribute = 0; } else { if ((status = nc_inq_dimlen(exoid, dimid, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes in %s %"PRId64" in file id %d", ex_name_of_object(block->type),block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } block->num_attribute = len; } if (block->num_nodes_per_entry > 0) { ; /* Do nothing, vblkcon should be correctly set already */ } else if (block->num_edges_per_entry > 0) { vblkcon = VAR_EBCONN(blk_id_ndx); } else if (block->num_faces_per_entry > 0) { vblkcon = VAR_FCONN(blk_id_ndx); } if (vblkcon) { /* look up connectivity array for this element block id */ if ((status = nc_inq_varid (exoid, vblkcon, &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(block->type), block->id,exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } if ((status = nc_inq_attlen (exoid, connid, ablknam, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get %s %"PRId64" type in file id %d", ex_name_of_object(block->type), block->id,exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } if (len > (MAX_STR_LENGTH+1)) { len = MAX_STR_LENGTH; sprintf (errmsg, "Warning: %s %"PRId64" type will be truncated to %ld chars", ex_name_of_object(block->type), block->id, (long)len); ex_err("ex_get_block_param",errmsg,EX_MSG); } for (i=0; i < MAX_STR_LENGTH+1; i++) block->topology[i] = '\0'; /* get the element type name */ if ((status = nc_get_att_text (exoid, connid, ablknam, block->topology)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to get %s %"PRId64" type in file id %d", ex_name_of_object(block->type), block->id, exoid); ex_err("ex_get_block_param",errmsg, exerrval); return(EX_FATAL); } /* get rid of trailing blanks */ ex_trim_internal(block->topology); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_cmap_params.c000066400000000000000000000414001225312213100235010ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_cmap_params() ***************************************************************************** * This function outputs the communication map parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * node_cmap_ids - Pointer to vector of nodal communication * set IDs. * node_cmap_node_cnts - Pointer to a vector which contains a count of * the number of FEM nodes for each nodal * communication map. * elem_cmap_ids - Pointer to vector for retrieval of elemental * communication set IDs. * elem_cmap_elem_cnts - Pointer to a vector which contains a count of * the number of FEM elements for each elemental * communication map. * processor - The processor the file being read was written * for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include int ex_get_cmap_params(int exoid, void_int *node_cmap_ids, void_int *node_cmap_node_cnts, void_int *elem_cmap_ids, void_int *elem_cmap_elem_cnts, int processor ) { const char *func_name="ex_get_cmap_params"; size_t cnt, num_n_comm_maps, num_e_comm_maps, start[1], count[1]; int64_t cmap_info_idx[2], cmap_data_idx[2]; int nmstat; int status, map_idx, varid, dimid; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /*****************************************************************************/ /*****************************************************************************/ /* Nodal communication map(s) */ /*****************************************************************************/ /*****************************************************************************/ /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_N_COMM_INFO_IDX, cmap_info_idx, processor) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the number of nodal communications maps in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_N_CMAPS, &dimid)) == NC_NOERR) { /* check if I need to get the dimension of the nodal comm map */ if (cmap_info_idx[1] == -1) { if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ cmap_info_idx[1] = count[0]; } /* End "if (cmap_info_idx[1] == -1) */ num_n_comm_maps = cmap_info_idx[1] - cmap_info_idx[0]; if (num_n_comm_maps > 0) { count[0] = num_n_comm_maps; /* Get the variable ID for the vector of nodal comm map IDs */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_IDS, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable ID for \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of nodal communication map IDs */ if (node_cmap_ids != NULL) { start[0] = cmap_info_idx[0]; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, node_cmap_ids); } else { status = nc_get_vara_int(exoid, varid, start, count, node_cmap_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_N_COMM_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (node_cmap_node_cnts != NULL) { /* Get the node counts in each of the nodal communication maps */ for(cnt=0; cnt < num_n_comm_maps; cnt++) { int64_t cmap_id; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { cmap_id = ((int64_t*)node_cmap_ids)[cnt]; } else { cmap_id = ((int*)node_cmap_ids)[cnt]; } if ((map_idx=ne_id_lkup(exoid, VAR_N_COMM_IDS, cmap_info_idx, cmap_id)) < 0) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to find nodal comm map with ID %"PRId64" in file ID %d", cmap_id, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Check the status of the node map */ start[0] = map_idx; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_N_COMM_DATA_IDX, cmap_data_idx, map_idx) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (cmap_data_idx[1] == -1) { /* * Find the dimension ID of the variable containing the * node count */ if ((status = nc_inq_dimid(exoid, DIM_NCNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Find the value of the number of nodes in this nodal comm map */ if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } cmap_data_idx[1] = count[0]; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)node_cmap_node_cnts)[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } else { ((int*)node_cmap_node_cnts)[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } } else if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)node_cmap_node_cnts)[cnt] = 0; } else { ((int*)node_cmap_node_cnts)[cnt] = 0; } } /* "for(cnt=0; cnt < num_n_comm_maps; cnt++)" */ } /* "if (node_cmap_node_cnts != NULL)" */ } /* "if (node_cmap_ids != NULL)" */ } /* "if (num_n_comm_maps > 0)" */ } /* End "if ((dimid = nc_inq_dimid(exoid, DIM_NUM_N_CMAPS)) != -1)" */ /*****************************************************************************/ /*****************************************************************************/ /* Elemental communication map(s) */ /*****************************************************************************/ /*****************************************************************************/ /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_E_COMM_INFO_IDX, cmap_info_idx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the number of elemental communications maps in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_E_CMAPS, &dimid)) == NC_NOERR) { /* check if I need to get the dimension of the nodal comm map */ if (cmap_info_idx[1] == -1) { if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ cmap_info_idx[1] = count[0]; } /* End "if (cmap_info_idx[1] == -1) */ num_e_comm_maps = cmap_info_idx[1] - cmap_info_idx[0]; if (num_e_comm_maps > 0) { count[0] = num_e_comm_maps; /* Get the variable ID for the vector of nodal comm map IDs */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_IDS, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable ID for \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of elemental communication map IDs */ if (elem_cmap_ids != NULL) { start[0] = cmap_info_idx[0]; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, elem_cmap_ids); } else { status = nc_get_vara_int(exoid, varid, start, count, elem_cmap_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_E_COMM_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (elem_cmap_elem_cnts != NULL) { /* * Get the element counts in each of the elemental * communication maps */ for(cnt=0; cnt < num_e_comm_maps; cnt++) { int64_t cmap_id; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { cmap_id = ((int64_t*)elem_cmap_ids)[cnt]; } else { cmap_id = ((int*)elem_cmap_ids)[cnt]; } if ((map_idx=ne_id_lkup(exoid, VAR_E_COMM_IDS, cmap_info_idx, cmap_id)) < 0) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to find elemental comm map with ID %"PRId64" in file ID %d", cmap_id, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Check the status of the requested elemental map */ start[0] = map_idx; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_E_COMM_DATA_IDX, cmap_data_idx, map_idx) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (cmap_data_idx[1] == -1) { /* * Find the dimension ID of the variable containing the * element count */ if ((status = nc_inq_dimid(exoid, DIM_ECNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Find the value of the number of elements in this elemental * comm map */ if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } cmap_data_idx[1] = count[0]; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)elem_cmap_elem_cnts)[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } else { ((int*)elem_cmap_elem_cnts)[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } } else if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)elem_cmap_elem_cnts)[cnt] = 0; } else { ((int*)elem_cmap_elem_cnts)[cnt] = 0; } } /* "for(cnt=0; cnt < num_e_comm_maps; cnt++)" */ } /* "if (elem_cmap_elem_cnts != NULL)" */ } /* "if (elem_cmap_ids != NULL)" */ } /* "if (num_e_comm_maps > 0)" */ } /* End "if ((dimid = nc_inq_dimid(exoid, DIM_NUM_E_CMAPS(processor))) != -1)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_concat_node_sets.c000066400000000000000000000141561225312213100245400ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_concat_sets()(exoid, EX_NODE_SET, set_specs) instead The function ex_get_concat_node_sets() reads the node set ID's, node set node count array, node set distribution factors count array, node set node pointers array, node set distribution factors pointer array, node set node list, and node set distribution factors for all of the node sets. ``Concatenated node sets'' refers to the arrays required to define all of the node sets (ID array, counts arrays, pointers arrays, node list array, and distribution factors array) as described in Section 3.10 on page 11. Because the distribution factors are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). The length of each of the returned arrays can be determined by invoking ex_inquire() or ex_inquire_int(). \return In case of an error, ex_get_concat_node_sets() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - a warning value is returned if no node sets are stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] node_set_ids Returned array containing the node set ID for each set. \param[out] num_nodes_per_set Returned array containing the number of nodes for each set. \param[out] num_df_per_set Returned array containing the number of distribution factors for each set. \param[out] node_sets_node_index Returned array containing the indices into the \c node_set_node_list which are the locations of the first node for each set. These indices are 0-based. \param[out] node_sets_df_index Returned array containing the indices into the \c node_set_dist_fact which are the locations of the first distribution factor for each set. These indices are 0-based. \param[out] node_sets_node_list Returned array containing the nodes for all sets. Internal node IDs are used in this list (see Section LocalNodeIds). \param[out] node_sets_dist_fact Returned array containing the distribution factors for all sets. As an example, the following code segment will read concatenated node sets: \code #include "exodusII.h" int error, exoid, num_node_sets, list_len, *ids, *num_nodes_per_set, *num_df_per_set, *node_ind, *df_ind, *node_list; float *dist_fact \comment{read concatenated node sets} num_node_sets = ex_inquire_int(exoid, EX_INQ_NODE_SETS); 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)); list_len = ex_inquire_int(exoid, EX_INQ_NS_NODE_LEN); node_list = (int *) calloc(list_len, sizeof(int)); list_len = ex_inquire_int(exoid, EX_INQ_NS_DF_LEN); 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); \endcode */ int ex_get_concat_node_sets (int exoid, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_df_per_set, void_int *node_sets_node_index, void_int *node_sets_df_index, void_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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_concat_sets.c000066400000000000000000000202521225312213100235250ustar00rootroot00000000000000/* * 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. * */ /*! * * \undoc exgcss - ex_get_concat_sets * * 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. * * entry conditions - * input parameters: * int exoid exodus file id * ex_entity_type set_type type of set * * exit conditions - * struct ex_set_specs* set_specs set specs structure * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" int ex_get_concat_sets (int exoid, ex_entity_type set_type, struct ex_set_specs* set_specs) { int status, dimid; void_int *num_entries_per_set = set_specs->num_entries_per_set; void_int *num_dist_per_set = set_specs->num_dist_per_set; void_int *sets_entry_index = set_specs->sets_entry_index; void_int *sets_dist_index = set_specs->sets_dist_index; void *sets_dist_fact = set_specs->sets_dist_fact; int num_sets, i; float *flt_dist_fact; double *dbl_dist_fact; char errmsg[MAX_ERR_LENGTH]; ex_inquiry ex_inq_val; 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) { ex_inq_val = EX_INQ_NODE_SETS; } else if (set_type == EX_EDGE_SET) { ex_inq_val = EX_INQ_EDGE_SETS; } else if (set_type == EX_FACE_SET) { ex_inq_val = EX_INQ_FACE_SETS; } else if (set_type == EX_SIDE_SET) { ex_inq_val = EX_INQ_SIDE_SETS; } else if (set_type == EX_ELEM_SET) { ex_inq_val = EX_INQ_ELEM_SETS; } else { exerrval = EX_FATAL; sprintf(errmsg, "Error: invalid set type (%d)", set_type); ex_err("ex_put_set_param",errmsg,exerrval); return (EX_FATAL); } /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; if (status == NC_EBADDIM) { sprintf(errmsg, "Warning: no %ss defined for file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_concat_sets",errmsg,exerrval); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %ss defined in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_concat_sets",errmsg,exerrval); return (EX_FATAL); } } /* inquire how many sets have been stored */ num_sets = ex_inquire_int(exoid, ex_inq_val); if (num_sets < 0) { sprintf(errmsg, "Error: failed to get number of %ss defined for file id %d", ex_name_of_object(set_type), exoid); /* use error val from inquire */ ex_err("ex_get_concat_sets",errmsg,exerrval); return (EX_FATAL); } if (ex_get_ids (exoid, set_type, set_specs->sets_ids) != NC_NOERR) { sprintf(errmsg, "Error: failed to get %s ids for file id %d", ex_name_of_object(set_type), exoid); /* use error val from inquire */ ex_err("ex_get_concat_sets",errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { ((int64_t*)sets_entry_index)[0] = 0; ((int64_t*)sets_dist_index)[0] = 0; } else { ((int*)sets_entry_index)[0] = 0; ((int*)sets_dist_index)[0] = 0; } for (i=0; isets_ids)[i]; } else { set_id = ((int*)set_specs->sets_ids)[i]; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { if (ex_get_set_param(exoid, set_type, set_id, &(((int64_t*)num_entries_per_set)[i]), &(((int64_t*)num_dist_per_set)[i])) != NC_NOERR) return(EX_FATAL); /* error will be reported by sub */ if (i < num_sets-1) { /* fill in entry and dist factor index arrays */ ((int64_t*)sets_entry_index)[i+1] = ((int64_t*)sets_entry_index)[i]+((int64_t*)num_entries_per_set)[i]; ((int64_t*)sets_dist_index)[i+1] = ((int64_t*)sets_dist_index)[i]+((int64_t*)num_dist_per_set)[i]; } if (((int64_t*)num_entries_per_set)[i] == 0) /* NULL set? */ continue; { /* Now, use ExodusII call to get sets */ int64_t *sets_entry_list = set_specs->sets_entry_list; int64_t *sets_extra_list = set_specs->sets_extra_list; int64_t *sets_extra = sets_extra_list ? &((int64_t*)sets_extra_list)[((int64_t*)sets_entry_index)[i]] : NULL; status = ex_get_set(exoid, set_type, set_id, &(sets_entry_list[((int64_t*)sets_entry_index)[i]]), sets_extra); } } else { if (ex_get_set_param(exoid, set_type, set_id, &(((int*)num_entries_per_set)[i]), &(((int*)num_dist_per_set)[i])) != NC_NOERR) return(EX_FATAL); /* error will be reported by sub */ if (i < num_sets-1) { /* fill in entry and dist factor index arrays */ ((int*)sets_entry_index)[i+1] = ((int*)sets_entry_index)[i]+((int*)num_entries_per_set)[i]; ((int*)sets_dist_index)[i+1] = ((int*)sets_dist_index)[i]+((int*)num_dist_per_set)[i]; } if (((int*)num_entries_per_set)[i] == 0) /* NULL set? */ continue; { /* Now, use ExodusII call to get sets */ int *sets_entry_list = set_specs->sets_entry_list; int *sets_extra_list = set_specs->sets_extra_list; int *sets_extra = sets_extra_list ? &((int*)sets_extra_list)[((int*)sets_entry_index)[i]] : NULL; status = ex_get_set(exoid, set_type, set_id, &(sets_entry_list[((int*)sets_entry_index)[i]]), sets_extra); } } if (status != NC_NOERR) return(EX_FATAL); /* error will be reported by subroutine */ /* get distribution factors for this set */ if (sets_dist_fact != 0) { size_t df_idx; size_t num_dist; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { df_idx = ((int64_t*)sets_dist_index)[i]; num_dist = ((int64_t*)num_dist_per_set)[i]; } else { df_idx = ((int*)sets_dist_index)[i]; num_dist = ((int*)num_dist_per_set)[i]; } if (num_dist > 0) { /* only get df if they exist */ if (ex_comp_ws(exoid) == sizeof(float)) { flt_dist_fact = sets_dist_fact; status = ex_get_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_idx])); } else { dbl_dist_fact = sets_dist_fact; status = ex_get_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_idx])); } if (status != NC_NOERR) { return(EX_FATAL); /* error will be reported by subroutine */ } } } } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_concat_side_set_node_count.c000066400000000000000000000577351225312213100266030ustar00rootroot00000000000000/* * 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. * */ /***************************************************************************** * * exgcssc - ex_get_concat_side_set_node_count * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * int *side_set_node_cnt_list returned array of number of nodes for * side or face for all sidesets * revision history - * *****************************************************************************/ #include #include #include #include #include "exodusII.h" #include "exodusII_int.h" /*! \cond INTERNAL */ static void *safe_free(void *array) { if (array != 0) free(array); return 0; } /* Generic error message for element type/node count mapping...*/ #define EL_NODE_COUNT_ERROR sprintf(errmsg, \ "Error: An element of type '%s' with %d nodes is not valid.",\ 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); /*! \endcond */ /*! \undoc */ int ex_get_concat_side_set_node_count(int exoid, int *side_set_node_cnt_list) { size_t m; int ii, i, j, iss, ioff; ex_entity_id side_set_id; int num_side_sets, num_elem_blks, num_df, ndim; int64_t tot_num_elem = 0, tot_num_ss_elem = 0, side, elem; void_int *elem_blk_ids = NULL; void_int *side_set_ids = NULL; void_int *ss_elem_ndx = NULL; void_int *side_set_elem_list = NULL; void_int *side_set_side_list = NULL; size_t elem_ctr; int int_size, ids_size; int status; struct elem_blk_parm *elem_blk_parms; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ /* inquire how many side sets have been stored */ num_side_sets = ex_inquire_int(exoid, EX_INQ_SIDE_SETS); if (num_side_sets < 0) { sprintf(errmsg, "Error: failed to get number of side sets in file id %d",exoid); ex_err("ex_get_concat_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_concat_side_set_node_count",errmsg,EX_WARN); return(EX_WARN); } num_elem_blks = ex_inquire_int(exoid, EX_INQ_ELEM_BLK); if (num_elem_blks < 0) { sprintf(errmsg, "Error: failed to get number of element blocks in file id %d",exoid); ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval); return(EX_FATAL); } tot_num_elem = ex_inquire_int(exoid, EX_INQ_ELEM); if (tot_num_elem < 0) { sprintf(errmsg, "Error: failed to get total number of elements in file id %d",exoid); ex_err("ex_get_concat_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 */ ndim = ex_inquire_int(exoid, EX_INQ_DIM); if (ndim < 0) { sprintf(errmsg, "Error: failed to get dimensionality in file id %d",exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); return(EX_FATAL); } int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) int_size = sizeof(int64_t); /* Allocate space for the element block ids */ ids_size = sizeof(int); if (ex_int64_status(exoid) & EX_IDS_INT64_API) { ids_size = sizeof(int64_t); } if (!(elem_blk_ids=malloc(num_elem_blks*ids_size))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate space for element block ids for file id %d", exoid); ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval); goto error_ret; } if (ex_get_ids(exoid, EX_ELEM_BLOCK, elem_blk_ids) == -1) { sprintf(errmsg, "Error: failed to get element block ids in file id %d", exoid); ex_err("ex_get_concat_side_set_node_count",errmsg,EX_MSG); return(EX_FATAL); } /* Allocate space for the element block params */ if (!(elem_blk_parms=malloc(num_elem_blks*sizeof(struct elem_blk_parm)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate space for element block params for file id %d", exoid); ex_err("ex_get_concat_side_set_node_count",errmsg,exerrval); goto error_ret; } elem_ctr = 0; for (i=0; i #include "exodusII.h" #include "exodusII_int.h" int ex_get_conn( int exoid, ex_entity_type blk_type, ex_entity_id blk_id, void_int* nodeconn, void_int* edgeconn, void_int* faceconn ) { int connid = -1; int econnid = -1; int fconnid = -1; int blk_id_ndx, status; int numnodperentdim = -1; int numedgperentdim = -1; int numfacperentdim = -1; int iexit = (EX_NOERR); /* exit status */ size_t num_nodes_per_entry = 0; size_t num_edges_per_entry = 0; size_t num_faces_per_entry = 0; char errmsg[MAX_ERR_LENGTH]; const char* dnumnodent = NULL; const char* dnumedgent = NULL; const char* dnumfacent = NULL; const char* vnodeconn = NULL; const char* vedgeconn = NULL; const char* vfaceconn = NULL; /* 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. */ exerrval = 0; /* clear error code */ /* Locate index of element block id in VAR_ID_EL_BLK array */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no connectivity array for NULL %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg,EX_NULLENTITY); return (EX_WARN); /* no connectivity array for this element block */ } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg,exerrval); return (EX_FATAL); } } switch (blk_type) { case EX_EDGE_BLOCK: dnumnodent = DIM_NUM_NOD_PER_ED(blk_id_ndx); dnumedgent = 0; dnumfacent = 0; vnodeconn = VAR_EBCONN(blk_id_ndx); vedgeconn = 0; vfaceconn = 0; break; case EX_FACE_BLOCK: dnumnodent = DIM_NUM_NOD_PER_FA(blk_id_ndx); dnumedgent = 0; dnumfacent = 0; vnodeconn = VAR_FBCONN(blk_id_ndx); vedgeconn = 0; vfaceconn = 0; break; case EX_ELEM_BLOCK: dnumnodent = DIM_NUM_NOD_PER_EL(blk_id_ndx); dnumedgent = DIM_NUM_EDG_PER_EL(blk_id_ndx); dnumfacent = DIM_NUM_FAC_PER_EL(blk_id_ndx); vnodeconn = VAR_CONN(blk_id_ndx); vedgeconn = VAR_ECONN(blk_id_ndx); vfaceconn = VAR_FCONN(blk_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_get_conn",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ num_nodes_per_entry = 0; if ((status = nc_inq_dimid (exoid, dnumnodent, &numnodperentdim)) != NC_NOERR) { numnodperentdim = -1; } else { if ((status = nc_inq_dimlen(exoid, numnodperentdim, &num_nodes_per_entry)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes/entity for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } if ( dnumedgent ) { num_edges_per_entry = 0; if ((status = nc_inq_dimid(exoid, dnumedgent, &numedgperentdim)) != NC_NOERR) { numedgperentdim = -1; } else { if ((status = nc_inq_dimlen(exoid, numedgperentdim, &num_edges_per_entry)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of edges/entry for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } } if ( dnumfacent ) { num_faces_per_entry = 0; if ((status = nc_inq_dimid(exoid, dnumfacent, &numfacperentdim)) != NC_NOERR) { numfacperentdim = -1; } else { if ((status = nc_inq_dimlen(exoid, numfacperentdim, &num_faces_per_entry)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of faces/entry for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } } status = 0; if (nodeconn && (numnodperentdim >= 0) && ((status = nc_inq_varid(exoid, vnodeconn, &connid)) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to locate node connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } status = 0; if (edgeconn && (numedgperentdim >= 0) && ((status = nc_inq_varid (exoid, vedgeconn, &econnid)) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to locate edge connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } if (faceconn && (numfacperentdim >= 0) && ((status = nc_inq_varid (exoid, vfaceconn, &fconnid)) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to locate face connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } /* read in the connectivity array */ if ( edgeconn && num_edges_per_entry > 0) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, econnid, edgeconn); } else { status = nc_get_var_int(exoid, econnid, edgeconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get edge connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } if ( faceconn && num_faces_per_entry > 0) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, fconnid, faceconn); } else { status = nc_get_var_int(exoid, fconnid, faceconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get face connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } if ( nodeconn && num_nodes_per_entry > 0) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, connid, nodeconn); } else { status = nc_get_var_int(exoid, connid, nodeconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get node connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_conn",errmsg, exerrval); return(EX_FATAL); } } return iexit; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_coord.c000066400000000000000000000201331225312213100223240ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_coord() reads the nodal coordinates of the nodes. Memory must be allocated for the coordinate arrays (\c x_coor, \c y_coor, and \c z_coor) before this call is made. The length of each of these arrays is the number of nodes in the mesh. Because the coordinates are floating point values, the application code must declare the arrays passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_coord() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - a warning value is returned if nodal coordinates were not stored. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] x_coor Returned X coordinates of the nodes. If this is \c NULL, the X-coordinates will not be read. \param[out] y_coor Returned Y coordinates of the nodes. These are returned only if \c num_dim > 1; otherwise, pass in \c NULL. If this is \c NULL, the Y-coordinates will not be read. \param[out] z_coor Returned Z coordinates of the nodes. These are returned only if \c num_dim > 2; otherwise, pass in \c NULL. If this is \c NULL, the Z-coordinates will not be read. The following code segment will read the nodal coordinates from an open exodus file : \code int error, exoid; double *x, *y, *z; \comment{read nodal coordinates values 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); \comment{Do the same as the previous call in three separate calls} error = ex_get_coord(exoid, x, NULL, NULL); error = ex_get_coord(exoid, NULL, y, NULL); if (num_dim >= 3) error = ex_get_coord(exoid, NULL, NULL, z); \endcode */ int ex_get_coord (int exoid, void *x_coor, void *y_coor, void *z_coor) { int status; int coordid; int coordidx, coordidy, coordidz; int numnoddim, ndimdim; size_t num_nod, num_dim, start[2], count[2], i; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* inquire id's of previously defined dimensions */ if (ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions", &num_dim, &ndimdim, "ex_get_coord") != NC_NOERR) { return(EX_FATAL); } if (nc_inq_dimid (exoid, DIM_NUM_NODES, &numnoddim) != NC_NOERR) { /* If not found, then this file is storing 0 nodes. Return immediately */ return (EX_NOERR); } if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in file id %d", exoid); ex_err("ex_get_coord",errmsg,exerrval); return (EX_FATAL); } /* read in the coordinates */ if (ex_large_model(exoid) == 0) { if ((status = nc_inq_varid (exoid, VAR_COORD, &coordid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate nodal coordinates in file id %d", exoid); ex_err("ex_get_coord",errmsg,exerrval); return (EX_FATAL); } for (i=0; i 1) { if ((status = nc_inq_varid (exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate y nodal coordinates in file id %d", exoid); ex_err("ex_get_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidy = 0; } if (num_dim > 2) { if ((status = nc_inq_varid (exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate z nodal coordinates in file id %d", exoid); ex_err("ex_get_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidz = 0; } /* write out the coordinates */ for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /* -------------------- local defines --------------------------- */ #define PROCNAME "ex_get_coordinate_frames" /* -------------------- end of local defines -------------------- */ /*! * Coordinate frames are stored in the database as a series of three * points (defined in the basic cartesian coordinate system). The * first of these points describes the origin of the new system. The * second point lies on the 3 axis (or Z axis) of the frame. The third * point is in the 1-3 (xz) plane. Each coordinate frame is identified * by a unique, integer coordinate ID, and by a character tag * indicating whether the frame is rectangular cartesian * "R", cylindrical "C, or spherical "S". * Because the coordinates are floating point values, * the application code must declare the arrays passed to be the * appropriate type "float" or "double" to match the * compute word size passed in ex_create() or * ex_open(). * \param exoid exodus file id * \param[in,out] nframes if 'cf_ids' is NULL, then nframes is returned with the number * of defined coordinate frames. Else it is the number of coordinate * frames to read. * \param[out] cf_ids The (nframes) coordinate frame Ids. If cf_ids is * NULL, no data will be returned in this or any other array. Only * nframes will be modified. Otherwise, space must be allocated to * store 'nframes' integers before making this call. * \param[out] pt_coordinates The (9*nframes) coordinates of the three * points defining each coordinate axis. The first three values are * the origin of the first frame. The next three values are the * coordinates of a point on the 3rd axis of the first frame. The next * three values are the coordinates of a point in the plane of the 1-3 * axis. The pattern is repeated for each frame. If 'cf_ids' * is null, no data will be returned in this array. Otherwise, space * must be allocated for 9*nframes floating point values. The size of * the allocation depends upon the compute word size. * \param[out] tags The (nframes) character tags associated with each * coordinate frame. If 'cf_ids' is NULL, no data will be * returned in this array. Otherwise, space must be allocated for * 'nframes' characters. */ int ex_get_coordinate_frames( int exoid, int *nframes, void_int *cf_ids, void* pt_coordinates, char* tags) { int status; int dimid; /* ID of the dimension of # frames */ char errmsg[MAX_ERR_LENGTH]; int varids; /* variable id for the frame ids */ size_t start=0; /* start value for varputs */ size_t count; /* number vars to put in varput */ /* get the dimensions */ assert( nframes !=NULL ); status = nc_inq_dimid(exoid, DIM_NUM_CFRAMES, &dimid); if (status != NC_NOERR){ *nframes=0; return EX_NOERR; } nc_inq_dimlen(exoid,dimid,&count); *nframes=(int)count; if ( count==0 ) return (EX_NOERR); if ( cf_ids ) { if ((status = nc_inq_varid(exoid,VAR_FRAME_IDS, &varids))!= NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read number coordinate ids from file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid,varids,cf_ids); } else { status = nc_get_var_int(exoid,varids,cf_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read coordinate frame ids from file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } } if ( tags ) if ( (status = nc_inq_varid(exoid,VAR_FRAME_TAGS,&varids))!= NC_NOERR || (nc_get_vara_text(exoid,varids,&start,&count,tags) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to read number coordinate tags from file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } if (pt_coordinates ){ if ( (status = nc_inq_varid(exoid,VAR_FRAME_COORDS,&varids))!= NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read number coordinate tags from file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } if (ex_comp_ws(exoid) == 4) { status = nc_get_var_float(exoid,varids,pt_coordinates); } else { status = nc_get_var_double(exoid,varids,pt_coordinates); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read number coordinate tags from file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_eb_info_global.c000066400000000000000000000114671225312213100241510ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_eb_info_global() ***************************************************************************** * This function retrieves the global parameters of all the element blocks * associated with a geometry. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * el_blk_ids - Pointer to vector of global element block IDs. * el_blk_cnts - Pointer to vector of global element block counts. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include int ex_get_eb_info_global(int exoid, void_int *el_blk_ids, void_int *el_blk_cnts) { const char *func_name="ex_get_eb_info_global"; int varid, status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Find the variable ID for the element block IDs */ if ((status = nc_inq_varid(exoid, VAR_ELBLK_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELBLK_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the global element block IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid, varid, el_blk_ids); } else { status = nc_get_var_int(exoid, varid, el_blk_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_ELBLK_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Find the variable ID for the element block counts */ if ((status = nc_inq_varid(exoid, VAR_ELBLK_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELBLK_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the global element block counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, varid, el_blk_cnts); } else { status = nc_get_var_int(exoid, varid, el_blk_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_ELBLK_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_attr.c000066400000000000000000000063171225312213100232020ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib) instead The function ex_get_elem_attr() reads the attributes for an element block. Memory must be allocated for(\c num_attr x \c num_elem_this_blk) attributes before this routine is called. Because the attributes are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_elem_attr() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid element block ID. - a warning value is returned if no attributes are stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[out] attrib Size [num_elem_this_blk*num_attr]. Returned list of(\c num_attr x num_elem_this_blk) attributes for the element block, with the \c num_attr index cycling faster. Refer to the code example in ex_get_elem_block() for an example of reading the element attributes for an element block. */ int ex_get_elem_attr (int exoid, ex_entity_id elem_blk_id, void *attrib) { return ex_get_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_attr_names.c000066400000000000000000000050621225312213100243610ustar00rootroot00000000000000/* * 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 * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the attribute names for an element block * \deprecated Use ex_get_attr_names()(exoid, EX_ELEM_BLOCK, elem_blk_id, names) instead */ int ex_get_elem_attr_names (int exoid, ex_entity_id elem_blk_id, char **names) { return ex_get_attr_names( exoid, EX_ELEM_BLOCK, elem_blk_id, names ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_blk_ids.c000066400000000000000000000062041225312213100236320ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_ids()(exoid, EX_ELEM_BLOCK, ids) instead The function ex_get_elem_blk_ids() reads the IDs of all of the element blocks. Memory must be allocated for the returned array of ({num_elem_blk}) IDs before this function is invoked. The required size(\c num_elem_blk) can be determined via a call to ex_inquire() or ex_inquire_int(). \return In case of an error, ex_get_elem_blk_ids() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] ids Returned array of the element blocks IDs. The order of the IDs in this array reflects the sequence that the element blocks were introduced into the file. The following code segment reads all the element block IDs: \code int error, exoid, *idelbs, num_elem_blk; idelbs = (int *) calloc(num_elem_blk, sizeof(int)); error = ex_get_elem_blk_ids (exoid, idelbs); \comment{Same result using non-deprecated functions} error = ex_get_ids (exoid, EX_ELEM_BLOCK, idelbs); \endcode */ int ex_get_elem_blk_ids (int exoid, void_int *ids) { /* ex_get_elem_blk_ids should be deprecated. */ return ex_get_ids( exoid, EX_ELEM_BLOCK, ids ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_block.c000066400000000000000000000107311225312213100233150ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /** \deprecated Use ex_get_block()(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type, num_elem_this_blk, num_nodes_per_elem, num_attr) instead The function ex_get_elem_block() reads the parameters used to describe an element block. IDs of all element blocks stored can be determined by calling ex_get_elem_blk_ids(). \return In case of an error, ex_get_elem_block() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - element block with specified ID is not stored in the data file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[out] elem_type Returned element typetype of elements in the element block. The maximum length of this string is \p MAX_STR_LENGTH . \param[out] num_elem_this_blk Returned number of elements in the element block. \param[out] num_nodes_per_elem Returned number of nodes per element in the element block. \param[out] num_attr Returned number of attributes per element in the element block. As an example, the following code segment will read the parameters for the element block with an ID of 10 and read the connectivity and element attributes arrays from an open exodus file : \code #include "exodusII.h" int id, error, exoid, num_el_in_blk, num_nod_per_el, num_attr, *connect; float *attrib; char elem_type[MAX_STR_LENGTH+1]; \comment{read element block parameters} id = 10; error = ex_get_elem_block(exoid, id, elem_type, &num_el_in_blk, &num_nod_per_elem, &num_attr); \comment{read element connectivity} connect = (int *) calloc(num_nod_per_el*num_el_in_blk, sizeof(int)); error = ex_get_elem_conn(exoid, id, connect); \comment{read element block attributes} attrib = (float *) calloc (num_attr * num_el_in_blk, sizeof(float)); error = ex_get_elem_attr (exoid, id, attrib); \comment{Same result using non-deprecated functions} error = ex_get_block(exoid, EX_ELEM_BLOCK, id, elem_type, &num_el_in_blk, &num_nod_per_elem, 0, 0, &num_attr); error = ex_get_conn (exoid, EX_ELEM_BLOCK, id, connect); error = ex_get_attr (exoid, EX_ELEM_BLOCK, id, attrib); \endcode */ int ex_get_elem_block (int exoid, ex_entity_id elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_cmap.c000066400000000000000000000204041225312213100231410ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /****************************************************************************/ /****************************************************************************/ /* Function(s) in this file: * ex_get_elem_cmap() **************************************************************************** * This function retrieves an elemental communication map. **************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * map_id - The ID of the nodal communication map to retrieve. * elem_ids - Pointer to vector for retrieval of FEM element IDs * that make up this communication map. * side_ids - Pointer to vector for retrieval of FEM element * side IDs that make up this communication map. * proc_ids - Pointer to vector for retrieval of the processors * associated with each of the elements in this * elemental communication map. * processor - The processor the file being read was written for. */ /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ #include #include #include #include #include int ex_get_elem_cmap(int exoid, ex_entity_id map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int processor ) { const char *func_name="ex_get_elem_cmap"; int map_idx, dimid, varid[3], status; size_t start[1], count[1]; int64_t varidx[2]; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_E_COMM_INFO_IDX, varidx, processor) == -1) { exerrval = -1; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * no need to check if the second index is -1 that is handled * in ne_id_lkup, where the dimension must be looked up anyways */ /* Get the index of the elemental comm map with the given ID */ if ((map_idx=ne_id_lkup(exoid, VAR_E_COMM_IDS, varidx, map_id)) < 0) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to find elemental comm map with ID %"PRId64" in file \ ID %d", map_id, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* get the cmap data variables index for this map */ if (ex_get_idx(exoid, VAR_E_COMM_DATA_IDX, varidx, map_idx) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the dimension of this elemental communication map */ if ((status = nc_inq_dimid(exoid, DIM_ECNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } /* Get the variable ID for the elemental comm map node IDs */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_EIDS, &varid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the elemental side set IDs */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_SIDS, &varid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the elemental comm map processor IDs */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_PROC, &varid[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the elemental comm map element IDs */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, varid[0], start, count, elem_ids); } else { status = nc_get_vara_int(exoid, varid[0], start, count, elem_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the elemental comm map side IDs */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, varid[1], start, count, side_ids); } else { status = nc_get_vara_int(exoid, varid[1], start, count, side_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the elemental comm map processor IDs */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, varid[2], start, count, proc_ids); } else { status = nc_get_vara_int(exoid, varid[2], start, count, proc_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_conn.c000066400000000000000000000057631225312213100231710ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_conn()(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0) instead The function ex_get_elem_conn() reads the connectivity array for an element block. Memory must be allocated for the connectivity array(\c num_elem_this_blk * \c num_nodes_per_elem in length) before this routine is called. \return In case of an error, ex_get_elem_conn() returns a negative number; a warning will return a positive number. Possible causes of errors include: - an element block with the specified ID is not stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[out] connect Size [num_elem_this_blk,num_nodes_per_elem]. Returned connectivity array; a list of nodes (internal node IDs; See Section LocalNodeIds) that define each element. The node index cycles faster than the element index. Refer to the code example in ex_get_elem_block() for an example of reading the connectivity for an element block. */ int ex_get_elem_conn (int exoid, ex_entity_id elem_blk_id, void_int *connect) { return ex_get_conn( exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_map.c000066400000000000000000000050011225312213100227720ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * int map_id element map id * * exit conditions - * int* elem_map element map * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * reads the element map with specified ID * \deprecated Use ex_get_num_map()(exoid, EX_ELEM_MAP, map_id, elem_map) instead */ int ex_get_elem_map (int exoid, ex_entity_id map_id, void_int *elem_map) { return ex_get_num_map( exoid, EX_ELEM_MAP, map_id, elem_map ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_num_map.c000066400000000000000000000070021225312213100236540ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * int* elem_map element number map array * * revision history - * *****************************************************************************/ #include "exodusII.h" /*! \deprecated Use ex_get_id_map()(exoid, EX_ELEM_MAP, elem_map) The function ex_get_elem_num_map() reads the optional element number map from the database. See Section LocalElementIds for a description of the element number map. If an element number map is not stored in the data file, a default array (1,2,3,. .. \c num_elem) is returned. Memory must be allocated for the element number map array ({num_elem} in length) before this call is made. \return In case of an error, ex_get_elem_num_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - if an element number map is not stored, a default map and a warning value are returned. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] elem_map Returned element number map. The following code will read an element number map from an open exodus file : \code int *elem_map, error, exoid; \comment{read element number map} elem_map = (int *) calloc(num_elem, sizeof(int)); error = ex_get_elem_num_map (exoid, elem_map); \comment{Equivalent using non-deprecated function} error = ex_get_id_map(exoid, EX_ELEM_MAP, elem_map); \endcode */ int ex_get_elem_num_map (int exoid, void_int *elem_map) { return ex_get_id_map(exoid, EX_ELEM_MAP, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_type.c000066400000000000000000000111611225312213100232020ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_elem_type() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID to find the element type * for. * elem_type - The returned name of the element. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_elem_type (int exoid, ex_entity_id elem_blk_id, char *elem_type) /* * Reads the element type for a specific element block * elem_type is assumed to have a length of MAX_STR_LENGTH+1 */ { const char *func_name="ex_get_elem_type"; int connid, el_blk_id_ndx, status; size_t len; char errmsg[MAX_ERR_LENGTH]; /*****************************************************************************/ /* inquire id's of previously defined dimensions */ if ((el_blk_id_ndx=ex_id_lkup(exoid, EX_ELEM_BLOCK, elem_blk_id)) == -1) { sprintf(errmsg, "Error: failed to find element block ID %"PRId64" in file %d", elem_blk_id, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_CONN(el_blk_id_ndx), &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find connectivity variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* get the element type name */ if ((status = nc_inq_attlen(exoid, connid, ATT_NAME_ELB, &len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find attribute in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (len > (MAX_STR_LENGTH+1)) { exerrval = EX_MSG; sprintf(errmsg, "Error: Element type must be of length %d in file ID %d", (int)len, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Make sure the end of the string is terminated with a null character */ elem_type[MAX_STR_LENGTH] = '\0'; if ((status = nc_get_att_text(exoid, connid, ATT_NAME_ELB, elem_type)) != NC_NOERR ) { exerrval = status; sprintf(errmsg, "Error: failed to get attribute \"%s\" in file ID %d", ATT_NAME_ELB, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_var.c000066400000000000000000000113131225312213100230100ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_get_var()(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, num_elem_this_blk, elem_var_vals) instead The function ex_get_elem_var() reads the values of a single element variable for one element block at one time step. Memory must be allocated for the element variable values array before this function is invoked. Because element variables are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_elem_var() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - variable does not exist for the desired element block. - invalid element block. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number, as described under ex_put_time(), at which the element variable values are desired. This is essentially an index (in the time dimension) into the element variable values array stored in the database. The first time step is 1. \param[in] elem_var_index The index of the desired element variable. The first variable has an index of 1. \param[in] elem_blk_id The desired element block ID. \param[in] num_elem_this_blk The number of elements in this element block. \param[out] elem_var_vals Returned array of \c num_elem_this_blk values of the \c elem_var_index element variable for the element block with ID of \c elem_blk_id at the \c time_step time step. As an example, the following code segment will read the \c var_index-th element variable at one time step stored in an exodus file : \code int *ids, num_elem_blk, error, exoid, *num_elem_in_block, step, var_ind; float *var_vals; ids = (int *) calloc(num_elem_blk, sizeof(int)); error = ex_get_elem_blk_ids (exoid, ids); step = 1; \comment{read at the first time step} for (i=0; i < num_elem_blk; i++) { var_vals = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, step, var_ind, ids[i], num_elem_in_block[i], var_vals); \comment{Using non-deprecated function:} error = ex_get_var (exoid, step, EX_ELEM_BLOCK, var_ind, ids[i], num_elem_in_block[i], var_vals); free (var_values); } \endcode */ int ex_get_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t 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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_var_tab.c000066400000000000000000000107761225312213100236520ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_get_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab) The function ex_get_elem_var_tab() reads the exodus element variable truth table from the database. For a description of the truth table, see the usage of the function ex_put_elem_var_tab(). Memory must be allocated for the truth table(\c num_elem_blk \b x \c num_elem_var in length) before this function is invoked. If the truth table is not stored in the file, it will be created based on information in the file and then returned. \return In case of an error, ex_get_elem_var_tab() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file not initialized properly with call to ex_put_init(). - the specified number of element blocks is different than the number specified in a call to ex_put_init(). - there are no element variables stored in the file or the specified number of element variables doesn't match the number specified in a call to ex_put_variable_param(). \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] num_elem_blk The number of element blocks. \param[in] num_elem_var The number of element variables. \param[out] elem_var_tab Size [num_elem_blk,num_elem_var]. Returned 2-dimensional array (with the \c num_elem_var index cycling faster) containing the element variable truth table. As an example, the following coding will read the element variable truth table from an opened exodus file : \code int *truth_tab, num_elem_blk, num_ele_vars, error, exoid; 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); \endcode */ int ex_get_elem_var_tab (int exoid, int num_elem_blk, int num_elem_var, int *elem_var_tab) { return ex_get_truth_table(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_elem_var_time.c000066400000000000000000000135771225312213100240440ustar00rootroot00000000000000/* * 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 * * 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 #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_get_var_time()(exoid, EX_ELEM_BLOCK, elem_var_index, elem_number, beg_time_step, end_time_step, elem_var_vals) The function ex_get_elem_var_time() reads the values of an element variable for a single element through a specified number of time steps. Memory must be allocated for the element variable values array before this function is invoked. Because element variables are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_elem_var_time() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file not initialized properly with call to ex_put_init(). - ex_put_elem_block() not called previously to specify parameters for all element blocks. - variable does not exist for the desired element or results haven't been written. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_var_index The index of the desired element variable. The first variable has an index of 1. \param[in] elem_number The internal ID (see Section LocalElementIds) of the desired element. The first element is 1. \param[in] beg_time_step The beginning time step for which an element variable value is desired. This is not a time value but rather a time step number, as described under ex_put_time(). The first time step is 1. \param[in] end_time_step The last time step for which an element variable value is desired. If negative, the last time step in the database will be used. The first time step is 1. \param[out] elem_var_vals returned array of(\c end_time_step {-} \c beg_time_step + 1) values of the \c elem_number-th element for the \c elem_var_index-th element variable. For example, the following coding will read the values of the \c var_index-th element variable for element number 2 from the first time step to the last time step: \code #include "exodusII.h" int error, exoid, num_time_steps, var_index, elem_num, beg_time, end_time; float *var_values; \comment{determine how many time steps are stored} num_time_steps = ex_inquire_int(exoid, EX_INQ_TIME); \comment{read an element variable through time} var_values = (float *) calloc (num_time_steps, sizeof(float)); var_index = 2; elem_num = 2; beg_time = 1; end_time = -1; error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time, end_time, var_values); \comment{Using non-deprecated function:} error = ex_get_elem_var_time (exoid, EX_ELEM_BLOCK, var_index, elem_num, beg_time, end_time, var_values); \endcode */ int ex_get_elem_var_time (int exoid, int elem_var_index, int64_t 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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_entity_count_per_polyhedra.c000066400000000000000000000107641225312213100266700ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * exgecpp - ex_get_entity_count_per_polyhedra * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! * reads in the number of entities (nodes/faces) per polyhedra * (nsided/nfaced) in this element block. * \param exoid exodus file id * \param blk_type type of block (face, or element) * \param blk_id block identifer * \param entity_counts entity_per_polyhedra count array */ int ex_get_entity_count_per_polyhedra (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int *entity_counts) { int npeid=-1, blk_id_ndx, status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: entity_counts array not allowed for NULL %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_entity_count_per_polyhedra",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s block id %"PRId64" in id array in file id %d", ex_name_of_object(blk_type),blk_id, exoid); ex_err("ex_get_entity_count_per_polyhedra",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ switch (blk_type) { case EX_ELEM_BLOCK: status = nc_inq_varid (exoid, VAR_EBEPEC(blk_id_ndx), &npeid); break; case EX_FACE_BLOCK: status = nc_inq_varid (exoid, VAR_FBEPEC(blk_id_ndx), &npeid); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_get_entity_count_per_polyhedra",errmsg,EX_MSG); return (EX_FATAL); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate entity_counts array for %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_entity_count_per_polyhedra",errmsg, exerrval); return(EX_FATAL); } status = nc_get_var_int(exoid, npeid, entity_counts); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read node counts array for %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_entity_count_per_polyhedra",errmsg, exerrval); return(EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_glob_var_time.c000066400000000000000000000126531225312213100240370ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_glob_var_time() reads the values of a single global variable through a specified number of time steps. Memory must be allocated for the global variable values array before this function is invoked. Because global variables are floating point values, the application code must declare the array passed to be the appropriate type (float or double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_glob_var_time() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - specified global variable does not exist. - a warning value is returned if no global variables are stored in the file. \param exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param glob_var_index The index of the desired global variable. The first variable has an index of 1. \param beg_time_step The beginning time step for which a global variable value is desired. This is not a time value but rather a time step number, as described under ex_put_time(). The first time step is 1. \param end_time_step The last time step for which a global variable value is desired. If negative, the last time step in the database will be used. The first time step is 1. \param[out] glob_var_vals Returned array of (end_time_step - beg_time_step + 1) values for the glob_var_index$^{th}$ global variable. The following is an example of using this function: \code #include "exodusII.h" int error, exoid, num_time_steps, var_index; int beg_time, end_time; float *var_values; num_time_steps = ex_inquire_int(exoid, EX_INQ_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); \endcode */ 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 status; int varid; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ 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 */ end_time_step = ex_inquire_int(exoid, EX_INQ_TIME); } end_time_step--; /* read values of global variables */ start[0] = --beg_time_step; start[1] = --glob_var_index; count[0] = end_time_step - beg_time_step + 1; count[1] = 1; /* inquire previously defined variable */ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate global variables in file id %d", exoid); ex_err("ex_get_glob_var_time",errmsg,exerrval); return (EX_WARN); } if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, varid, start, count, glob_var_vals); } else { status = nc_get_vara_double(exoid, varid, start, count, glob_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get global variable %d values from file id %d", glob_var_index, exoid); ex_err("ex_get_glob_var_time",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_glob_vars.c000066400000000000000000000124511225312213100232000ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! \ingroup ResultsData The function ex_get_glob_vars() reads the values of all the global variables for a single time step. Memory must be allocated for the global variables values array before this function is invoked. Because global variables are floating point values, the application code must declare the array passed to be the appropriate type (float or double) to match the compute word size passed in ex_create() or ex_open(). In case of an error, ex_get_glob_vars() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - no global variables stored in the file. - a warning value is returned if no global variables are stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step, as described under ex_put_time(), at which the global variable values are desired. This is essentially an index (in the time dimension) into the global variable values array stored in the database. The first time step is 1. \param[in] num_glob_vars The number of global variables stored in the database. \param[out] glob_var_vals Returned array of num_glob_vars global variable values for the time_step'th time step. The following is an example code segment that reads all the global variables at one time step: \verbatim int num_glo_vars, error, time_step; float *var_values; error = ex_get_variable_param (idexo, EX_GLOBAL, &num_glo_vars); var_values = (float *) calloc (num_glo_vars, sizeof(float)); error = ex_get_glob_vars (idexo, time_step, num_glo_vars, var_values); \endverbatim */ int ex_get_glob_vars (int exoid, int time_step, int num_glob_vars, void *glob_var_vals) { int varid; int status; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire previously defined variable */ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: failed to locate global variables in file id %d", exoid); 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 (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, varid, start, count, glob_var_vals); } else { status = nc_get_vara_double(exoid, varid, start, count, glob_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get global variable values from file id %d", exoid); ex_err("ex_get_glob_vars",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_group_id.c000066400000000000000000000067361225312213100230430ustar00rootroot00000000000000/* * Copyright (c) 2013 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include #include /** * Given an exoid and group name (NULL gets root group), return id of that group. * If the name is NULL, return the root group. * If the name contains "/", then the name is assumed to be a full path name * and all groups in the file are searched. * Otherwise, the name is assumed to be the name of a child group of exoid */ int ex_get_group_id (int parent_id, const char *group_name, int *group_id) { int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ #if defined(NOT_NETCDF4) exerrval = NC_ENOTNC4; sprintf(errmsg, "Error: Group capabilities are not available in this netcdf version--not netcdf4"); ex_err("ex_get_group_id",errmsg,exerrval); return (EX_FATAL); #else /* See if name contains "/" indicating it is a full path name... */ if (group_name == NULL) { /* Return root */ *group_id = (unsigned)parent_id & EX_FILE_ID_MASK; } else if (strchr(group_name, '/') == NULL) { /* Local child */ status = nc_inq_grp_ncid(parent_id, group_name, group_id); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: Failed to locate group with name %s as child group in file id %d", group_name, parent_id); ex_err("ex_get_group_id",errmsg,exerrval); return (EX_FATAL); } } else { /* Full path name */ status = nc_inq_grp_full_ncid(parent_id, group_name, group_id); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: Failed to locate group with full path name %s in file id %d", group_name, parent_id); ex_err("ex_get_group_id",errmsg,exerrval); return (EX_FATAL); } } return (EX_NOERR); #endif } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_group_ids.c000066400000000000000000000052641225312213100232210ustar00rootroot00000000000000/* * Copyright (c) 2013 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /** * Given a file or group 'parent' id, return the number of child groups and the ids * of the child groups below the parent. If num_groups is NULL, do not return * count; if group_ids is NULL, do not return ids. */ int ex_get_group_ids (int parent_id, int *num_groups, int *group_ids) { int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ #if defined(NOT_NETCDF4) exerrval = NC_ENOTNC4; sprintf(errmsg, "Error: Group capabilities are not available in this netcdf version--not netcdf4"); ex_err("ex_get_group_ids",errmsg,exerrval); return (EX_FATAL); #else status = nc_inq_grps(parent_id, num_groups, group_ids); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: Failed to get child group ids in file id %d", parent_id); ex_err("ex_get_group_ids",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); #endif } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_id_map.c000066400000000000000000000106651225312213100224600ustar00rootroot00000000000000/* * Copyright (c) 2007 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * exgnm - ex_get_id_map * * entry conditions - * input parameters: * int exoid exodus file id * int map_type type of map (node, edge, face, element) * * exit conditions - * int* map map * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the id map */ int ex_get_id_map ( int exoid, ex_entity_type map_type, void_int* map ) { int dimid, mapid, status; size_t i; size_t num_entries; char errmsg[MAX_ERR_LENGTH]; const char* dnumentries; const char* vmap; const char* tname; switch (map_type) { case EX_NODE_MAP: tname = "node"; dnumentries = DIM_NUM_NODES; vmap = VAR_NODE_NUM_MAP; break; case EX_EDGE_MAP: tname = "edge"; dnumentries = DIM_NUM_EDGE; vmap = VAR_EDGE_NUM_MAP; break; case EX_FACE_MAP: tname = "face"; dnumentries = DIM_NUM_FACE; vmap = VAR_FACE_NUM_MAP; break; case EX_ELEM_MAP: tname = "element"; dnumentries = DIM_NUM_ELEM; vmap = VAR_ELEM_NUM_MAP; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad map type (%d) specified for file id %d", map_type, exoid ); ex_err( "ex_get_id_map", errmsg, exerrval ); return (EX_FATAL); } exerrval = 0; /* clear error code */ /* See if any entries are stored in this file */ if (nc_inq_dimid(exoid, dnumentries,&dimid) != NC_NOERR) { return (EX_NOERR); } if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) { if ((status = nc_inq_dimlen(exoid, dimid, &num_entries)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %ss in file id %d", tname, exoid); ex_err("ex_get_id_map",errmsg,exerrval); return (EX_FATAL); } /* generate default map of 1..n, where n is num_entries */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { int64_t *lmap = (int64_t*)map; for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /* * reads the element block ids from the database */ int ex_get_ids (int exoid, ex_entity_type obj_type, void_int *ids) { int varid, status; char errmsg[MAX_ERR_LENGTH]; const char* varidobj; exerrval = 0; /* clear error code */ switch (obj_type) { case EX_EDGE_BLOCK: varidobj = VAR_ID_ED_BLK; break; case EX_FACE_BLOCK: varidobj = VAR_ID_FA_BLK; break; case EX_ELEM_BLOCK: varidobj = VAR_ID_EL_BLK; break; case EX_NODE_SET: varidobj = VAR_NS_IDS; break; case EX_EDGE_SET: varidobj = VAR_ES_IDS; break; case EX_FACE_SET: varidobj = VAR_FS_IDS; break; case EX_SIDE_SET: varidobj = VAR_SS_IDS; break; case EX_ELEM_SET: varidobj = VAR_ELS_IDS; break; case EX_NODE_MAP: varidobj = VAR_NM_PROP(1); break; case EX_EDGE_MAP: varidobj = VAR_EDM_PROP(1); break; case EX_FACE_MAP: varidobj = VAR_FAM_PROP(1); break; case EX_ELEM_MAP: 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); } /* Determine if there are any 'obj-type' objects */ if ((status = nc_inq_dimid (exoid, ex_dim_num_objects(obj_type), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %s defined in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_get_ids",errmsg,exerrval); return (EX_WARN); } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, varidobj, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids variable in file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_get_ids",errmsg,exerrval); return (EX_FATAL); } /* read in the element block ids */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid, varid, ids); } else { status = nc_get_var_int(exoid, varid, ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to return %s ids in file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_get_ids",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_info.c000066400000000000000000000112311225312213100221500ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_info() reads information records from the database. The records are \c MAX_LINE_LENGTH-character strings. Memory must be allocated for the information records before this call is made. The number of records can be determined by invoking ex_inquire() or ex_inquire_int(). \returns In case of an error, ex_get_info() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - a warning value is returned if no information records were stored. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] info Returned array containing the information records. The following code segment will determine the number of information records and read them from an open exodus file : \code #include "exodusII.h" int error, exoid, num_info; char *info[MAXINFO]; \comment{read information records} num_info = ex_inquire_int (exoid,EX_INQ_INFO); for (i=0; i < num_info; i++) { info[i] = (char *) calloc ((MAX_LINE_LENGTH+1), sizeof(char)); } error = ex_get_info (exoid, info); \endcode */ int ex_get_info (int exoid, char **info) { int status; size_t i; int dimid, varid; size_t num_info, start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; int rootid = exoid & EX_FILE_ID_MASK; exerrval = 0; /* clear error code */ /* inquire previously defined dimensions and variables */ if ((status = nc_inq_dimid (rootid, DIM_NUM_INFO, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: failed to locate number of info records in file id %d", rootid); ex_err("ex_get_info",errmsg,exerrval); return (EX_WARN); } if ((status = nc_inq_dimlen(rootid, dimid, &num_info)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of info records in file id %d", rootid); ex_err("ex_get_info",errmsg,exerrval); return (EX_FATAL); } /* do this only if there are any information records */ if (num_info > 0) { if ((status = nc_inq_varid(rootid, VAR_INFO, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate info record data in file id %d", rootid); ex_err("ex_get_info",errmsg,exerrval); return (EX_FATAL); } /* read the information records */ for (i=0; i /*! The function ex_get_init() reads the initializationinitialization parameters from an opened exodus file. \return In case of an error, ex_get_init() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open(). \param exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] title Returned database title. String length may be up to \c MAX_LINE_LENGTH bytes. \param[out] num_dim Returned dimensionality of the database. This is the number of coordinates per node. \param[out] num_nodes Returned number of nodal points. \param[out] num_elem Returned number of elements \param[out] num_elem_blk Returned number of element blocks \param[out] num_node_sets Returned number of node sets \param[out] num_side_sets Returned number of side sets \sa ex_get_init_ext() The following code segment will read the initialization parameters from the open exodus file: \code #include "exodusII.h" int num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets, error, exoid; char title[MAX_LINE_LENGTH+1]; \comment{read database parameters} error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem, &num_elem_blk, &num_node_sets, &num_side_sets); \endcode */ int ex_get_init (int exoid, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets) { ex_init_params info; int errval; info.title[0] = '\0'; errval = ex_get_init_ext( exoid, &info ); if ( errval < 0 ) { return errval; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { int64_t *n_dim = num_dim; int64_t *n_nodes = num_nodes; int64_t *n_elem = num_elem; int64_t *n_elem_blk = num_elem_blk; int64_t *n_node_sets = num_node_sets; int64_t *n_side_sets = num_side_sets; *n_dim = info.num_dim; *n_nodes = info.num_nodes; *n_elem = info.num_elem; *n_elem_blk = info.num_elem_blk; *n_node_sets = info.num_node_sets; *n_side_sets = info.num_side_sets; } else { int *n_dim = num_dim; int *n_nodes = num_nodes; int *n_elem = num_elem; int *n_elem_blk = num_elem_blk; int *n_node_sets = num_node_sets; int *n_side_sets = num_side_sets; *n_dim = info.num_dim; *n_nodes = info.num_nodes; *n_elem = info.num_elem; *n_elem_blk = info.num_elem_blk; *n_node_sets = info.num_node_sets; *n_side_sets = info.num_side_sets; } strcpy( title, info.title ); return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_init_ext.c000066400000000000000000000160301225312213100230420ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * ex_init_params* info parameter information * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include /* Used to reduce repeated code below */ static int64_t ex_get_dim_value(int exoid, const char *name, const char *dimension_name, int dimension, int64_t *value) { char errmsg[MAX_ERR_LENGTH]; int status; if ((status = nc_inq_dimid (exoid, dimension_name, &dimension)) != NC_NOERR) { /* optional and default to zero. */ *value = 0; } else { size_t tmp; if ((status = nc_inq_dimlen(exoid, dimension, &tmp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %s in file id %d", name, exoid); ex_err("ex_get_init",errmsg,exerrval); return (EX_FATAL); } *value = tmp; } return EX_NOERR; } /*! * reads the initialization parameters from an opened EXODUS II file * \param exoid exodus file id * \param[out] info #ex_init_params structure containing metadata for mesh. * \sa ex_get_init() */ int ex_get_init_ext (int exoid, ex_init_params *info) { int dimid; char errmsg[MAX_ERR_LENGTH]; int status; size_t title_len; nc_type title_type; int rootid = exoid & EX_FILE_ID_MASK; exerrval = 0; /* clear error code */ info->num_dim = 0; info->num_nodes = 0; info->num_edge = 0; info->num_edge_blk = 0; info->num_face = 0; info->num_face_blk = 0; info->num_elem = 0; info->num_elem_blk = 0; info->num_node_sets = 0; info->num_edge_sets = 0; info->num_face_sets = 0; info->num_side_sets = 0; info->num_elem_sets = 0; info->num_node_maps = 0; info->num_edge_maps = 0; info->num_face_maps = 0; info->num_elem_maps = 0; { size_t tmp; status = ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions", &tmp, &dimid, "ex_get_init_ext"); if (status != NC_NOERR) return status; info->num_dim = tmp; } /* Handle case with zero-nodes */ if (ex_get_dim_value(exoid, "nodes",DIM_NUM_NODES,dimid,&info->num_nodes) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid, "edges", DIM_NUM_EDGE,dimid,&info->num_edge) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid, "faces", DIM_NUM_FACE,dimid,&info->num_face) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"elements", DIM_NUM_ELEM,dimid,&info->num_elem) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"element blocks", DIM_NUM_EL_BLK,dimid,&info->num_elem_blk) != EX_NOERR) return EX_FATAL; if (info->num_elem_blk == 0 && info->num_elem > 0) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of element blocks in file id %d", exoid); ex_err("ex_get_init_ext",errmsg,exerrval); return (EX_FATAL); } if (ex_get_dim_value(exoid,"node sets", DIM_NUM_NS,dimid,&info->num_node_sets) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"edge sets", DIM_NUM_ES,dimid,&info->num_edge_sets) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"face sets", DIM_NUM_FS,dimid,&info->num_face_sets) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"side sets", DIM_NUM_SS,dimid,&info->num_side_sets) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"elem sets",DIM_NUM_ELS,dimid,&info->num_elem_sets) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"node maps", DIM_NUM_NM,dimid,&info->num_node_maps) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"edge maps",DIM_NUM_EDM,dimid,&info->num_edge_maps) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"face maps",DIM_NUM_FAM,dimid,&info->num_face_maps) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"elem maps", DIM_NUM_EM,dimid,&info->num_elem_maps) != EX_NOERR) return EX_FATAL; /* Edge and face blocks are also optional (for backwards compatability) */ if (ex_get_dim_value(exoid,"edge blocks",DIM_NUM_ED_BLK,dimid,&info->num_edge_blk) != EX_NOERR) return EX_FATAL; if (ex_get_dim_value(exoid,"face blocks",DIM_NUM_FA_BLK,dimid,&info->num_face_blk) != EX_NOERR) return EX_FATAL; if ((status = nc_inq_att(rootid, NC_GLOBAL, ATT_TITLE, &title_type, &title_len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to inquire title in file id %d", rootid); ex_err("ex_get_init_ext",errmsg,exerrval); return (EX_FATAL); } /* Check title length to avoid overrunning clients memory space; include trailing null */ if (title_len > MAX_LINE_LENGTH) { char *title = malloc(title_len+1); if ((status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, title)) == NC_NOERR) { strncpy(info->title, title, MAX_LINE_LENGTH+1); info->title[MAX_LINE_LENGTH] = '\0'; } free(title); } else { status = nc_get_att_text(rootid, NC_GLOBAL, ATT_TITLE, info->title); info->title[title_len] = '\0'; } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get title in file id %d", rootid); ex_err("ex_get_init_ext",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_init_global.c000066400000000000000000000167561225312213100235210ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_init_global() ***************************************************************************** * This function reads the global initial information. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_nodes_g - The number of global FEM nodes. This is output as * a NetCDF variable. * num_elems_g - The number of global FEM elements. This is output * as a NetCDF variable. * num_elem_blks_g - The number of global element blocks. This is output * as a NetCDF dimension. * num_node_sets_g - The number of global node sets. This is output as * a NetCDF dimension. * num_side_sets_g - The number of global side sets. This is output as * a NetCDF dimension. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_init_global(int exoid, void_int *num_nodes_g, void_int *num_elems_g, void_int *num_elem_blks_g, void_int *num_node_sets_g, void_int *num_side_sets_g ) { const char *func_name="ex_get_init_global"; int dimid, status; size_t nng, neg, nebg, nnsg, nssg; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error flag */ /* Check the file version information */ if ((dimid=ne_check_file_version(exoid)) != EX_NOERR) return (dimid); /* Get the dimension ID for the number of global FEM nodes */ if ((status = nc_inq_dimid(exoid, DIM_NUM_NODES_GLOBAL, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_NODES_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the value of the number of global FEM nodes */ if ((status = nc_inq_dimlen(exoid, dimid, &nng)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_NODES_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the dimension ID for the number of global FEM elements */ if ((status = nc_inq_dimid(exoid, DIM_NUM_ELEMS_GLOBAL, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_ELEMS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the value of the number of global FEM elements */ if ((status = nc_inq_dimlen(exoid, dimid, &neg)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_ELEMS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the dimension ID for the number of global element blocks */ if ((status = nc_inq_dimid(exoid, DIM_NUM_ELBLK_GLOBAL, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_ELBLK_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the value of the number of global element blocks */ if ((status = nc_inq_dimlen(exoid, dimid, &nebg)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_ELBLK_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the dimension ID for the number of global node sets */ if ((status = nc_inq_dimid(exoid, DIM_NUM_NS_GLOBAL, &dimid)) != NC_NOERR) { nnsg = 0; } else { /* Get the value of the number of global node sets */ if ((status = nc_inq_dimlen(exoid, dimid, &nnsg)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_NS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* Get the dimension ID for the number of global side sets */ if ((status = nc_inq_dimid(exoid, DIM_NUM_SS_GLOBAL, &dimid)) != NC_NOERR) { nssg = 0; } else { /* Get the value of the number of global side sets */ if ((status = nc_inq_dimlen(exoid, dimid, &nssg)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_SS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_nodes_g = nng; *(int64_t*)num_elems_g = neg; *(int64_t*)num_elem_blks_g = nebg; *(int64_t*)num_node_sets_g = nnsg; *(int64_t*)num_side_sets_g = nssg; } else { *(int*)num_nodes_g = nng; *(int*)num_elems_g = neg; *(int*)num_elem_blks_g = nebg; *(int*)num_node_sets_g = nnsg; *(int*)num_side_sets_g = nssg; } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_init_info.c000066400000000000000000000115121225312213100231750ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_init_info() ***************************************************************************** * This function reads information about the processors for which the * decomposition was performed. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_proc - The number of processors in the decomposition. * num_proc_in_f - The number of processors the file contains * information for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_get_init_info(int exoid, int *num_proc, int *num_proc_in_f, char *ftype ) { const char *func_name="ex_get_init_info"; int dimid, status; size_t ltempsv; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to get file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_PROCS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the value of the number of processors */ if ((status = nc_inq_dimlen(exoid, dimid, <empsv)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_PROCS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } *num_proc = ltempsv; /* Get the dimension ID of processors that have info in this file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the value of the number of processors that have info in this file */ if ((status = nc_inq_dimlen(exoid, dimid, <empsv)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } *num_proc_in_f = ltempsv; return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_loadbal_param.c000066400000000000000000000432471225312213100240070ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_loadbal_param() ***************************************************************************** * This function retrieves the load balance parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_int_nodes - The number of internal FEM nodes. * num_bor_nodes - The number of border FEM nodes. * num_ext_nodes - The number of external FEM nodes. * num_int_elems - The number of internal FEM elements. * num_bor_elems - The number of border FEM elements. * num_node_cmaps - The number of nodal communication maps. * num_elem_cmaps - The number of elemental communication maps. * processor - The processor the file being read was written for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_loadbal_param(int exoid, void_int *num_int_nodes, void_int *num_bor_nodes, void_int *num_ext_nodes, void_int *num_int_elems, void_int *num_bor_elems, void_int *num_node_cmaps, void_int *num_elem_cmaps, int processor ) { const char *func_name="ex_get_loadbal_param"; int dimid, varid, status; size_t start[1]; size_t nin, nbn, nen, nie, nbe, nncm, necm; int64_t varidx[2]; char ftype[2]; int nmstat; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_int_nodes = 0; *(int64_t*)num_bor_nodes = 0; *(int64_t*)num_ext_nodes = 0; *(int64_t*)num_int_elems = 0; *(int64_t*)num_bor_elems = 0; *(int64_t*)num_node_cmaps = 0; *(int64_t*)num_elem_cmaps = 0; } else { *(int*)num_int_nodes = 0; *(int*)num_bor_nodes = 0; *(int*)num_ext_nodes = 0; *(int*)num_int_elems = 0; *(int*)num_bor_elems = 0; *(int*)num_node_cmaps = 0; *(int*)num_elem_cmaps = 0; } exerrval = 0; /* clear error code */ /* Check the file version information */ if ((dimid=ne_check_file_version(exoid)) != EX_NOERR) return (dimid); /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: unable to find file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the status for this node map */ if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { if (ex_get_idx(exoid, VAR_NODE_MAP_INT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the internal node map */ if (varidx[1] == -1) { /* Get the dimension ID for the number of internal nodes */ if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the value of the dimension representing the total number of * internal FEM nodes. */ if ((status = nc_inq_dimlen(exoid, dimid, &nin)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nin; } /* End "if (varidx[1] = -1)" */ /* now get the number of nodes */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_int_nodes = varidx[1] - varidx[0]; } else { *(int*)num_int_nodes = varidx[1] - varidx[0]; } } /* Get the status for this node map */ if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { if (ex_get_idx(exoid, VAR_NODE_MAP_BOR_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the border node map */ if (varidx[1] == -1) { /* Get the dimension ID for the number of border nodes */ if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the value of the dimension representing the number of border * FEM nodes. */ if ((status = nc_inq_dimlen(exoid, dimid, &nbn)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nbn; } /* End "if (varidx[1] == -1)" */ /* now calculate the number of nodes */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_bor_nodes = varidx[1] - varidx[0]; } else { *(int*)num_bor_nodes = varidx[1] - varidx[0]; } } /* Get the status for this node map */ if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { if (ex_get_idx(exoid, VAR_NODE_MAP_EXT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_EXT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the external node map */ if (varidx[1] == -1) { /* Get the dimension ID for the number of external nodes */ if ((status = nc_inq_dimid(exoid, DIM_NUM_EXT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the value of the dimension representing the number of external * FEM nodes. */ if ((status = nc_inq_dimlen(exoid, dimid, &nen)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nen; } /* End "if (varidx[1] == -1)" */ /* now get the number of nodes */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_ext_nodes = varidx[1] - varidx[0]; } else { *(int*)num_ext_nodes = varidx[1] - varidx[0]; } } /* Get the status for this element map */ if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { if (ex_get_idx(exoid, VAR_ELEM_MAP_INT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the internal element map */ if (varidx[1] == -1) { /* Get the dimension ID for the number of internal elements */ if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" from file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the value of the dimension representing the number of internal * FEM elements. */ if ((status = nc_inq_dimlen(exoid, dimid, &nie)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimesion \"%s\" in file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nie; } /* End "if (varidx[1] == -1)" */ /* now get the number of elements */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_int_elems = varidx[1] - varidx[0]; } else { *(int*)num_int_elems = varidx[1] - varidx[0]; } } /* Get the status for this element map */ if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { if (ex_get_idx(exoid, VAR_ELEM_MAP_BOR_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the border element map */ if (varidx[1] == -1) { /* Get the dimension ID for the number of border elements */ if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" from file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the value of the dimension representing the number of border * FEM elements. */ if ((status = nc_inq_dimlen(exoid, dimid, &nbe)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimesion \"%s\" in file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nbe; } /* End "if (varidx[1] == -1)" */ /* now get the number of nodes */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_bor_elems = varidx[1] - varidx[0]; } else { *(int*)num_bor_elems = varidx[1] - varidx[0]; } } /* End "if (nmstat == 1)" */ if (ex_get_idx(exoid, VAR_N_COMM_INFO_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the nodal comm map */ if (varidx[1] == -1) { /* Get the nodal comm map information */ if ((status = nc_inq_dimid(exoid, DIM_NUM_N_CMAPS, &dimid)) != NC_NOERR) varidx[1] = 0; else { if ((status = nc_inq_dimlen(exoid, dimid, &nncm)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = nncm; } } /* End "if (varidx[1] == -1)" */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_node_cmaps = varidx[1] - varidx[0]; } else { *(int*)num_node_cmaps = varidx[1] - varidx[0]; } if (ex_get_idx(exoid, VAR_E_COMM_INFO_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the elemental comm map */ if (varidx[1] == -1) { /* Get the elemental comm map information */ if ((status = nc_inq_dimid(exoid, DIM_NUM_E_CMAPS, &dimid)) != NC_NOERR) varidx[1] = 0; else { if ((status = nc_inq_dimlen(exoid, dimid, &necm)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ varidx[1] = necm; } } /* End "if (varidx[1] == -1)" */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { *(int64_t*)num_elem_cmaps = varidx[1] - varidx[0]; } else { *(int*)num_elem_cmaps = varidx[1] - varidx[0]; } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_map.c000066400000000000000000000107001225312213100217720ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_get_num_map() instead. The function ex_get_map() reads the element order map from the database. See #ElementOrderMap for a description of the element order map. If an element order map is not stored in the data file, a default array (1,2,3,. .. \c num_elem) is returned. Memory must be allocated for the element map array ({num_elem} in length) before this call is made. \return In case of an error, ex_get_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - if an element order map is not stored, a default map and a warning value are returned. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] elem_map Returned element order map. The following code will read an element order map from an open exodus file : \code int *elem_map, error, exoid; \comment{read element order map} elem_map = (int *)calloc(num_elem, sizeof(int)); error = ex_get_map(exoid, elem_map); \endcode */ int ex_get_map (int exoid, void_int *elem_map) { int numelemdim, mapid, status; size_t num_elem, i; 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 ((status = nc_inq_dimid (exoid, DIM_NUM_ELEM, &numelemdim)) != NC_NOERR) { return (EX_NOERR); } if ((status = nc_inq_dimlen(exoid, numelemdim, &num_elem)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of elements in file id %d", exoid); ex_err("ex_get_map",errmsg,exerrval); return (EX_FATAL); } if (nc_inq_varid(exoid, VAR_MAP, &mapid) != NC_NOERR) { /* generate default map of 1..n, where n is num_elem */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { int64_t *lmap = (int64_t*)elem_map; for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated Use ex_get_partial_attr() instead. */ int ex_get_n_elem_attr (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void *attrib) { return ex_get_partial_attr(exoid, EX_ELEM_BLOCK, elem_blk_id, start_elem_num, num_elems, attrib); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_elem_conn.c000066400000000000000000000061721225312213100235010ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_n_elem_conn() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID. * start_elem_num - The starting index of the elements to be * obtained. * num_elems - The number of FEM elements to read coords for. * connect - Pointer to the connectivity vector. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" /*! * \deprecated use ex_get_partial_conn() * reads the connectivity array for an element block */ int ex_get_n_elem_conn (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void_int *connect) { return ex_get_partial_conn(exoid, EX_ELEM_BLOCK, elem_blk_id, start_elem_num, num_elems, connect, NULL, NULL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_elem_num_map.c000066400000000000000000000047451225312213100242040ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_gennm - ex_get_n_elem_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent starting location for read * int num_ents number of elemental points * * exit conditions - * int* elem_map element number map array * * revision history - * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated Use ex_get_partial_id_map() instead */ int ex_get_n_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, void_int *elem_map) { return ex_get_partial_id_map(exoid, EX_ELEM_MAP, start_ent, num_ents, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_elem_var.c000066400000000000000000000043011225312213100233240ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_var() instead */ int ex_get_n_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, int64_t start_elem_num, int64_t num_elem, void *elem_var_vals) { return ex_get_partial_var(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, start_elem_num, num_elem, elem_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_nodal_var.c000066400000000000000000000041371225312213100235060ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ #include /*! * \deprecated Use ex_get_partial_nodal_var() instead */ int ex_get_n_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, void *var_vals) { return ex_get_partial_nodal_var(exoid, time_step, nodal_var_index, start_node, num_nodes, var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_node_num_map.c000066400000000000000000000046651225312213100242100ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_gnnnm - ex_get_n_node_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid nemesis file id * * exit conditions - * int* node_map node numbering map array * * revision history - * * *****************************************************************************/ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_num_map() instead */ int ex_get_n_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, void_int *node_map) { return ex_get_partial_id_map(exoid, EX_NODE_MAP, start_ent, num_ents, node_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_node_set.c000066400000000000000000000060061225312213100233360ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_n_node_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to read. * start_node_num - The starting index of the nodes to be read. * num_nodes - The number of nodes to read in. * node_set_node_list - List of node IDs in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_node_set() instead */ int ex_get_n_node_set (int exoid, ex_entity_id node_set_id, int64_t start_node_num, int64_t num_nodes, void_int *node_set_node_list) { return ex_get_partial_node_set(exoid, node_set_id, start_node_num, num_nodes, node_set_node_list); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_node_set_df.c000066400000000000000000000042521225312213100240100ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_set_dist_fact() instead */ int ex_get_n_node_set_df (int exoid, ex_entity_id node_set_id, int64_t start_num, int64_t num_df_to_get, void *node_set_dist_fact) { return ex_get_partial_set_dist_fact(exoid, EX_NODE_SET, node_set_id, start_num, num_df_to_get, node_set_dist_fact); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_one_attr.c000066400000000000000000000051501225312213100233500ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_one_attr() instead. * * reads the specified attribute for a subsect of a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param start_num the starting index of the attributes to be returned. * \param num_ent the number of entities to read attributes for. * \param attrib_index index of attribute to write * \param attrib array of attributes */ /* */ int ex_get_n_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, void* attrib ) { return ex_get_partial_one_attr(exoid, obj_type, obj_id, start_num, num_ent, attrib_index, attrib); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_side_set.c000066400000000000000000000043151225312213100233360ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ #include "exodusII.h" /*! * \deprecated Use ex_get_partial_side_set() instead */ int ex_get_n_side_set (int exoid, ex_entity_id side_set_id, int64_t start_side_num, int64_t num_sides, void_int *side_set_elem_list, void_int *side_set_side_list) { return ex_get_partial_side_set(exoid, side_set_id, start_side_num, num_sides, side_set_elem_list, side_set_side_list); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_side_set_df.c000066400000000000000000000063041225312213100240070ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_n_side_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to read. * start_side_num - The starting index of the sides to be read. * num_sides - The number of sides to read in. * side_set_dist_fact - List of side IDs in side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated Use ex_get_partial_set_dist_fact() instead */ int ex_get_n_side_set_df (int exoid, ex_entity_id side_set_id, int64_t start_num, int64_t num_df_to_get, void *side_set_dist_fact) { return ex_get_partial_set_dist_fact(exoid, EX_SIDE_SET, side_set_id, start_num, num_df_to_get, side_set_dist_fact); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_n_var.c000066400000000000000000000057121225312213100223310ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /* * reads the values of a single element variable for one element block at * one time step in the database; assume the first time step and * element variable index is 1 */ /*! * \deprecated Use ex_get_partial_var() instead. * * reads the values of a single variable for a partial block at one time * step from the database; assume the first time step and variable index * and start_index are 1 * \param exoid exodus file id * \param time_step time step number * \param var_type type (edge block, face block, edge set, ... ) * \param var_index element variable index * \param obj_id element block id * \param start_index index of first entity in block to read (1-based) * \param num_entities number of entries to read in this block/set * \param var_vals the values to read */ int ex_get_n_var( int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, void* var_vals ) { return ex_get_partial_var(exoid, time_step, var_type, var_index, obj_id, start_index, num_entities, var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_name.c000066400000000000000000000105711225312213100221430ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /* * reads the specified entity name from the database */ int ex_get_name (int exoid, ex_entity_type obj_type, ex_entity_id entity_id, char *name) { int status; int varid, ent_ndx; char errmsg[MAX_ERR_LENGTH]; char *vobj = NULL; const char *routine = "ex_get_name"; exerrval = 0; switch(obj_type) { case EX_ELEM_BLOCK: vobj = VAR_NAME_EL_BLK; break; case EX_EDGE_BLOCK: vobj = VAR_NAME_ED_BLK; break; case EX_FACE_BLOCK: vobj = VAR_NAME_FA_BLK; break; case EX_NODE_SET: vobj = VAR_NAME_NS; break; case EX_SIDE_SET: vobj = VAR_NAME_SS; break; case EX_EDGE_SET: vobj = VAR_NAME_ES; break; case EX_FACE_SET: vobj = VAR_NAME_FS; break; case EX_ELEM_SET: vobj = VAR_NAME_ELS; break; case EX_NODE_MAP: vobj = VAR_NAME_NM; break; case EX_EDGE_MAP: vobj = VAR_NAME_EDM; break; case EX_FACE_MAP: vobj = VAR_NAME_FAM; break; case EX_ELEM_MAP: vobj = VAR_NAME_EM; break; default: /* invalid variable type */ exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid); ex_err(routine,errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, vobj, &varid)) == NC_NOERR) { /* If this is a null entity, then 'ent_ndx' will be negative. * We don't care in this routine, so make it positive and continue... */ ent_ndx = ex_id_lkup(exoid, obj_type, entity_id); if (ent_ndx < 0) ent_ndx = -ent_ndx; /* read the name */ { int db_name_size = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); int name_size = db_name_size < api_name_size ? db_name_size : api_name_size; status = ex_get_name_internal(exoid, varid, ent_ndx-1, name, name_size, obj_type, routine); if (status != NC_NOERR) { return (EX_FATAL); } } } 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_names.c000066400000000000000000000125021225312213100223220ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type, * * exit conditions - * char* names[] ptr array of names * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /* * reads the entity names from the database */ int ex_get_names (int exoid, ex_entity_type obj_type, char **names) { int status; int varid, temp; size_t num_entity, i; 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, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_ED_BLK, &varid); break; case EX_FACE_BLOCK: ex_get_dimension(exoid, DIM_NUM_FA_BLK, "face block", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_FA_BLK, &varid); break; case EX_ELEM_BLOCK: ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element block", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_EL_BLK, &varid); break; /* ======== SETS ========= */ case EX_NODE_SET: ex_get_dimension(exoid, DIM_NUM_NS, "nodeset", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_NS, &varid); break; case EX_EDGE_SET: ex_get_dimension(exoid, DIM_NUM_ES, "edgeset", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_ES, &varid); break; case EX_FACE_SET: ex_get_dimension(exoid, DIM_NUM_FS, "faceset", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_FS, &varid); break; case EX_SIDE_SET: ex_get_dimension(exoid, DIM_NUM_SS, "sideset", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_SS, &varid); break; case EX_ELEM_SET: ex_get_dimension(exoid, DIM_NUM_ELS, "elemset", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_ELS, &varid); break; /* ======== MAPS ========= */ case EX_NODE_MAP: ex_get_dimension(exoid, DIM_NUM_NM, "node map", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_NM, &varid); break; case EX_EDGE_MAP: ex_get_dimension(exoid, DIM_NUM_EDM, "edge map", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_EDM, &varid); break; case EX_FACE_MAP: ex_get_dimension(exoid, DIM_NUM_FAM, "face map", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_FAM, &varid); break; case EX_ELEM_MAP: ex_get_dimension(exoid, DIM_NUM_EM, "element map", &num_entity, &temp, routine); status = nc_inq_varid(exoid, VAR_NAME_EM, &varid); break; /* invalid variable type */ default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid); ex_err(routine,errmsg,exerrval); return(EX_FATAL); } if (status == NC_NOERR) { if ((status = ex_get_names_internal(exoid, varid, num_entity, names, obj_type, "ex_get_names")) != EX_NOERR) { return status; } } 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 #include #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_node_cmap(int exoid, ex_entity_id map_id, void_int *node_ids, void_int *proc_ids, int processor ) { const char *func_name="ex_get_node_cmap"; int map_idx, dimid, varid[2], status; size_t start[1], count[1]; int64_t varidx[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* get the cmap information variables index */ if (ex_get_idx(exoid, VAR_N_COMM_INFO_IDX, varidx, processor) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * no need to check if the second index is -1 that is handled * in ne_id_lkup, where the dimension must be looked up anyways */ /* Get the index of the nodal comm map with the given ID */ if ((map_idx=ne_id_lkup(exoid, VAR_N_COMM_IDS, varidx, map_id)) < 0) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to find nodal comm map with ID %"PRId64" in file ID %d", map_id, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* get the cmap data variables index for this map */ if (ex_get_idx(exoid, VAR_N_COMM_DATA_IDX, varidx, map_idx) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the dimension of this nodal communication map */ if ((status = nc_inq_dimid(exoid, DIM_NCNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid,count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } /* Get the variable ID for the nodal comm map node IDs */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_NIDS, &varid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the nodal comm map processor IDs */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_PROC, &varid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the nodal comm map node IDs */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, varid[0], start, count, node_ids); } else { status = nc_get_vara_int(exoid, varid[0], start, count, node_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the nodal comm map processor IDs */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, varid[1], start, count, proc_ids); } else { status = nc_get_vara_int(exoid, varid[1], start, count, proc_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_map.c000066400000000000000000000050121225312213100227770ustar00rootroot00000000000000/* * 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 * * 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 #include "exodusII.h" #include "exodusII_int.h" /*! * reads the node map with specified ID * \deprecated Use ex_get_num_map()(exoid, EX_NODE_MAP, map_id, node_map */ int ex_get_node_map( int exoid, ex_entity_id map_id, void_int *node_map ) { return ex_get_num_map( exoid, EX_NODE_MAP, map_id, node_map ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_num_map.c000066400000000000000000000067701225312213100236720ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * int* node_map node numbering map array * * revision history - * * *****************************************************************************/ #include "exodusII.h" /*! \deprecated Use ex_get_id_map()(exoid, EX_NODE_MAP, node_map) The function ex_get_node_num_map() reads the optional node number mapnode number map from the database. See Section LocalNodeIds for a description of the node number map. If a node number map is not stored in the data file, a default array (1,2,3,. .. \c num_nodes) is returned. Memory must be allocated for the node number map array (\c num_nodes in length) before this call is made. \return In case of an error, ex_get_node_num_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - if a node number map is not stored, a default map and a warning value are returned. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] node_map Returned node number map. The following code will read a node number map from an open exodus file : \code int *node_map, error, exoid; \comment{read node number map} node_map = (int *)calloc(num_nodes, sizeof(int)); error = ex_get_node_num_map(exoid, node_map); \comment{Equivalent using non-deprecated function} error = ex_get_id_map(exoid, EX_NODE_MAP, node_map); \endcode */ int ex_get_node_num_map (int exoid, void_int *node_map) { return ex_get_id_map(exoid, EX_NODE_MAP, node_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_set.c000066400000000000000000000051341225312213100230220ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * reads the node list for a single node set * \deprecated Use ex_get_set()(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL) */ int ex_get_node_set (int exoid, ex_entity_id node_set_id, void_int *node_set_node_list) { return ex_get_set(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_set_dist_fact.c000066400000000000000000000062071225312213100250440ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_set_dist_fact()(exoid, EX_NODE_SET, node_set_id, node_set_dist_fact) The function ex_get_node_set_dist_fact() returns the node set distribution factors for a single node set. Memory must be allocated for the list of distribution factors(\c num_dist_in_set in length) before this function is invoked. Because the distribution factors are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_node_set_dist_fact() returns a negative number; a warning will return a positive number. Possible causes of errors include: - a warning value is returned if no distribution factors were stored. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_id The node set ID. \param[out] node_set_dist_fact Returned array containing the distribution factors in the node set. Refer to the description of ex_get_node_set_param() for a sample code segment to read a node set's distribution factors. */ int ex_get_node_set_dist_fact (int exoid, ex_entity_id 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_set_ids.c000066400000000000000000000060311225312213100236560ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_ids()(exoid, EX_NODE_SET, ids) The function ex_get_node_set_ids() reads the IDs of all of the node sets. Memory must be allocated for the returned array of ({num_node_sets}) IDs before this function is invoked. \return In case of an error, ex_get_node_set_ids() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - a warning value is returned if no node sets are stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[out] ids Returned array of the node sets IDs. The order of the IDs in this array reflects the sequence the node sets were introduced into the file. As an example, the following code will read all of the node set IDs from an open data file: \code int *ids, num_node_sets, error, exoid; \comment{read node sets IDs} ids = (int *) calloc(num_node_sets, sizeof(int)); error = ex_get_node_set_ids (exoid, ids); \comment{Same result using non-deprecated functions.} error = ex_get_ids (exoid, EX_NODE_SET, ids); \endcode */ int ex_get_node_set_ids (int exoid, void_int *ids) { return ex_get_ids( exoid, EX_NODE_SET, ids ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_node_set_param.c000066400000000000000000000075451225312213100242120ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_get_set_param()(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_df_in_set) The function ex_get_node_set_param() reads the number of nodes which describe a single node set and the number of distribution factors for the node set. \return In case of an error, ex_get_node_set_param() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - a warning value is returned if no node sets are stored in the file. - incorrect node set ID. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_id The node set ID. \param[out] num_nodes_in_set Returned number of nodes in the node set. \param[out] num_df_in_set Returned number of distribution factors in the node set. The following code segment will read a node set from an open exodus file : \code int error, exoid, id, num_nodes_in_set, num_df_in_set, *node_list; float *dist_fact; \comment{read node set parameters} id = 100; error = ex_get_node_set_param(exoid, id, &num_nodes_in_set, &num_df_in_set); \comment{read node set node list} node_list = (int *) calloc(num_nodes_in_set, sizeof(int)); error = ex_get_node_set(exoid, id, node_list); \comment{read node set distribution factors} if (num_df_in_set > 0) { dist_fact = (float *) calloc(num_nodes_in_set, sizeof(float)); error = ex_get_node_set_dist_fact(exoid, id, dist_fact); } \comment{Same result using non-deprecated functions} error = ex_get_set_param(exoid, EX_NODE_SET, id, &num_nodes_in_set, &num_df_in_set); error = ex_get_set(exoid, EX_NODE_SET, id, node_list); if (num_df_in_set > 0) { error = ex_get_set_dist_fact(exoid, EX_NODE_SET, id, dist_fact); } \endcode */ int ex_get_node_set_param (int exoid, ex_entity_id node_set_id, void_int *num_nodes_in_set, void_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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_ns_param_global.c000066400000000000000000000142361225312213100243450ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_ns_param_global() ***************************************************************************** * This function retrieves the global node-set parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * global_ids - Pointer to a vector of global node-set IDs. * node_cnts - Pointer to a vector of global node counts in * each global node set. * df_cnts - Pointer to a vector of global distribution * factors in each global node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include int ex_get_ns_param_global(int exoid, void_int *global_ids, void_int *node_cnts, void_int *df_cnts ) { const char *func_name="ex_get_ns_param_global"; int varid, status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the variable ID for the vector of global node set IDs */ if ((status = nc_inq_varid(exoid, VAR_NS_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of node set IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid, varid, global_ids); } else { status = nc_get_var_int(exoid, varid, global_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the vector of global node set node count */ if (node_cnts != NULL) { if ((status = nc_inq_varid(exoid, VAR_NS_NODE_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_NODE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of node set node counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, varid, node_cnts); } else { status = nc_get_var_int(exoid, varid, node_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NS_NODE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (node_cnts != NULL)" */ /* Get the variable ID for the vector of global node set dist. fact count */ if (df_cnts != NULL) { if ((status = nc_inq_varid(exoid, VAR_NS_DF_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of node set dist. fact counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, varid, df_cnts); } else { status = nc_get_var_int(exoid, varid, df_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (df_cnts != NULL)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_nset_var.c000066400000000000000000000061121225312213100230400ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the values of a single nodeset variable for one nodeset at * one time step in the database; assume the first time step and * nodeset variable index is 1 * \deprecated Use ex_get_var()(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_node_this_nset, nset_var_vals) instead */ int ex_get_nset_var (int exoid, int time_step, int nset_var_index, ex_entity_id nset_id, int64_t num_node_this_nset, void *nset_var_vals) { return ex_get_var(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_node_this_nset, nset_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_nset_var_tab.c000066400000000000000000000053411225312213100236710ustar00rootroot00000000000000/* * 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 * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * reads the EXODUS II nodeset variable truth table from the database * \deprecated Use ex_get_truth_table()(exoid, EX_NODE_SET, num_nodesets, num_nset_var, nset_var_tab) */ int ex_get_nset_var_tab (int exoid, int num_nodesets, int num_nset_var, int *nset_var_tab) { return ex_get_truth_table(exoid, EX_NODE_SET, num_nodesets, num_nset_var, nset_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_num_map.c000066400000000000000000000117471225312213100226650ustar00rootroot00000000000000/* * 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 * * 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 #include "exodusII.h" #include "exodusII_int.h" /* * reads the map with specified ID */ int ex_get_num_map ( int exoid, ex_entity_type map_type, ex_entity_id map_id, void_int* map ) { int dimid, var_id, id_ndx, status; char errmsg[MAX_ERR_LENGTH]; const char* dim_map_size; const char* dim_num_maps; switch (map_type) { case EX_NODE_MAP: dim_map_size = DIM_NUM_NODES; dim_num_maps = DIM_NUM_NM; break; case EX_EDGE_MAP: dim_map_size = DIM_NUM_EDGE; dim_num_maps = DIM_NUM_EDM; break; case EX_FACE_MAP: dim_map_size = DIM_NUM_FACE; dim_num_maps = DIM_NUM_FAM; break; case EX_ELEM_MAP: dim_map_size = DIM_NUM_ELEM; dim_num_maps = DIM_NUM_EM; 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 (nc_inq_dimid (exoid, dim_map_size, &dimid) != NC_NOERR) { return (EX_NOERR); } /* first check if any maps have been defined */ if ((status = nc_inq_dimid(exoid, dim_num_maps, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %ss defined in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_get_map",errmsg,exerrval); return (EX_WARN); } /* Lookup index of map id property array */ id_ndx = ex_id_lkup(exoid,map_type,map_id); if (exerrval != 0) { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id variable in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_get_map",errmsg,exerrval); return (EX_FATAL); } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, ex_name_of_map(map_type,id_ndx), &var_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s %"PRId64" in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_get_map",errmsg,exerrval); return (EX_FATAL); } /* read in the map */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_var_longlong(exoid, var_id, map); } else { status = nc_get_var_int(exoid, var_id, map); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get %s in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_get_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_object_truth_vector.c000066400000000000000000000151751225312213100253060ustar00rootroot00000000000000/* * 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. * */ /***************************************************************************** * * exgotv - ex_get_object_truth_vector * * revision history - * * *****************************************************************************/ #include #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, ex_entity_type obj_type, ex_entity_id entity_id, int num_var, int *var_vec) { int statust; int varid, tabid, i, status, ent_ndx; size_t num_var_db = 0; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; const char* routine = "ex_get_object_truth_vector"; /* * The ent_type and the var_name are used to build the netcdf * variables name. Normally this is done via a macro defined in * exodusII_int.h */ const char* ent_type = NULL; const char* var_name = NULL; exerrval = 0; /* clear error code */ switch (obj_type) { case EX_EDGE_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var_db, &varid, routine); statust = nc_inq_varid(exoid, VAR_EBLK_TAB, &tabid); var_name = "vals_edge_var"; ent_type = "eb"; break; case EX_FACE_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_FBLK_TAB, &tabid); var_name = "vals_face_var"; ent_type = "fb"; break; case EX_ELEM_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_ELEM_TAB, &tabid); var_name = "vals_elem_var"; ent_type = "eb"; break; case EX_NODE_SET: status = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_NSET_TAB, &tabid); var_name = "vals_nset_var"; ent_type = "ns"; break; case EX_EDGE_SET: status = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_ESET_TAB, &tabid); var_name = "vals_eset_var"; ent_type = "es"; break; case EX_FACE_SET: status = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_FSET_TAB, &tabid); var_name = "vals_fset_var"; ent_type = "fs"; break; case EX_SIDE_SET: status = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_SSET_TAB, &tabid); var_name = "vals_sset_var"; ent_type = "ss"; break; case EX_ELEM_SET: status = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elemset variables", &num_var_db, &varid, routine); statust = nc_inq_varid (exoid, VAR_ELSET_TAB, &tabid); var_name = "vals_elset_var"; ent_type = "es"; break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid variable type %d specified in file id %d", obj_type, exoid); ex_err(routine,errmsg,exerrval); return (EX_WARN); } if (status != NC_NOERR) { exerrval = status; return (EX_WARN); } /* Determine index of entity_id in id array */ ent_ndx = ex_id_lkup(exoid,obj_type,entity_id); if (exerrval != 0) { if (exerrval != EX_NULLENTITY) { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id variable in file id %d", ex_name_of_object(obj_type), entity_id, exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } } /* If this is a null entity, then 'ent_ndx' will be negative. * We don't care in this routine, so make it positive and continue... */ if (ent_ndx < 0) ent_ndx = -ent_ndx; if ((int)num_var_db != num_var) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # of variables doesn't match those defined in file id %d", exoid); ex_err("ex_get_object_truth_vector",errmsg,exerrval); return (EX_FATAL); } if (statust != NC_NOERR) { /* since truth vector isn't stored in the data file, derive it dynamically */ for (i=0; i (int)num_attr) { exerrval = EX_FATAL; sprintf(errmsg, "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %"PRId64" in file id %d", attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_get_one_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),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 (ex_comp_ws(exoid) == 4) { status = nc_get_vars_float(exoid, attrid, start, count, stride, attrib); } else { status = nc_get_vars_double(exoid, attrid, start, count, stride, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get attribute %d for %s %"PRId64" in file id %d", attrib_index, ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_get_one_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_one_elem_attr.c000066400000000000000000000051641225312213100240420ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the attributes for an element block * \deprecated Use ex_get_one_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib) */ int ex_get_one_elem_attr (int exoid, ex_entity_id elem_blk_id, int attrib_index, void *attrib) { return ex_get_one_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_attr.c000066400000000000000000000166771225312213100237260ustar00rootroot00000000000000/* * 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_partial_attr * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type object type (edge, face, elem block) * int obj_id object id (edge face, elem block ID) * int start_num starting index of attributes to be returned. * int num_ent number of entities to read attributes for. * * exit conditions - * float* attrib array of attributes * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the specified attribute for a subsect of a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param start_num the starting index of the attributes to be returned. * \param num_ent the number of entities to read attributes for. * \param attrib_index index of attribute to write * \param attrib array of attributes */ /* */ int ex_get_partial_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, void* attrib ) { int status; int attrid, obj_id_ndx; int temp; size_t num_entries_this_obj, num_attr; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; const char* dnumobjent; const char* dnumobjatt; const char* vattrbname; exerrval = 0; /* clear error code */ if (num_ent == 0) return 0; /* Determine index of obj_id in vobjids array */ if (obj_type != EX_NODAL) { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_partial_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this object */ } else { sprintf(errmsg, "Warning: failed to locate %s id%"PRId64" in id array in file id %d", ex_name_of_object(obj_type),obj_id, exoid); ex_err("ex_get_partial_attr",errmsg,exerrval); return (EX_WARN); } } } switch (obj_type) { case EX_SIDE_SET: dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vattrbname = VAR_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vattrbname = VAR_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vattrbname = VAR_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vattrbname = VAR_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vattrbname = VAR_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjent = DIM_NUM_NODES; dnumobjatt = DIM_NUM_ATT_IN_NBLK; vattrbname = VAR_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vattrbname = VAR_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx); vattrbname = VAR_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx); vattrbname = VAR_ATTRIB(obj_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_get_partial_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_get_partial_attr") != NC_NOERR) return EX_FATAL; if (start_num + num_ent -1 > num_entries_this_obj) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: start index (%"PRId64") + count (%"PRId64") is larger than total number of entities (%"ST_ZU") in file id %d", start_num, num_ent, num_entries_this_obj, exoid); ex_err("ex_get_partial_attr",errmsg,exerrval); return (EX_FATAL); } if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_get_partial_attr") != NC_NOERR) return EX_FATAL; if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_partial_attr",errmsg,exerrval); return (EX_FATAL); } /* read in the attributes */ start[0] = start_num-1; start[1] = 0; count[0] = num_ent; count[1] = num_attr; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, attrid, start, count, attrib); } else { status = nc_get_vara_double(exoid, attrid, start, count, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_get_partial_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_conn.c000066400000000000000000000250601225312213100236730ustar00rootroot00000000000000/* * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * exgnconn - exodusII read partial edge/face/element block connectivity * * entry conditions - * expelb must be called first to establish element block parameters. * input parameters: * int exoid exodus file id * int blk_type block type (edge, face, element) * int blk_id block id * int start_num The starting index (1-based) of entities to read * int num_ent The number of entities to read connectivity info for. * * exit conditions - * int* nodeconn nodal connectivity array * int* edgeconn edge connectivity array (where applicable) * int* faceconn face connectivity array (where applicable) * * revision history - * */ #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the connectivity array for an element block */ int ex_get_partial_conn( int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_num, int64_t num_ent, void_int* nodeconn, void_int* edgeconn, void_int* faceconn ) { int connid = -1; int econnid = -1; int fconnid = -1; int blk_id_ndx, status; int numnodperentdim = -1; int numedgperentdim = -1; int numfacperentdim = -1; int iexit = (EX_NOERR); /* exit status */ size_t num_nodes_per_entry = 0; size_t num_edges_per_entry = 0; size_t num_faces_per_entry = 0; char errmsg[MAX_ERR_LENGTH]; const char* dnumnodent = NULL; const char* dnumedgent = NULL; const char* dnumfacent = NULL; const char* vnodeconn = NULL; const char* vedgeconn = NULL; const char* vfaceconn = NULL; /* The partial connectivity input function can currently only handle nodal * connectivity. Print a warning if edgeconn or faceconn is non-NULL */ if (edgeconn != NULL || faceconn != NULL) { exerrval = 1005; sprintf(errmsg, "Warning: ex_get_partial_conn only supports nodal connectivity at this time. %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg,EX_MSG); } exerrval = 0; /* clear error code */ /* Locate index of element block id in VAR_ID_EL_BLK array */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no connectivity array for NULL %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg,EX_NULLENTITY); return (EX_WARN); /* no connectivity array for this element block */ } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg,exerrval); return (EX_FATAL); } } switch (blk_type) { case EX_EDGE_BLOCK: dnumnodent = DIM_NUM_NOD_PER_ED(blk_id_ndx); dnumedgent = 0; dnumfacent = 0; vnodeconn = VAR_EBCONN(blk_id_ndx); vedgeconn = 0; vfaceconn = 0; break; case EX_FACE_BLOCK: dnumnodent = DIM_NUM_NOD_PER_FA(blk_id_ndx); dnumedgent = 0; dnumfacent = 0; vnodeconn = VAR_FBCONN(blk_id_ndx); vedgeconn = 0; vfaceconn = 0; break; case EX_ELEM_BLOCK: dnumnodent = DIM_NUM_NOD_PER_EL(blk_id_ndx); dnumedgent = DIM_NUM_EDG_PER_EL(blk_id_ndx); dnumfacent = DIM_NUM_FAC_PER_EL(blk_id_ndx); vnodeconn = VAR_CONN(blk_id_ndx); vedgeconn = VAR_ECONN(blk_id_ndx); vfaceconn = VAR_FCONN(blk_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_get_partial_conn",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, dnumnodent, &numnodperentdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes/entity for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg,exerrval); return(EX_FATAL); } if (nc_inq_dimlen(exoid, numnodperentdim, &num_nodes_per_entry) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes/entity for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } if ( edgeconn && dnumedgent ) { num_edges_per_entry = 0; if ((status = nc_inq_dimid(exoid, dnumedgent, &numedgperentdim)) != NC_NOERR) { numedgperentdim = -1; } else { if ((status = nc_inq_dimlen(exoid, numedgperentdim, &num_edges_per_entry)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of edges/entry for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } } } if ( faceconn && dnumfacent ) { num_faces_per_entry = 0; if ((status = nc_inq_dimid(exoid, dnumfacent, &numfacperentdim)) != NC_NOERR) { numfacperentdim = -1; } else { if ((status = nc_inq_dimlen(exoid, numfacperentdim, &num_faces_per_entry)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of faces/entry for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } } } if ((status = nc_inq_varid(exoid, vnodeconn, &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } status = 0; if (edgeconn && (numedgperentdim > 0) && ((status = nc_inq_varid (exoid, vedgeconn, &econnid)) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to locate edge connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } if (faceconn && (numfacperentdim > 0) && ((status = nc_inq_varid (exoid, vfaceconn, &fconnid)) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to locate face connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } /* read in the connectivity array */ if ( edgeconn && num_edges_per_entry > 0) { size_t start[2], count[2]; start[0] = (start_num-1); start[1] = 0; count[0] = num_ent; count[1] = num_edges_per_entry; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, econnid, start, count, edgeconn); } else { status = nc_get_vara_int(exoid, econnid, start, count, edgeconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get edge connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } } if ( faceconn && num_faces_per_entry > 0) { size_t start[2], count[2]; start[0] = start_num-1; start[1] = 0; count[0] = num_ent; count[1] = num_faces_per_entry; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, fconnid, start, count, faceconn); } else { status = nc_get_vara_int(exoid, fconnid, start, count, faceconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get face connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } } if ( nodeconn && num_nodes_per_entry > 0) { size_t start[2], count[2]; start[0] = start_num-1; start[1] = 0; count[0] = num_ent; count[1] = num_nodes_per_entry; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, connid, start, count, nodeconn); } else { status = nc_get_vara_int(exoid, connid, start, count, nodeconn); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_get_partial_conn",errmsg, exerrval); return(EX_FATAL); } } return iexit; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_coord.c000066400000000000000000000204361225312213100240460ustar00rootroot00000000000000/* * 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_partial_coord * * entry conditions - * input parameters: * int exoid exodus file id * int start_node_num starting index of coordinates to be returned. * int num_nodes number of nodes to read coordinates for. * * exit conditions - * float* x_coord X coord array * float* y_coord y coord array * float* z_coord z coord array * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the coordinates of the nodes. * Memory must be allocated for the coordinate arrays (x_coor, y_coor, * and z_coor) before this call is made. The length of each of these * arrays is the number of nodes in the mesh. Because the coordinates * are floating point values, the application code must declare the * arrays passed to be the appropriate type "float" or "double" * to match the compute word size passed in ex_create() or ex_open() * \param exoid exodus file id * \param start_node_num the starting index of the coordinates to be returned. * \param num_nodes the number of nodes to read coordinates for. * \param[out] x_coor Returned X coordinates of the nodes. These are * returned only if x_coor is non-NULL. * \param[out] y_coor Returned Y coordinates of the nodes. These are * returned only if y_coor is non-NULL. * \param[out] z_coor Returned Z coordinates of the nodes. These are * returned only if z_coor is non-NULL. */ int ex_get_partial_coord (int exoid, int64_t start_node_num, int64_t num_nodes, void *x_coor, void *y_coor, void *z_coor) { int status; int coordid; int coordidx, coordidy, coordidz; int numnoddim, ndimdim; size_t num_nod; size_t num_dim, start[2], count[2], i; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* inquire id's of previously defined dimensions */ if (nc_inq_dimid (exoid, DIM_NUM_NODES, &numnoddim) != NC_NOERR) { /* If not found, then this file is storing 0 nodes. Return immediately */ return (EX_NOERR); } if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in file id %d", exoid); ex_err("ex_get_partial_coord",errmsg,exerrval); return (EX_FATAL); } if (start_node_num + num_nodes -1 > num_nod) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: start index (%"PRId64") + node count (%"PRId64") is larger than total number of nodes (%"ST_ZU") in file id %d", start_node_num, num_nodes, num_nod, exoid); ex_err("ex_get_partial_coord",errmsg,exerrval); return (EX_FATAL); } if (ex_get_dimension(exoid, DIM_NUM_DIM, "dimensions", &num_dim, &ndimdim, "ex_get_partial_coord") != NC_NOERR) { return(EX_FATAL); } --start_node_num; /* read in the coordinates */ if (ex_large_model(exoid) == 0) { if ((status = nc_inq_varid (exoid, VAR_COORD, &coordid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate nodal coordinates in file id %d", exoid); ex_err("ex_get_partial_coord",errmsg,exerrval); return (EX_FATAL); } for (i=0; i 1) { if ((status = nc_inq_varid (exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate y nodal coordinates in file id %d", exoid); ex_err("ex_get_partial_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidy = 0; } if (num_dim > 2) { if ((status = nc_inq_varid (exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate z nodal coordinates in file id %d", exoid); ex_err("ex_get_partial_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidz = 0; } /* write out the coordinates */ for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /* * reads the attributes for an element block */ int ex_get_partial_elem_attr (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void *attrib) { int numelbdim, numattrdim, attrid, elem_blk_id_ndx, status; size_t num_elem_this_blk, num_attr, start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */ if ((elem_blk_id_ndx = ex_id_lkup(exoid, EX_ELEM_BLOCK, elem_blk_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this element block */ } else { sprintf(errmsg, "Warning: failed to locate element block %"PRId64" in %s array in file id %d", elem_blk_id,VAR_ID_EL_BLK, exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_WARN); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx), &numelbdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of elements for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, numelbdim, &num_elem_this_blk)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of elements for block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(elem_blk_id_ndx), &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no attributes found for block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,EX_MSG); return (EX_WARN); /* no attributes for this element block */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes for block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_ATTRIB(elem_blk_id_ndx), &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attributes for block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } /* do some error checking */ if (num_elem_this_blk < (start_elem_num + num_elems - 1)) { exerrval = status; sprintf(errmsg, "Error: requested attributes from too many elements in this block, %"PRId64"", elem_blk_id); ex_err("ex_get_partial_elem_attr",errmsg, exerrval); return(EX_FATAL); } /* read in the attributes */ start[0] = --start_elem_num; start[1] = 0; count[0] = num_elems; count[1] = num_attr; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, attrid, start, count, attrib); } else { status = nc_get_vara_double(exoid, attrid, start, count, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get attributes for block %"PRId64" in file id %d", elem_blk_id,exoid); ex_err("ex_get_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_elem_conn.c000066400000000000000000000062071225312213100246770ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_partial_elem_conn() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID. * start_elem_num - The starting index of the elements to be * obtained. * num_elems - The number of FEM elements to read coords for. * connect - Pointer to the connectivity vector. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" /*! * \deprecated use ex_get_partial_conn() * reads the connectivity array for an element block */ int ex_get_partial_elem_conn (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void_int *connect) { return ex_get_partial_conn(exoid, EX_ELEM_BLOCK, elem_blk_id, start_elem_num, num_elems, connect, NULL, NULL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_elem_map.c000066400000000000000000000042731225312213100245200ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the element map with specified ID * \deprecated Use ex_get_partial_num_map()(exoid, EX_ELEM_MAP, map_id, ent_start, ent_count, elem_map) instead */ int ex_get_partial_elem_map (int exoid, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, void_int *elem_map) { return ex_get_partial_num_map(exoid, EX_ELEM_MAP, map_id, ent_start, ent_count, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_elem_num_map.c000066400000000000000000000122631225312213100253750ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_gennm - ex_get_partial_elem_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent starting location for read * int num_ents number of elemental points * * exit conditions - * int* elem_map element number map array * * revision history - * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /* * reads the element numbering map from the database; allows element numbers * to be noncontiguous */ int ex_get_partial_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, void_int *elem_map) { int numelemdim, mapid, status; size_t i; size_t num_elem, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_ELEM, &numelemdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of elements in file id %d", exoid); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen (exoid, numelemdim, &num_elem)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of elements in file id %d", exoid); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_ent < 0 || start_ent > num_elem) { exerrval = status; sprintf(errmsg, "Error: Invalid input to function ex_get_partial_elem_num_map!\n"); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); return (EX_FATAL); } if (num_ents < 0) { exerrval = status; sprintf(errmsg, "Error: Invalid number of entries in map!\n"); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); return (EX_FATAL); } /* start_ent now starts at 1, not 0 */ if ((start_ent + num_ents - 1) > num_elem) { exerrval = status; sprintf(errmsg, "Error: request range invalid!\n"); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_ELEM_NUM_MAP, &mapid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: elem numbering map not stored in file id %d; returning default map", exoid); ex_err("ex_get_partial_elem_num_map",errmsg,exerrval); /* generate default map of 1..n, where n is num_elem */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { int64_t *lmap = (int64_t*)elem_map; for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /* * reads the id map */ int ex_get_partial_id_map ( int exoid, ex_entity_type map_type, int64_t start_entity_num, int64_t num_entities, void_int* map ) { int dimid, mapid, status; size_t i; size_t num_entries; size_t start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; const char* dnumentries; const char* vmap; const char* tname; switch (map_type) { case EX_NODE_MAP: tname = "node"; dnumentries = DIM_NUM_NODES; vmap = VAR_NODE_NUM_MAP; break; case EX_EDGE_MAP: tname = "edge"; dnumentries = DIM_NUM_EDGE; vmap = VAR_EDGE_NUM_MAP; break; case EX_FACE_MAP: tname = "face"; dnumentries = DIM_NUM_FACE; vmap = VAR_FACE_NUM_MAP; break; case EX_ELEM_MAP: tname = "element"; dnumentries = DIM_NUM_ELEM; vmap = VAR_ELEM_NUM_MAP; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad map type (%d) specified for file id %d", map_type, exoid ); ex_err( "ex_get_partial_id_map", errmsg, exerrval ); return (EX_FATAL); } exerrval = 0; /* clear error code */ /* See if any entries are stored in this file */ if (nc_inq_dimid(exoid, dnumentries,&dimid) != NC_NOERR) { return (EX_NOERR); } if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) { if ((status = nc_inq_dimlen(exoid, dimid, &num_entries)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %ss in file id %d", tname, exoid); ex_err("ex_get_partial_id_map",errmsg,exerrval); return (EX_FATAL); } /* generate default map of 1..n, where n is num_entries */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { int64_t *lmap = (int64_t*)map; for (i=0; i < num_entities; i++) { lmap[i] = start_entity_num+i; } } else { int *lmap = (int*)map; for (i=0; i #include /* * 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_partial_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, void *var_vals) { int varid; int status; size_t 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 ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variables in file id %d", exoid); ex_err("ex_get_partial_nodal_var",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --nodal_var_index; start[2] = --start_node; 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 ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err("ex_get_partial_nodal_var",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --start_node; count[0] = 1; count[1] = num_nodes; } if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, varid, start, count, var_vals); } else { status = nc_get_vara_double(exoid, varid, start, count, var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get nodal variables in file id %d", exoid); ex_err("ex_get_partial_nodal_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_node_num_map.c000066400000000000000000000117041225312213100253770ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_gnnnm - ex_get_partial_node_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid nemesis file id * * exit conditions - * int* node_map node numbering map array * * revision history - * * *****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the node numbering map from the database */ int ex_get_partial_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, void_int *node_map) { int numnodedim, mapid, status; size_t i; size_t num_nodes, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &numnodedim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes in file id %d", exoid); ex_err("ex_get_partial_node_num_map",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, numnodedim, &num_nodes)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in file id %d", exoid); ex_err("ex_get_partial_node_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_ent < 0 || start_ent > num_nodes) { fprintf(stderr, "ERROR: Invalid input to function" " ex_get_partial_node_num_map!\n"); return (EX_FATAL); } if (num_ents < 0) { fprintf(stderr, "ERROR: Invalid number of entries in map!\n"); return (EX_FATAL); } /* start_ent now starts at 1, not 0 */ if ((start_ent + num_ents - 1) > num_nodes) { fprintf(stderr, "ERROR: request range invalid!\n"); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_NODE_NUM_MAP, &mapid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: node numbering map not stored in file id %d; returning default map", exoid); ex_err("ex_get_partial_node_num_map",errmsg,exerrval); /* generate default map of 1..n, where n is num_nodes */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { int64_t *lmap = (int64_t*)node_map; for (i=0; i #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the node list for a single node set */ int ex_get_partial_node_set (int exoid, ex_entity_id node_set_id, int64_t start_node_num, int64_t num_nodes, void_int *node_set_node_list) { int dimid, node_list_id, node_set_id_ndx, status; size_t num_nodes_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any node sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no node sets defined in file id %d", exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_WARN); } /* Lookup index of node set id in VAR_NS_IDS array */ if ((node_set_id_ndx = ex_id_lkup(exoid, EX_NODE_SET, node_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: node set %"PRId64" is NULL in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate node set %"PRId64" in %s in file id %d", node_set_id,VAR_NS_IDS,exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_NS(node_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes in node set %"PRId64" in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_nodes_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_node_num < 0 || start_node_num > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } if (num_nodes < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of nodes in nodes set!"); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* start_node_num now starts at 1, not 0 */ if ((start_node_num + num_nodes - 1) > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of nodes in set!"); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_NODE_NS(node_set_id_ndx), &node_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate node set %"PRId64" node list in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* read in the node list array */ start[0] = --start_node_num; count[0] = num_nodes; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, node_list_id, start, count, node_set_node_list); } else { status = nc_get_vara_int(exoid, node_list_id, start, count, node_set_node_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get node set node list in file id %d", exoid); ex_err("ex_get_partial_node_set",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_node_set_df.c000066400000000000000000000152251225312213100252110ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_partial_node_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to read. * start_num - The starting index of the dist fact to be read. * num_df_to_get - The number of distribution factors to read in. * node_set_dist_fact - List of distribution factors in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * reads the distribution factors for a single node set */ int ex_get_partial_node_set_df (int exoid, ex_entity_id node_set_id, int64_t start_num, int64_t num_df_to_get, void *node_set_dist_fact) { int status; int dimid, dist_id, node_set_id_ndx; size_t num_nodes_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any node sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no node sets defined in file id %d", exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_WARN); } /* Lookup index of node set id in VAR_NS_IDS array */ if ((node_set_id_ndx = ex_id_lkup(exoid,EX_NODE_SET,node_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: node set %"PRId64" is NULL in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set_df",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate node set %"PRId64" in %s in file id %d", node_set_id,VAR_NS_IDS,exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_NS(node_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes in node set %"PRId64" in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_nodes_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in node set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_num < 0 || start_num > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } if (num_df_to_get < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of nodes in nodes set!"); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* start_num now starts at 1, not 0 */ if ((start_num + num_df_to_get - 1) > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of nodes in set!"); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_FACT_NS(node_set_id_ndx), &dist_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: dist factors not stored for node set %"PRId64" in file id %d", node_set_id,exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_WARN); /* complain - but not too loud */ } /* read in the distribution factors array */ start[0] = --start_num; count[0] = num_df_to_get; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, dist_id, start, count, node_set_dist_fact); } else { status = nc_get_vara_double(exoid, dist_id, start, count, node_set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get distribution factors in file id %d", exoid); ex_err("ex_get_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_num_map.c000066400000000000000000000141401225312213100243670ustar00rootroot00000000000000/* * 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 * * 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 #include "exodusII.h" #include "exodusII_int.h" /* * reads the element map with specified ID */ int ex_get_partial_num_map (int exoid, ex_entity_type map_type, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, void_int *map) { int dimid, var_id, id_ndx, status; size_t num_mobj, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; const char* dim_map_size; const char* dim_num_maps; switch (map_type) { case EX_NODE_MAP: dim_map_size = DIM_NUM_NODES; dim_num_maps = DIM_NUM_NM; break; case EX_EDGE_MAP: dim_map_size = DIM_NUM_EDGE; dim_num_maps = DIM_NUM_EDM; break; case EX_FACE_MAP: dim_map_size = DIM_NUM_FACE; dim_num_maps = DIM_NUM_FAM; break; case EX_ELEM_MAP: dim_map_size = DIM_NUM_ELEM; dim_num_maps = DIM_NUM_EM; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Bad map type (%d) specified", map_type ); ex_err( "ex_get_partial_num_map", errmsg, exerrval ); return (EX_FATAL); } exerrval = 0; /* clear error code */ /* See if file contains any elements...*/ if (nc_inq_dimid (exoid, dim_map_size, &dimid) != NC_NOERR) { return (EX_NOERR); } if ((status = nc_inq_dimlen(exoid, dimid, &num_mobj)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of mesh objects in file id %d", exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (ent_start <= 0 || ent_start > num_mobj) { exerrval = EX_FATAL; sprintf(errmsg, "Error: start count is invalid in file id %d", exoid); ex_err("ex_get_partial_num_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_num_map",errmsg,exerrval); return (EX_FATAL); } if (ent_start+ent_count-1 > num_mobj) { exerrval = EX_FATAL; sprintf(errmsg, "Error: start+count-1 is larger than element count in file id %d", exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* first check if any maps have been defined */ if ((status = nc_inq_dimid (exoid, dim_num_maps, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %ss defined in file id %d", ex_name_of_object(map_type), exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_WARN); } /* Lookup index of element map id property array */ id_ndx = ex_id_lkup(exoid,map_type,map_id); if (exerrval != 0) { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id variable in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, ex_name_of_map(map_type,id_ndx), &var_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s %"PRId64" in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* read in the map */ start[0] = ent_start-1; count[0] = ent_count; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, var_id, start, count, map); } else { status = nc_get_vara_int(exoid, var_id, start, count, map); } if (status == -1) { exerrval = status; sprintf(errmsg, "Error: failed to get %s in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_get_partial_num_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_one_attr.c000066400000000000000000000200051225312213100245430ustar00rootroot00000000000000/* * 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_partial_one_attr * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type object type (edge, face, elem block) * int obj_id object id (edge face, elem block ID) * int start_num starting index of attributes to be returned. * int num_ent number of entities to read attributes for. * * exit conditions - * float* attrib array of attributes * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the specified attribute for a subsect of a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param start_num the starting index of the attributes to be returned. * \param num_ent the number of entities to read attributes for. * \param attrib_index index of attribute to write * \param attrib array of attributes */ /* */ int ex_get_partial_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, void* attrib ) { int status; int attrid, obj_id_ndx; int temp; size_t num_entries_this_obj, num_attr; size_t start[2], count[2]; ptrdiff_t stride[2]; char errmsg[MAX_ERR_LENGTH]; const char* dnumobjent; const char* dnumobjatt; const char* vattrbname; exerrval = 0; /* clear error code */ if (num_ent == 0) return 0; /* Determine index of obj_id in vobjids array */ if (obj_type != EX_NODAL) { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_partial_one_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this object */ } else { sprintf(errmsg, "Warning: failed to locate %s id%"PRId64" in id array in file id %d", ex_name_of_object(obj_type),obj_id, exoid); ex_err("ex_get_partial_one_attr",errmsg,exerrval); return (EX_WARN); } } } switch (obj_type) { case EX_SIDE_SET: dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vattrbname = VAR_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vattrbname = VAR_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vattrbname = VAR_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vattrbname = VAR_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vattrbname = VAR_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjent = DIM_NUM_NODES; dnumobjatt = DIM_NUM_ATT_IN_NBLK; vattrbname = VAR_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vattrbname = VAR_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx); vattrbname = VAR_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx); vattrbname = VAR_ATTRIB(obj_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_get_partial_one_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_get_partial_one_attr") != NC_NOERR) return EX_FATAL; if (start_num + num_ent -1 > num_entries_this_obj) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: start index (%"PRId64") + count (%"PRId64") is larger than total number of entities (%"ST_ZU") in file id %d", start_num, num_ent, num_entries_this_obj, exoid); ex_err("ex_get_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_get_partial_one_attr") != NC_NOERR) return EX_FATAL; if (attrib_index < 1 || attrib_index > (int)num_attr) { exerrval = EX_FATAL; sprintf(errmsg, "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %"PRId64" in file id %d", attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_get_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_get_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } /* read in the attributes */ start[0] = start_num-1; start[1] = attrib_index-1; count[0] = num_ent; count[1] = 1; stride[0] = 1; stride[1] = num_attr; if (ex_comp_ws(exoid) == 4) { status = nc_get_vars_float(exoid, attrid, start, count, stride, attrib); } else { status = nc_get_vars_double(exoid, attrid, start, count, stride, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get attribute %d for %s %"PRId64" in file id %d", attrib_index, ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_get_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_set_dist_fact.c000066400000000000000000000120641225312213100255510ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the distribution factors for a single set */ int ex_get_partial_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t num_to_put, void *set_dist_fact) { int dimid, dist_id, set_id_ndx; int status; size_t start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; char* factptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid (exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %s sets stored in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_partial_set_dist_fact",errmsg,exerrval); return (EX_WARN); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: %s set %"PRId64" is NULL in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_partial_set_dist_fact",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s set %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_partial_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { factptr = VAR_FACT_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { factptr = VAR_FACT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { factptr = VAR_FACT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { factptr = VAR_FACT_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { factptr = VAR_FACT_ELS(set_id_ndx); } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) { exerrval = status; /* not an error for node sets because this is how we check that df's exist */ if (set_type == EX_NODE_SET) { sprintf(errmsg, "Warning: dist factors not stored for %s set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_get_partial_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 %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_partial_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* read in the distribution factors array */ start[0] = offset-1; count[0] = num_to_put; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, dist_id, start, count, set_dist_fact); } else { status = nc_get_vara_double(exoid, dist_id, start, count, set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dist factors list for %s set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_partial_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_side_set.c000066400000000000000000000171271225312213100245420ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_partial_side_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to read. * start_side_num - The starting index of the sides to be read. * num_sides - The number of sides to read in. * side_set_elem_list - List of element IDs in side set. * side_set_side_list - List of side IDs in side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #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_partial_side_set (int exoid, ex_entity_id side_set_id, int64_t start_side_num, int64_t num_sides, void_int *side_set_elem_list, void_int *side_set_side_list) { int dimid, elem_list_id, side_list_id, status; int side_set_id_ndx; size_t num_side_in_set, count[1], start[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no side sets stored in file id %d", exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_WARN); } /* Lookup index of side set id in VAR_SS_IDS array */ if ((side_set_id_ndx = ex_id_lkup(exoid, EX_SIDE_SET, side_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: side set %"PRId64" is NULL in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set id %"PRId64" in %s array in file id %d", side_set_id, VAR_SS_IDS, exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SIDE_SS(side_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of sides in side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_side_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of sides in side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_ELEM_SS(side_set_id_ndx), &elem_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate element list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_SIDE_SS(side_set_id_ndx), &side_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate side list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of side numbers */ if (start_side_num < 0 || start_side_num > num_side_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if (num_sides < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of elements in side set!"); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* start_side_num now starts at 1, not 0 */ if ((start_side_num + num_sides - 1) > num_side_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of elements in set!"); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* read in the element list and side list arrays */ start[0] = --start_side_num; count[0] = num_sides; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, elem_list_id, start, count, side_set_elem_list); } else { status = nc_get_vara_int(exoid, elem_list_id, start, count, side_set_elem_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get element list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_vara_longlong(exoid, side_list_id, start, count, side_set_side_list); } else { status = nc_get_vara_int(exoid, side_list_id, start, count, side_set_side_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get side list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_side_set_df.c000066400000000000000000000150341225312213100252060ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_get_partial_side_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to read. * start_side_num - The starting index of the sides to be read. * num_sides - The number of sides to read in. * side_set_dist_fact - List of side IDs in side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_partial_side_set_df (int exoid, ex_entity_id side_set_id, int64_t start_num, int64_t num_df_to_get, void *side_set_dist_fact) { int dimid, dist_id, side_set_id_ndx, status; size_t num_df_in_set, count[1], start[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no side sets stored in file id %d", exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_WARN); } /* Lookup index of side set id in VAR_SS_IDS array */ if ((side_set_id_ndx = ex_id_lkup(exoid,EX_SIDE_SET,side_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: side set %"PRId64" is NULL in file id %d", side_set_id, exoid); ex_err("ex_get_partial_side_set_df",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set %"PRId64" in %s array in file id %d", side_set_id, VAR_SS_IDS, exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_DF_SS(side_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: dist factors not stored for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_WARN); /* complain - but not too loud */ } if ((status = nc_inq_dimlen (exoid, dimid, &num_df_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of dist factors in side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_num < 0 || start_num > num_df_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } if (num_df_to_get < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of df's to get!"); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* start_num now starts at 1, not 0 */ if ((start_num + num_df_to_get - 1) > num_df_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of df's in set!"); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_FACT_SS(side_set_id_ndx), &dist_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate dist factors list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* read in the distribution factors array */ start[0] = --start_num; count[0] = num_df_to_get; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float (exoid, dist_id, start, count, side_set_dist_fact); } else { status = nc_get_vara_double (exoid, dist_id, start, count, side_set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dist factors list for side set %"PRId64" in file id %d", side_set_id,exoid); ex_err("ex_get_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_partial_var.c000066400000000000000000000120231225312213100235210ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /* * reads the values of a single element variable for one element block at * one time step in the database; assume the first time step and * element variable index is 1 */ /*! * reads the values of a single variable for a partial block at one time * step from the database; assume the first time step and variable index * and start_index are 1 * \param exoid exodus file id * \param time_step time step number * \param var_type type (edge block, face block, edge set, ... ) * \param var_index element variable index * \param obj_id element block id * \param start_index index of first entity in block to read (1-based) * \param num_entities number of entries to read in this block/set * \param var_vals the values to read */ int ex_get_partial_var( int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, void* var_vals ) { int status = 0; int varid, obj_id_ndx; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; if (num_entities == 0) return status; if (var_type == EX_NODAL) { /* FIXME: Special case: ignore obj_id, possible large_file complications, etc. */ return ex_get_partial_nodal_var( exoid, time_step, var_index, start_index, num_entities, var_vals ); } else if (var_type == EX_GLOBAL) { /* FIXME: Special case: all vars stored in 2-D single array. */ return ex_get_glob_vars( exoid, time_step, num_entities, var_vals ); } exerrval = 0; /* clear error code */ /* Determine index of obj_id in VAR_ID_EL_BLK array */ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no %s variables for NULL block %"PRId64" in file id %d", ex_name_of_object(var_type), obj_id,exoid); ex_err("ex_get_partial_var",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id variable in file id %d", ex_name_of_object(var_type), obj_id, exoid); ex_err("ex_get_partial_var",errmsg,exerrval); return (EX_FATAL); } } /* inquire previously defined variable */ if((status = nc_inq_varid(exoid, ex_name_var_of_object(var_type,var_index, obj_id_ndx), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s %"PRId64" var %d in file id %d", ex_name_of_object(var_type),obj_id,var_index,exoid); ex_err("ex_get_partial_var",errmsg,exerrval); return (EX_FATAL); } /* read values of element variable */ start[0] = --time_step; start[1] = start_index-1; count[0] = 1; count[1] = num_entities; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, varid, start, count, var_vals); } else { status = nc_get_vara_double(exoid, varid, start, count, var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get %s %"PRId64" variable %d in file id %d", ex_name_of_object(var_type), obj_id, var_index,exoid); ex_err("ex_get_partial_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_processor_elem_maps.c000066400000000000000000000214121225312213100252600ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_elem_map() * ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * elem_mapi - Pointer to vector for retrieval of internal * FEM element IDs. * elem_mapb - Pointer to vector for retrieval of border * FEM element IDs. * processor - The processor the file being read was written for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include // for size_t #include // for sprintf #include // for int64_t #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_processor_elem_maps(int exoid, void_int *elem_mapi, void_int *elem_mapb, int processor ) { const char *func_name="ex_get_processor_elem_maps"; char ftype[2]; int dimid, varid, status; size_t start[1], count[1]; int64_t varidx[2]; int emstat; char errmsg[MAX_ERR_LENGTH]; /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: unable to find file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Check the status of the internal element map */ if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = processor; if ((status = nc_get_var1_int(exoid, varid, start, &emstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (emstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_ELEM_MAP_INT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the size of the internal element map */ if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } /* Get the map */ if ((status = nc_inq_varid(exoid, VAR_ELEM_MAP_INT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, elem_mapi); } else { status = nc_get_vara_int(exoid, varid, start, count, elem_mapi); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (emstat == 1)" */ /* Check the status of the internal element map */ if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = processor; if ((status = nc_get_var1_int(exoid, varid, start, &emstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (emstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_ELEM_MAP_BOR_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the size of the border element map */ if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } /* Get the map */ if ((status = nc_inq_varid(exoid, VAR_ELEM_MAP_BOR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, elem_mapb); } else { status = nc_get_vara_int(exoid, varid, start, count, elem_mapb); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (emstat == 1)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_processor_node_maps.c000066400000000000000000000273741225312213100253000ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_node_map() ***************************************************************************** * This function retrieves the nodal map. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * node_mapi - Pointer to vector for retrieval of internal FEM * nodal IDs. * node_mapb - Pointer to vector for retrieval of border FEM * nodal IDs. * node_mape - Pointer to vector for retrieval of external FEM * nodal IDs. * processor - The processor the file being read was written for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_processor_node_maps(int exoid, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int processor ) { const char *func_name="ex_get_processor_node_maps"; char ftype[2]; int status, varid, dimid; size_t start[1], count[1]; int64_t varidx[2]; int nmstat; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: unable to find file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = processor; if (nc_get_var1_int(exoid, varid, start, &nmstat) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" in file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_NODE_MAP_INT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_INT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, node_mapi); } else { status = nc_get_vara_int(exoid, varid, start, count, node_mapi); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = processor; if (nc_get_var1_int(exoid, varid, start, &nmstat) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_NODE_MAP_BOR_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_BOR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, node_mapb); } else { status = nc_get_vara_int(exoid, varid, start, count, node_mapb); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = processor; if (nc_get_var1_int(exoid, varid, start, &nmstat) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_NODE_MAP_EXT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_EXT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_EXT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_EXT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_get_vara_longlong(exoid, varid, start, count, node_mape); } else { status = nc_get_vara_int(exoid, varid, start, count, node_mape); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_prop.c000066400000000000000000000201241225312213100221760ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_prop() reads an integer object property value stored for a single element block, node set, or side set. \return In case of an error, ex_get_prop() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid object type specified. - a warning value is returned if a property with the specified name is not found. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[in] obj_id The element block, node set, or side set ID. \param[in] prop_name The name of the property (maximum length is \p MAX_STR_LENGTH ) for which the value is desired. \param[out] value Returned value of the property.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
For an example of code to read an object property, refer to the description for ex_get_prop_names(). */ int ex_get_prop (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, void_int *value) { int status; int num_props, i, propid; int found = FALSE; size_t start[1]; char name[MAX_VAR_NAME_LENGTH+1]; char tmpstr[MAX_STR_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); for (i=1; i<=num_props; i++) { switch (obj_type){ case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(i)); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(i)); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(i)); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(i)); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(i)); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(i)); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(i)); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(i)); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(i)); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(i)); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(i)); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(i)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_get_prop",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate property array %s in file id %d", name, exoid); 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 ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property name in file id %d", exoid); ex_err("ex_get_prop",errmsg,exerrval); return (EX_FATAL); } if (strcmp(tmpstr, prop_name) == 0) { 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", ex_name_of_object(obj_type), 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_type, obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: %s id %"PRId64" is NULL in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_get_prop",errmsg,EX_NULLENTITY); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate id %"PRId64" in %s property array in file id %d", obj_id, ex_name_of_object(obj_type), exoid); ex_err("ex_get_prop",errmsg,exerrval); return (EX_FATAL); } } start[0] = start[0] - 1; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { long long l_val; status = nc_get_var1_longlong (exoid, propid, start, &l_val); if (status == NC_NOERR) { int64_t *val = (int64_t*)value; *val = l_val; } } else { int i_val; status = nc_get_var1_int (exoid, propid, start, &i_val); if (status == NC_NOERR) { int *val = (int*)value; *val = i_val; } } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read value in %s property array in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_get_prop",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_prop_array.c000066400000000000000000000204711225312213100234010ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_prop_array() reads an array of integer property values for all element blocks, node sets, or side sets. The order of the values in the array correspond to the order in which the element blocks, node sets, or side sets were introduced into the file. Before this function is invoked, memory must be allocated for the returned array of(\c num_elem_blk, \c num_node_sets, or {num_side_sets}) integer values. This function can be used in place of - ex_get_elem_blk_ids(), - ex_get_node_set_ids(), and - ex_get_side_set_ids() to get element block, node set, and side set IDs, respectively, by requesting the property name \b ID. One should also note that this same function can be accomplished with multiple calls to ex_get_prop(). \return In case of an error, ex_get_prop_array() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid object type specified. - a warning value is returned if a property with the specified name is not found. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[in] prop_name The name of the property (maximum length of \p MAX_STR_LENGTH ) for which the values are desired. \param[out] values Returned array of property values.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
For an example of code to read an array of object properties, refer to the description for ex_get_prop_names(). */ int ex_get_prop_array (int exoid, ex_entity_type obj_type, const char *prop_name, void_int *values) { int num_props, i, propid, status; int found = FALSE; char name[MAX_VAR_NAME_LENGTH+1]; char tmpstr[MAX_STR_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); for (i=1; i<=num_props; i++) { switch (obj_type){ case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(i)); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(i)); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(i)); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(i)); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(i)); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(i)); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(i)); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(i)); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(i)); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(i)); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(i)); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(i)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_get_prop_array",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate property array %s in file id %d", name, exoid); 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 ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property name in file id %d", exoid); ex_err("ex_get_prop_array",errmsg,exerrval); return (EX_FATAL); } if (strcmp(tmpstr, prop_name) == 0) { 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); } /* read num_obj values from property variable */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid, propid, values); } else { status = nc_get_var_int(exoid, propid, values); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to read values in %s property array in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_get_prop_array",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_prop_names.c000066400000000000000000000164201225312213100233650ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_prop_names() returns names of integer properties stored for an element block, node set, or side set. The number of properties (needed to allocate space for the property names) can be obtained via a call to ex_inquire() or ex_inquire_int(). \return In case of an error, ex_get_prop_names() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid object type specified. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[out] prop_names Returned array containing \c num_props (obtained from call to ex_inquire() or ex_inquire_int()) names (of maximum length \p MAX_STR_LENGTH ) of properties to be stored. \b ID, a reserved property name, will be the first name in the array.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
As an example, the following code segment reads in properties assigned to node sets: \code #include "exodusII.h"; int error, exoid, num_props, *prop_values; char *prop_names[MAX_PROPS]; \comment{read node set properties} num_props = ex_inquire_int(exoid, EX_INQ_NS_PROP); for (i=0; i < num_props; i++) { prop_names[i] = (char *) malloc ((MAX_STR_LENGTH+1), sizeof(char)); prop_values = (int *) malloc (num_node_sets, sizeof(int)); } error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names); for (i=0; i < num_props; i++) { error = ex_get_prop_array(exoid, EX_NODE_SET, prop_names[i], prop_values); } \endcode */ int ex_get_prop_names (int exoid, ex_entity_type obj_type, char **prop_names) { int status; int i, num_props, propid; char var_name[12]; size_t att_len; nc_type att_type; int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); 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 0) { if ((status = nc_inq_varid(rootid, VAR_QA_TITLE, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate qa record data in file id %d", rootid); ex_err("ex_get_qa",errmsg,exerrval); return (EX_FATAL); } /* read the QA records */ for (i=0; i #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, ex_entity_type set_type, ex_entity_id set_id, void_int *set_entry_list, void_int *set_extra_list) /* NULL if dont want to retrieve data */ { int dimid, entry_list_id, extra_list_id, status; int set_id_ndx; char errmsg[MAX_ERR_LENGTH]; char* entryptr = NULL; char* extraptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %ss stored in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_set",errmsg,exerrval); return (EX_WARN); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: %s %"PRId64" is NULL in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { entryptr = VAR_NODE_NS(set_id_ndx); extraptr = NULL; } else if (set_type == EX_EDGE_SET) { entryptr = VAR_EDGE_ES(set_id_ndx); extraptr = VAR_ORNT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { entryptr = VAR_FACE_FS(set_id_ndx); extraptr = VAR_ORNT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { entryptr = VAR_ELEM_SS(set_id_ndx); extraptr = VAR_SIDE_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { entryptr = VAR_ELEM_ELS(set_id_ndx); extraptr = NULL; } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, entryptr, &entry_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set",errmsg,exerrval); return (EX_FATAL); } /* If client doet not pass in an array to store the extra list, don't access it at all */ /* only do extra list for edge, face and side sets */ if (set_extra_list) { if ((status = nc_inq_varid (exoid, extraptr, &extra_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set",errmsg,exerrval); return (EX_FATAL); } } /* read in the entry list and extra list arrays unless they are NULL */ if (set_entry_list) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, entry_list_id, set_entry_list); } else { status = nc_get_var_int(exoid, entry_list_id, set_entry_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set",errmsg,exerrval); return (EX_FATAL); } } /* only do extra list for edge, face and side sets */ if (set_extra_list) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, extra_list_id, set_extra_list); } else { status = nc_get_var_int(exoid, extra_list_id, set_extra_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_get_set", errmsg, exerrval); return (EX_FATAL); } } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_set_dist_fact.c000066400000000000000000000125331225312213100240360ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the distribution factors for a single set */ int ex_get_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, void *set_dist_fact) { int dimid, dist_id, set_id_ndx; int status; char errmsg[MAX_ERR_LENGTH]; char* factptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid (exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %s sets stored in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_set_dist_fact",errmsg,exerrval); return (EX_WARN); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: %s set %"PRId64" is NULL in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_dist_fact",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s set %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { factptr = VAR_FACT_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { factptr = VAR_FACT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { factptr = VAR_FACT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { factptr = VAR_FACT_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { factptr = VAR_FACT_ELS(set_id_ndx); } /* inquire id's of previously defined dimensions and variables */ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) { exerrval = status; /* not an error for node sets because this is how we check that df's exist */ if (set_type == EX_NODE_SET) { sprintf(errmsg, "Warning: dist factors not stored for %s set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_get_set_dist_fact",errmsg,exerrval); return (EX_WARN); /* complain - but not too loud */ } /* is an error for other sets */ else { sprintf(errmsg, "Error: failed to locate dist factors list for %s set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* read in the distribution factors array */ if (ex_comp_ws(exoid) == 4) { status = nc_get_var_float(exoid, dist_id, set_dist_fact); } else { status = nc_get_var_double(exoid, dist_id, set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dist factors list for %s set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_set_param.c000066400000000000000000000163231225312213100231770ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #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, ex_entity_type set_type, ex_entity_id set_id, void_int *num_entry_in_set, void_int *num_dist_fact_in_set) { int status; int varid, dimid, set_id_ndx; size_t lnum_entry_in_set; size_t lnum_dist_fact_in_set; char errmsg[MAX_ERR_LENGTH]; char* numentryptr = NULL; char* numdfptr = NULL; exerrval = 0; /* clear error code */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { if (num_entry_in_set) *(int64_t*)num_entry_in_set = 0; if (num_dist_fact_in_set) *(int64_t*)num_dist_fact_in_set = 0; } else { if (num_entry_in_set) *(int*)num_entry_in_set = 0; if (num_dist_fact_in_set) *(int*)num_dist_fact_in_set = 0; } /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %ss stored in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_get_set_param",errmsg,exerrval); return (EX_WARN); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) /* NULL set? */ { return (EX_NOERR); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_param",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { numentryptr = DIM_NUM_NOD_NS(set_id_ndx); /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */ numdfptr = DIM_NUM_NOD_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { numentryptr = DIM_NUM_EDGE_ES(set_id_ndx); numdfptr = DIM_NUM_DF_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { numentryptr = DIM_NUM_FACE_FS(set_id_ndx); numdfptr = DIM_NUM_DF_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { numentryptr = DIM_NUM_SIDE_SS(set_id_ndx); numdfptr = DIM_NUM_DF_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { numentryptr = DIM_NUM_ELE_ELS(set_id_ndx); numdfptr = DIM_NUM_DF_ELS(set_id_ndx); } /* inquire values of dimension for number of entities in set */ if (ex_get_dimension(exoid, numentryptr,"entries", &lnum_entry_in_set, &dimid, "ex_get_set_param") != NC_NOERR) return EX_FATAL; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { if (num_entry_in_set) *(int64_t*)num_entry_in_set = lnum_entry_in_set; } else { if (num_entry_in_set) *(int*)num_entry_in_set = lnum_entry_in_set; } /* Inquire value of dimension of number of dist factors for this set. NOTE: For node sets, because DIM_NUM_DF_NS is not used, we check to see if the dist factor variable for a node set index exits. If it does not, the dist factor count is assumed to be zero, otherwise the dist factor count will be the same as the number of nodes in the set. */ if (set_type == EX_NODE_SET) { if ((status = nc_inq_varid(exoid, VAR_FACT_NS(set_id_ndx), &varid)) != NC_NOERR) { if (status == NC_ENOTVAR) return (EX_NOERR); else { exerrval = status; sprintf(errmsg, "Error: failed to locate the dist factors for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_get_set_param",errmsg,exerrval); return (EX_FATAL); } } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { if (num_dist_fact_in_set) *(int64_t*)num_dist_fact_in_set = lnum_entry_in_set; } else { if (num_dist_fact_in_set) *(int*)num_dist_fact_in_set = lnum_entry_in_set; } } else {/* all other set types */ if ((status = nc_inq_dimid(exoid, numdfptr, &dimid)) != NC_NOERR) { if (status == NC_EBADDIM) return (EX_NOERR); else { exerrval = status; sprintf(errmsg, "Error: failed to locate number of dist factors in %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_get_set_param",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_dimlen(exoid, dimid, &lnum_dist_fact_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of dist factors in %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_get_set_param",errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { if (num_dist_fact_in_set) *(int64_t*)num_dist_fact_in_set = lnum_dist_fact_in_set; } else { if (num_dist_fact_in_set) *(int*)num_dist_fact_in_set = lnum_dist_fact_in_set; } } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_sets.c000066400000000000000000000060401225312213100221750ustar00rootroot00000000000000/* * Copyright (c) 2012 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" int ex_get_sets (int exoid, size_t set_count, struct ex_set *sets) { size_t i; int status = EX_NOERR; int stat; for (i=0; i < set_count; i++) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { stat = ex_get_set_param(exoid, sets[i].type, sets[i].id, &sets[i].num_entry, &sets[i].num_distribution_factor); } else { /* API expecting 32-bit ints; ex_set structure has 64-bit ints. */ int num_entry; int num_dist; stat = ex_get_set_param(exoid, sets[i].type, sets[i].id, &num_entry, &num_dist); sets[i].num_entry = num_entry; sets[i].num_distribution_factor = num_dist; } if (stat != EX_NOERR) status = (status == EX_FATAL) ? EX_FATAL : stat; if (stat == EX_NOERR && (sets[i].entry_list != NULL || sets[i].extra_list != NULL)) { stat = ex_get_set(exoid, sets[i].type, sets[i].id, sets[i].entry_list, sets[i].extra_list); if (stat != EX_NOERR) status = (status == EX_FATAL) ? EX_FATAL : stat; } if (stat == EX_NOERR && sets[i].distribution_factor_list != NULL) { stat = ex_get_set_dist_fact(exoid, sets[i].type, sets[i].id, sets[i].distribution_factor_list); if (stat != EX_NOERR) status = (status == EX_FATAL) ? EX_FATAL : stat; } } return status; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set.c000066400000000000000000000054201225312213100230170ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * reads the side set element list and side set side list for a single side set * \deprecated Use ex_get_set()(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list) */ int ex_get_side_set (int exoid, ex_entity_id side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list) { return ex_get_set(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set_dist_fact.c000066400000000000000000000052051225312213100250400ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the distribution factors for a single side set * \deprecated Use ex_get_set_dist_fact()(exoid, EX_SIDE_SET, side_set_id, side_set_dist_fact) */ int ex_get_side_set_dist_fact (int exoid, ex_entity_id 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set_ids.c000066400000000000000000000046141225312213100236620ustar00rootroot00000000000000/* * 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_side_set_ids * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * int* size_set_ids array of side set IDs * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the side set ids from the database * \deprecated Use ex_get_ids()(exoid, EX_SIDE_SET, ids) */ int ex_get_side_set_ids (int exoid, void_int *ids) { return ex_get_ids( exoid, EX_SIDE_SET, ids ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set_node_count.c000066400000000000000000000551031225312213100252370ustar00rootroot00000000000000/* * 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 * * 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 - * *****************************************************************************/ #include #include #include #include #include "exodusII.h" #include "exodusII_int.h" /* Generic error message for element type/node count mapping...*/ static int el_node_count_error(struct elem_blk_parm elem_blk_parms) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: An element of type '%s' with %d nodes is not valid.", elem_blk_parms.elem_type, elem_blk_parms.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, ex_entity_id side_set_id, int *side_set_node_cnt_list) { size_t m; int ii, i, j; int num_side_sets, num_elem_blks, num_df, ndim; size_t tot_num_ss_elem = 0; int64_t side, elem; void_int *elem_blk_ids; void_int *ss_elem_ndx; void_int *side_set_elem_list, *side_set_side_list; size_t elem_ctr; struct elem_blk_parm *elem_blk_parms; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ /* inquire how many side sets have been stored */ num_side_sets = ex_inquire_int(exoid, EX_INQ_SIDE_SETS); if (num_side_sets < 0) { 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,EX_SIDE_SET,side_set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: side set %"PRId64" is NULL in file id %d", side_set_id,exoid); ex_err("ex_get_side_set_node_count",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set %"PRId64" 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); } } num_elem_blks = ex_inquire_int(exoid, EX_INQ_ELEM_BLK); if (num_elem_blks < 0) { 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); } /* get the dimensionality of the coordinates; this is necessary to distinguish between 2d TRIs and 3d TRIs */ ndim = ex_inquire_int(exoid, EX_INQ_DIM); if (ndim < 0) { 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 %"PRId64" 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 */ { int int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) int_size = sizeof(int64_t); if (!(side_set_elem_list=malloc(tot_num_ss_elem*int_size))) { 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*int_size))) { 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 %"PRId64" 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*int_size))) { 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); } if (int_size == sizeof(int64_t)) { /* Sort side set element list into index array - non-destructive */ int64_t *elems = (int64_t*)ss_elem_ndx; for (i=0;i #include #include #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. */ static void* safe_free(void* array) { if (array != 0) free(array); return 0; } static void set_count(int exoid, void_int *cnt, size_t ndx, size_t val) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)cnt)[ndx] = val; } else { ((int*)cnt)[ndx] = val; } } static void get_nodes(int exoid, void_int *to, size_t ito, void_int *from, size_t ifrom) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ((int64_t*)to)[ito] = ((int64_t*)from)[ifrom]; } else { ((int*)to)[ito] = ((int*)from)[ifrom]; } } int ex_get_side_set_node_list(int exoid, ex_entity_id side_set_id, void_int *side_set_node_cnt_list, void_int *side_set_node_list) { size_t m; size_t i, j; int64_t elem, side; int64_t num_side_sets, num_elem_blks, num_df, ndim; int64_t tot_num_elem = 0, tot_num_ss_elem = 0, elem_num = 0; size_t connect_offset, side_num, node_pos; void_int *elem_blk_ids = NULL; void_int *connect = NULL; void_int *ss_elem_ndx = NULL; void_int *ss_elem_node_ndx = NULL; void_int *ss_parm_ndx = NULL; void_int *side_set_elem_list = NULL; void_int *side_set_side_list = NULL; size_t elem_ctr, node_ctr, elem_num_pos; size_t num_nodes_per_elem; int int_size, ids_size; int err_stat = EX_NOERR; int status; struct elem_blk_parm *elem_blk_parms = NULL; /* 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 */ /* first check if any side sets are specified */ /* inquire how many side sets have been stored */ num_side_sets = ex_inquire_int(exoid, EX_INQ_SIDE_SETS); if (num_side_sets < 0) { 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,EX_SIDE_SET,side_set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: side set %"PRId64" is NULL in file id %d", side_set_id,exoid); ex_err("ex_get_side_set_node_list",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set %"PRId64" 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); } } num_elem_blks = ex_inquire_int(exoid, EX_INQ_ELEM_BLK); if (num_elem_blks < 0) { 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); } tot_num_elem = ex_inquire_int(exoid, EX_INQ_ELEM); if (tot_num_elem < 0) { 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 */ ndim = ex_inquire_int(exoid, EX_INQ_DIM); if (ndim < 0) { sprintf(errmsg, "Error: failed to get dimensionality in file id %d",exoid); ex_err("ex_cvt_nodes_to_sides",errmsg,exerrval); return(EX_FATAL); } int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } ids_size = sizeof(int); if (ex_int64_status(exoid) & EX_IDS_INT64_API) { ids_size = sizeof(int64_t); } /* First determine the # of elements in the side set*/ if (int_size == sizeof(int64_t)) { status = ex_get_set_param(exoid,EX_SIDE_SET, side_set_id,&tot_num_ss_elem,&num_df); } else { int tot, df; status = ex_get_set_param(exoid,EX_SIDE_SET, side_set_id,&tot,&df); tot_num_ss_elem = tot; num_df = df; } if (status != EX_NOERR) { sprintf(errmsg, "Error: failed to get number of elements in side set %"PRId64" 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*int_size))) { 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*int_size))) { 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); err_stat = EX_FATAL; goto cleanup; } if (ex_get_set(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list) == -1) { safe_free(side_set_elem_list); safe_free(side_set_side_list); sprintf(errmsg, "Error: failed to get side set %"PRId64" 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*int_size))) { 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); err_stat = EX_FATAL; goto cleanup; } /* Sort side set element list into index array - non-destructive */ if (int_size == sizeof(int64_t)) { /* Sort side set element list into index array - non-destructive */ int64_t *elems = (int64_t*)ss_elem_ndx; for (i=0;i= num_elem_blks) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid element number %"PRId64" found in side set %"PRId64" in file %d", elem, side_set_id, exoid); ex_err("ex_get_side_set_node_list",errmsg,EX_MSG); err_stat = EX_FATAL; goto cleanup; } if (int_size == sizeof(int64_t)) { ((int64_t*)ss_parm_ndx)[i] = j; /* assign parameter block index */ ((int64_t*)ss_elem_node_ndx)[i] = node_ctr; /* assign node list index */ } else { ((int*)ss_parm_ndx)[i] = j; /* assign parameter block index */ ((int*)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 == EX_EL_WEDGE && (side == 4 || side == 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 == EX_EL_PYRAMID && (side < 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 == EX_EL_SHELL && (side > 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 == EX_EL_TRIANGLE && ndim == 3 && side > 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[0]; } /* All setup, ready to go ... */ elem_ctr=0; for (j=0; j < tot_num_ss_elem; j++) { int64_t elem_ndx; size_t parm_ndx; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { elem_ndx = ((int64_t*)ss_elem_ndx)[j]; elem = ((int64_t*)side_set_elem_list)[elem_ndx]; side = ((int64_t*)side_set_side_list)[elem_ndx]; parm_ndx = ((int64_t*)ss_parm_ndx)[elem_ndx]; } else { elem_ndx = ((int*)ss_elem_ndx)[j]; elem = ((int*)side_set_elem_list)[elem_ndx]; side = ((int*)side_set_side_list)[elem_ndx]; parm_ndx = ((int*)ss_parm_ndx)[elem_ndx]; } if (elem > elem_ctr) { /* release connectivity array space and get next one */ if (elem_ctr > 0) { safe_free(connect); } /* Allocate space for the connectivity array for new element block */ if (!(connect=malloc(elem_blk_parms[parm_ndx].num_elem_in_blk* elem_blk_parms[parm_ndx].num_nodes_per_elem* int_size))) { 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); err_stat = EX_FATAL; goto cleanup; } /* get connectivity array */ if (ex_get_elem_conn(exoid, elem_blk_parms[parm_ndx].elem_blk_id, connect) == -1) { 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); err_stat = EX_FATAL; goto cleanup; } elem_ctr = elem_blk_parms[parm_ndx].elem_ctr; } /* For each side in side set, use the appropriate lookup table to determine the nodes from the connect array. */ elem_num = elem-1;/* element number 0-based*/ /* calculate the relative element number position in it's block*/ elem_num_pos = elem_num - (elem_blk_parms[parm_ndx].elem_ctr - elem_blk_parms[parm_ndx].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[parm_ndx].num_nodes_per_elem; connect_offset = num_nodes_per_elem*elem_num_pos; side_num = side-1; if (int_size == sizeof(int64_t)) { node_pos = ((int64_t*)ss_elem_node_ndx)[elem_ndx]; } else { node_pos = ((int*)ss_elem_node_ndx)[elem_ndx]; } switch (elem_blk_parms[parm_ndx].elem_type_val) { case EX_EL_CIRCLE: case EX_EL_SPHERE: { /* Note: no side-node lookup table is used for this simple case */ get_nodes(exoid, side_set_node_list, node_pos, connect, connect_offset); set_count(exoid, side_set_node_cnt_list, elem_ndx, 1); /* 1 node object */ break; } case EX_EL_TRUSS: case EX_EL_BEAM: { /* Note: no side-node lookup table is used for this simple case */ for (i=0; i < num_nodes_per_elem; i++) { get_nodes(exoid, side_set_node_list, node_pos+i, connect, connect_offset+i); } set_count(exoid, side_set_node_cnt_list, elem_ndx, num_nodes_per_elem); break; } case EX_EL_TRIANGLE: { if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid triangle edge number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } if (ndim == 2) /* 2d TRIs */ { get_nodes(exoid, side_set_node_list, node_pos, connect, connect_offset+tri_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+tri_table[side_num][1]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 2); /* 2 node object */ if (num_nodes_per_elem > 3) /* 6-node TRI */ { get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+tri_table[side_num][2]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node object */ } } else if (ndim == 3) /* 3d TRIs */ { get_nodes(exoid, side_set_node_list, node_pos, connect, connect_offset+tri3_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+tri3_table[side_num][1]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 2); /* 2 node object */ if (side_num+1 <= 2) /* 3- or 6-node face */ { if (num_nodes_per_elem == 3) /* 3-node face */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node object */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+tri3_table[side_num][2]-1); } else /* 6-node face */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 6); /* 6 node object */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+tri3_table[side_num][2]-1); get_nodes(exoid, side_set_node_list, node_pos+3, connect, connect_offset+tri3_table[side_num][3]-1); get_nodes(exoid, side_set_node_list, node_pos+4, connect, connect_offset+tri3_table[side_num][4]-1); get_nodes(exoid, 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 */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node object */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+tri3_table[side_num][2]-1); } } } break; } case EX_EL_QUAD: { if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid quad edge number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos+0, connect, connect_offset+quad_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+quad_table[side_num][1]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 2); /* 2 node object */ if (num_nodes_per_elem > 5) { set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node object */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+quad_table[side_num][2]-1); } break; } case EX_EL_SHELL: { if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid shell face number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos+0, connect, connect_offset+shell_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+shell_table[side_num][1]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 2); /* 2 node object */ if (num_nodes_per_elem > 2) /*** KLUDGE for 2D shells ***/ { if (side_num+1 <= 2) /* 4-node face */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 4); /* 4 node object */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+shell_table[side_num][2]-1); get_nodes(exoid, 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 */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 8); /* 8 node object */ get_nodes(exoid, side_set_node_list, node_pos+4, connect, connect_offset+shell_table[side_num][4]-1); get_nodes(exoid, side_set_node_list, node_pos+5, connect, connect_offset+shell_table[side_num][5]-1); get_nodes(exoid, side_set_node_list, node_pos+6, connect, connect_offset+shell_table[side_num][6]-1); get_nodes(exoid, side_set_node_list, node_pos+7, connect, connect_offset+shell_table[side_num][7]-1); } else { set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node edge */ get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+shell_table[side_num][2]-1); } } break; } case EX_EL_TETRA: { if (side_num+1 < 1 || side_num+1 > 4) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid tetra face number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos+0, connect, connect_offset+tetra_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+tetra_table[side_num][1]-1); get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+tetra_table[side_num][2]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node object */ if (num_nodes_per_elem == 8) { set_count(exoid, side_set_node_cnt_list, elem_ndx, 4); /* 4 node object */ get_nodes(exoid, side_set_node_list, node_pos+3, connect, connect_offset+tetra_table[side_num][3]-1); } else if (num_nodes_per_elem > 8) { set_count(exoid, side_set_node_cnt_list, elem_ndx, 6); /* 6 node object */ get_nodes(exoid, side_set_node_list, node_pos+3, connect, connect_offset+tetra_table[side_num][3]-1); get_nodes(exoid, side_set_node_list, node_pos+4, connect, connect_offset+tetra_table[side_num][4]-1); get_nodes(exoid, side_set_node_list, node_pos+5, connect, connect_offset+tetra_table[side_num][5]-1); } break; } case EX_EL_WEDGE: { if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid wedge face number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][1]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][2]-1); if (wedge_table[side_num][3] == 0) { /* degenerate side? */ set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node side */ } else { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][3]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 4); /* 4 node side */ } if (num_nodes_per_elem > 6) { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][4]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][5]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][6]-1); if (wedge_table[side_num][7] == 0) /* degenerate side? */ set_count(exoid, side_set_node_cnt_list, elem_ndx, 7); /* 6 node side */ else { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+wedge_table[side_num][7]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 8); /* 8 node side */ } } break; } case EX_EL_PYRAMID: { if (side_num+1 < 1 || side_num+1 > 5) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid pyramid face number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][1]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][2]-1); if (pyramid_table[side_num][3] == 0) { /* degenerate side? */ set_count(exoid, side_set_node_cnt_list, elem_ndx, 3); /* 3 node side */ } else { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][3]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 4); /* 4 node side */ } if (num_nodes_per_elem > 5) { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][4]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][5]-1); get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][6]-1); if (pyramid_table[side_num][7] == 0) /* degenerate side? */ set_count(exoid, side_set_node_cnt_list, elem_ndx, 7); /* 6 node side */ else { get_nodes(exoid, side_set_node_list, node_pos++, connect, connect_offset+pyramid_table[side_num][7]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 8); /* 8 node side */ } } break; } case EX_EL_HEX: { if (side_num+1 < 1 || side_num+1 > 6) /* side number range check */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid hex face number %"ST_ZU" in file id %d", side_num+1, exoid); ex_err("ex_get_side_set_node_list",errmsg,exerrval); err_stat = EX_FATAL; goto cleanup; } get_nodes(exoid, side_set_node_list, node_pos+0, connect, connect_offset+hex_table[side_num][0]-1); get_nodes(exoid, side_set_node_list, node_pos+1, connect, connect_offset+hex_table[side_num][1]-1); get_nodes(exoid, side_set_node_list, node_pos+2, connect, connect_offset+hex_table[side_num][2]-1); get_nodes(exoid, side_set_node_list, node_pos+3, connect, connect_offset+hex_table[side_num][3]-1); set_count(exoid, side_set_node_cnt_list, elem_ndx, 4); /* 4 node object */ if (num_nodes_per_elem > 12) /* more nodes than HEXSHELL */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 8); /* 8 node object */ get_nodes(exoid, side_set_node_list, node_pos+4, connect, connect_offset+hex_table[side_num][4]-1); get_nodes(exoid, side_set_node_list, node_pos+5, connect, connect_offset+hex_table[side_num][5]-1); get_nodes(exoid, side_set_node_list, node_pos+6, connect, connect_offset+hex_table[side_num][6]-1); get_nodes(exoid, 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 */ { set_count(exoid, side_set_node_cnt_list, elem_ndx, 9); /* 9 node object */ get_nodes(exoid, 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[parm_ndx].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 */ cleanup: safe_free(connect); safe_free(ss_parm_ndx); safe_free(elem_blk_ids); safe_free(elem_blk_parms); safe_free(ss_elem_ndx); safe_free(ss_elem_node_ndx); safe_free(side_set_side_list); safe_free(side_set_elem_list); return(err_stat); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set_node_list_len.c000066400000000000000000000474151225312213100257270ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include #include #include "exodusII.h" #include "exodusII_int.h" static void *safe_free(void *array); /*! * This routine is designed to read the Exodus II V 2.0 side set side * definition and return the length of a ExodusI style side set node list. * \param exoid exodus file id * \param side_set_id side set id * \param[out] *side_set_node_list_len length of node list */ int ex_get_side_set_node_list_len(int exoid, ex_entity_id side_set_id, void_int *side_set_node_list_len) { size_t i, j; size_t m; int64_t num_side_sets, num_elem_blks, num_df, ndim; size_t list_len = 0; int64_t tot_num_elem = 0, tot_num_ss_elem = 0; void_int *elem_blk_ids; int *ss_elem_ndx = NULL; int64_t *ss_elem_ndx_64 = NULL; void_int *side_set_elem_list; void_int *side_set_side_list; int elem_ctr; int status; struct elem_blk_parm *elem_blk_parms; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) *(int64_t*)side_set_node_list_len = 0; /* default value */ else *(int*)side_set_node_list_len = 0; /* default value */ /* first check if any side sets are specified */ /* inquire how many side sets have been stored */ /* get the dimensionality of the coordinates; this is necessary to distinguish between 2d TRIs and 3d TRIs */ ndim = ex_inquire_int(exoid, EX_INQ_DIM); if (ndim < 0) { sprintf(errmsg, "Error: failed to get dimensionality in file id %d",exoid); ex_err("ex_get_side_set_node_list_len",errmsg,exerrval); return(EX_FATAL); } tot_num_elem = ex_inquire_int(exoid, EX_INQ_ELEM); if (tot_num_elem < 0) { 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); } num_elem_blks = ex_inquire_int(exoid, EX_INQ_ELEM_BLK); if (num_elem_blks < 0) { 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); } num_side_sets = ex_inquire_int(exoid, EX_INQ_SIDE_SETS); if (num_side_sets < 0) { 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); } /* First determine the # of elements in the side set*/ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = ex_get_side_set_param(exoid,side_set_id,&tot_num_ss_elem,&num_df); } else { int tot; int df; status = ex_get_side_set_param(exoid,side_set_id,&tot,&df); tot_num_ss_elem = tot; num_df = df; } if (status != NC_NOERR) { sprintf(errmsg, "Error: failed to get number of elements in side set %"PRId64" 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 */ /* Minor optimization/kluge -- If num_df is nonzero, or 1 per face then assume that it matches the number of nodes in the sideset... */ if (num_df > 0 && num_df != tot_num_ss_elem) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) *(int64_t*)side_set_node_list_len = num_df; else *(int*)side_set_node_list_len = num_df; return(EX_NOERR); } /* Allocate space for the side set element list */ { int int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) int_size = sizeof(int64_t); if (!(side_set_elem_list=malloc(tot_num_ss_elem*int_size))) { 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*int_size))) { safe_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) != NC_NOERR) { safe_free(side_set_elem_list); safe_free(side_set_side_list); sprintf(errmsg, "Error: failed to get side set %"PRId64" 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 (int_size == sizeof(int64_t)) { ss_elem_ndx_64=malloc(tot_num_ss_elem*int_size); } else { ss_elem_ndx =malloc(tot_num_ss_elem*int_size); } if (ss_elem_ndx_64==NULL && ss_elem_ndx == NULL) { safe_free(side_set_elem_list); safe_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 */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { for (i=0;i= num_elem_blks) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid element number %"ST_ZU" found in side set %"PRId64" in file %d", elem, side_set_id, exoid); safe_free(elem_blk_parms); safe_free(elem_blk_ids); safe_free(ss_elem_ndx); safe_free(ss_elem_ndx_64); safe_free(side_set_side_list); safe_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 == EX_EL_WEDGE && (side == 4 || side == 5)) { if (elem_blk_parms[j].num_nodes_per_elem == 6) list_len += 3; /* 3 node side */ else 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 == EX_EL_PYRAMID && (side < 5)) { if (elem_blk_parms[j].num_nodes_per_elem == 5) list_len += 3; /* 3 node side */ else 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 == EX_EL_SHELL && (side > 2 )) { if (elem_blk_parms[j].num_nodes_per_elem == 4) list_len += 2; /* 2 node side */ else 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 == EX_EL_TRIANGLE && ndim == 3 && side > 2 ) { if (elem_blk_parms[j].num_nodes_per_elem == 3) /* 3-node TRI */ list_len += 2; /* 2 node side */ else /* 6-node TRI */ list_len += 3; /* 3 node side */ } else if (elem_blk_parms[j].elem_type_val == EX_EL_UNK) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: %s in elem block %"PRId64" is an unsupported element type", elem_blk_parms[i].elem_type, elem_blk_parms[i].elem_blk_id); safe_free(elem_blk_parms); safe_free(elem_blk_ids); safe_free(ss_elem_ndx); safe_free(ss_elem_ndx_64); safe_free(side_set_side_list); safe_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 */ list_len += elem_blk_parms[j].num_nodes_per_side[0]; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) *(int64_t*)side_set_node_list_len = list_len; else *(int*)side_set_node_list_len = list_len; /* All done: release element block ids array, element block parameters array, and side set element index array */ safe_free(elem_blk_ids); safe_free(elem_blk_parms); safe_free(ss_elem_ndx); safe_free(ss_elem_ndx_64); safe_free(side_set_side_list); safe_free(side_set_elem_list); return(EX_NOERR); } static void *safe_free(void *array) { if (array != 0) free(array); return 0; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_side_set_param.c000066400000000000000000000061551225312213100242050ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * int side_set_id side set id * * exit conditions - * int* num_side_in_set number of sides in the side set * int* num_dist_fact_in_set number of distribution factors in the * side set * * revision history - * * *****************************************************************************/ #include "exodusII.h" /*! * reads the number of sides and the number of distribution factors which * describe a single side set * \param exoid exodus file id * \param side_set_id side set id * \param[out] num_side_in_set number of sides in the side set * \param[out] num_dist_fact_in_set number of distribution factors in the * \deprecated Use ex_get_set_param()(exoid, EX_SIDE_SET, side_set_id, num_side_in_set, num_dist_fact_in_set) */ int ex_get_side_set_param (int exoid, ex_entity_id side_set_id, void_int *num_side_in_set, void_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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_ss_param_global.c000066400000000000000000000142361225312213100243520ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_get_ss_param_global() ***************************************************************************** * This function retrieves the global side-set parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * global_ids - Pointer to a vector of global node-set IDs. * side_cnts - Pointer to a vector of global node counts in * each global node set. * df_cnts - Pointer to a vector of global distribution * factors in each global node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include int ex_get_ss_param_global(int exoid, void_int *global_ids, void_int *side_cnts, void_int *df_cnts ) { const char *func_name="ex_get_ss_param_global"; int varid, status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the variable ID for the vector of global side set IDs */ if ((status = nc_inq_varid(exoid, VAR_SS_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of side set IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong(exoid, varid, global_ids); } else { status = nc_get_var_int(exoid, varid, global_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_SS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the vector of global side set side count */ if (side_cnts != NULL) { if ((status = nc_inq_varid(exoid, VAR_SS_SIDE_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_SIDE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of side set side counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, varid, side_cnts); } else { status = nc_get_var_int(exoid, varid, side_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_SS_SIDE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (side_cnts != NULL)" */ /* Get the variable ID for the vector of global side set dist. fact count */ if (df_cnts != NULL) { if ((status = nc_inq_varid(exoid, VAR_SS_DF_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of side set dist. fact counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_get_var_longlong(exoid, varid, df_cnts); } else { status = nc_get_var_int(exoid, varid, df_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_SS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (df_cnts != NULL)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_sset_var.c000066400000000000000000000061131225312213100230460ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #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 * \deprecated Use ex_get_var()(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_side_this_sset, sset_var_vals) instead */ int ex_get_sset_var (int exoid, int time_step, int sset_var_index, ex_entity_id sset_id, int64_t num_side_this_sset, void *sset_var_vals) { return ex_get_var(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_side_this_sset, sset_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_sset_var_tab.c000066400000000000000000000053151225312213100236770ustar00rootroot00000000000000/* * 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 * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the EXODUS II sideset variable truth table from the database * \deprecated Use ex_get_truth_table()(exoid, EX_SIDE_SET, num_sidesets, num_sset_var, sset_var_tab) */ int ex_get_sset_var_tab (int exoid, int num_sidesets, int num_sset_var, int *sset_var_tab) { return ex_get_truth_table(exoid, EX_SIDE_SET, num_sidesets, num_sset_var, sset_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_time.c000066400000000000000000000077361225312213100221720ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_get_time() reads the time value for a specified time step. Because time values are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_get_time() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - no time steps have been stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number. This is essentially an index (in the time dimension) into the global, nodal, and element variables arrays stored in the database. The first time step is 1. \param[out] time_value Returned time at the specified time step. As an example, the following coding will read the time value stored in the data file for time step n: \code int n, error, exoid; float time_value; \comment{read time value at time step 3} n = 3; error = ex_get_time (exoid, n, &time_value); \endcode */ int ex_get_time (int exoid, int time_step, void *time_value) { int status; int varid; size_t start[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire previously defined variable */ if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time variable in file id %d", exoid); ex_err("ex_get_time",errmsg,exerrval); return (EX_FATAL); } /* read time value */ start[0] = --time_step; if (ex_comp_ws(exoid) == 4) { status = nc_get_var1_float(exoid, varid, start, time_value); } else { status = nc_get_var1_double(exoid, varid, start, time_value); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get time value in file id %d", exoid); ex_err("ex_get_time",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_truth_table.c000066400000000000000000000154431225312213100235430ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * exgvtt - ex_get_truth_table * * entry conditions - * input parameters: * int exoid exodus file id * int num_blk number of blocks * int num_var number of variables * * exit conditions - * int* var_tab element variable truth table array * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" #include /*! * reads the EXODUS II specified variable truth table from the database */ int ex_get_truth_table (int exoid, ex_entity_type obj_type, int num_blk, int num_var, int *var_tab) { int dimid, varid, tabid, i, j, status, status1; size_t num_entity = 0; size_t num_var_db = 0; char errmsg[MAX_ERR_LENGTH]; const char* routine = "ex_get_truth_table"; /* * The ent_type and the var_name are used to build the netcdf * variables name. Normally this is done via a macro defined in * exodusII_int.h */ const char* ent_type = NULL; const char* var_name = NULL; exerrval = 0; /* clear error code */ switch (obj_type) { case EX_EDGE_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_EBLK_TAB, &tabid); var_name = "vals_edge_var"; ent_type = "eb"; break; case EX_FACE_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_FBLK_TAB, &tabid); var_name = "vals_face_var"; ent_type = "fb"; break; case EX_ELEM_BLOCK: status = ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_ELEM_TAB, &tabid); var_name = "vals_elem_var"; ent_type = "eb"; break; case EX_NODE_SET: status = ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_NSET_TAB, &tabid); var_name = "vals_nset_var"; ent_type = "ns"; break; case EX_EDGE_SET: status = ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edgeset variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_ESET_TAB, &tabid); var_name = "vals_eset_var"; ent_type = "es"; break; case EX_FACE_SET: status = ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "faceset variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_FSET_TAB, &tabid); var_name = "vals_fset_var"; ent_type = "fs"; break; case EX_SIDE_SET: status = ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_SSET_TAB, &tabid); var_name = "vals_sset_var"; ent_type = "ss"; break; case EX_ELEM_SET: status = ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "elemset variables", &num_var_db, &varid, routine); status1 = nc_inq_varid (exoid, VAR_ELSET_TAB, &tabid); var_name = "vals_elset_var"; ent_type = "es"; break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid variable type %d specified in file id %d", obj_type, exoid); ex_err(routine,errmsg,exerrval); return (EX_WARN); } if (status != NC_NOERR) { exerrval = status; return (EX_WARN); } status = ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type), &num_entity, &dimid, routine); if (status != NC_NOERR) { exerrval = status; return (EX_FATAL); } if (num_entity != (size_t)num_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # of %s doesn't match those defined in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } if (num_var_db != (size_t)num_var) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # of %s variables doesn't match those defined in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } if (status1 != NC_NOERR) { /* since truth table isn't stored in the data file, derive it dynamically */ for (j=0; j /*! * reads the names of the results variables from the database * \deprecated Use ex_get_variable_names()(exoid, obj_type, num_vars, var_names) */ int ex_get_var_names (int exoid, const char *var_type, int num_vars, char *var_names[]) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return ex_get_variable_names(exoid, obj_type, num_vars, var_names); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_var_param.c000066400000000000000000000052551225312213100231760ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * reads the number of global, nodal, or element variables that are * stored in the database * \deprecated Use ex_get_variable_param()(exoid, obj_type, *num_vars) */ int ex_get_var_param (int exoid, const char *var_type, int *num_vars) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return (ex_get_variable_param(exoid, obj_type, num_vars)); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_var_tab.c000066400000000000000000000054111225312213100226360ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * int num_blk number of blocks * int num_var number of variables * * exit conditions - * int* var_tab element variable truth table array * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" #include /*! * reads the EXODUS II specified variable truth table from the database * \deprecated Use ex_get_truth_table()(exoid, obj_type, num_blk, num_var, var_tab) */ int ex_get_var_tab (int exoid, const char *var_type, int num_blk, int num_var, int *var_tab) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return ex_get_truth_table(exoid, obj_type, num_blk, num_var, var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_var_time.c000066400000000000000000000234051225312213100230310ustar00rootroot00000000000000/* * 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 * * 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 * * *****************************************************************************/ #include #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, ex_entity_type var_type, int var_index, int64_t id, int beg_time_step, int end_time_step, void* var_vals ) { int dimid, varid, numel = 0, offset; int status; int *stat_vals; size_t num_obj, i; size_t num_entries_this_obj = 0; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; 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: varobjids = VAR_ID_ED_BLK; varobstat = VAR_STAT_ED_BLK; break; case EX_FACE_BLOCK: varobjids = VAR_ID_FA_BLK; varobstat = VAR_STAT_FA_BLK; break; case EX_ELEM_BLOCK: varobjids = VAR_ID_EL_BLK; varobstat = VAR_STAT_EL_BLK; break; case EX_NODE_SET: varobjids = VAR_NS_IDS; varobstat = VAR_NS_STAT; break; case EX_EDGE_SET: varobjids = VAR_ES_IDS; varobstat = VAR_ES_STAT; break; case EX_FACE_SET: varobjids = VAR_FS_IDS; varobstat = VAR_FS_STAT; break; case EX_SIDE_SET: varobjids = VAR_SS_IDS; varobstat = VAR_SS_STAT; break; case EX_ELEM_SET: 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 */ /* 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 */ status = ex_get_dimension(exoid, ex_dim_num_objects(var_type), ex_name_of_object(var_type), &num_obj, &dimid, "ex_get_var_time"); if (status != NC_NOERR) return status; /* get the array of object ids */ /* don't think we need this anymore since the netcdf variable names associated with objects don't contain the object ids */ if ((status = nc_inq_varid (exoid, varobjids, &varid )) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids in file id %d", ex_name_of_object(var_type),exoid); ex_err("ex_get_var_time",errmsg,exerrval); return (EX_FATAL); } /* allocate space for stat array */ if (!(stat_vals = malloc((int)num_obj*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for %s status array for file id %d", ex_name_of_object(var_type),exoid); ex_err("ex_get_var_time",errmsg,exerrval); return (EX_FATAL); } /* get variable id of status array */ if (nc_inq_varid (exoid, varobstat, &varid) == NC_NOERR) { /* if status array exists, use it, otherwise assume, object exists to be backward compatible */ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) { exerrval = status; free(stat_vals); sprintf(errmsg, "Error: failed to get %s status array from file id %d", ex_name_of_object(var_type),exoid); ex_err("ex_get_var_time",errmsg,exerrval); return (EX_FATAL); } } else { /* default: status is true */ for(i=0;i /*! The function ex_get_variable_names() reads the names of the results variables from the database. Memory must be allocated for the name array before this function is invoked. The names are \p MAX_STR_LENGTH-characters in length. \return In case of an error, ex_get_variable_names() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid variable type specified. - a warning value is returned if no variables of the specified type are stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Variable indicating the type of variable which is described. Use one of the options in the table below. \param[in] num_vars The number of \c var_type variables that will be read from the database. \param[out] var_names Returned array of pointers to \c num_vars variable names.
\c EX_GLOBAL} Global entity type
\c EX_NODAL} Nodal entity type
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
As an example, the following code segment will read the names of the nodal variables stored in the data file: \code #include "exodusII.h" int error, exoid, num_nod_vars; char *var_names[10]; \comment{read nodal variables parameters and names} error = ex_get_variable_param(exoid, EX_NODAL, &num_nod_vars); for (i=0; i < num_nod_vars; i++) { var_names[i] = (char *) calloc ((MAX_STR_LENGTH+1), sizeof(char)); } error = ex_get_variable_names(exoid, EX_NODAL, num_nod_vars, var_names); \endcode */ int ex_get_variable_names (int exoid, ex_entity_type obj_type, int num_vars, char *var_names[]) { int varid, status; char errmsg[MAX_ERR_LENGTH]; const char* vvarname; exerrval = 0; /* clear error code */ switch (obj_type) { case EX_NODAL: vvarname = VAR_NAME_NOD_VAR; break; case EX_EDGE_BLOCK: vvarname = VAR_NAME_EDG_VAR; break; case EX_FACE_BLOCK: vvarname = VAR_NAME_FAC_VAR; break; case EX_ELEM_BLOCK: vvarname = VAR_NAME_ELE_VAR; break; case EX_NODE_SET: vvarname = VAR_NAME_NSET_VAR; break; case EX_EDGE_SET: vvarname = VAR_NAME_ESET_VAR; break; case EX_FACE_SET: vvarname = VAR_NAME_FSET_VAR; break; case EX_SIDE_SET: vvarname = VAR_NAME_SSET_VAR; break; case EX_ELEM_SET: vvarname = VAR_NAME_ELSET_VAR; break; case EX_GLOBAL: vvarname = VAR_NAME_GLO_VAR; break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: invalid variable type %d requested from file id %d", obj_type, exoid); ex_err("ex_get_variable_names",errmsg,exerrval); return (EX_WARN); } /* inquire previously defined variables */ if ((status = nc_inq_varid(exoid, vvarname, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: no %s variables names stored in file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_get_variable_names",errmsg,exerrval); return (EX_WARN); } /* read the variable names */ status = ex_get_names_internal(exoid, varid, num_vars, var_names, obj_type, "ex_get_variable_names"); if (status != NC_NOERR) { return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_get_variable_param.c000066400000000000000000000135041225312213100241670ustar00rootroot00000000000000/* * 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_variable_param * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type variable type * * exit conditions - * int* num_vars number of variables in database * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! The function ex_get_variable_param() reads the number of global, nodal, or element variables stored in the database. \return In case of an error, ex_get_variable_param() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - invalid variable type specified. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Variable indicating the type of variable which is described. Use one of the options in the table below. \param[out] num_vars Returned number of \c var_type variables that are stored in the database.
\c EX_GLOBAL} Global entity type
\c EX_NODAL} Nodal entity type
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
As an example, the following coding will determine the number of global variables stored in the data file: \code int num_glo_vars, error, exoid; \comment{read global variables parameters} error = ex_get_variable_param(exoid, EX_GLOBAL, &num_glo_vars); \endcode */ int ex_get_variable_param (int exoid, ex_entity_type obj_type, int *num_vars) { int dimid; size_t dimlen; char errmsg[MAX_ERR_LENGTH]; const char* dnumvar; int status; exerrval = 0; /* clear error code */ *num_vars = 0; switch (obj_type) { case EX_GLOBAL: dnumvar = DIM_NUM_GLO_VAR; break; case EX_NODAL: dnumvar = DIM_NUM_NOD_VAR; break; case EX_EDGE_BLOCK: dnumvar = DIM_NUM_EDG_VAR; break; case EX_FACE_BLOCK: dnumvar = DIM_NUM_FAC_VAR; break; case EX_ELEM_BLOCK: dnumvar = DIM_NUM_ELE_VAR; break; case EX_NODE_SET: dnumvar = DIM_NUM_NSET_VAR; break; case EX_EDGE_SET: dnumvar = DIM_NUM_ESET_VAR; break; case EX_FACE_SET: dnumvar = DIM_NUM_FSET_VAR; break; case EX_SIDE_SET: dnumvar = DIM_NUM_SSET_VAR; break; case EX_ELEM_SET: dnumvar = DIM_NUM_ELSET_VAR; break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: invalid variable type %d requested from file id %d", obj_type, exoid); ex_err("ex_get_var_param",errmsg,exerrval); return (EX_WARN); } if ((status = nc_inq_dimid (exoid, dnumvar, &dimid)) != NC_NOERR) { *num_vars = 0; if (status == NC_EBADDIM) return(EX_NOERR); /* no global variables defined */ else { exerrval = status; sprintf(errmsg, "Error: failed to locate %s variable names in file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_get_var_param",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_dimlen(exoid, dimid, &dimlen)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %s variables in file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_get_var_param",errmsg,exerrval); return (EX_FATAL); } *num_vars = dimlen; return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_inquire.c000066400000000000000000001112501225312213100220340ustar00rootroot00000000000000/* * 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. * */ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! \fn{int ex_inquire (int exoid, int req_info, void_int *ret_int, float *ret_float, char *ret_char)} The function ex_inquire() is used to inquire values of certain data entities in an exodus file. Memory must be allocated for the returned values before this function is invoked.query database. \sa ex_inquire_int(). \return In case of an error, ex_inquire() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open(). - requested information not stored in the file. - invalid request flag. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] req_info A flag which designates what information is requested. It must be one of the following constants in the table below. \param[out] ret_int Returned integer, if an integer value is requested (according to \c req_info); otherwise, supply a dummy argument. \param[out] ret_float Returned float, if a float value is requested (according to \c req_info); otherwise, supply a dummy argument. This argument is always a float even if the database IO and/or CPU word size is a double. \param[out] ret_char Returned character string, if a character value is requested (according to \c req_info); otherwise, supply a dummy argument.
\c EX_INQ_API_VERS The exodus API version number is returned in \c ret_float and an undotted version number is returned in \c ret_int. The API version number reflects the release of the function library (i.e., function names, argument list, etc.). The API and LIB version numbers are synchronized and will always match. Initially, it was thought that maintaining the two versions separately would be a benefit, but that was more confusing than helpful, so the numbers were made the same.
\c EX_INQ_DB_VERS The exodus database version number is returned in \c ret_float and an ``undotted'' version number is returned in \c ret_int. The database version number reflects the version of the library that was used to \e write the file pointed to by \c exoid.
\c EX_INQ_LIB_VERS The exodus library version number is returned in \c ret_float and an undotted version number is returned in \c ret_int. The API library version number reflects the version number of the exodus library linked with this application.
\c EX_INQ_TITLE The title stored in the database is returned in \c ret_char.
\c EX_INQ_DIM The dimensionality, or number of coordinates per node (1, 2 or 3), of the database is returned in \c ret_int.
\c EX_INQ_NODES The number of nodes is returned in \c ret_int.
\c EX_INQ_ELEM The number of elements is returned in \c ret_int.
\c EX_INQ_ELEM_BLK The number of element blocks is returned in \c ret_int.
\c EX_INQ_NODE_SETS The number of node sets is returned in \c ret_int.
\c EX_INQ_NS_NODE_LEN The length of the concatenated node sets node list is returned in \c ret_int.
\c EX_INQ_NS_DF_LEN The length of the concatenated node sets distribution list is returned in \c ret_int.
\c EX_INQ_SIDE_SETS The number of side sets is returned in \c ret_int.
\c EX_INQ_SS_ELEM_LEN The length of the concatenated side sets element list is returned in \c ret_int.
\c EX_INQ_SS_DF_LEN The length of the concatenated side sets distribution factor list is returned in \c ret_int.
\c EX_INQ_SS_NODE_LEN The aggregate length of all of the side sets node lists is returned in \c ret_int.
\c EX_INQ_EB_PROP The number of integer properties stored for each element block is returned in \c ret_int; this number includes the property named \c ID.
\c EX_INQ_NS_PROP The number of integer properties stored for each node set is returned in \c ret_int; this number includes the property named \c ID.
\c EX_INQ_SS_PROP The number of integer properties stored for each side set is returned in \c ret_int; this number includes the property named \c ID.
\c EX_INQ_QA The number of QA records is returned in \c ret_int.
\c EX_INQ_INFO The number of information records is returned in \c ret_int.
\c EX_INQ_TIME The number of time steps stored in the database is returned in \c ret_int.
\c EX_INQ_EDGE_BLK The number of edge blocks is returned in \c ret_int.
\c EX_INQ_EDGE_MAP The number of edge maps is returned in \c ret_int.
\c EX_INQ_EDGE_PROP The number of properties stored per edge blockis returned in \c ret_int.
\c EX_INQ_EDGE_SETS The number of edge sets is returned in \c ret_int.
\c EX_INQ_EDGE The number of edges is returned in \c ret_int.
\c EX_INQ_FACE The number of faces is returned in \c ret_int.
\c EX_INQ_EB_PROP The number of element block properties is returned in \c ret_int.
\c EX_INQ_ELEM_MAP The number of element maps is returned in \c ret_int.
\c EX_INQ_ELEM_SETS The number of element sets is returned in \c ret_int.
\c EX_INQ_ELS_DF_LEN The length of the concatenated element set distribution factor list is returned in \c ret_int.
\c EX_INQ_ELS_LEN The length of the concatenated element set element list is returned in \c ret_int.
\c EX_INQ_ELS_PROP The number of properties stored per elem set is returned in \c ret_int.
\c EX_INQ_EM_PROP The number of element map properties is returned in \c ret_int.
\c EX_INQ_ES_DF_LEN The length of the concatenated edge set distribution factor list is returned in \c ret_int.
\c EX_INQ_ES_LEN The length of the concatenated edge set edge list is returned in \c ret_int.
\c EX_INQ_ES_PROP The number of properties stored per edge set is returned in \c ret_int.
\c EX_INQ_FACE_BLK The number of face blocks is returned in \c ret_int.
\c EX_INQ_FACE_MAP The number of face maps is returned in \c ret_int.
\c EX_INQ_FACE_PROP The number of properties stored per face block is returned in \c ret_int.
\c EX_INQ_FACE_SETS The number of face sets is returned in \c ret_int.
\c EX_INQ_FS_DF_LEN The length of the concatenated face set distribution factor list is returned in \c ret_int.
\c EX_INQ_FS_LEN The length of the concatenated face set face list is returned in \c ret_int.
\c EX_INQ_FS_PROP The number of properties stored per face set is returned in \c ret_int.
\c EX_INQ_NM_PROP The number of node map properties is returned in \c ret_int.
\c EX_INQ_NODE_MAP The number of node maps is returned in \c ret_int.
\c EX_INQ_COORD_FRAMES The number of coordinate frames is returned in \c ret_int.
As an example, the following will return the number of element block properties stored in the exodus file : \code #include "exodusII.h" int error, exoid, num_props; float fdum; char *cdum; \comment{determine the number of element block properties} error = ex_inquire (exoid, EX_INQ_EB_PROP, &num_props, &fdum, cdum); ...Another way to get the same information num_props = ex_inquire_int(exoid, EX_INQ_EB_PROP); \endcode */ /*! \cond INTERNAL */ static int ex_get_dimension_value(int exoid, int64_t *var, int default_value, const char *dimension_name, int missing_ok) { int status; char errmsg[MAX_ERR_LENGTH]; size_t idum; int dimid; if ((status = nc_inq_dimid( exoid, dimension_name, &dimid)) != NC_NOERR) { *var = default_value; if ( missing_ok ) { return (EX_NOERR); } else { exerrval = status; sprintf( errmsg, "Error: failed to retrieve dimension %s for file id %d", dimension_name, exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_dimlen( exoid, dimid, &idum)) != NC_NOERR) { *var = default_value; exerrval = status; sprintf( errmsg, "Error: failed to retrieve value for dimension %s for file id %d", dimension_name, exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } *var = idum; return (EX_NOERR); } static int ex_get_concat_set_len(int exoid, int64_t *set_length, const char *set_name, ex_entity_type set_type, const char *set_num_dim, const char *set_stat_var, const char *set_size_root, int missing_ok) { int i; int status; char errmsg[MAX_ERR_LENGTH]; size_t idum; int dimid, varid; size_t num_sets; int *stat_vals = NULL; *set_length = 0; /* default return value */ if ((status = nc_inq_dimid (exoid, set_num_dim, &dimid)) == NC_NOERR) { if ((status = nc_inq_dimlen (exoid, dimid, &num_sets)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %s sets in file id %d", set_name, exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } /* Allocate space for stat array */ if (!(stat_vals = malloc((int)num_sets*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for %s set status array for file id %d", set_name, exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } /* get variable id of status array */ if ((status = nc_inq_varid (exoid, set_stat_var, &varid)) == NC_NOERR) { /* if status array exists, use it, otherwise assume, object exists to be backward compatible */ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) { exerrval = status; free(stat_vals); sprintf(errmsg, "Error: failed to get %s set status array from file id %d", set_name, exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } } else /* default: status is true */ for(i=0;imaximum_name_length; } } break; case EX_INQ_TITLE: if (!ret_char) { sprintf(errmsg, "Error: Requested title, but character pointer was null for file id %d", rootid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } else { /* returns the title of the database */ /* Title is stored at root level... */ if ((status = nc_get_att_text (rootid, NC_GLOBAL, ATT_TITLE, tmp_title)) != NC_NOERR) { *ret_char = '\0'; exerrval = status; sprintf(errmsg, "Error: failed to get database title for file id %d", exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } else { strncpy(ret_char, tmp_title, MAX_LINE_LENGTH+1); ret_char[MAX_LINE_LENGTH] = '\0'; } } break; case EX_INQ_DIM: /* returns the dimensionality (2 or 3, for 2-d or 3-d) of the database */ if (ex_get_dimension(exoid, DIM_NUM_DIM, "database dimensionality", &ldum, &dimid, "ex_inquire") != NC_NOERR) return EX_FATAL; *ret_int = ldum; break; case EX_INQ_NODES: /* returns the number of nodes */ if (ex_get_dimension(exoid, DIM_NUM_NODES, "nodes", &ldum, &dimid, NULL) != NC_NOERR) *ret_int = 0; else *ret_int = ldum; break; case EX_INQ_ELEM: /* returns the number of elements */ if (ex_get_dimension(exoid, DIM_NUM_ELEM, "elements", &ldum, &dimid, NULL) != NC_NOERR) *ret_int = 0; else *ret_int = ldum; break; case EX_INQ_ELEM_BLK: /* returns the number of element blocks */ if (ex_get_dimension(exoid, DIM_NUM_EL_BLK, "element blocks", &ldum, &dimid, NULL) != NC_NOERR) *ret_int = 0; else *ret_int = ldum; break; case EX_INQ_NODE_SETS: /* returns the number of node sets */ if (ex_get_dimension(exoid, DIM_NUM_NS, "node sets", &ldum, &dimid, NULL) != NC_NOERR) *ret_int = 0; else *ret_int = ldum; break; case EX_INQ_NS_NODE_LEN: /* returns the length of the concatenated node sets node list */ ex_get_concat_set_len(exoid, ret_int,"node",EX_NODE_SET,DIM_NUM_NS,VAR_NS_STAT,"num_nod_ns",0); break; case EX_INQ_NS_DF_LEN: /* returns the length of the concatenated node sets dist factor list */ /* Determine the concatenated node sets distribution factor length: 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 (nc_inq_dimid (exoid, DIM_NUM_NS, &dimid) == NC_NOERR) { if ((status = nc_inq_dimlen(exoid, dimid, &num_sets)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of node sets in file id %d", exoid); ex_err("ex_inquire",errmsg,exerrval); return (EX_FATAL); } for (i=0; i // for size_t #include // for sprintf, NULL #include // for malloc #include // for strcpy, strlen #include // for int64_t #include #include #include /* Global variables */ char *ne_ret_string; int ex_leavedef(int exoid, const char *call_rout ) { char errmsg[MAX_ERR_LENGTH]; int status; if ((status = nc_enddef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to end define mode for file id %d", exoid); ex_err(call_rout, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ char *ex_catstrn12(char *name, int num1, int num2 ) { const char *func_name="ex_catstrn12"; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if (ne_ret_string == NULL) { ne_ret_string = (char *)malloc((NC_MAX_NAME+1)*sizeof(char)); if (ne_ret_string == NULL) { exerrval = EX_MSG; sprintf(errmsg, "Error: Insufficient memory!\n"); ex_err(func_name, errmsg, exerrval); return NULL; } } if (strlen(name) > NC_MAX_NAME) { exerrval = EX_MSG; sprintf(errmsg, "Error: name too long!"); ex_err(func_name, errmsg, exerrval); return (NULL); } sprintf(ne_ret_string, "%s%d-%d", name, num1, num2); return ne_ret_string; } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Note: This function assumes a 1-d vector of data for "ne_var_name". */ /*****************************************************************************/ int ne_id_lkup(int exoid, const char *ne_var_name, int64_t *idx, ex_entity_id ne_var_id) { const char *func_name="ne_id_lkup"; int status; int varid, ndims, dimid[1], ret=-1; nc_type var_type; size_t length, start[1]; int64_t my_index, begin, end; long long id_val; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if ((status = nc_inq_varid(exoid, ne_var_name, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", ne_var_name, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need the length for this varible */ if (idx[1] == -1) { /* Get the dimension IDs for this variable */ if ((status = nc_inq_var(exoid, varid, (char *) 0, &var_type, &ndims, dimid, (int *) 0)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err(func_name, errmsg, exerrval); return -1; } /* Get the length of this variable */ if ((status = nc_inq_dimlen(exoid, dimid[0], &length)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension for variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err(func_name, errmsg, exerrval); return -1; } idx[1] = length; } /* End "if (idx[1] == -1)" */ begin = idx[0]; end = idx[1]; /* Find the index by looping over each entry */ for(my_index=begin; my_index < end; my_index++) { start[0] = my_index; status = nc_get_var1_longlong(exoid, varid, start, &id_val); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err(func_name, errmsg, exerrval); return -1; } if (id_val == ne_var_id) { ret = (int) my_index; break; } } return ret; } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* This function retrieves the file type from a Nemesis file. */ /*****************************************************************************/ int ex_get_file_type(int exoid, char *ftype ) { const char *func_name="ex_get_file_type"; int status; int varid; int lftype; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if ((status = nc_inq_varid(exoid, VAR_FILE_TYPE, &varid)) != NC_NOERR) { /* If no file type is found, assume parallel */ ftype[0] = 'p'; ftype[1] = '\0'; return (EX_NOERR); } if ((status = nc_get_var1_int(exoid, varid, NULL, &lftype)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_FILE_TYPE, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Set the appropriate character */ if (lftype == 0) strcpy(ftype, "p"); else if (lftype == 1) strcpy(ftype, "s"); return (EX_NOERR); } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* This function outputs the Nemesis version information to the file. */ /*****************************************************************************/ int ex_put_nemesis_version(int exoid) { const char *func_name="ex_put_nemesis_version"; int status; float file_ver, api_ver; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear the error code */ file_ver = NEMESIS_FILE_VERSION; api_ver = NEMESIS_API_VERSION; /* Check to see if the nemesis file version is already in the file */ if (nc_get_att_float(exoid, NC_GLOBAL, "nemesis_file_version", &file_ver) != NC_NOERR) { /* Output the Nemesis file version */ if ((status = nc_put_att_float(exoid, NC_GLOBAL, "nemesis_file_version", NC_FLOAT, 1, &file_ver)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output nemesis file version in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the Nemesis API version */ if ((status = nc_put_att_float(exoid, NC_GLOBAL, "nemesis_api_version", NC_FLOAT, 1, &api_ver)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output nemesis api version in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } return (EX_NOERR); } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* This function checks that the version info is correct. */ /*****************************************************************************/ int ne_check_file_version(int exoid) { #if 0 const char *func_name="ne_check_file_version"; float file_ver; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* Get the file version */ if ((status = nc_get_att_float(exoid, NC_GLOBAL, "nemesis_file_version", &file_ver)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get the nemesis file version from file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (fabs(NEMESIS_FILE_VERSION-file_ver) > 0.001) { exerrval = EX_MSG; sprintf(errmsg, "Error: Nemesis version mismatch in file ID %d!\n", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } #endif return (EX_NOERR); } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* This function gets the index for the given variable at the * position given. */ /*****************************************************************************/ int ex_get_idx(int exoid, const char *ne_var_name, int64_t *my_index, int pos) { const char *func_name="ex_get_idx"; int status; int varid; size_t start[1], count[1]; #if defined(NC_NETCDF4) long long varidx[2]; #else int varidx[2]; #endif char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* set default values for idx */ my_index[0] = 0; my_index[1] = -1; /* * assume that if there is an error returned, that this * means that this is a parallel file, and the index does * not exists. This is not an error */ if ((status = nc_inq_varid(exoid, ne_var_name, &varid)) == NC_NOERR) { /* check if we are at the beginning of the index vector */ if (pos == 0) { start[0] = pos; count[0] = 1; } else { start[0] = pos - 1; count[0] = 2; } #if defined(NC_NETCDF4) status = nc_get_vara_longlong(exoid, varid, start, count, varidx); #else status = nc_get_vara_int(exoid, varid, start, count, varidx); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable \"%s\" in file ID %d", ne_var_name, exoid); ex_err(func_name, errmsg, exerrval); return -1; } if (pos == 0) { my_index[0] = 0; my_index[1] = varidx[0]; } else { my_index[0] = varidx[0]; my_index[1] = varidx[1]; } } return 1; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_open.c000066400000000000000000000270401225312213100213240ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_open() opens an existing exodus file and returns an ID that can subsequently be used to refer to the file, the word size of the floating point values stored in the file, and the version of the exodus database (returned as a ``float'', regardless of the compute or I/O word size). Multiple files may be ``open'' simultaneously. \return In case of an error, ex_open() returns a negative number. Possible causes of errors include: - The specified file does not exist. - The mode specified is something other than the predefined constant \fparam{EX_READ} or \fparam{EX_WRITE}. - Database version is earlier than 2.0. \param path The file name of the exodus file. This can be given as either an absolute path name (from the root of the file system) or a relative path name (from the current directory). \param mode Access mode. Use one of the following predefined constants: - \fparam{EX_READ} To open the file just for reading. - \fparam{EX_WRITE} To open the file for writing and reading. \param[in,out] comp_ws The word size in bytes (0, 4 or 8) of the floating point variables used in the application program. If 0 (zero) is passed, the default size of floating point values for the machine will be used and returned in this variable. WARNING: all exodus functions requiring reals must be passed reals declared with this passed in or returned compute word size (4 or 8). \param[in,out] io_ws The word size in bytes (0, 4 or 8) of the floating point data as they are stored in the exodus file. If the word size does not match the word size of data stored in the file, a fatal error is returned. If this argument is 0, the word size of the floating point data already stored in the file is returned. \param[out] version Returned exodus database version number. The following opens an exodus file named \file{test.exo} for read only, using default settings for compute and I/O word sizes: \code #include "exodusII.h" int CPU_word_size,IO_word_size, exoid; float version; CPU_word_size = sizeof(float); \co{float or double} IO_word_size = 0; \co{use what is stored in file} \comment{open exodus files} exoid = ex_open ("test.exo", \co{filename path} EX_READ, \co{access mode = READ} &CPU_word_size, \co{CPU word size} &IO_word_size, \co{IO word size} &version); \co{ExodusII library version} \endcode */ static int warning_output = 0; int ex_open_int (const char *path, int mode, int *comp_ws, int *io_ws, float *version, int run_version) { int exoid; int status, stat_att, stat_dim; nc_type att_type = NC_NAT; size_t att_len = 0; int old_fill; int file_wordsize; int dim_str_name; int int64_status = 0; 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 (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodus version %d.%02d,\n but was linked with exodus library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } if ((mode & EX_READ) && (mode & EX_WRITE)) { exerrval = EX_BADFILEMODE; sprintf(errmsg,"Error: Cannot specify both EX_READ and EX_WRITE"); ex_err("ex_open",errmsg,exerrval); return (EX_FATAL); } /* The EX_READ mode is the default if EX_WRITE is not specified... */ if (!(mode & EX_WRITE)) { /* READ ONLY */ #if defined(__LIBCATAMOUNT__) if ((status = nc_open (path, NC_NOWRITE, &exoid)) != NC_NOERR) #else if ((status = nc_open (path, NC_NOWRITE|NC_SHARE, &exoid)) != NC_NOERR) #endif { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) { exerrval = EX_FATAL; } else { /* It is possible that the user is trying to open a netcdf4 file, but the netcdf4 capabilities aren't available in the netcdf linked to this library. Note that we can't just use a compile-time define since we could be using a shareable netcdf library, so the netcdf4 capabilities aren't known until runtime... Netcdf-4.X does not (yet?) have a function that can be queried to determine whether the library being used was compiled with --enable-netcdf4, so that isn't very helpful.. At this time, query the beginning of the file and see if it is an HDF-5 file and if it is assume that the open failure is due to the netcdf library not enabling netcdf4 features... */ int type = 0; ex_check_file_type(path, &type); if (type == 5) { /* This is an hdf5 (netcdf4) file. Since the nc_open failed, the assumption is that the netcdf doesn't have netcdf4 capabilities enabled. Tell the user... */ fprintf(stderr, "EXODUS: Error: Attempting to open the netcdf-4 file:\n\t'%s'\n\twith a netcdf library that does not support netcdf-4\n", path); } exerrval = status; } sprintf(errmsg,"Error: failed to open %s read only",path); ex_err("ex_open",errmsg,exerrval); return(EX_FATAL); } } else /* (mode & EX_WRITE) READ/WRITE */ { #if defined(__LIBCATAMOUNT__) if ((status = nc_open (path, NC_WRITE, &exoid)) != NC_NOERR) #else if ((status = nc_open (path, NC_WRITE|NC_SHARE, &exoid)) != NC_NOERR) #endif { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) exerrval = EX_FATAL; else exerrval = status; 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } stat_att = nc_inq_att(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, &att_type, &att_len); stat_dim = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name); if(stat_att != NC_NOERR || stat_dim != NC_NOERR) { nc_redef(exoid); if (stat_att != NC_NOERR) { int max_so_far = 32; nc_put_att_int(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &max_so_far); } /* If the DIM_STR_NAME variable does not exist on the database, we need to add it now. */ if(stat_dim != NC_NOERR) { /* Not found; set to default value of 32+1. */ int max_name = ex_default_max_name_length < 32 ? 32 : ex_default_max_name_length; nc_def_dim(exoid, DIM_STR_NAME, max_name+1, &dim_str_name); } nc_enddef (exoid); } } /* determine version of EXODUS II file, and the word size of * floating point and integer values stored in the file */ if ((status = nc_get_att_float(exoid, NC_GLOBAL, ATT_VERSION, version)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to get database version for file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); 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 (nc_get_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) != NC_NOERR) { /* try old (prior to db version 2.02) attribute name */ if (nc_get_att_int (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) != NC_NOERR) { exerrval = EX_FATAL; sprintf(errmsg,"Error: failed to get file wordsize from file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); return(exerrval); } } /* See if int64 status attribute exists and if so, what data is stored as int64 * Older files don't have the attribute, so it is not an error if it is missing */ if (nc_get_att_int (exoid, NC_GLOBAL, ATT_INT64_STATUS, &int64_status) != NC_NOERR) { int64_status = 0; /* Just in case it gets munged by a failed get_att_int call */ } /* Merge in API int64 status flags as specified by caller of function... */ int64_status |= (mode & EX_ALL_INT64_API); /* initialize floating point and integer size conversion. */ if (ex_conv_ini(exoid, comp_ws, io_ws, file_wordsize, int64_status, 0) != EX_NOERR ) { exerrval = EX_FATAL; sprintf(errmsg, "Error: failed to initialize conversion routines in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_open_par.c000066400000000000000000000275021225312213100221710ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #include #include "netcdf_par.h" #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_open() opens an existing exodus file and returns an ID that can subsequently be used to refer to the file, the word size of the floating point values stored in the file, and the version of the exodus database (returned as a ``float'', regardless of the compute or I/O word size). Multiple files may be ``open'' simultaneously. \return In case of an error, ex_open() returns a negative number. Possible causes of errors include: - The specified file does not exist. - The mode specified is something other than the predefined constant \fparam{EX_READ} or \fparam{EX_WRITE}. - Database version is earlier than 2.0. \param path The file name of the exodus file. This can be given as either an absolute path name (from the root of the file system) or a relative path name (from the current directory). \param mode Access mode. Use one of the following predefined constants: - \fparam{EX_READ} To open the file just for reading. - \fparam{EX_WRITE} To open the file for writing and reading. \param[in,out] comp_ws The word size in bytes (0, 4 or 8) of the floating point variables used in the application program. If 0 (zero) is passed, the default size of floating point values for the machine will be used and returned in this variable. WARNING: all exodus functions requiring reals must be passed reals declared with this passed in or returned compute word size (4 or 8). \param[in,out] io_ws The word size in bytes (0, 4 or 8) of the floating point data as they are stored in the exodus file. If the word size does not match the word size of data stored in the file, a fatal error is returned. If this argument is 0, the word size of the floating point data already stored in the file is returned. \param[out] version Returned exodus database version number. The following opens an exodus file named \file{test.exo} for read only, using default settings for compute and I/O word sizes: \code #include "exodusII.h" int CPU_word_size,IO_word_size, exoid; float version; CPU_word_size = sizeof(float); \co{float or double} IO_word_size = 0; \co{use what is stored in file} \comment{open exodus files} exoid = ex_open ("test.exo", \co{filename path} EX_READ, \co{access mode = READ} &CPU_word_size, \co{CPU word size} &IO_word_size, \co{IO word size} &version); \co{ExodusII library version} \endcode */ static int warning_output = 0; int ex_open_par_int (const char *path, int mode, int *comp_ws, int *io_ws, float *version, MPI_Comm comm, MPI_Info info, int run_version) { int exoid; int status, stat_att, stat_dim; nc_type att_type = NC_NAT; size_t att_len = 0; int old_fill; int file_wordsize; int dim_str_name; int int64_status = 0; int pariomode = NC_MPIPOSIX; 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 (run_version != EX_API_VERS_NODOT && warning_output == 0) { int run_version_major = run_version / 100; int run_version_minor = run_version % 100; int lib_version_major = EX_API_VERS_NODOT / 100; int lib_version_minor = EX_API_VERS_NODOT % 100; fprintf(stderr, "EXODUS: Warning: This code was compiled with exodus version %d.%02d,\n but was linked with exodus library version %d.%02d\n This is probably an error in the build process of this code.\n", run_version_major, run_version_minor, lib_version_major, lib_version_minor); warning_output = 1; } if ((mode & EX_READ) && (mode & EX_WRITE)) { exerrval = EX_BADFILEMODE; sprintf(errmsg,"Error: Cannot specify both EX_READ and EX_WRITE"); ex_err("ex_open",errmsg,exerrval); return (EX_FATAL); } /* Check parallel io mode. Valid is NC_MPIPOSIX or NC_MPIIO or NC_PNETCDF * Exodus uses different flag values; map to netcdf values */ if (mode & EX_MPIPOSIX) pariomode = NC_MPIPOSIX; else if (mode & EX_MPIIO) pariomode = NC_MPIIO; else if (mode & EX_PNETCDF) pariomode = NC_PNETCDF; /* The EX_READ mode is the default if EX_WRITE is not specified... */ if (!(mode & EX_WRITE)) { /* READ ONLY */ if ((status = nc_open_par (path, NC_NOWRITE|NC_SHARE|pariomode, comm, info, &exoid)) != NC_NOERR) { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) { exerrval = EX_FATAL; } else { /* It is possible that the user is trying to open a netcdf4 file, but the netcdf4 capabilities aren't available in the netcdf linked to this library. Note that we can't just use a compile-time define since we could be using a shareable netcdf library, so the netcdf4 capabilities aren't known until runtime... Netcdf-4.X does not (yet?) have a function that can be queried to determine whether the library being used was compiled with --enable-netcdf4, so that isn't very helpful.. At this time, query the beginning of the file and see if it is an HDF-5 file and if it is assume that the open failure is due to the netcdf library not enabling netcdf4 features... */ int type = 0; ex_check_file_type(path, &type); if (type == 5) { /* This is an hdf5 (netcdf4) file. Since the nc_open failed, the assumption is that the netcdf doesn't have netcdf4 capabilities enabled. Tell the user... */ fprintf(stderr, "EXODUS: Error: Attempting to open the netcdf-4 file:\n\t'%s'\n\twith a netcdf library that does not support netcdf-4\n", path); } exerrval = status; } sprintf(errmsg,"Error: failed to open %s read only",path); ex_err("ex_open",errmsg,exerrval); return(EX_FATAL); } } else /* (mode & EX_WRITE) READ/WRITE */ { if ((status = nc_open_par (path, NC_WRITE|NC_SHARE|pariomode, comm, info, &exoid)) != NC_NOERR) { /* NOTE: netCDF returns an id of -1 on an error - but no error code! */ if (status == 0) exerrval = EX_FATAL; else exerrval = status; 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 ((status = nc_set_fill (exoid, NC_NOFILL, &old_fill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to set nofill mode in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } stat_att = nc_inq_att(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, &att_type, &att_len); stat_dim = nc_inq_dimid(exoid, DIM_STR_NAME, &dim_str_name); if(stat_att != NC_NOERR || stat_dim != NC_NOERR) { nc_redef(exoid); if (stat_att != NC_NOERR) { int max_so_far = 32; nc_put_att_int(exoid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &max_so_far); } /* If the DIM_STR_NAME variable does not exist on the database, we need to add it now. */ if(stat_dim != NC_NOERR) { /* Not found; set to default value of 32+1. */ int max_name = ex_default_max_name_length < 32 ? 32 : ex_default_max_name_length; nc_def_dim(exoid, DIM_STR_NAME, max_name+1, &dim_str_name); } nc_enddef (exoid); } } /* determine version of EXODUS II file, and the word size of * floating point and integer values stored in the file */ if ((status = nc_get_att_float(exoid, NC_GLOBAL, ATT_VERSION, version)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to get database version for file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); 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 (nc_get_att_int (exoid, NC_GLOBAL, ATT_FLT_WORDSIZE, &file_wordsize) != NC_NOERR) { /* try old (prior to db version 2.02) attribute name */ if (nc_get_att_int (exoid,NC_GLOBAL,ATT_FLT_WORDSIZE_BLANK,&file_wordsize) != NC_NOERR) { exerrval = EX_FATAL; sprintf(errmsg,"Error: failed to get file wordsize from file id: %d", exoid); ex_err("ex_open",errmsg,exerrval); return(exerrval); } } /* See if int64 status attribute exists and if so, what data is stored as int64 * Older files don't have the attribute, so it is not an error if it is missing */ if (nc_get_att_int (exoid, NC_GLOBAL, ATT_INT64_STATUS, &int64_status) != NC_NOERR) { int64_status = 0; /* Just in case it gets munged by a failed get_att_int call */ } /* Merge in API int64 status flags as specified by caller of function... */ int64_status |= (mode & EX_ALL_INT64_API); /* initialize floating point and integer size conversion. */ if (ex_conv_ini(exoid, comp_ws, io_ws, file_wordsize, int64_status, 1) != EX_NOERR ) { exerrval = EX_FATAL; sprintf(errmsg, "Error: failed to initialize conversion routines in file id %d", exoid); ex_err("ex_open", errmsg, exerrval); return (EX_FATAL); } return (exoid); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_opts.c000066400000000000000000000064421225312213100213530ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! \cond INTERNAL */ int ex_default_max_name_length = 32; /* For default compatibility with older clients */ #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 = EX_DEFAULT; /* set default global options value to NOT print error msgs*/ #endif #endif /*! \endcond */ /*! The function ex_opts() is used to set message reporting options. \return Returns previous value for the message reporting option. \param[in] options Integer option value. Current options are shown in the table below.
\c EX_ABORT Causes fatal errors to force program exit. (Default is false.)
\c EX_DEBUG Causes certain messages to print for debug use. (Default is false.)
\c EX_VERBOSE Causes all error messages to print when true, otherwise no error messages will print. (Default is false.)
\note Values may be OR'ed together to provide any combination of these capabilities. For example, the following will cause all messages to print and will cause the program to exit upon receipt of fatal error: \code #include "exodusII.h" ex_opts(EX_ABORT|EX_VERBOSE); \endcode */ int ex_opts (int options) { int oldval = exoptval; exerrval = 0; /* clear error code */ exoptval = options; return oldval; } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_all_var_param.c000066400000000000000000000101351225312213100240500ustar00rootroot00000000000000/* * 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 - * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * defines the number of global, nodal, element, nodeset, and sideset variables * that will be written to the database * \param exoid exodus file id * \param num_g global variable count * \param num_n nodal variable count * \param num_e element variable count * \param *elem_var_tab element variable truth table array * \param num_m nodeset variable count * \param *nset_var_tab nodeset variable truth table array * \param num_s sideset variable count * \param *sset_var_tab sideset variable truth table array */ int ex_put_all_var_param (int exoid, 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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_all_var_param_ext.c000066400000000000000000000515651225312213100247440ustar00rootroot00000000000000/* * 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 - * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" #include static void *safe_free(void *array); static int define_dimension(int exoid, const char *DIMENSION, int count, const char *label, int *dimid); static int define_variable_name_variable(int exoid, const char *VARIABLE, int dimension, const char *label); static int *get_status_array(int exoid, int count, const char *VARIABLE, const char *label); static int put_truth_table(int exoid, int varid, int *table, const char *label); static int define_truth_table(ex_entity_type obj_type, int exoid, int num_ent, int num_var, int *var_tab, int *status, void_int *ids, const char *label); #define EX_GET_IDS_STATUS(TNAME,NUMVAR,DNAME,DID,DVAL,VIDS,EIDS,VSTAT,VSTATVAL) \ if (NUMVAR > 0) { \ status = ex_get_dimension(exoid, DNAME, TNAME "s", &DVAL, &DID, routine); \ if (status != NC_NOERR) \ goto error_ret; \ \ /* get element block IDs */ \ if (!(VIDS = malloc(DVAL*sizeof(int64_t)))) { \ exerrval = EX_MEMFAIL; \ sprintf(errmsg, \ "Error: failed to allocate memory for " TNAME " id array for file id %d", \ exoid); \ ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \ goto error_ret; \ } \ ex_get_ids (exoid, EIDS, VIDS); \ \ /* Get element block status array for later use (allocates memory) */ \ VSTATVAL = get_status_array(exoid, DVAL, VSTAT, TNAME); \ if (VSTATVAL == NULL) { \ goto error_ret; \ } \ } /*! * writes the number of global, nodal, element, nodeset, and sideset variables * that will be written to the database * \param exoid exodus file id * \param *vp pointer to variable parameter info */ int ex_put_all_var_param_ext ( int exoid, const ex_var_params* vp ) { int in_define = 0; int status; int temp; int time_dim, num_nod_dim, dimid; size_t num_elem_blk, num_edge_blk, num_face_blk; size_t num_nset, num_eset, num_fset, num_sset, num_elset; int numelblkdim, numelvardim, numedvardim, numedblkdim, numfavardim, numfablkdim, numnsetdim, nsetvardim, numesetdim, esetvardim, numfsetdim, fsetvardim, numssetdim, ssetvardim, numelsetdim, elsetvardim; int i; int edblk_varid, fablk_varid, eblk_varid, nset_varid, eset_varid, fset_varid, sset_varid, elset_varid, varid; void_int* eblk_ids = 0; void_int* edblk_ids = 0; void_int* fablk_ids = 0; void_int* nset_ids = 0; void_int* eset_ids = 0; void_int* fset_ids = 0; void_int* sset_ids = 0; void_int* elset_ids = 0; int* eblk_stat = 0; int* edblk_stat = 0; int* fablk_stat = 0; int* nset_stat = 0; int* eset_stat = 0; int* fset_stat = 0; int* sset_stat = 0; int* elset_stat = 0; int dims[3]; char errmsg[MAX_ERR_LENGTH]; const char* routine = "ex_put_all_var_param_ext"; exerrval = 0; /* clear error code */ /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time dimension in file id %d", exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); goto error_ret; } if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &num_nod_dim)) != NC_NOERR) { num_nod_dim = -1; /* There is probably no nodes on this file */ } /* Check this now so we can use it later without checking for errors */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get string length in file id %d",exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); goto error_ret; } 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 ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); goto error_ret; } in_define = 1; /* define dimensions and variables */ if (vp->num_glob > 0) { if (define_dimension(exoid, DIM_NUM_GLO_VAR, vp->num_glob, "global", &dimid) != NC_NOERR) goto error_ret; dims[0] = time_dim; dims[1] = dimid; if ((status = nc_def_var (exoid, VAR_GLO_VAR, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define global variables in file id %d", exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); /* Now define global variable name variable */ if (define_variable_name_variable(exoid, VAR_NAME_GLO_VAR, dimid, "global") != NC_NOERR) goto error_ret; } if (vp->num_node > 0 && num_nod_dim > 0) { /* * There are two ways to store the nodal variables. The old way * * was a blob (#times,#vars,#nodes), but that was exceeding the * netcdf maximum dataset size for large models. The new way is * to store #vars separate datasets each of size (#times,#nodes) * * We want this routine to be capable of storing both formats * based on some external flag. Since the storage format of the * coordinates have also been changed, we key off of their * storage type to decide which method to use for nodal * variables. If the variable 'coord' is defined, then store old * way; otherwise store new. */ if (define_dimension(exoid, DIM_NUM_NOD_VAR, vp->num_node, "nodal", &dimid) != NC_NOERR) goto error_ret; if (ex_large_model(exoid) == 0) { /* Old way */ dims[0] = time_dim; dims[1] = dimid; dims[2] = num_nod_dim; if ((status = nc_def_var(exoid, VAR_NOD_VAR, nc_flt_code(exoid), 3, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define nodal variables in file id %d", exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } else { /* Store new way */ for (i = 1; i <= vp->num_node; i++) { dims[0] = time_dim; dims[1] = num_nod_dim; if ((status = nc_def_var(exoid, VAR_NOD_VAR_NEW(i), nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define nodal variable %d in file id %d", i, exoid); ex_err("ex_put_var_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); } } /* Now define nodal variable name variable */ if (define_variable_name_variable(exoid, VAR_NAME_NOD_VAR, dimid, "nodal") != NC_NOERR) goto error_ret; } #define EX_DEFINE_VARS(TID,STNAME,TNAME,NUMVAR,DNAME,DID1,DID2,DVAL,VIDS,VNOV,VTV,VSTATVAL,VTABVAL,VTABVAR) \ if (NUMVAR > 0) { \ status = define_dimension(exoid, DNAME, NUMVAR, STNAME, &DID2); \ if (status != NC_NOERR) goto error_ret; \ \ /* Now define STNAME variable name variable */ \ if (define_variable_name_variable(exoid, VNOV, DID2, STNAME) != NC_NOERR) \ goto error_ret; \ \ if (define_truth_table(TID, exoid, DVAL, NUMVAR, VTABVAL, VSTATVAL, VIDS, TNAME) != NC_NOERR) \ goto error_ret; \ \ VSTATVAL = safe_free (VSTATVAL); \ VIDS = safe_free (VIDS); \ \ /* create a variable array in which to store the STNAME variable truth \ * table \ */ \ \ dims[0] = DID1; \ dims[1] = DID2; \ \ if ((status = nc_def_var(exoid, VTV, NC_INT, 2, dims, &VTABVAR)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define " STNAME " variable truth table in file id %d", \ exoid); \ ex_err("ex_put_all_var_param_ext",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ } 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 ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; 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) { if (put_truth_table(exoid, edblk_varid, vp->edge_var_tab, "edge") != NC_NOERR) goto error_ret; } if (vp->num_face > 0) { if (put_truth_table(exoid, fablk_varid, vp->face_var_tab, "face") != NC_NOERR) goto error_ret; } if (vp->num_elem > 0) { if (put_truth_table(exoid, eblk_varid, vp->elem_var_tab, "element") != NC_NOERR) goto error_ret; } if (vp->num_nset > 0) { if (put_truth_table(exoid, nset_varid, vp->nset_var_tab, "nodeset") != NC_NOERR) goto error_ret; } if (vp->num_eset > 0) { if (put_truth_table(exoid, eset_varid, vp->eset_var_tab, "edgeset") != NC_NOERR) goto error_ret; } if (vp->num_fset > 0) { if (put_truth_table(exoid, fset_varid, vp->fset_var_tab, "faceset") != NC_NOERR) goto error_ret; } if (vp->num_sset > 0) { if (put_truth_table(exoid, sset_varid, vp->sset_var_tab, "sideset") != NC_NOERR) goto error_ret; } if (vp->num_elset > 0) { if (put_truth_table(exoid, elset_varid, vp->elset_var_tab, "elemset") != NC_NOERR) goto error_ret; } return(EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (in_define == 1) { if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_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); } static int define_dimension(int exoid, const char *DIMENSION, int count, const char *label, int *dimid) { char errmsg[MAX_ERR_LENGTH]; int status; if ((status = nc_def_dim(exoid, DIMENSION, count, dimid)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { sprintf(errmsg, "Error: %s variable name parameters are already defined in file id %d", label, exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); } else { 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 status; } static int define_variable_name_variable(int exoid, const char *VARIABLE, int dimension, const char *label) { char errmsg[MAX_ERR_LENGTH]; int dims[2]; int variable; int status; dims[0] = dimension; nc_inq_dimid(exoid, DIM_STR_NAME, &dims[1]); /* Checked earlier, so known to exist */ if ((status=nc_def_var(exoid, VARIABLE, NC_CHAR, 2, dims, &variable)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: %s variable names are already defined in file id %d", label, exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define %s variable names in file id %d", label, exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); } } return status; } static int *get_status_array(int exoid, int var_count, const char *VARIABLE, const char *label) { char errmsg[MAX_ERR_LENGTH]; int varid; int status; int *stat_vals = NULL; if (!(stat_vals = malloc(var_count*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for %s status array for file id %d", label, exoid); ex_err("ex_put_all_var_param_ext",errmsg,exerrval); return (NULL); } /* get variable id of status array */ if ((nc_inq_varid (exoid, VARIABLE, &varid)) == NC_NOERR) { /* if status array exists (V 2.01+), use it, otherwise assume object exists to be backward compatible */ if ((status = nc_get_var_int(exoid, varid, stat_vals)) != NC_NOERR) { exerrval = status; 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 /*! * writes the attribute names for a block * \param exoid exodus file id * \param blk_type block type (edge, face, elem) * \param blk_id block id * \param names ptr to array of attribute names */ int ex_put_attr_names(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char* names[]) { int varid, numattrdim, blk_id_ndx; size_t num_attr; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ blk_id_ndx = ex_id_lkup(exoid, blk_type, blk_id); /* Determine index of blk_id in blk_id_ndx array */ if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_attr_names",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this block */ } else { sprintf(errmsg, "Error: no %s id %"PRId64" in %s array in file id %d", ex_name_of_object(blk_type), blk_id, VAR_ID_EL_BLK, exoid); ex_err("ex_put_attr_names",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ switch (blk_type) { case EX_SIDE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_SS(blk_id_ndx), &numattrdim); break; case EX_NODE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NS(blk_id_ndx), &numattrdim); break; case EX_EDGE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ES(blk_id_ndx), &numattrdim); break; case EX_FACE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FS(blk_id_ndx), &numattrdim); break; case EX_ELEM_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ELS(blk_id_ndx), &numattrdim); break; case EX_NODAL: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NBLK, &numattrdim); break; case EX_EDGE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx), &numattrdim); break; case EX_FACE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx), &numattrdim); break; case EX_ELEM_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx), &numattrdim); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_put_attr_names",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: number of attributes not defined for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_attr_names",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_attr_names",errmsg,exerrval); return (EX_FATAL); } switch (blk_type) { case EX_SIDE_SET: status = nc_inq_varid (exoid, VAR_NAME_SSATTRIB(blk_id_ndx), &varid); break; case EX_NODE_SET: status = nc_inq_varid (exoid, VAR_NAME_NSATTRIB(blk_id_ndx), &varid); break; case EX_EDGE_SET: status = nc_inq_varid (exoid, VAR_NAME_ESATTRIB(blk_id_ndx), &varid); break; case EX_FACE_SET: status = nc_inq_varid (exoid, VAR_NAME_FSATTRIB(blk_id_ndx), &varid); break; case EX_ELEM_SET: status = nc_inq_varid (exoid, VAR_NAME_ELSATTRIB(blk_id_ndx), &varid); break; case EX_NODAL: status = nc_inq_varid (exoid, VAR_NAME_NATTRIB, &varid); break; case EX_EDGE_BLOCK: status = nc_inq_varid (exoid, VAR_NAME_EATTRIB(blk_id_ndx), &varid); break; case EX_FACE_BLOCK: status = nc_inq_varid (exoid, VAR_NAME_FATTRIB(blk_id_ndx), &varid); break; case EX_ELEM_BLOCK: status = nc_inq_varid (exoid, VAR_NAME_ATTRIB(blk_id_ndx), &varid); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_put_attr_names",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s attribute names for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),ex_name_of_object(blk_type),blk_id, exoid); ex_err("ex_put_attr_names",errmsg,exerrval); return (EX_FATAL); } /* write out the attributes */ status = ex_put_names_internal(exoid, varid, num_attr, names, blk_type, "attribute", "ex_put_attr_names"); return(status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_attr_param.c000066400000000000000000000206711225312213100234100ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expmp - ex_put_attr_param * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type block/set type (node, edge, face, elem) * int obj_id block/set id (ignored for NODAL) * int num_attrs number of attributes * * exit conditions - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * defines the number of attributes. * \param exoid exodus file id * \param obj_type block/set type (node, edge, face, elem) * \param obj_id block/set id (ignored for NODAL) * \param num_attrs number of attributes */ int ex_put_attr_param (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int num_attrs) { int status; int dims[2]; int strdim, varid; char errmsg[MAX_ERR_LENGTH]; const char *dnumobjent; const char *dnumobjatt; const char *vobjatt; const char *vattnam; int numobjentdim; int obj_id_ndx; int numattrdim; /* Determine index of obj_id in obj_type id array */ if (obj_type == EX_NODAL) obj_id_ndx = 0; else { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes found for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_put_attr_param",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this object */ } else { sprintf(errmsg, "Warning: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(obj_type),obj_id, exoid); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_WARN); } } } switch (obj_type) { case EX_SIDE_SET: dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vobjatt = VAR_SSATTRIB(obj_id_ndx); vattnam = VAR_NAME_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vobjatt = VAR_NSATTRIB(obj_id_ndx); vattnam = VAR_NAME_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vobjatt = VAR_ESATTRIB(obj_id_ndx); vattnam = VAR_NAME_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vobjatt = VAR_FSATTRIB(obj_id_ndx); vattnam = VAR_NAME_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vobjatt = VAR_ELSATTRIB(obj_id_ndx); vattnam = VAR_NAME_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjent = DIM_NUM_NODES; dnumobjatt = DIM_NUM_ATT_IN_NBLK; vobjatt = VAR_NATTRIB; vattnam = VAR_NAME_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vobjatt = VAR_EATTRIB(obj_id_ndx); vattnam = VAR_NAME_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx); vobjatt = VAR_FATTRIB(obj_id_ndx); vattnam = VAR_NAME_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx); vobjatt = VAR_ATTRIB(obj_id_ndx); vattnam = VAR_NAME_ATTRIB(obj_id_ndx); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Bad block type (%d) specified for file id %d", obj_type, exoid ); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_FATAL); } exerrval = 0; /* clear error code */ if ((status = nc_inq_dimid(exoid, dnumobjent, &numobjentdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of entries for %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_FATAL); } /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_def_dim(exoid, dnumobjatt, num_attrs, &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of attributes in %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_put_attr_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } dims[0] = numobjentdim; dims[1] = numattrdim; if ((status = nc_def_var(exoid, vobjatt, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define attributes for %s %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_put_attr_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &strdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get string length in file id %d",exoid); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_FATAL); } /* Attribute names... */ dims[0] = numattrdim; dims[1] = strdim; if ((status = nc_def_var(exoid, vattnam, NC_CHAR, 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s attribute name array in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_put_attr_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* leave define mode */ if ((status = nc_enddef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete %s attribute parameter definition in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_put_attr_param",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_attr_param",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_block.c000066400000000000000000000103141225312213100223410ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the parameters used to describe an element/face/edge block * \param exoid exodus file id * \param blk_type type of block (edge, face, or element) * \param blk_id block identifer * \param entry_descrip string describing shape of entries in the block * \param num_entries_this_blk number of entries(records) in the block * \param num_nodes_per_entry number of nodes per block entry * \param num_edges_per_entry number of edges per block entry * \param num_faces_per_entry number of faces per block entry * \param num_attr_per_entry number of attributes per block entry */ int ex_put_block( int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const char* entry_descrip, int64_t num_entries_this_blk, int64_t num_nodes_per_entry, int64_t num_edges_per_entry, int64_t num_faces_per_entry, int64_t num_attr_per_entry ) { ex_block block; block.type = blk_type; block.id = blk_id; strcpy(block.topology, entry_descrip); block.num_entry = num_entries_this_blk; block.num_nodes_per_entry = num_nodes_per_entry; block.num_edges_per_entry = num_edges_per_entry; block.num_faces_per_entry = num_faces_per_entry; block.num_attribute = num_attr_per_entry; return ex_put_block_param(exoid, block); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_block_param.c000066400000000000000000000476101225312213100235320ustar00rootroot00000000000000/* * 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 block.num_edges_per_entry number of edges per block entry * int block.num_faces_per_entry number of faces per block entry * int num_attribute number of attributes per block entry * * exit conditions - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the parameters used to describe an element/face/edge block * \param exoid exodus file id * \param block ex_block structure describing block counts */ int ex_put_block_param( int exoid, const ex_block block) { int conn_int_type; int status; int arbitrary_polyhedra = 0; /* 1 if block is arbitrary 2d polyhedra type; 2 if 3d polyhedra */ int att_name_varid = -1; int varid, dimid, dims[2], blk_id_ndx, blk_stat, strdim; size_t start[2]; int num_blk; size_t temp; int cur_num_blk, numblkdim, numattrdim; int nnodperentdim = -1; int nedgperentdim = -1; int nfacperentdim = -1; int connid; int npeid; char errmsg[MAX_ERR_LENGTH]; char entity_type1[5]; char entity_type2[5]; const char* dnumblk = NULL; const char* vblkids = NULL; const char* vblksta = NULL; const char* vnodcon = NULL; const char* vnpecnt = NULL; const char* vedgcon = NULL; const char* vfaccon = NULL; const char* vconn = NULL; const char* vattnam = NULL; const char* vblkatt = NULL; const char* dneblk = NULL; const char* dnape = NULL; const char* dnnpe = NULL; const char* dnepe = NULL; const char* dnfpe = NULL; exerrval = 0; /* clear error code */ switch (block.type) { case EX_EDGE_BLOCK: dnumblk = DIM_NUM_ED_BLK; vblkids = VAR_ID_ED_BLK; vblksta = VAR_STAT_ED_BLK; break; case EX_FACE_BLOCK: dnumblk = DIM_NUM_FA_BLK; vblkids = VAR_ID_FA_BLK; vblksta = VAR_STAT_FA_BLK; break; case EX_ELEM_BLOCK: dnumblk = DIM_NUM_EL_BLK; vblkids = VAR_ID_EL_BLK; vblksta = VAR_STAT_EL_BLK; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad block type (%d) specified for file id %d", block.type, exoid ); ex_err( "ex_put_block", errmsg, exerrval ); return (EX_FATAL); } /* first check if any element blocks are specified */ if ((status = ex_get_dimension(exoid, dnumblk, ex_name_of_object(block.type), &temp, &dimid, "ex_put_block")) != NC_NOERR) { return EX_FATAL; } num_blk = temp; /* Next: Make sure that this is not a duplicate element block id by searching the vblkids array. WARNING: This must be done outside of define mode because id_lkup accesses the database to determine the position */ if ((status = nc_inq_varid(exoid, vblkids, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids in file id %d", ex_name_of_object(block.type), exoid); ex_err("ex_put_block",errmsg,exerrval); } ex_id_lkup(exoid,block.type,block.id); /* Error value used, but don't need return value */ if (exerrval != EX_LOOKUPFAIL) { /* found the element block id */ exerrval = EX_FATAL; sprintf(errmsg, "Error: %s id %"PRId64" already exists in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } /* Keep track of the total number of element blocks defined using a counter stored in a linked list keyed by exoid. NOTE: ex_get_file_item is a function that finds the number of element blocks for a specific file and returns that value incremented. */ cur_num_blk=ex_get_file_item(exoid, ex_get_counter_list(block.type)); if (cur_num_blk >= num_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of %ss (%d) defined in file id %d", ex_name_of_object(block.type), num_blk,exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } /* NOTE: ex_get_file_item is a function that finds the number of element blocks for a specific file and returns that value incremented. */ cur_num_blk=ex_inc_file_item(exoid, ex_get_counter_list(block.type)); start[0] = cur_num_blk; /* write out block id to previously defined id array variable*/ status = nc_put_var1_longlong(exoid, varid, start, (long long*)&block.id); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id to file id %d", ex_name_of_object(block.type), exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } blk_id_ndx = start[0]+1; /* element id index into vblkids array*/ if (block.num_entry == 0) /* Is this a NULL element block? */ blk_stat = 0; /* change element block status to NULL */ else blk_stat = 1; /* change element block status to TRUE */ if ((status = nc_inq_varid (exoid, vblksta, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s status in file id %d", ex_name_of_object(block.type), exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_put_var1_int(exoid, varid, start, &blk_stat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id %"PRId64" status to file id %d", ex_name_of_object(block.type), block.id, exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } if (block.num_entry == 0) {/* Is this a NULL element block? */ return(EX_NOERR); } /* put netcdf file into define mode */ if ((status=nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } switch (block.type) { case EX_EDGE_BLOCK: dneblk = DIM_NUM_ED_IN_EBLK(blk_id_ndx); dnnpe = DIM_NUM_NOD_PER_ED(blk_id_ndx); dnepe = 0; dnfpe = 0; dnape = DIM_NUM_ATT_IN_EBLK(blk_id_ndx); vblkatt = VAR_EATTRIB(blk_id_ndx); vattnam = VAR_NAME_EATTRIB(blk_id_ndx); vnodcon = VAR_EBCONN(blk_id_ndx); vedgcon = 0; vfaccon = 0; break; case EX_FACE_BLOCK: dneblk = DIM_NUM_FA_IN_FBLK(blk_id_ndx); dnnpe = DIM_NUM_NOD_PER_FA(blk_id_ndx); dnepe = 0; dnfpe = 0; dnape = DIM_NUM_ATT_IN_FBLK(blk_id_ndx); vblkatt = VAR_FATTRIB(blk_id_ndx); vattnam = VAR_NAME_FATTRIB(blk_id_ndx); vnodcon = VAR_FBCONN(blk_id_ndx); vnpecnt = VAR_FBEPEC(blk_id_ndx); vedgcon = 0; vfaccon = 0; break; case EX_ELEM_BLOCK: dneblk = DIM_NUM_EL_IN_BLK(blk_id_ndx); dnnpe = DIM_NUM_NOD_PER_EL(blk_id_ndx); dnepe = DIM_NUM_EDG_PER_EL(blk_id_ndx); dnfpe = DIM_NUM_FAC_PER_EL(blk_id_ndx); dnape = DIM_NUM_ATT_IN_BLK(blk_id_ndx); vblkatt = VAR_ATTRIB(blk_id_ndx); vattnam = VAR_NAME_ATTRIB(blk_id_ndx); vnodcon = VAR_CONN(blk_id_ndx); vnpecnt = VAR_EBEPEC(blk_id_ndx); vedgcon = VAR_ECONN(blk_id_ndx); vfaccon = VAR_FCONN(blk_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", block.type,exoid); ex_err("ex_put_block",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* define some dimensions and variables*/ if ((status = nc_def_dim(exoid,dneblk,block.num_entry, &numblkdim )) != NC_NOERR) { if (status == NC_ENAMEINUSE) { /* duplicate entry */ exerrval = status; sprintf(errmsg, "Error: %s %"PRId64" already defined in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define number of entities/block for %s %"PRId64" file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } if ( dnnpe && block.num_nodes_per_entry > 0) { /* A nfaced block would not have any nodes defined... */ if ((status = nc_def_dim(exoid,dnnpe,block.num_nodes_per_entry, &nnodperentdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodes/entity for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } if (dnepe && block.num_edges_per_entry > 0 ) { if ((status = nc_def_dim (exoid,dnepe,block.num_edges_per_entry, &nedgperentdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of edges/entity for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } if ( dnfpe && block.num_faces_per_entry > 0 ) { if ((status = nc_def_dim(exoid,dnfpe,block.num_faces_per_entry, &nfacperentdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of faces/entity for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } /* element attribute array */ if (block.num_attribute > 0) { if ((status = nc_def_dim(exoid, dnape, block.num_attribute, &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of attributes in %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } dims[0] = numblkdim; dims[1] = numattrdim; if ((status = nc_def_var(exoid, vblkatt, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define attributes for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &strdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get string length in file id %d",exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } /* Attribute names... */ dims[0] = numattrdim; dims[1] = strdim; if ((status = nc_def_var(exoid, vattnam, NC_CHAR, 2, dims, &att_name_varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s attribute name array in file id %d", ex_name_of_object(block.type), exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } conn_int_type = NC_INT; if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { conn_int_type = NC_INT64; } /* See if storing an 'nsided' element block (arbitrary 2d polyhedra or super element) */ if (strlen(block.topology) >= 3) { if ((block.topology[0] == 'n' || block.topology[0] == 'N') && (block.topology[1] == 's' || block.topology[1] == 'S') && (block.topology[2] == 'i' || block.topology[2] == 'I')) arbitrary_polyhedra = 1; else if ((block.topology[0] == 'n' || block.topology[0] == 'N') && (block.topology[1] == 'f' || block.topology[1] == 'F') && (block.topology[2] == 'a' || block.topology[2] == 'A')) /* If a FACE_BLOCK, then we are dealing with the faces of the nfaced block. */ arbitrary_polyhedra = block.type == EX_FACE_BLOCK ? 1 : 2; } /* element connectivity array */ if (arbitrary_polyhedra > 0) { if (block.type != EX_FACE_BLOCK && block.type != EX_ELEM_BLOCK) { exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad block type (%d) for nsided/nfaced block in file id %d", block.type, exoid ); ex_err( "ex_put_block", errmsg, exerrval ); return (EX_FATAL); } if (arbitrary_polyhedra == 1) { dims[0] = nnodperentdim; vconn = vnodcon; /* store entity types as attribute of npeid variable -- node/elem, node/face, face/elem*/ strcpy(entity_type1, "NODE"); if (block.type == EX_ELEM_BLOCK) strcpy(entity_type2, "ELEM"); else strcpy(entity_type2, "FACE"); } else if (arbitrary_polyhedra == 2) { dims[0] = nfacperentdim; vconn = vfaccon; /* store entity types as attribute of npeid variable -- node/elem, node/face, face/elem*/ strcpy(entity_type1, "FACE"); strcpy(entity_type2, "ELEM"); } if ((status = nc_def_var(exoid, vconn, conn_int_type, 1, dims, &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* element face-per-element or node-per-element count array */ dims[0] = numblkdim; if ((status = nc_def_var(exoid, vnpecnt, conn_int_type, 1, dims, &npeid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create face- or node- per-entity count array for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id, exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_put_att_text(exoid, npeid, "entity_type1", strlen(entity_type1)+1, entity_type1)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store entity type attribute text for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id, exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_put_att_text(exoid, npeid, "entity_type2", strlen(entity_type2)+1, entity_type2)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store entity type attribute text for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id, exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } else { /* "Normal" (non-polyhedra) element block type */ dims[0] = numblkdim; dims[1] = nnodperentdim; if ((status = nc_def_var(exoid, vnodcon, conn_int_type, 2, dims, &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, connid, 1); } /* store element type as attribute of connectivity variable */ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(block.topology)+1, block.topology)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s type name %s in file id %d", ex_name_of_object(block.type), block.topology,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if (arbitrary_polyhedra == 0) { if (vedgcon && block.num_edges_per_entry ) { dims[0] = numblkdim; dims[1] = nedgperentdim; if ((status = nc_def_var(exoid, vedgcon, conn_int_type, 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create edge connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } if ( vfaccon && block.num_faces_per_entry ) { dims[0] = numblkdim; dims[1] = nfacperentdim; if ((status = nc_def_var(exoid, vfaccon, conn_int_type, 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create face connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(block.type), block.id,exoid); ex_err("ex_put_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } } /* leave define mode */ if ((exerrval=nc_enddef (exoid)) != NC_NOERR) { sprintf(errmsg, "Error: failed to complete %s definition in file id %d", ex_name_of_object(block.type), exoid); ex_err("ex_put_block",errmsg,exerrval); return (EX_FATAL); } /* Output a dummy empty attribute name in case client code doesn't write anything; avoids corruption in some cases. */ if (block.num_attribute > 0 && att_name_varid >= 0) { size_t count[2]; char *text = ""; size_t i; count[0] = 1; start[1] = 0; count[1] = strlen(text)+1; for (i = 0; i < block.num_attribute; i++) { start[0] = i; nc_put_vara_text(exoid, att_name_varid, start, count, text); } } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_block",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_cmap_params.c000066400000000000000000000411421225312213100235350ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_cmap_params() ***************************************************************************** * This function outputs the communication map parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * node_cmap_ids - Pointer to vector of nodal communication * set IDs. * node_cmap_node_cnts - Pointer to a vector which contains a count of * the number of FEM nodes for each nodal * communication map. * elem_cmap_ids - Pointer to vector for retrieval of elemental * communication set IDs. * elem_cmap_elem_cnts - Pointer to a vector which contains a count of * the number of FEM elements for each elemental * communication map. * processor - The processor the file being read was written * for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include // for size_t #include // for int64_t #include // for sprintf #include #include #include int ex_put_cmap_params(int exoid, void_int *node_cmap_ids, void_int *node_cmap_node_cnts, void_int *elem_cmap_ids, void_int *elem_cmap_elem_cnts, int64_t processor ) { const char *func_name="ex_put_cmap_params"; size_t num_n_comm_maps, num_e_comm_maps; size_t ncnt_cmap, ecnt_cmap; size_t icm; int varid, dimid[1], n_varid, e_varid, status; int n_varid_idx, e_varid_idx; size_t start[1]; char ftype[2]; int64_t nl_ncnt_cmap, nl_ecnt_cmap; int nmstat; char errmsg[MAX_ERR_LENGTH]; int index_type = NC_INT; int id_type = NC_INT; int format; nc_inq_format(exoid, &format); if ((ex_int64_status(exoid) & EX_BULK_INT64_DB) || (format == NC_FORMAT_NETCDF4)) { index_type = NC_INT64; } if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { id_type = NC_INT64; } /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* ** with the new database format, this function sould only ** be used for writing a parallel file */ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to get file type from file ID %d\n", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* make sure that this is a parallel file */ if (ftype[0] != 'p') { exerrval = EX_MSG; sprintf(errmsg, "Error: function for use with parallel files only, file ID %d\n", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Put NetCDF file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to file ID %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Check to see if there are nodal communications maps in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_N_CMAPS, &dimid[0])) != NC_NOERR) { num_n_comm_maps = 0; } else { if ((status = nc_inq_dimlen(exoid, dimid[0], &num_n_comm_maps)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* * Add dimensions for the size of the number of nodal * communication maps. */ if (num_n_comm_maps > 0) { /* add the communications data index variable */ if ((status = nc_def_var(exoid, VAR_N_COMM_DATA_IDX, index_type, 1, dimid, &n_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add dimensions for all of the nodal communication maps */ ncnt_cmap = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { for(icm=0; icm < num_n_comm_maps; icm++) { ncnt_cmap += ((int64_t*)node_cmap_node_cnts)[icm]; } } else { for(icm=0; icm < num_n_comm_maps; icm++) { ncnt_cmap += ((int*)node_cmap_node_cnts)[icm]; } } if ((status = nc_def_dim(exoid, DIM_NCNT_CMAP, ncnt_cmap, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension for \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variables for the nodal IDS and processor vectors */ if ((status = nc_def_var(exoid, VAR_N_COMM_NIDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_N_COMM_PROC, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_n_comm_maps > 0)" */ /* Check to see if there are elemental communications maps in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_E_CMAPS, &dimid[0])) != NC_NOERR) { num_e_comm_maps = 0; } else{ if ((status = nc_inq_dimlen(exoid, dimid[0], &num_e_comm_maps)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* * Add dimensions for the size of the number of elemental * communication maps. */ if (num_e_comm_maps > 0) { /* add the communications data index variable */ if ((status = nc_def_var(exoid, VAR_E_COMM_DATA_IDX, index_type, 1, dimid, &e_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add dimensions for each of the nodal communication maps */ ecnt_cmap = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { for(icm=0; icm < num_e_comm_maps; icm++) ecnt_cmap += ((int64_t*)elem_cmap_elem_cnts)[icm]; } else { for(icm=0; icm < num_e_comm_maps; icm++) ecnt_cmap += ((int*)elem_cmap_elem_cnts)[icm]; } if ((status = nc_def_dim(exoid, DIM_ECNT_CMAP, ecnt_cmap, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension for \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variables for the element IDS and processor vectors */ if ((status = nc_def_var(exoid, VAR_E_COMM_EIDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_E_COMM_PROC, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_E_COMM_SIDS, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_e_comm_maps > 0)" */ /* Exit define mode */ ex_leavedef(exoid, func_name); /* Set the status of the nodal communication maps */ if (num_n_comm_maps > 0) { if ((status = nc_inq_varid(exoid, VAR_N_COMM_STAT, &n_varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } nl_ncnt_cmap = 0; /* reset this for index */ for(icm=0; icm < num_n_comm_maps; icm++) { size_t ncnc; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ncnc = ((int64_t*)node_cmap_node_cnts)[icm]; } else { ncnc = ((int*)node_cmap_node_cnts)[icm]; } start[0] = icm; if (ncnc > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, n_varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* increment to the next starting position */ nl_ncnt_cmap += ncnc; /* fill the cmap data index */ if ((status = nc_put_var1_longlong(exoid, n_varid_idx, start, (long long*)&nl_ncnt_cmap)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output int elem map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "for(icm=0; icm < num_n_comm_maps; icm++)" */ /* Get the variable ID for the comm map IDs vector */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_IDS, &n_varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the nodal comm map IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, n_varid, node_cmap_ids); } else { status = nc_put_var_int(exoid, n_varid, node_cmap_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_n_comm_maps > 0)" */ /* Set the status of the elemental communication maps */ if (num_e_comm_maps > 0) { /* Get variable ID for elemental status vector */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_STAT, &e_varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } nl_ecnt_cmap = 0; /* reset this for index */ for(icm=0; icm < num_e_comm_maps; icm++) { size_t ecec; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ecec = ((int64_t*)elem_cmap_elem_cnts)[icm]; } else { ecec = ((int*)elem_cmap_elem_cnts)[icm]; } start[0] = icm; if (ecec > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, e_varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* increment to the next starting position */ nl_ecnt_cmap += ecec; /* fill the cmap data index */ if ((status = nc_put_var1_longlong(exoid, e_varid_idx, start, (long long*)&nl_ecnt_cmap)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output int elem map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "for(icm=0; icm < num_e_comm_maps; icm++)" */ /* Get the variable ID for the elemental comm map IDs vector */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_IDS, &e_varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the elemental comm map IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, e_varid, elem_cmap_ids); } else { status = nc_put_var_int(exoid, e_varid, elem_cmap_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_e_comm_maps > 0)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_cmap_params_cc.c000066400000000000000000000512611225312213100242050ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_cmap_params_cc() ***************************************************************************** * This function outputs the concantenated list of communication map * parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * node_cmap_ids - Pointer to vector of nodal communication * set IDs. * node_cmap_node_cnts - Pointer to a vector which contains a count of * the number of FEM nodes for each nodal * communication map. * elem_cmap_ids - Pointer to vector for retrieval of elemental * communication set IDs. * elem_cmap_elem_cnts - Pointer to a vector which contains a count of * the number of FEM elements for each elemental * communication map. * proc_ids - The processor the file being read was written * for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include int ex_put_cmap_params_cc(int exoid, void_int *node_cmap_ids, void_int *node_cmap_node_cnts, void_int *node_proc_ptrs, void_int *elem_cmap_ids, void_int *elem_cmap_elem_cnts, void_int *elem_proc_ptrs ) { const char *func_name="ex_put_cmap_params_cc"; size_t num_n_comm_maps, num_e_comm_maps, num_procs_in_file; int status, icm, n_varid[2], e_varid[2], iproc; int varid, n_dimid[1], e_dimid[1]; int n_varid_idx, e_varid_idx; int num_icm; size_t start[1], count[1]; size_t ecnt_cmap, ncnt_cmap; long long nl_ecnt_cmap, nl_ncnt_cmap; long long *n_var_idx = NULL; long long *e_var_idx = NULL; int nmstat; char errmsg[MAX_ERR_LENGTH]; int format; int index_type, bulk_type; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* See if using NC_FORMAT_NETCDF4 format... */ nc_inq_format(exoid, &format); if ((ex_int64_status(exoid) & EX_BULK_INT64_DB) || (format == NC_FORMAT_NETCDF4)) { index_type = NC_INT64; } else { index_type = NC_INT; } if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { bulk_type = NC_INT64; } else { bulk_type = NC_INT; } /* Get the number of processors in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &n_dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dimension ID for \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, n_dimid[0], &num_procs_in_file)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * since I cannot get variables while in define mode, I need to * get the cmap information index variables before I go into * define mode */ /* Check to see if there are nodal communications maps in the file */ if (nc_inq_dimid(exoid, DIM_NUM_N_CMAPS, &n_dimid[0]) != NC_NOERR) { num_n_comm_maps = 0; } else { if ((status = nc_inq_dimlen(exoid, n_dimid[0], &num_n_comm_maps)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in \ file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (num_n_comm_maps > 0) { /* Get the variable ID for the comm map index vector */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_INFO_IDX, &n_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* allocate space for the index variable */ n_var_idx = malloc((num_procs_in_file + 1) * sizeof(long long)); if (!n_var_idx) { exerrval = EX_MSG; sprintf(errmsg, "Error: insufficient memory to read index variable from file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* and set the last value of the index */ n_var_idx[0] = 0; /* get the communication map info index */ #if defined(NC_NETCDF4) status = nc_get_var_longlong(exoid, n_varid_idx, &(n_var_idx[1])); #else status = nc_get_var_int(exoid, n_varid_idx, &(n_var_idx[1])); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* "if (num_n_comm_maps > 0)" */ /* Check to see if there are elemental communications maps in the file */ if ((status = nc_inq_dimid(exoid, DIM_NUM_E_CMAPS, &e_dimid[0])) != NC_NOERR) { num_e_comm_maps = 0; } else { if ((status = nc_inq_dimlen(exoid, e_dimid[0], &num_e_comm_maps)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in \ file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (num_e_comm_maps > 0) { /* Get the variable ID for the comm map index vector */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_INFO_IDX, &e_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* allocate space for the index variable */ e_var_idx = malloc((num_procs_in_file + 1) * sizeof(long long)); if (!e_var_idx) { exerrval = EX_MSG; sprintf(errmsg, "Error: insufficient memory to read index variable from file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* and set the first value of the index */ e_var_idx[0] = 0; /* get the communication map info index */ #if defined NC_NETCDF4 status = nc_get_var_longlong(exoid, e_varid_idx, &(e_var_idx[1])); #else status = nc_get_var_int(exoid, e_varid_idx, &(e_var_idx[1])); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* "if (num_e_comm_maps >0)" */ /* Put NetCDF file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file ID %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Add dimensions for the size of the number of nodal * communication maps. */ if (num_n_comm_maps > 0) { /* add the communications data index variable */ if ((status = nc_def_var(exoid, VAR_N_COMM_DATA_IDX, index_type, 1, n_dimid, &n_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* now add up all of the nodal communications maps */ ncnt_cmap = 0; for(iproc=0; iproc < num_procs_in_file; iproc++) { num_icm = n_var_idx[iproc+1] - n_var_idx[iproc]; for(icm=0; icm < num_icm; icm++) if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ncnt_cmap += ((int64_t*)node_cmap_node_cnts)[((int64_t*)node_proc_ptrs)[iproc]+icm]; } else { ncnt_cmap += ((int*)node_cmap_node_cnts)[((int*)node_proc_ptrs)[iproc]+icm]; } } if ((status = nc_def_dim(exoid, DIM_NCNT_CMAP, ncnt_cmap, &n_dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension for \"%s\" of size %lu in file ID %d", DIM_NCNT_CMAP, (unsigned long)ncnt_cmap, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variables for the nodal IDS and processor vectors */ if ((status = nc_def_var(exoid, VAR_N_COMM_NIDS, bulk_type, 1, n_dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_N_COMM_PROC, NC_INT, 1, n_dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_n_comm_maps > 0)" */ /* * Add dimensions for the size of the number of elemental * communication maps. */ if (num_e_comm_maps > 0) { /* add the communications data index variable */ if ((status = nc_def_var(exoid, VAR_E_COMM_DATA_IDX, index_type, 1, e_dimid, &e_varid_idx)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* now add up all of the nodal communications maps */ ecnt_cmap = 0; for(iproc=0; iproc < num_procs_in_file; iproc++) { num_icm = e_var_idx[iproc+1] - e_var_idx[iproc]; for(icm=0; icm < num_icm; icm++) if (ex_int64_status(exoid) & EX_BULK_INT64_API) { ecnt_cmap += ((int64_t*)elem_cmap_elem_cnts)[((int64_t*)elem_proc_ptrs)[iproc]+icm]; } else { ecnt_cmap += ((int*)elem_cmap_elem_cnts)[((int*)elem_proc_ptrs)[iproc]+icm]; } } /* Add dimensions for elemental communications maps */ if ((status = nc_def_dim(exoid, DIM_ECNT_CMAP, ecnt_cmap, &e_dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension for \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variables for the element IDS and processor vectors */ if ((status = nc_def_var(exoid, VAR_E_COMM_EIDS, bulk_type, 1, e_dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_E_COMM_PROC, NC_INT, 1, e_dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_E_COMM_SIDS, bulk_type, 1, e_dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add variable \"%s\" in file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_e_comm_maps > 0)" */ /* Exit define mode */ ex_leavedef(exoid, func_name); /* Set the status of the nodal communication maps */ if (num_n_comm_maps > 0) { /* need to get the two "n_comm_*" variable ids */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_STAT, &n_varid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the comm map IDs vector */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_IDS, &n_varid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* reset the index variable */ nl_ncnt_cmap = 0; for(iproc=0; iproc < num_procs_in_file; iproc++) { size_t proc_ptr; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { proc_ptr = ((int64_t*)node_proc_ptrs)[iproc]; } else { proc_ptr = ((int*)node_proc_ptrs)[iproc]; } num_icm = n_var_idx[iproc+1] - n_var_idx[iproc]; for(icm=0; icm < num_icm; icm++) { size_t cnt; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { cnt = ((int64_t*)node_cmap_node_cnts)[proc_ptr+icm]; } else { cnt = ((int*)node_cmap_node_cnts)[proc_ptr+icm]; } start[0] = n_var_idx[iproc] + icm; if (cnt > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, n_varid[0], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* increment to the next starting position */ nl_ncnt_cmap += cnt; /* fill the data index variable */ status = nc_put_var1_longlong(exoid, n_varid_idx, start, &nl_ncnt_cmap); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output int elem map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "for(icm=0; icm < num_icm; icm++)" */ if (num_icm > 0) { /* Output the nodal comm map IDs */ start[0] = n_var_idx[iproc]; count[0] = num_icm; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_vara_longlong(exoid, n_varid[1], start, count, &((long long*)node_cmap_ids)[proc_ptr]); } else { status = nc_put_vara_int(exoid, n_varid[1], start, count, &((int*)node_cmap_ids)[proc_ptr]); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } } /* End "for(iproc=0; iproc < num_procs_in_file; iproc++)" */ /* free up memory for index */ free(n_var_idx); } /* End "if (num_n_comm_maps > 0)" */ /* Set the status of the elemental communication maps */ if (num_e_comm_maps > 0) { /* need to get the two "e_comm_*" variables" */ /* Get variable ID for elemental status vector */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_STAT, &e_varid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the elemental comm map IDs vector */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_IDS, &e_varid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* reset the index variable */ nl_ecnt_cmap = 0; for(iproc=0; iproc < num_procs_in_file; iproc++) { size_t proc_ptr; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { proc_ptr = ((int64_t*)elem_proc_ptrs)[iproc]; } else { proc_ptr = ((int*)elem_proc_ptrs)[iproc]; } num_icm = e_var_idx[iproc+1] - e_var_idx[iproc]; for(icm=0; icm < num_icm; icm++) { size_t cnt; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { cnt = ((int64_t*)elem_cmap_elem_cnts)[proc_ptr+icm]; } else { cnt = ((int*)elem_cmap_elem_cnts)[proc_ptr+icm]; } start[0] = e_var_idx[iproc] + icm; if (cnt > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, e_varid[0], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* increment to the next starting position */ nl_ecnt_cmap += cnt; /* fill the data index variable */ status = nc_put_var1_longlong(exoid, e_varid_idx, start, &nl_ecnt_cmap); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output int elem map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "for(icm=0; icm < num_icm; icm++)" */ if (num_icm > 0) { /* Output the elemental comm map IDs */ start[0] = e_var_idx[iproc]; count[0] = num_icm; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_vara_longlong(exoid, e_varid[1], start, count, &((long long*)elem_cmap_ids)[proc_ptr]); } else { status = nc_put_vara_int(exoid, e_varid[1], start, count, &((int*)elem_cmap_ids)[proc_ptr]); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } } /* End "for(iproc=0; iproc < num_procs_in_file; iproc++)" */ free(e_var_idx); } /* End "if (num_e_comm_maps > 0)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_all_blocks.c000066400000000000000000000562761225312213100247240ustar00rootroot00000000000000/* * 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 #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the parameters used to describe all element, edge, and face blocks * \param exoid exodus file id * \param param block parameters structure */ int ex_put_concat_all_blocks (int exoid, const ex_block_params *param) { int varid, dimid, dims[2], strdim, *eb_stat, *ed_stat, *fa_stat; int temp; size_t iblk; size_t i; int status; size_t num_elem_blk = 0; size_t num_edge_blk = 0; size_t num_face_blk = 0; 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 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 */ int* edge_id_int = NULL; int* face_id_int = NULL; int* elem_id_int = NULL; int64_t* edge_id_int64 = NULL; int64_t* face_id_int64 = NULL; int64_t* elem_id_int64 = NULL; int ids_int64 = ex_int64_status(exoid) & EX_IDS_INT64_API; 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 ex_entity_type 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 */ size_t num_maps[sizeof(dim_num_maps)/sizeof(dim_num_maps[0])]; size_t num_map_dims = sizeof(dim_num_maps)/sizeof(dim_num_maps[0]); if (ids_int64) { edge_id_int64 = param->edge_blk_id; face_id_int64 = param->face_blk_id; elem_id_int64 = param->elem_blk_id; } else { edge_id_int = param->edge_blk_id; face_id_int = param->face_blk_id; elem_id_int = param->elem_blk_id; } exerrval = 0; /* clear error code */ /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_STR_NAME, &strdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get string length in file id %d",exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); return (EX_FATAL); } if ( param->define_maps ) { for ( i = 0; i < num_map_dims; ++i ) { if ((status = nc_inq_dimid(exoid, dim_num_maps[i], &dimid)) != NC_NOERR) { exerrval = status; sprintf( errmsg, "Error: failed to find node map size of file id %d", exoid ); ex_err( "ex_put_concat_all_blocks", errmsg, exerrval ); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, num_maps+i)) != NC_NOERR) { exerrval = status; sprintf( errmsg, "Error: failed to retrieve node map size of file id %d", exoid ); ex_err( "ex_put_concat_all_blocks", errmsg, exerrval ); return (EX_FATAL); } } } #define EX_PREPARE_BLOCK(TNAME,WNAME,DNUMNAME,VSTATNAME,VIDNAME,LNUMNAME,SNUMNAME,SIDNAME,GSTAT) \ /* first check if any TNAME blocks are specified \ * OK if zero... \ */ \ if ((status = (nc_inq_dimid(exoid, DNUMNAME, &dimid))) == NC_NOERR) { \ WNAME = 1; \ \ /* Get number of TNAME blocks defined for this file */ \ if ((status = nc_inq_dimlen(exoid,dimid,&LNUMNAME)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to get number of " TNAME " blocks in file id %d", \ exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ return (EX_FATAL); \ } \ \ /* Fill out the TNAME block status array */ \ if (!(GSTAT = malloc(LNUMNAME*sizeof(int)))) { \ exerrval = EX_MEMFAIL; \ sprintf(errmsg, \ "Error: failed to allocate space for " TNAME " block status array in file id %d", \ exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ return (EX_FATAL); \ } \ \ for (i=0;inum_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 ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); return (EX_FATAL); } #define EX_PREPARE_ATTRIB_ARRAY(TNAME,CURBLK,DNAME,DVAL,ID,VANAME,VADIM0,VADIM1,VANNAME) \ if (DVAL[iblk] > 0) { \ if ((status = nc_def_dim (exoid, \ DNAME(CURBLK+1), \ DVAL[iblk], &VADIM1)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define number of attributes in " TNAME " block %"PRId64" in file id %d", \ ID,exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ \ dims[0] = VADIM0; \ dims[1] = VADIM1; \ \ if ((status = nc_def_var (exoid, VANAME(CURBLK+1), \ nc_flt_code(exoid), 2, dims, &temp)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define attributes for " TNAME " block %"PRId64" in file id %d", \ ID,exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ ex_compress_variable(exoid, temp, 2); \ \ /* Attribute names... */ \ dims[0] = VADIM1; \ dims[1] = strdim; \ \ if ((status = nc_def_var(exoid, VANNAME(CURBLK+1), NC_CHAR, 2, dims, &temp)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define " TNAME " attribute name array in file id %d",exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ } #define EX_PREPARE_CONN(TNAME,BLK,BLKID,BLKSZ,VNAME,DNAME) \ if ( DNAME > 0 ) { \ int conn_int_type = NC_INT; \ if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { \ conn_int_type = NC_INT64; \ } \ dims[0] = BLKSZ; \ dims[1] = DNAME; \ \ if ((status = nc_def_var(exoid, VNAME(BLK+1), \ conn_int_type, 2, dims, &connid)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to create " TNAME " connectivity array for block %"PRId64" in file id %d", \ BLKID,exoid); \ ex_err("ex_put_concat_all_blocks",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ ex_compress_variable(exoid, connid, 1); \ } /* Iterate over edge blocks ... */ for (iblk = 0; iblk < num_edge_blk; ++iblk) { ex_entity_id eb_id; if (ids_int64) eb_id = edge_id_int64[iblk]; else eb_id = edge_id_int[iblk]; cur_num_edge_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK)); if (cur_num_edge_blk >= (int)num_edge_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of edge blocks (%ld) defined in file id %d", (long)num_edge_blk,exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; } /* NOTE: ex_inc_file_item is used to find the number of edge blocks for a specific file and returns that value incremented. */ cur_num_edge_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_EDGE_BLOCK)); if (param->num_edge_this_blk[iblk] == 0) /* Is this a NULL edge block? */ continue; /* define some dimensions and variables*/ if ((status = nc_def_dim(exoid, DIM_NUM_ED_IN_EBLK(cur_num_edge_blk+1), param->num_edge_this_blk[iblk],&numedbdim)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { /* duplicate entry */ sprintf(errmsg, "Error: edge block %"PRId64" already defined in file id %d", eb_id,exoid); } else { sprintf(errmsg, "Error: failed to define number of edges/block for block %"PRId64" file id %d", eb_id,exoid); } ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_def_dim(exoid, DIM_NUM_NOD_PER_ED(cur_num_edge_blk+1), param->num_nodes_per_edge[iblk],&nednoddim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodes/edge for block %"PRId64" in file id %d", eb_id,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, eb_id,VAR_EATTRIB,numedbdim,numattrdim,VAR_NAME_EATTRIB); EX_PREPARE_CONN("edge block",cur_num_edge_blk, eb_id,numedbdim,VAR_EBCONN,nednoddim); /* store edge type as attribute of connectivity variable */ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->edge_type[iblk])+1, (void*)param->edge_type[iblk])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store edge type name %s in file id %d", param->edge_type[iblk],exoid); 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) { ex_entity_id fb_id; if (ids_int64) fb_id = face_id_int64[iblk]; else fb_id = face_id_int[iblk]; cur_num_face_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK)); if (cur_num_face_blk >= (int)num_face_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of face blocks (%ld) defined in file id %d", (long)num_face_blk,exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; } /* NOTE: ex_inc_file_item is used to find the number of edge blocks for a specific file and returns that value incremented. */ cur_num_face_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_FACE_BLOCK)); if (param->num_face_this_blk[iblk] == 0) /* Is this a NULL face block? */ continue; /* define some dimensions and variables*/ if ((status = nc_def_dim (exoid, DIM_NUM_FA_IN_FBLK(cur_num_face_blk+1), param->num_face_this_blk[iblk],&numfabdim)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { /* duplicate entry */ sprintf(errmsg, "Error: face block %"PRId64" already defined in file id %d", fb_id,exoid); } else { sprintf(errmsg, "Error: failed to define number of faces/block for block %"PRId64" file id %d", fb_id,exoid); } ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_def_dim (exoid, DIM_NUM_NOD_PER_FA(cur_num_face_blk+1), param->num_nodes_per_face[iblk],&nfanoddim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodes/face for block %"PRId64" in file id %d", fb_id,exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* face attribute array */ EX_PREPARE_ATTRIB_ARRAY("face",cur_num_face_blk,DIM_NUM_ATT_IN_FBLK,param->num_attr_face, fb_id,VAR_FATTRIB,numfabdim,numattrdim,VAR_NAME_FATTRIB); EX_PREPARE_CONN("face block",cur_num_face_blk,fb_id,numfabdim,VAR_FBCONN,nfanoddim); /* store face type as attribute of connectivity variable */ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->face_type[iblk])+1, (void*)param->face_type[iblk])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store face type name %s in file id %d", param->face_type[iblk],exoid); 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) { ex_entity_id eb_id; if (ids_int64) eb_id = elem_id_int64[iblk]; else eb_id = elem_id_int[iblk]; cur_num_elem_blk=ex_get_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK)); if (cur_num_elem_blk >= (int)num_elem_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of element blocks (%ld) defined in file id %d", (long)num_elem_blk,exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; } /* NOTE: ex_inc_file_item is used to find the number of element blocks for a specific file and returns that value incremented. */ cur_num_elem_blk=ex_inc_file_item(exoid, ex_get_counter_list(EX_ELEM_BLOCK)); if (param->num_elem_this_blk[iblk] == 0) /* Is this a NULL element block? */ continue; /* define some dimensions and variables*/ if ((status = nc_def_dim (exoid, DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1), param->num_elem_this_blk[iblk], &numelbdim)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { /* duplicate entry */ sprintf(errmsg, "Error: element block %"PRId64" already defined in file id %d", eb_id,exoid); } else { sprintf(errmsg, "Error: failed to define number of elements/block for block %"PRId64" file id %d", eb_id,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 ((status = nc_def_dim (exoid, DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1), param->num_nodes_per_elem[iblk], &nelnoddim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodes/element for block %"PRId64" in file id %d", eb_id,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 ((status = nc_def_dim (exoid, DIM_NUM_EDG_PER_EL(cur_num_elem_blk+1), param->num_edges_per_elem[iblk],&neledgdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of edges/element for block %"PRId64" in file id %d", eb_id,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 ((status = nc_def_dim(exoid, DIM_NUM_FAC_PER_EL(cur_num_elem_blk+1), param->num_faces_per_elem[iblk],&nelfacdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of faces/element for block %"PRId64" in file id %d", eb_id,exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } EX_PREPARE_ATTRIB_ARRAY("element",cur_num_elem_blk,DIM_NUM_ATT_IN_BLK,param->num_attr_elem, eb_id,VAR_ATTRIB,numelbdim,numattrdim,VAR_NAME_ATTRIB); EX_PREPARE_CONN("nodal",cur_num_elem_blk,eb_id,numelbdim,VAR_CONN,nelnoddim); /* store element type as attribute of connectivity variable */ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(param->elem_type[iblk])+1, (void*)param->elem_type[iblk])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store element type name %s in file id %d", param->elem_type[iblk],exoid); 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,eb_id,numelbdim,VAR_ECONN,neledgdim); EX_PREPARE_CONN( "face",cur_num_elem_blk,eb_id,numelbdim,VAR_FCONN,nelfacdim); } /* Define the element map here to avoid a later redefine call */ if ( param->define_maps != 0 ) { size_t map_type; for ( map_type = 0; map_type < num_map_dims; ++map_type ) { if ((status = nc_inq_dimid(exoid, dim_size_maps[map_type], &dims[0])) != NC_NOERR) { exerrval = status; sprintf( errmsg, "Error: could not find map size dimension %s in file id %d", dim_size_maps[map_type], exoid ); ex_err( "ex_put_concat_all_blocks", errmsg, exerrval ); } for ( i = 1; i <= num_maps[map_type]; ++i ) { const char* mapname = ex_name_of_map( map_enums[map_type], i ); if (nc_inq_varid(exoid, mapname, &temp) != NC_NOERR) { int map_int_type = NC_INT; if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_int_type = NC_INT64; } if ((status = nc_def_var(exoid, mapname, map_int_type, 1, dims, &temp)) != NC_NOERR) { exerrval = status; if ( status == NC_ENAMEINUSE ) { sprintf( errmsg, "Error: number map %s already exists in file id %d", mapname, exoid ); } else { sprintf( errmsg, "Error: failed to create number map array %s in file id %d", mapname, exoid ); } ex_err( "ex_put_concat_all_blocks", errmsg, exerrval ); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 1); \ } } } } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; 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 (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_concat_all_blocks",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_elem_block.c000066400000000000000000000353321225312213100247010ustar00rootroot00000000000000/* * 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_this_blk number of attributes * int define_maps if != 0, write maps, else don't * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the parameters used to describe an element block * \param exoid exodus file id * \param elem_blk_id element block id * \param elem_type element type string * \param num_elem_this_blk number of elements in the element blk * \param num_nodes_per_elem number of nodes per element block * \param num_attr_this_blk number of attributes * \param define_maps if != 0, write maps, else don't */ int ex_put_concat_elem_block (int exoid, const void_int* elem_blk_id, char *elem_type[], const void_int* num_elem_this_blk, const void_int* num_nodes_per_elem, const void_int* num_attr_this_blk, int define_maps) { int i, varid, dimid, dims[2], strdim, *eb_array; int temp; int iblk; int status; int num_elem_blk; int map_int_type, conn_int_type; size_t length; int cur_num_elem_blk, nelnoddim, numelbdim, numattrdim, connid, numelemdim, numnodedim; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any element blocks are specified * OK if zero... */ if (nc_inq_dimid(exoid, DIM_NUM_EL_BLK, &dimid) != NC_NOERR) { return (EX_NOERR); } /* Get number of element blocks defined for this file */ if ((status = nc_inq_dimlen(exoid,dimid,&length)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of element blocks in file id %d", exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); return (EX_FATAL); } num_elem_blk = length; /* Fill out the element block status array */ if (!(eb_array = malloc(num_elem_blk*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate space for element block status array in file id %d", exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { for (i=0;i= num_elem_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of element blocks (%d) defined in file id %d", num_elem_blk,exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); goto error_ret; } /* 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, ex_get_counter_list(EX_ELEM_BLOCK)); if (eb_array[iblk] == 0) /* Is this a NULL element block? */ continue; /* define some dimensions and variables*/ if ((status = nc_def_dim(exoid, DIM_NUM_EL_IN_BLK(cur_num_elem_blk+1), num_elem, &numelbdim)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { /* duplicate entry */ sprintf(errmsg, "Error: element block %"PRId64" already defined in file id %d", eb_id,exoid); } else { sprintf(errmsg, "Error: failed to define number of elements/block for block %"PRId64" file id %d", eb_id,exoid); } ex_err("ex_put_concat_elem_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_def_dim(exoid, DIM_NUM_NOD_PER_EL(cur_num_elem_blk+1), num_npe, &nelnoddim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodes/element for block %"PRId64" in file id %d", eb_id,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 ((status = nc_def_var (exoid, VAR_CONN(cur_num_elem_blk+1), conn_int_type, 2, dims, &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create connectivity array for block %"PRId64" in file id %d", eb_id,exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, connid, 1); /* store element type as attribute of connectivity variable */ if ((status = nc_put_att_text(exoid, connid, ATT_NAME_ELB, strlen(elem_type[iblk])+1, (void*)elem_type[iblk])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store element type name %s in file id %d", elem_type[iblk],exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* element attribute array */ if (num_attr > 0) { if ((status = nc_def_dim (exoid, DIM_NUM_ATT_IN_BLK(cur_num_elem_blk+1), num_attr, &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of attributes in block %"PRId64" in file id %d", eb_id,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 ((status = nc_def_var(exoid, VAR_NAME_ATTRIB(cur_num_elem_blk+1), NC_CHAR, 2, dims, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define element attribute name array in file id %d",exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } eb_array[iblk] = temp; dims[0] = numelbdim; dims[1] = numattrdim; if ((status = nc_def_var(exoid, VAR_ATTRIB(cur_num_elem_blk+1), nc_flt_code(exoid), 2, dims, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define attributes for element block %"PRId64" in file id %d", eb_id,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 (nc_inq_varid(exoid, VAR_ELEM_NUM_MAP, &temp) != NC_NOERR) { /* Map does not exist */ /* Possible to have zero elements but >0 element blocks. * Only define map if there are nonzero elements */ if (nc_inq_dimid(exoid, DIM_NUM_ELEM, &numelemdim) == NC_NOERR) { dims[0] = numelemdim; if ((status = nc_def_var(exoid, VAR_ELEM_NUM_MAP, map_int_type, 1, dims, &temp)) != NC_NOERR) { exerrval = status; if (status == 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 */ } ex_compress_variable(exoid, temp, 1); } } /* Do the same for the node numbering map */ if (nc_inq_varid(exoid, VAR_NODE_NUM_MAP, &temp) != NC_NOERR) { /* Map does not exist */ if ((nc_inq_dimid(exoid, DIM_NUM_NODES, &numnodedim)) == NC_NOERR) { dims[0] = numnodedim; if ((status = nc_def_var(exoid, VAR_NODE_NUM_MAP, map_int_type, 1, dims, &temp)) != NC_NOERR) { exerrval = status; if (status == 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 */ } ex_compress_variable(exoid, temp, 1); } } } /* leave define mode */ if ((status = nc_enddef(exoid)) != NC_NOERR) { exerrval = status; 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); } { /* Write dummy attribute name. Without this we get corruption in the * attribute name. */ size_t start[2], count[2]; char *text = ""; count[0] = 1; start[1] = 0; count[1] = strlen(text)+1; for (iblk = 0; iblk < num_elem_blk; iblk++) { size_t num_attr; if (eb_array[iblk] == 0) /* Is this a NULL element block? */ continue; if (ex_int64_status(exoid) & EX_IDS_INT64_API) { num_attr = ((int64_t*)num_attr_this_blk)[iblk]; } else { num_attr = ((int*)num_attr_this_blk)[iblk]; } for (i = 0; i < num_attr; i++) { start[0] = i; nc_put_vara_text(exoid, eb_array[iblk], start, count, text); } } } free(eb_array); return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_concat_elem_block",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_node_sets.c000066400000000000000000000145371225312213100245740ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_concat_sets()(exoid, EX_NODE_SET, &set_specs) The function ex_put_concat_node_sets() writes the node set ID's, node sets node count array, node sets distribution factor count array, node sets node list pointers array, node sets distribution factor pointer, node set node list, and node set distribution factors for all of the node sets. ``Concatenated node sets'' refers to the arrays required to define all of the node sets (ID array, counts arrays, pointers arrays, node list array, and distribution factors array) as described in Section 3.10 on page 11. Writing concatenated node sets is more efficient than writing individual node sets. See #Efficiency for a discussion of efficiency issues. Because the distribution factors are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_concat_node_sets() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - the number of node sets specified in a call to ex_put_init() was zero or has been exceeded. - a node set with the same ID has already been stored. - the number of distribution factors specified for one of the node sets is not zero and is not equal to the number of nodes in the same node set. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_ids Array containing the node set ID for each set. \param[in] num_nodes_per_set Array containing the number of nodes for each set. \param[in] num_dist_per_set Array containing the number of distribution factors for each set. \param[in] node_sets_node_index Array containing the indices into the \c node_set_node_list which are the locations of the first node for each set. These indices are 0-based. Pass \c NULL for remaining parameters to just set the nodeset parameters and not output nodeset data. \param[in] node_sets_df_index Array containing the indices into the \c node_set_dist_list which are the locations of the first distribution factor for each set. These indices are 0-based. \param[in] node_sets_node_list Array containing the nodes for all sets. Internal node IDs are used in this list (See Section LocalNodeIds). \param[in] node_sets_dist_fact Array containing the distribution factors for all sets. For example, the following code will write out two node sets in a concatenated format: \code int ids[2], num_nodes_per_set[2], node_ind[2], node_list[8], num_df_per_set[2], df_ind[2], error, exoid; float dist_fact[8]; 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); \endcode */ int ex_put_concat_node_sets (int exoid, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_df_index, void_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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_sets.c000066400000000000000000000446511225312213100235670ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #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. * \param exoid exodus file id * \param set_type type of set * \param set_specs set specs structure */ int ex_put_concat_sets (int exoid, ex_entity_type set_type, const struct ex_set_specs* set_specs) { int status; int temp; const void_int *num_entries_per_set = set_specs->num_entries_per_set; const void_int *num_dist_per_set = set_specs->num_dist_per_set; const void_int *sets_entry_index = set_specs->sets_entry_index; const void_int *sets_dist_index = set_specs->sets_dist_index; const void *sets_dist_fact = set_specs->sets_dist_fact; size_t i, num_df, num_entry; int cur_num_sets, num_sets; int dimid, varid, set_id_ndx, dims[1]; int *set_stat = NULL; int set_int_type, int_size; const float *flt_dist_fact = NULL; const double *dbl_dist_fact = NULL; char errmsg[MAX_ERR_LENGTH]; char* idsptr = NULL; char* statptr = NULL; char* numdfptr = NULL; char* factptr = NULL; char* elemptr = NULL; char* extraptr = NULL; ex_inquiry ex_inq_val; exerrval = 0; /* clear error code */ int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } /* setup pointers based on set_type NOTE: there is another block that sets more stuff later ... */ if (set_type == EX_NODE_SET) { ex_inq_val = EX_INQ_NODE_SETS; idsptr = VAR_NS_IDS; statptr = VAR_NS_STAT; } else if (set_type == EX_EDGE_SET) { ex_inq_val = EX_INQ_EDGE_SETS; idsptr = VAR_ES_IDS; statptr = VAR_ES_STAT; } else if (set_type == EX_FACE_SET) { ex_inq_val = EX_INQ_FACE_SETS; idsptr = VAR_FS_IDS; statptr = VAR_FS_STAT; } else if (set_type == EX_SIDE_SET) { ex_inq_val = EX_INQ_SIDE_SETS; idsptr = VAR_SS_IDS; statptr = VAR_SS_STAT; } else if (set_type == EX_ELEM_SET) { ex_inq_val = EX_INQ_ELEM_SETS; idsptr = VAR_ELS_IDS; statptr = VAR_ELS_STAT; } else { exerrval = EX_FATAL; sprintf(errmsg, "Error: invalid set type (%d)", set_type); ex_err("ex_put_set_param",errmsg,exerrval); return (EX_FATAL); } /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &temp)) != NC_NOERR) { if (status == NC_EBADDIM) { exerrval = status; sprintf(errmsg, "Error: no %ss defined for file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate %ss defined in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } return (EX_FATAL); } /* inquire how many sets are to be stored */ num_sets = ex_inquire_int(exoid, ex_inq_val); if (num_sets < 0) { sprintf(errmsg, "Error: failed to get number of %ss defined for file id %d", ex_name_of_object(set_type), exoid); /* use error val from inquire */ ex_err("ex_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 status array in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); return (EX_FATAL); } if (int_size == sizeof(int64_t)) { for (i=0;isets_ids)[i]; } else { set_id = ((int*)set_specs->sets_ids)[i]; } /* Keep track of the total number of sets defined using a counter stored in a linked list keyed by exoid. NOTE: ex_get_file_item is used to find the number of sets of type for a specific file and returns that value. */ cur_num_sets=ex_get_file_item(exoid, ex_get_counter_list(set_type)); if (cur_num_sets >= num_sets) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of %ss (%d) defined in file id %d", ex_name_of_object(set_type), num_sets,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); goto error_ret; } /* NOTE: ex_inc_file_item is used to find the number of sets for a specific file and returns that value incremented. */ cur_num_sets=ex_inc_file_item(exoid, ex_get_counter_list(set_type)); set_id_ndx = cur_num_sets + 1; /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { 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) { 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) { 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) { 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) { 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 (set_stat[i] == 0) /* Is this a NULL set? */ continue; /* Do not create anything for NULL sets! */ if (int_size == sizeof(int)) { status = nc_def_dim(exoid, ex_dim_num_entries_in_object(set_type, set_id_ndx), ((int*)num_entries_per_set)[i], &dimid); } else { status = nc_def_dim(exoid, ex_dim_num_entries_in_object(set_type, set_id_ndx), ((int64_t*)num_entries_per_set)[i], &dimid); } if (status != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: %s entry count %"PRId64" already defined in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define number of entries for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } goto error_ret; } /* create element list variable for set */ set_int_type = NC_INT; if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { set_int_type = NC_INT64; } dims[0] = dimid; if ((status = nc_def_var(exoid,elemptr,set_int_type,1,dims, &temp)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: element list already exists for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create element list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 1); /* create extra list variable for set (only for edge, face and side sets) */ if (extraptr) { if ((status = nc_def_var(exoid,extraptr,set_int_type,1,dims, &temp)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: extra list already exists for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 1); } /* define dimension for number of dist factors per set */ /* NOTE: only define df count if the dist factors exist! */ if (int_size == sizeof(int64_t)) { num_df = ((int64_t*)num_dist_per_set)[i]; num_entry = ((int64_t*)num_entries_per_set)[i]; } else { num_df = ((int*)num_dist_per_set)[i]; num_entry = ((int*)num_entries_per_set)[i]; } if (num_df > 0) { if (set_type == EX_NODE_SET) { if (num_df != num_entry) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # dist fact (%"ST_ZU") not equal to # nodes (%"ST_ZU") in node set %"PRId64" file id %d", num_df, num_entry, set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* resuse dimid from entry lists */ } else { if ((status = nc_def_dim(exoid, numdfptr, num_df, &dimid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: %s df count %"PRId64" already defined in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define %s df count for set %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } goto error_ret; } } /* create distribution factor list variable for set */ dims[0] = dimid; if ((status = nc_def_var(exoid, factptr, nc_flt_code(exoid), 1, dims, &temp)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: dist factor list already exists for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create dist factor list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 2); } /* end define dist factors */ } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); return (EX_FATAL); } /* Next, fill out set ids array */ /* first get id of set ids array variable */ if ((status = nc_inq_varid(exoid, idsptr, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids array in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); return (EX_FATAL); } /* then, write out set id list */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, varid, set_specs->sets_ids); } else { status = nc_put_var_int(exoid, varid, set_specs->sets_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id array in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); return (EX_FATAL); } /* 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; isets_ids)[i]; } else { set_id = ((int*)set_specs->sets_ids)[i]; } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { int64_t* extra_list = NULL; /* set extra list */ if (set_type == EX_EDGE_SET || set_type == EX_FACE_SET || set_type == EX_SIDE_SET) extra_list = &(((int64_t*)set_specs->sets_extra_list)[((int64_t*)sets_entry_index)[i]]); status = ex_put_set(exoid, set_type, set_id, &(((int64_t*)set_specs->sets_entry_list)[((int64_t*)sets_entry_index)[i]]), extra_list); } else { int* extra_list = NULL; /* set extra list */ if (set_type == EX_EDGE_SET || set_type == EX_FACE_SET || set_type == EX_SIDE_SET) extra_list = &(((int*)set_specs->sets_extra_list)[((int*)sets_entry_index)[i]]); status = ex_put_set(exoid, set_type, set_id, &(((int*)set_specs->sets_entry_list)[((int*)sets_entry_index)[i]]), extra_list); } if (status != NC_NOERR) return(EX_FATAL); /* error will be reported by subroutine */ if (int_size == sizeof(int)) { num_df = ((int*)num_dist_per_set)[i]; df_ndx = ((int*)sets_dist_index)[i]; } else { num_df = ((int64_t*)num_dist_per_set)[i]; df_ndx = ((int64_t*)sets_dist_index)[i]; } if (ex_comp_ws(exoid) == sizeof(float)) { flt_dist_fact = sets_dist_fact; if (num_df > 0) { /* store dist factors if required */ if (ex_put_set_dist_fact(exoid, set_type, set_id, &(flt_dist_fact[df_ndx])) == -1) { sprintf(errmsg, "Error: failed to store %s %"PRId64" dist factors for file id %d", ex_name_of_object(set_type), set_id,exoid); /* use error val from exodusII routine */ ex_err("ex_put_concat_sets",errmsg,exerrval); return (EX_FATAL); } } } else if (ex_comp_ws(exoid) == sizeof(double)) { dbl_dist_fact = sets_dist_fact; if (num_df) { /* only store if they exist */ if (ex_put_set_dist_fact(exoid, set_type, set_id, &(dbl_dist_fact[df_ndx])) == -1) { sprintf(errmsg, "Error: failed to store %s %"PRId64" dist factors for file id %d", ex_name_of_object(set_type), set_id,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); } } free(set_stat); return(EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: free(set_stat); if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_concat_sets",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_side_sets.c000066400000000000000000000110411225312213100245560ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #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. * \param exoid exodus file id * \param side_set_ids array of side set ids * \param num_elem_per_set number of elements/sides/faces per set * \param num_dist_per_set number of distribution factors per set * \param side_sets_elem_index index array of elements into elem list * \param side_sets_dist_index index array of df into df list * \param side_sets_elem_list array of elements * \param side_sets_side_list array of sides/faces * \param side_sets_dist_fact array of distribution factors * \deprecated Use ex_put_concat_sets()(exoid, EX_SIDE_SET, set_specs) */ int ex_put_concat_side_sets (int exoid, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_concat_var_param.c000066400000000000000000000065731225312213100245620ustar00rootroot00000000000000/* * 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 * * 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 (unused) * int* elem_var_tab element variable truth table array * * exit conditions - * * revision history - * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the number of global, nodal, and element variables * that will be written to the database * \param exoid int exodus file id * \param num_g int global variable count * \param num_n int nodal variable count * \param num_e int element variable count * \param num_elem_blk int number of element blocks * \param elem_var_tab int* element variable truth table array * \deprecated Use ex_put_all_var_param()(exoid, num_g, num_n, num_e, elem_var_tab, 0, 0, 0, 0) */ int ex_put_concat_var_param (int exoid, int num_g, int num_n, int num_e, int num_elem_blk, /* unused */ int *elem_var_tab) { return ex_put_all_var_param(exoid, num_g, num_n, num_e, elem_var_tab, 0, 0, 0, 0); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_conn.c000066400000000000000000000207011225312213100222050ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! write out the connectivity array */ #define EX_WRITE_CONN(TNAME,VARCONN,VARCONNVAL) \ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { \ status = nc_put_var_longlong(exoid, VARCONN, VARCONNVAL); \ } else { \ status = nc_put_var_int(exoid, VARCONN, VARCONNVAL); \ } \ if (status != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to write connectivity array for %s block %"PRId64" in file id %d", \ TNAME,blk_id,exoid); \ ex_err("ex_put_conn",errmsg, exerrval); \ return(EX_FATAL); \ } /*! * writes the connectivity array for a block * \param exoid exodus file id * \param blk_type type of block * \param blk_id id of block * \param node_conn node-element connectivity * \param elem_edge_conn element-edge connectivity (NULL if none) * \param elem_face_conn element-face connectivity (NULL if none) */ int ex_put_conn (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void_int *node_conn, const void_int *elem_edge_conn, const void_int *elem_face_conn) { int connid=-1, blk_id_ndx, status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: connectivity array not allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_conn",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in id array in file id %d", ex_name_of_object(blk_type),blk_id, exoid); ex_err("ex_put_conn",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if (node_conn) { switch (blk_type) { case EX_ELEM_BLOCK: status = nc_inq_varid (exoid, VAR_CONN(blk_id_ndx), &connid); break; case EX_FACE_BLOCK: status = nc_inq_varid (exoid, VAR_FBCONN(blk_id_ndx), &connid); break; case EX_EDGE_BLOCK: status = nc_inq_varid (exoid, VAR_EBCONN(blk_id_ndx), &connid); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_putt_conn",errmsg,EX_MSG); return (EX_FATAL); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_conn",errmsg, exerrval); return(EX_FATAL); } EX_WRITE_CONN(ex_name_of_object(blk_type),connid,node_conn); } /* 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; size_t num_ed_per_elem, num_fa_per_elem; status = nc_inq_dimid (exoid, DIM_NUM_EDG_PER_EL(blk_id_ndx), &nedpereldim); if (status != NC_NOERR && elem_edge_conn != 0) { exerrval = status; sprintf(errmsg, "Error: edge connectivity specified but failed to " "locate number of edges/element in block %"PRId64" in file id %d", blk_id,exoid); ex_err("ex_put_conn",errmsg,exerrval); return(EX_FATAL); } status = nc_inq_dimid (exoid, DIM_NUM_FAC_PER_EL(blk_id_ndx), &nfapereldim); if (status != NC_NOERR && elem_face_conn != 0) { exerrval = status; sprintf(errmsg, "Error: face connectivity specified but failed to " "locate number of faces/element in block %"PRId64" in file id %d", blk_id,exoid); ex_err("ex_put_conn",errmsg,exerrval); return(EX_FATAL); } num_ed_per_elem = 0; if ((elem_edge_conn != 0) && (status = nc_inq_dimlen(exoid, nedpereldim, &num_ed_per_elem) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to get number of edges/elem in block %"PRId64" in file id %d", blk_id,exoid); ex_err("ex_put_conn",errmsg,exerrval); return(EX_FATAL); } num_fa_per_elem = 0; if ((elem_face_conn != 0) && (status = nc_inq_dimlen(exoid, nfapereldim, &num_fa_per_elem) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to get number of faces/elem in block %"PRId64" 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)", (long)num_ed_per_elem, (void*)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)", (long)num_fa_per_elem, (void*)elem_face_conn ); ex_err("ex_put_conn",errmsg,exerrval); return (EX_FATAL); } if ( num_ed_per_elem != 0 ) { status = nc_inq_varid(exoid, VAR_ECONN(blk_id_ndx), &connid); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for " "element edge block %"PRId64" in file id %d", blk_id,exoid); ex_err("ex_put_conn",errmsg, exerrval); return(EX_FATAL); } EX_WRITE_CONN("element edge",connid,elem_edge_conn); } if ( num_fa_per_elem != 0 ) { status = nc_inq_varid (exoid, VAR_FCONN(blk_id_ndx), &connid); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for " "element face block %"PRId64" in file id %d", blk_id,exoid); ex_err("ex_put_conn",errmsg, exerrval); return(EX_FATAL); } EX_WRITE_CONN("element face",connid,elem_face_conn); } } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_coord.c000066400000000000000000000215011225312213100223550ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_put_coord() writes the nodal coordinates of the nodes in the model. The function ex_put_init() must be invoked before this call is made. Because the coordinates are floating point values, the application code must declare the arrays passed to be the appropriate type (\e float or \e double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_coord() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] x_coor The X-coordinates of the nodes. If this is \c NULL, the X-coordinates will not be written. \param[in] y_coor The Y-coordinates of the nodes. These are stored only if \c num_dim > 1; otherwise, pass in \c NULL. If this is \c NULL, the Y-coordinates will not be written. \param[in] z_coor The Z-coordinates of the nodes. These are stored only if \c num_dim > 2; otherwise, pass in \c NULL. If this is \c NULL, the Z-coordinates will not be written. The following will write the nodal coordinates to an open exodus file : \code int error, exoid; // \comment{if file opened with compute word size of sizeof(float)} float x[8], y[8], z[8]; // \comment{write nodal coordinates values to database} x[0] = 0.0; y[0] = 0.0; z[0] = 0.0; x[1] = 0.0; y[1] = 0.0; z[1] = 1.0; x[2] = 1.0; y[2] = 0.0; z[2] = 1.0; x[3] = 1.0; y[3] = 0.0; z[3] = 0.0; x[4] = 0.0; y[4] = 1.0; z[4] = 0.0; x[5] = 0.0; y[5] = 1.0; z[5] = 1.0; x[6] = 1.0; y[6] = 1.0; z[6] = 1.0; x[7] = 1.0; y[7] = 1.0; z[7] = 0.0; error = ex_put_coord(exoid, x, y, z); // \comment{Do the same as the previous call in three separate calls} error = ex_put_coord(exoid, x, NULL, NULL); error = ex_put_coord(exoid, NULL, y, NULL); error = ex_put_coord(exoid, NULL, NULL, z); \endcode */ int ex_put_coord (int exoid, const void *x_coor, const void *y_coor, const void *z_coor) { int status; int coordid; int coordidx, coordidy, coordidz; int numnoddim, ndimdim; size_t num_nod, num_dim, start[2], count[2], i; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_NUM_NODES, &numnoddim)) != NC_NOERR) { /* If not found, then this file is storing 0 nodes. Return immediately */ return (EX_NOERR); } if ((status = nc_inq_dimlen(exoid, numnoddim, &num_nod)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: inquire failed to return number of nodes in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of dimensions in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of dimensions in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } /* write out the coordinates */ if (ex_large_model(exoid) == 0) { if ((status = nc_inq_varid(exoid, VAR_COORD, &coordid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate nodal coordinates in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } for (i=0; i 1) { if ((status = nc_inq_varid(exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate y nodal coordinates in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidy = 0; } if (num_dim > 2) { if ((status = nc_inq_varid(exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate z nodal coordinates in file id %d", exoid); ex_err("ex_put_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidz = 0; } /* write out the coordinates */ for (i=0; i /*! The function ex_put_coord_names() writes the names (\p MAX_STR_LENGTH-characters in length) of the coordinate arrays to the database. Memory must be allocated for the character strings before this function is invoked. In case of an error, ex_put_coord_names() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] coord_names Array containing \c num_dim names of length \p MAX_STR_LENGTH of the nodal coordinate arrays. The following coding will write the coordinate names to an open exodus file : \code int error, exoid; char *coord_names[3]; coord_names[0] = "xcoor"; coord_names[1] = "ycoor"; coord_names[2] = "zcoor"; error = ex_put_coord_names (exoid, coord_names); \endcode */ int ex_put_coord_names (int exoid, char *coord_names[]) { int status; int ndimdim, varid; size_t num_dim; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of dimensions in file id %d", exoid); ex_err("ex_put_coord_names",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: inquire failed to get number of dimensions in file id %d", exoid); ex_err("ex_put_coord_names",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_NAME_COOR, &varid)) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to locate coordinate names in file id %d", exoid); ex_err("ex_put_coord_names",errmsg,exerrval); return (EX_FATAL); } /* write out coordinate names */ status = ex_put_names_internal(exoid, varid, num_dim, coord_names, EX_COORDINATE, "", "ex_put_coord_names"); return (status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_coordinate_frames.c000066400000000000000000000151101225312213100247320ustar00rootroot00000000000000/* * 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 * * \param exoid exodus file id * \param nframes number of coordinate frames in model * \param cf_ids coordinate ids * \param pt_coordinates pointer to coordinates. 9 values per coordinate frame * \param tags character tag for each frame. 'r' - rectangular, 'c' - cylindrical, 's' - spherical * * returns - * EX_NOERR for no error * EX_FATAL for fatal errors * 1 number frames < 0 * *****************************************************************************/ #include #include #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 void_int *cf_ids, void* pt_coordinates, const char* tags) { int status; int dim, dim9; /* dimension id for nframes, nframes*9 */ char errmsg[MAX_ERR_LENGTH]; /* buffer for error messages */ int varcoords; /* variable id for the coordinates */ int varids; /* variable id for the frame ids */ int vartags; /* variable id for the frame tags */ int i; /* general indices */ int int_type; 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 ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode", exoid); ex_err(PROCNAME,errmsg,exerrval); return (EX_FATAL); } if ((status = nc_def_dim(exoid, DIM_NUM_CFRAMES, nframes, &dim)) != NC_NOERR || (nc_def_dim(exoid, DIM_NUM_CFRAME9, nframes*9, &dim9) != NC_NOERR)) { exerrval = status; sprintf(errmsg, "Error: failed to define number of coordinate frames in file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); goto error_ret; } int_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } /* define the variables. coordinates, tags and ids */ if (nc_def_var (exoid, VAR_FRAME_COORDS, nc_flt_code(exoid), 1, &dim9, &varcoords) != NC_NOERR || (nc_def_var(exoid, VAR_FRAME_IDS,int_type, 1, &dim, &varids) != NC_NOERR) || (nc_def_var(exoid, VAR_FRAME_TAGS,NC_CHAR,1,&dim, &vartags) != NC_NOERR) ) { exerrval = EX_FATAL; sprintf(errmsg, "Error: failed to define coordinate frames in file id %d", exoid); ex_err(PROCNAME,errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete 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 #include #include #include int ex_put_eb_info_global(int exoid, void_int *el_blk_ids, void_int *el_blk_cnts ) { const char *func_name="ex_put_eb_info_global"; int varid, status; char errmsg[MAX_ERR_LENGTH]; /* Find the variable ID for the element block IDs */ if ((status = nc_inq_varid(exoid, VAR_ELBLK_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELBLK_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the global element block IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, varid, el_blk_ids); } else { status = nc_put_var_int(exoid, varid, el_blk_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_ELBLK_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Find the variable ID for the element block counts */ if ((status = nc_inq_varid(exoid, VAR_ELBLK_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELBLK_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the global element block counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, varid, el_blk_cnts); } else { status = nc_put_var_int(exoid, varid, el_blk_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_ELBLK_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_attr.c000066400000000000000000000066731225312213100232400ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib) The function ex_put_elem_attr() writes the attributes for an element block. Each element in the element block must have the same number of attributes, so there are(\c num_attr x \c num_elem_this_blk) attributes for each element block. The function ex_put_elem_block() must be invoked before this call is made. Because the attributes are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_elem_attr() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - ex_put_elem_block() was not called previously for specified element block ID. - ex_put_elem_block() was called with 0 attributes specified. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[in] attrib Size [num_elem_this_blk*num_attr] The list of attributes for the element block. The \c num_attr index cycles faster. Refer to the code example in ex_put_elem_block() for an example of writing the attributes array for an element block. */ int ex_put_elem_attr (int exoid, ex_entity_id elem_blk_id, const void *attrib) { return ex_put_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_attr_names.c000066400000000000000000000053051225312213100244120ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the attribute names for an element block * \param exoid exodus file id * \param elem_blk_id element block id * \param names[] ptr array of attribute names * \deprecated Use ex_put_attr_names()(exoid, EX_ELEM_BLOCK, elem_blk_id, names) */ int ex_put_elem_attr_names(int exoid, ex_entity_id elem_blk_id, char* names[]) { return ex_put_attr_names( exoid, EX_ELEM_BLOCK, elem_blk_id, names ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_block.c000066400000000000000000000132511225312213100233460ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" /*! \deprecated Use ex_put_block()(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type, num_elem_this_blk, num_nodes_per_elem, 0, 0, num_attr_per_elem) The function ex_put_elem_block() writes the parameters used to describe an element block. \return In case of an error, ex_put_elem_block() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - an element block with the same ID has already been specified. - the number of element blocks specified in the call to ex_put_init() has been exceeded. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[in] elem_type The type of elements in the element block. The maximum length of this string is \p MAX_STR_LENGTH . \param[in] num_elem_this_blk The number of elements in the element block. \param[in] num_nodes_per_elem The number of nodes per element in the element block. \param[in] num_attr_per_elem The number of attributes per element in the element block. For example, the following code segment will initialize an element block with an ID of 10, write out the connectivity array, and write out the element attributes array: \code int id, error, exoid, num_elem_in_blk, num_nodes_per_elem, *connect, num_attr; float *attrib; \comment{write element block parameters} id = 10; num_elem_in_blk = 2; num_nodes_per_elem = 4; \comment{elements are 4-node shells} num_attr = 1; \comment{one attribute per element} error = ex_put_elem_block(exoid, id, "SHELL", num_elem_in_blk, num_nodes_per_elem, num_attr); \comment{write element connectivity} connect = (int *)calloc(num_elem_in_blk*num_nodes_per_elem, sizeof(int)); \comment{fill connect with node numbers; nodes for first elemen} connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4; \comment{nodes for second element} connect[4] = 5; connect[5] = 6; connect[6] = 7; connect[7] = 8; error = ex_put_elem_conn (exoid, id, connect); \comment{write element block attributes} attrib = (float *) calloc (num_attr*num_elem_in_blk, sizeof(float)); for (i=0, cnt=0; i < num_elem_in_blk; i++) { for (j=0; j < num_attr; j++, cnt++) { attrib[cnt] = 1.0; } } error = ex_put_elem_attr (exoid, id, attrib); \comment{Same result using non-deprecated code} error = ex_put_block(exoid, EX_ELEM_BLOCK, id, "SHELL", num_elem_in_blk, num_nodes_per_elem, 0, 0, num_attr); error = ex_put_conn (exoid, EX_ELEM_BLOCK, id, connect); error = ex_put_attr (exoid, EX_ELEM_BLOCK, id, attrib); \endcode */ int ex_put_elem_block (int exoid, ex_entity_id elem_blk_id, const char *elem_type, int64_t num_elem_this_blk, int64_t num_nodes_per_elem, int64_t 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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_cmap.c000066400000000000000000000210521225312213100231720ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ /* Function(s) contained in this file: * ex_put_elem_cmap() **************************************************************************** * The function outputs an elemental communication map. **************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * map_id - The ID of the elementa communication map to write. * elem_ids - Pointer to vector of element IDs to output. * side_ids - Pointer to vector of side IDs for each element * in "elem_ids". * proc_ids - Pointer to vector of processor IDs for each * element in "elem_ids". * processor - The processor the file being read was written for. */ /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ #include #include #include #include int ex_put_elem_cmap(int exoid, ex_entity_id map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int processor ) { const char *func_name="ex_put_elem_cmap"; int map_idx, varid, dimid, status; size_t start[1], count[1], ret_val; int64_t varidx[2]; int value; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* get the index for the comm map information variables */ if (ex_get_idx(exoid, VAR_E_COMM_INFO_IDX, varidx, processor) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the index for this map_id */ if ((map_idx=ne_id_lkup(exoid, VAR_E_COMM_IDS, varidx, map_id)) == -1) { sprintf(errmsg, "Error: failed to find index for variable \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Find out if this is a NULL comm map by checking it's entry in * the status vector. */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = map_idx; if ((status = nc_get_var1_int(exoid, varid, start, &value)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (value == 0) return(EX_NOERR); /* NULL set */ /* now I need to get the comm map data index */ if (ex_get_idx(exoid, VAR_E_COMM_DATA_IDX, varidx, map_idx) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the cmap data */ if (varidx[1] == -1) { /* Get the size of the comm maps */ if ((status = nc_inq_dimid(exoid, DIM_ECNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dimension ID for \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &ret_val)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get length of dimension \"%s\" in file ID %d", DIM_ECNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = ret_val; } /* "if (varidx[1]==-1)" */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; /* Output the element IDs for this comm map */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_EIDS, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, elem_ids); } else { status = nc_put_vara_int(exoid, varid, start, count, elem_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output vector \"%s\" in file ID %d", VAR_E_COMM_EIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the processor IDs for this map */ if ((status = nc_inq_varid(exoid, VAR_E_COMM_PROC, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, proc_ids); } else { status = nc_put_vara_int(exoid, varid, start, count, proc_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_E_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_E_COMM_SIDS, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, side_ids); } else { status = nc_put_vara_int(exoid, varid, start, count, side_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to ouput variable \"%s\" in file ID %d", VAR_E_COMM_SIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_conn.c000066400000000000000000000060761225312213100232200ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_conn()(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0) The function ex_put_elem_conn() writes the connectivity array for an element block. The function ex_put_elem_block() must be invoked before this call is made. \return In case of an error, ex_put_elem_conn() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - ex_put_elem_block() was not called previously. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_blk_id The element block ID. \param[in] connect Size [num_elem_this_blk,num_nodes_per_elem], The connectivity array; a list of nodes (internal node IDs; See Section LocalNodeIds) that define each element in the element block. The node index cycles faster than the element index. Refer to the code example in ex_put_elem_block() for an example of writing the connectivity array for an element block. */ int ex_put_elem_conn (int exoid, ex_entity_id elem_blk_id, const void_int *connect) { return ex_put_conn(exoid, EX_ELEM_BLOCK, elem_blk_id, connect, 0, 0); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_map.c000066400000000000000000000052771225312213100230420ustar00rootroot00000000000000/* * 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 * * 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 * \param exoid exodus file id * \param map_id element map id * \param elem_map element map * \deprecated Use ex_put_num_map()(exoid, EX_ELEM_MAP, map_id, elem_map) */ int ex_put_elem_map (int exoid, ex_entity_id map_id, const void_int *elem_map) { return ex_put_num_map( exoid, EX_ELEM_MAP, map_id, elem_map ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_num_map.c000066400000000000000000000063701225312213100237140ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_id_map()(exoid, EX_ELEM_MAP, elem_map) The function ex_put_elem_num_map() writes out the optional element number map to the database. See Section LocalElementIds for a description of the element number map. The function ex_put_init() must be invoked before this call is made. \return In case of an error, ex_put_elem_num_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - an element number map already exists in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_map The element number map. The following code generates a default element number map and outputs it to an open exodus file. This is a trivial case and included just for illustration. Since this map is optional, it should be written out only if it contains something other than the default map. \code int error, exoid; int *elem_map = (int *)calloc(num_elem, sizeof(int)); for (i=1; i <= num_elem; i++) elem_map[i-1] = i; error = ex_put_elem_num_map(exoid, elem_map); \comment{Equivalent using non-deprecated function} error = ex_put_id_map(exoid, EX_ELEM_MAP, elem_map); \endcode */ int ex_put_elem_num_map (int exoid, const void_int *elem_map) { return ex_put_id_map(exoid, EX_ELEM_MAP, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_var.c000066400000000000000000000135411225312213100230460ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_put_var()(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, num_elem_this_blk, elem_var_vals) The function ex_put_elem_var() writes the values of a single element variable for one element block at one time step. It is recommended, but not required, to write the element variable truth table (with ex_put_elem_var_tab() before this function is invoked for better efficiency. See #Efficiency for a discussion of efficiency issues. Because element variables are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_elem_var() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - invalid element block ID. - ex_put_elem_block() not called previously to specify parameters for this element block. - ex_put_variable_param() not called previously specifying the number of element variables. - an element variable truth table was stored in the file but contains a zero (indicating no valid element variable) for the specified element block and element variable. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number, as described under ex_put_time(). This is essentially a counter that is incremented only when results variables are output. The first time step is 1. \param[in] elem_var_index The index of the element variable. The first variable has an index of 1. \param[in] elem_blk_id The element block ID. \param[in] num_elem_this_blk The number of elements in the given element block. \param[in] elem_var_vals Array of \c num_elem_this_blk values of the \c elem_var_index-th element variable for the element block with ID of \c elem_blk_id at the \c time_step-th time step. The following coding will write out all of the element variables for a single time step \c n to an open exodus file : \code int num_ele_vars, num_elem_blk, *num_elem_in_block,error, exoid, n, *ebids; float *elem_var_vals; \comment{write element variables} for (k=1; k <= num_ele_vars; k++) { for (j=0; j < num_elem_blk; j++) { elem_var_vals = (float *) calloc(num_elem_in_block[j], sizeof(float)); for (m=0; m < num_elem_in_block[j]; m++) { \comment{simulation code fills this in} elem_var_vals[m] = 10.0; } error = ex_put_elem_var (exoid, n, k, ebids[j], num_elem_in_block[j], elem_var_vals); \comment {Using non-deprecated function:} error = ex_put_var (exoid, n, EX_ELEM_BLOCK, k, ebids[j], num_elem_in_block[j], elem_var_vals); free (elem_var_vals); } } \endcode */ int ex_put_elem_var (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t num_elem_this_blk, const void *elem_var_vals) { return ex_put_var(exoid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, num_elem_this_blk, elem_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_var_slab.c000066400000000000000000000236311225312213100240500ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_elem_var_slab() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * time_step - The time step to write this data to. * elem_var_index - The index of this elemental variable. * elem_blk_id - The ID of the element block being written to. * start_pos - The start point for outputting data. The * first value is 0. * num_vals - The number of values to be output. * elem_var_vals - Pointer to the vector of values to be output. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* * writes the values of a single element variable for one element block, * starting at start_pos, at one time step to the database; assume the * first time step and element variable index are 1 */ int ex_put_elem_var_slab (int exoid, int time_step, int elem_var_index, ex_entity_id elem_blk_id, int64_t start_pos, int64_t num_vals, void *elem_var_vals) { int status; int varid, dimid,time_dim, numelbdim, dims[2], elem_blk_id_ndx; size_t num_elem_blk, num_elem_var, start[2], count[2]; int *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 */ if ((elem_blk_id_ndx = ex_id_lkup(exoid, EX_ELEM_BLOCK, elem_blk_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no variables allowed for NULL block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_elem_var_slab", errmsg, EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate element block id %"PRId64" in %s array in file id %d", elem_blk_id, VAR_ID_EL_BLK, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } } if ((status = nc_inq_varid (exoid, VAR_ELEM_VAR(elem_var_index, elem_blk_id_ndx), &varid)) != NC_NOERR) { if (status == NC_ENOTVAR) { /* variable doesn't exist, create it! */ /* inquire previously defined dimensions */ /* check for the existance of an element variable truth table */ if ((status = nc_inq_varid (exoid, VAR_ELEM_TAB, &varid)) == NC_NOERR) { /* find out number of element blocks and element variables */ if ((status = nc_inq_dimid (exoid, DIM_NUM_EL_BLK, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of element blocks in file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_elem_blk)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of element blocks in file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid (exoid, DIM_NUM_ELE_VAR, &dimid)) != NC_NOERR) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: no element variables stored in file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_elem_var)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of element variables in file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } if (!(elem_var_tab = (int *)malloc(num_elem_blk*num_elem_var*sizeof(int)))) { 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_slab", errmsg, exerrval); return (EX_FATAL); } /* read in the element variable truth table */ if ((status = nc_get_var_int(exoid, varid, elem_var_tab)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get truth table from file id %d", exoid); ex_err("ex_put_elem_var_slab", 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 %"PRId64" in file id %d", elem_var_index, elem_blk_id, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } free(elem_var_tab); } if ((status = nc_inq_dimid (exoid, DIM_TIME, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time dimension in file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); goto error_ret; /* exit define mode and return */ } if ((status = nc_inq_dimid(exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx), &numelbdim)) != NC_NOERR) { if (status == NC_EBADDIM) { exerrval = status; sprintf(errmsg, "Error: number of elements in element block %"PRId64" not defined in file id %d", elem_blk_id, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate number of elements in element block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); } goto error_ret; } /* variable doesn't exist so put file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } /* define netCDF variable to store element variable values */ dims[0] = time_dim; dims[1] = numelbdim; if ((status = nc_def_var(exoid, VAR_ELEM_VAR(elem_var_index, elem_blk_id_ndx), nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define element variable %d in file id %d", elem_var_index, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); goto error_ret; } ex_compress_variable(exoid, varid, 2); /* leave define mode */ if ((status = nc_enddef(exoid)) != NC_NOERR) { exerrval = status; 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_slab", errmsg, exerrval); return (EX_FATAL); } } else { exerrval = status; 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_slab", errmsg, exerrval); return (EX_FATAL); } } /* store element variable values */ start[0] = --time_step; start[1] = --start_pos; count[0] = 1; count[1] = num_vals; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, elem_var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, elem_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store element variable %d in file id %d", elem_var_index, exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_elem_var_slab", errmsg, exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_elem_var_tab.c000066400000000000000000000124021225312213100236670ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_put_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab) The function ex_put_elem_var_tab() writes the exodus element variable truth table to the database. The element variable truth table indicates whether a particular element result is written for the elements in a particular element block. A 0 (zero) entry indicates that no results will be output for that element variable for that element block. A non-zero entry indicates that the appropriate results will be output. Although writing the element variable truth table is optional, it is encouraged because it creates at one time all the necessary \code{NetCDF} variables in which to hold the exodus element variable values. This results in significant time savings. See Section #Efficiency for a discussion of efficiency issues. The function ex_put_variable_param() must be called before this routine in order to define the number of element variables. \return In case of an error, ex_put_elem_var_tab() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - the specified number of element blocks is different than the number specified in a call to ex_put_init(). - ex_put_elem_block() not called previously to specify element block parameters. - ex_put_variable_param() not called previously to specify the number of element variables or was called but with a different number of element variables. - ex_put_elem_var() previously called. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] num_elem_blk The number of element blocks. \param[in] num_elem_var The number of element variables. \param[in] elem_var_tab Size [num_elem_blk,num_elem_var]. A 2-dimensional array (with the \c num_elem_var index cycling faster) containing the element variable truth table. The following coding will create, populate, and write an element variable truth table to an opened exodus file (NOTE: all element variables are valid for all element blocks in this example.): \code int *truth_tab, num_elem_blk, num_ele_vars, error, exoid; \comment{write element variable truth table} truth_tab = (int *)calloc((num_elem_blk*num_ele_vars), sizeof(int)); for (i=0, k=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); \endcode */ int ex_put_elem_var_tab (int exoid, int num_elem_blk, int num_elem_var, int *elem_var_tab) { return ex_put_truth_table(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_entity_count_per_polyhedra.c000066400000000000000000000106731225312213100267200ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expecpp - ex_put_entity_count_per_polyhedra * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ #include /*! * writes out the number of entities (nodes/faces) per polyhedra * (nsided/nfaced) in this element block to the database. * \param exoid exodus file id * \param blk_type type of block (face, or element) * \param blk_id block identifer * \param entity_counts entity_per_polyhedra count array */ int ex_put_entity_count_per_polyhedra (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const int *entity_counts) { int npeid=-1, blk_id_ndx, status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: entity_counts array not allowed for NULL %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_entity_count_per_polyhedra",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s block id %"PRId64" in id array in file id %d", ex_name_of_object(blk_type),blk_id, exoid); ex_err("ex_put_entity_count_per_polyhedra",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ switch (blk_type) { case EX_ELEM_BLOCK: status = nc_inq_varid (exoid, VAR_EBEPEC(blk_id_ndx), &npeid); break; case EX_FACE_BLOCK: status = nc_inq_varid (exoid, VAR_FBEPEC(blk_id_ndx), &npeid); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized block type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_put_entity_count_per_polyhedra",errmsg,EX_MSG); return (EX_FATAL); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate entity_counts array for %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_entity_count_per_polyhedra",errmsg, exerrval); return(EX_FATAL); } status = nc_put_var_int(exoid, npeid, entity_counts); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to write node counts array for %s block %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_entity_count_per_polyhedra",errmsg, exerrval); return(EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_glob_vars.c000066400000000000000000000107521225312213100232330ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! \deprecated Use ex_put_var()(exoid, time_step, EX_GLOBAL, 1, 0, num_glob_vars, glob_var_vals) The function ex_put_glob_vars() writes the values of all the global variables for a single time step. The function ex_put_variable_param() must be invoked before this call is made. Because global variables are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_glob_vars() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - ex_put_variable_param() not called previously specifying the number of global variables. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number, as described under ex_put_time(). This is essentially a counter that is incremented when results variables are output. The first time step is 1. \param[in] num_glob_vars The number of global variables to be written to the database. \param[in] glob_var_vals Array of \c num_glob_vars global variable values for the \c time_step-th time step. As an example, the following coding will write the values of all the global variables at one time step to an open exodus II file: \code int num_glo_vars, error, exoid, time_step; float *glob_var_vals \comment{write global variables} for (j=0; j < num_glo_vars; j++) { \comment{application code fills this array} glob_var_vals[j] = 10.0; } error = ex_put_glob_vars (exoid, time_step, num_glo_vars, glob_var_vals); \comment{Using non-deprecated functions:} error = ex_put_var (exoid, time_step, EX_GLOBAL, 1, 0, num_glo_vars, glob_var_vals); \endcode */ 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 ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_id_map.c000066400000000000000000000135251225312213100225070ustar00rootroot00000000000000/* * Copyright (c) 2007 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expenm - ex_put_id_map * * entry conditions - * input parameters: * int exoid exodus file id * ex_entity_type obj_type * int* elem_map element numbering map array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! * writes out the entity numbering map to the database; this allows * the entity numbers to be non-contiguous. This map is used for * mapping between local and global entity ids. * \param exoid exodus file id * \param map_type * \param map element numbering map array */ int ex_put_id_map (int exoid, ex_entity_type map_type, const void_int *map) { int dimid, mapid, status, dims[1]; int map_int_type; char errmsg[MAX_ERR_LENGTH]; const char* tname; const char* dnumentries; const char* vmap; exerrval = 0; /* clear error code */ switch ( map_type ) { case EX_NODE_MAP: tname = "node"; dnumentries = DIM_NUM_NODES; vmap = VAR_NODE_NUM_MAP; break; case EX_EDGE_MAP: tname = "edge"; dnumentries = DIM_NUM_EDGE; vmap = VAR_EDGE_NUM_MAP; break; case EX_FACE_MAP: tname = "face"; dnumentries = DIM_NUM_FACE; vmap = VAR_FACE_NUM_MAP; break; case EX_ELEM_MAP: tname = "element"; dnumentries = DIM_NUM_ELEM; vmap = VAR_ELEM_NUM_MAP; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad map type (%d) specified for file id %d", map_type, exoid ); ex_err( "ex_put_id_map", errmsg, exerrval ); return (EX_FATAL); } /* Make sure the file contains entries */ if (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR) { return (EX_NOERR); } /* put netcdf file into define mode */ if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) { if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_id_map",errmsg,exerrval); return (EX_FATAL); } /* create a variable array in which to store the id map */ dims[0] = dimid; /* Check type to be used for maps... */ map_int_type = NC_INT; if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_int_type = NC_INT64; } if ((status = nc_def_var(exoid, vmap, map_int_type, 1, dims, &mapid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: %s numbering map already exists in file id %d", tname, exoid); ex_err("ex_put_id_map",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create %s id map in file id %d", tname, exoid); ex_err("ex_put_id_map",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, mapid, 1); /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_id_map",errmsg,exerrval); return (EX_FATAL); } } /* write out the entity numbering map */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_var_longlong(exoid, mapid, map); } else { status = nc_put_var_int(exoid, mapid, map); } if (status!= NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s numbering map in file id %d", tname, exoid); ex_err("ex_put_id_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_id_map",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_info.c000066400000000000000000000176321225312213100222140ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /*! The function ex_put_info() writes information records to the database. The records are \c MAX_LINE_LENGTH-character strings. In case of an error, ex_put_info() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - information records already exist in file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] num_info The number of information records. \param[in] info Array containing the information records. To only define the number of info records instead of defining and outputting, pass NULL for info argument. The following code will write out three information records to an open exodus file - \code #include "exodusII.h" int error, exoid, num_info; char *info[3]; \comment{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); \endcode The following code will first tell the database that there are three information records, and then later actually output those records. \code #include "exodusII.h" int error, exoid, num_info; char *info[3]; \comment{Define the number of information records that will be written later.} num_info = 3; error = ex_put_info(exoid, num_info, NULL); \comment{Now, actually write the information records} 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); \endcode */ int ex_put_info (int exoid, int num_info, char *info[]) { int status; int i, lindim, num_info_dim, dims[2], varid; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; int rootid = exoid & EX_FILE_ID_MASK; exerrval = 0; /* clear error code */ /* only do this if there are records */ if (num_info > 0) { /* See if the number of info records has already been defined. Assume that if the DIM_NUM_INFO dimension exists, then the VAR_INFO variable also exists... */ status = nc_inq_dimid(rootid, DIM_NUM_INFO, &num_info_dim); if (status != NC_NOERR) { /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(rootid, DIM_LIN, &lindim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get line string length in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); return (EX_FATAL); } /* put file into define mode */ if ((status = nc_redef (rootid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed put file id %d into define mode", rootid); ex_err("ex_put_info",errmsg,exerrval); return (EX_FATAL); } /* define dimensions */ if ((status = nc_def_dim(rootid, DIM_NUM_INFO, num_info, &num_info_dim)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { /* duplicate entry? */ exerrval = status; sprintf(errmsg, "Error: info records already exist in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define number of info records in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } /* define variable */ dims[0] = num_info_dim; dims[1] = lindim; if ((status = nc_def_var(rootid, VAR_INFO, NC_CHAR, 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define info record in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(rootid, varid, 3); /* leave define mode */ if ((status = nc_enddef (rootid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete info record definition in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); return (EX_FATAL); } } else { if ((status = nc_inq_varid(rootid, VAR_INFO, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find info record variable in file id %d", rootid); ex_err("ex_put_info",errmsg,exerrval); return (EX_FATAL); } } if (info != NULL) { /* write out information records */ for (i=0; i /*! The function ex_put_init() writes the initialization parameters to the exodus file. This function must be called once (and only once) before writing any data to the file. \return In case of an error, ex_put_init() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - this routine has been called previously. \param exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param title Database title. Maximum length is \c MAX_LINE_LENGTH. \param num_dim The dimensionality of the database. This is the number of coordinates per node. \param num_nodes The number of nodal points. \param num_elem The number of elements. \param num_elem_blk The number of element blocks. \param num_node_sets The number of node sets. \param num_side_sets The number of side sets. The following code segment will initialize an open exodus file with the specified parameters: \code int num_dim, num_nods, num_el, num_el_blk, num_ns, num_ss, error, exoid; \comment{initialize file with parameters} num_dim = 3; num_nods = 46; num_el = 5; num_el_blk = 5; num_ns = 2; num_ss = 5; error = ex_put_init (exoid, "This is the title", num_dim, num_nods, num_el,num_el_blk, num_ns, num_ss); \endcode */ int ex_put_init (int exoid, const char *title, int64_t num_dim, int64_t num_nodes, int64_t num_elem, int64_t num_elem_blk, int64_t num_node_sets, int64_t 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 )); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_init_ext.c000066400000000000000000000572771225312213100231150ustar00rootroot00000000000000/* * 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 * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include #include static void write_dummy_names(int exoid, ex_entity_type obj_type) { const char *routine = "write_dummy_names"; size_t start[2], count[2]; char *text = ""; int varid; size_t num_entity; size_t i; ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type), &num_entity, &varid, routine); for (i = 0; i < num_entity; i++) { start[0] = i; count[0] = 1; start[1] = 0; count[1] = strlen(text)+1; nc_put_vara_text(exoid, varid, start, count, text); } } static int ex_write_object_names(int exoid, const char *type, const char *dimension_name, int dimension_var, int string_dimension, int count) { int dim[2]; int status; int varid; char errmsg[MAX_ERR_LENGTH]; if (count > 0) { dim[0] = dimension_var; dim[1] = string_dimension; if ((status = nc_def_var (exoid, dimension_name, NC_CHAR, 2, dim, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s name array in file id %d",type,exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } } return NC_NOERR; } static int ex_write_object_params(int exoid, const char *type, const char *dimension_name, const char *status_dim_name, const char *id_array_dim_name, size_t count, int *dimension) { int dim[2]; int varid; int status; int int_type; char errmsg[MAX_ERR_LENGTH]; /* Can have nonzero model->num_elem_blk even if model->num_elem == 0 */ if (count > 0) { if ((status = nc_def_dim(exoid, dimension_name, count, dimension)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of %ss in file id %d", type, exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } /* ...and some variables */ /* element block id status array */ dim[0] = *dimension; if ((status = nc_def_var (exoid, status_dim_name, NC_INT, 1, dim, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s status array in file id %d", type, exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } /* type id array */ int_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } if ((status = nc_def_var (exoid, id_array_dim_name, int_type, 1, dim, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s id array in file id %d", type, exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } /* store property name as attribute of property array variable */ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s property name %s in file id %d", type, "ID", exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; } } return NC_NOERR; } static int ex_write_map_params(int exoid, const char *map_name, const char *map_dim_name, const char *map_id_name, size_t map_count, int *map_dimension) { int dim[2]; int varid; int status; char errmsg[MAX_ERR_LENGTH]; int int_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } /* Can have nonzero model->num_XXXX_map even if model->num_XXXX == 0 */ if ((map_count) > 0) { if ((status = nc_def_dim(exoid, map_dim_name, map_count, map_dimension)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of %ss in file id %d", map_name, exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } dim[0] = *map_dimension; /* map_name id array */ if ((status = nc_def_var(exoid, map_id_name, int_type, 1, dim, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s id array in file id %d", map_name, exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return status; /* exit define mode and return */ } /* store property name as attribute of property array variable */ if ((status=nc_put_att_text(exoid, varid, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s property name %s in file id %d", map_name, "ID",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } } return NC_NOERR; } static void invalidate_id_status(int exoid, const char *var_stat, const char *var_id, int count, int *ids) { int i; int id_var, stat_var; if (count > 0) { if (var_id != 0) { for (i=0; i < count; i++) { ids[i] = EX_INVALID_ID; } nc_inq_varid(exoid, var_id, &id_var); nc_put_var_int(exoid, id_var, ids); } if (var_stat != 0) { for (i=0; i < count; i++) { ids[i] = 0; } nc_inq_varid(exoid, var_stat, &stat_var); nc_put_var_int(exoid, stat_var, ids); } } } /*! * writes the initialization parameters to the EXODUS II file * \param exoid exodus file id * \param model finite element model parameters */ int ex_put_init_ext (int exoid, const ex_init_params *model) { int numdimdim, numnoddim, elblkdim, edblkdim, fablkdim, esetdim, fsetdim, elsetdim, nsetdim, ssetdim, dim_str_name, dim[2], temp; int nmapdim,edmapdim,famapdim,emapdim,timedim; int status; int title_len; #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]; int rootid = exoid & EX_FILE_ID_MASK; exerrval = 0; /* clear error code */ if (rootid == exoid && nc_inq_dimid (exoid, DIM_NUM_DIM, &temp) == NC_NOERR) { 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 ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } /* define some attributes... */ title_len = strlen(model->title) < MAX_LINE_LENGTH ? strlen(model->title) : MAX_LINE_LENGTH; if ((status = nc_put_att_text(rootid, NC_GLOBAL, (const char*)ATT_TITLE, title_len+1, model->title)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define model->title attribute to file id %d", rootid); ex_err("ex_put_init_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* ...and some dimensions... */ /* create name string length dimension */ if (nc_inq_dimid (rootid, DIM_STR_NAME, &dim_str_name) != NC_NOERR) { int max_name = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); if (max_name < ex_default_max_name_length) max_name = ex_default_max_name_length; if ((status=nc_def_dim (rootid, DIM_STR_NAME, max_name+1, &dim_str_name)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define name string length in file id %d",rootid); ex_err("ex_put_init_ext",errmsg,exerrval); goto error_ret; } } if ((status = nc_def_dim(exoid, DIM_TIME, NC_UNLIMITED, &timedim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define time dimension in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } dim[0] = timedim; if ((status = nc_def_var(exoid, VAR_WHOLE_TIME, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define whole time step variable in file id %d", exoid); ex_err("ex_create",errmsg,exerrval); return (EX_FATAL); } ex_compress_variable(exoid, temp, 2); if ((status = nc_def_dim(exoid, DIM_NUM_DIM, model->num_dim, &numdimdim)) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_dim(exoid, DIM_NUM_NODES, model->num_nodes, &numnoddim)) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_dim(exoid, DIM_NUM_ELEM, model->num_elem, &temp)) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_dim(exoid, DIM_NUM_EDGE, model->num_edge, &temp)) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_dim(exoid, DIM_NUM_FACE, model->num_face, &temp)) != NC_NOERR) { exerrval = status; 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 */ } } if (ex_write_object_params(exoid, "element block", DIM_NUM_EL_BLK, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, model->num_elem_blk, &elblkdim)) goto error_ret; if (ex_write_object_params(exoid, "edge block", DIM_NUM_ED_BLK, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, model->num_edge_blk, &edblkdim)) goto error_ret; if (ex_write_object_params(exoid, "face block", DIM_NUM_FA_BLK, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, model->num_face_blk, &fablkdim)) goto error_ret; if (ex_write_object_params(exoid, "node set", DIM_NUM_NS, VAR_NS_STAT, VAR_NS_IDS, model->num_node_sets, &nsetdim)) goto error_ret; if (ex_write_object_params(exoid, "edge set", DIM_NUM_ES, VAR_ES_STAT, VAR_ES_IDS, model->num_edge_sets, &esetdim)) goto error_ret; if (ex_write_object_params(exoid, "face set", DIM_NUM_FS, VAR_FS_STAT, VAR_FS_IDS, model->num_face_sets, &fsetdim)) goto error_ret; if (ex_write_object_params(exoid, "side set", DIM_NUM_SS, VAR_SS_STAT, VAR_SS_IDS, model->num_side_sets, &ssetdim)) goto error_ret; if (ex_write_object_params(exoid, "elem set", DIM_NUM_ELS, VAR_ELS_STAT, VAR_ELS_IDS, model->num_elem_sets, &elsetdim)) goto error_ret; if (ex_write_map_params(exoid, "node map", DIM_NUM_NM, VAR_NM_PROP(1), model->num_node_maps, &nmapdim) != NC_NOERR) goto error_ret; if (ex_write_map_params(exoid, "edge map", DIM_NUM_EDM, VAR_EDM_PROP(1), model->num_edge_maps, &edmapdim) != NC_NOERR) goto error_ret; if (ex_write_map_params(exoid, "face map", DIM_NUM_FAM, VAR_FAM_PROP(1), model->num_face_maps, &famapdim) != NC_NOERR) goto error_ret; if (ex_write_map_params(exoid, "element map", DIM_NUM_EM, VAR_EM_PROP(1), model->num_elem_maps, &emapdim) != NC_NOERR) goto error_ret; /* * 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... */ dim[0] = numnoddim; if (model->num_dim > 0) { if ((status = nc_def_var (exoid, VAR_COORD_X, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define node x coordinate array in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 2); } if (model->num_dim > 1) { if ((status = nc_def_var(exoid, VAR_COORD_Y, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define node y coordinate array in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 2); } if (model->num_dim > 2) { if ((status = nc_def_var(exoid, VAR_COORD_Z, nc_flt_code(exoid), 1, dim, &temp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define node z coordinate array in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, temp, 2); } } else { /* node coordinate arrays: -- all stored together (old method) */ dim[0] = numdimdim; dim[1] = numnoddim; if ((status = nc_def_var(exoid, VAR_COORD, nc_flt_code(exoid), 2, dim, &temp)) != NC_NOERR) { exerrval = status; 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 */ } } } if (ex_write_object_names(exoid, "element block",VAR_NAME_EL_BLK,elblkdim, dim_str_name, model->num_elem_blk) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "edge block", VAR_NAME_ED_BLK,edblkdim, dim_str_name, model->num_edge_blk) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "face block", VAR_NAME_FA_BLK,fablkdim, dim_str_name, model->num_face_blk) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "node set", VAR_NAME_NS, nsetdim, dim_str_name, model->num_node_sets) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "edge set", VAR_NAME_ES, esetdim, dim_str_name, model->num_edge_sets) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "face set", VAR_NAME_FS, fsetdim, dim_str_name, model->num_face_sets) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "side set", VAR_NAME_SS, ssetdim, dim_str_name, model->num_side_sets) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "element set", VAR_NAME_ELS, elsetdim, dim_str_name, model->num_elem_sets) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "node map", VAR_NAME_NM, nmapdim, dim_str_name, model->num_node_maps) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "edge map", VAR_NAME_EDM, edmapdim, dim_str_name, model->num_edge_maps) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "face map", VAR_NAME_FAM, famapdim, dim_str_name, model->num_face_maps) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "element map", VAR_NAME_EM, emapdim, dim_str_name, model->num_elem_maps) != NC_NOERR) goto error_ret; if (ex_write_object_names(exoid, "coordinate", VAR_NAME_COOR, numdimdim,dim_str_name, model->num_dim) != NC_NOERR) goto error_ret; /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete variable definitions in file id %d",exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } /* Fill the id and status arrays with EX_INVALID_ID */ { int *invalid_ids = NULL; int maxset = model->num_elem_blk; if (maxset < model->num_edge_blk) maxset = model->num_edge_blk; if (maxset < model->num_face_blk) maxset = model->num_face_blk; if (maxset < model->num_node_sets) maxset = model->num_node_sets; if (maxset < model->num_edge_sets) maxset = model->num_edge_sets; if (maxset < model->num_face_sets) maxset = model->num_face_sets; if (maxset < model->num_side_sets) maxset = model->num_side_sets; if (maxset < model->num_elem_sets) maxset = model->num_elem_sets; if (maxset < model->num_node_maps) maxset = model->num_node_maps; if (maxset < model->num_edge_maps) maxset = model->num_edge_maps; if (maxset < model->num_face_maps) maxset = model->num_face_maps; if (maxset < model->num_elem_maps) maxset = model->num_elem_maps; /* allocate space for id/status array */ if (!(invalid_ids = malloc(maxset*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for id/status array for file id %d", exoid); ex_err("ex_put_init_ext",errmsg,exerrval); return (EX_FATAL); } invalidate_id_status(exoid, VAR_STAT_EL_BLK, VAR_ID_EL_BLK, model->num_elem_blk, invalid_ids); invalidate_id_status(exoid, VAR_STAT_ED_BLK, VAR_ID_ED_BLK, model->num_edge_blk, invalid_ids); invalidate_id_status(exoid, VAR_STAT_FA_BLK, VAR_ID_FA_BLK, model->num_face_blk, invalid_ids); invalidate_id_status(exoid, VAR_NS_STAT, VAR_NS_IDS, model->num_node_sets, invalid_ids); invalidate_id_status(exoid, VAR_ES_STAT, VAR_ES_IDS, model->num_edge_sets, invalid_ids); invalidate_id_status(exoid, VAR_FS_STAT, VAR_FS_IDS, model->num_face_sets, invalid_ids); invalidate_id_status(exoid, VAR_SS_STAT, VAR_SS_IDS, model->num_side_sets, invalid_ids); invalidate_id_status(exoid, VAR_ELS_STAT, VAR_ELS_IDS, model->num_elem_sets, invalid_ids); invalidate_id_status(exoid, 0, VAR_NM_PROP(1), model->num_node_maps, invalid_ids); invalidate_id_status(exoid, 0, VAR_EDM_PROP(1), model->num_edge_maps, invalid_ids); invalidate_id_status(exoid, 0, VAR_FAM_PROP(1), model->num_face_maps, invalid_ids); invalidate_id_status(exoid, 0, VAR_EM_PROP(1), model->num_elem_maps, invalid_ids); if (invalid_ids != NULL) { free(invalid_ids); invalid_ids = NULL; } } /* Write dummy values to the names arrays to avoid corruption issues on some platforms */ if (model->num_elem_blk > 0) write_dummy_names(exoid, EX_ELEM_BLOCK); if (model->num_edge_blk > 0) write_dummy_names(exoid, EX_EDGE_BLOCK); if (model->num_face_blk > 0) write_dummy_names(exoid, EX_FACE_BLOCK); if (model->num_node_sets> 0) write_dummy_names(exoid, EX_NODE_SET); if (model->num_edge_sets> 0) write_dummy_names(exoid, EX_EDGE_SET); if (model->num_face_sets> 0) write_dummy_names(exoid, EX_FACE_SET); if (model->num_side_sets> 0) write_dummy_names(exoid, EX_SIDE_SET); if (model->num_elem_sets> 0) write_dummy_names(exoid, EX_ELEM_SET); if (model->num_node_maps> 0) write_dummy_names(exoid, EX_NODE_MAP); if (model->num_edge_maps> 0) write_dummy_names(exoid, EX_EDGE_MAP); if (model->num_face_maps> 0) write_dummy_names(exoid, EX_FACE_MAP); if (model->num_elem_maps> 0) write_dummy_names(exoid, EX_ELEM_MAP); return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_init_global.c000066400000000000000000000261771225312213100235500ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_init_global() ***************************************************************************** * This function outputs the initial global information. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_nodes_g - The number of global FEM nodes. This is output as * a NetCDF variable. * num_elems_g - The number of global FEM elements. This is output * as a NetCDF variable. * num_elem_blks_g - The number of global element blocks. This is output * as a NetCDF dimension. * num_node_sets_g - The number of global node sets. This is output as * a NetCDF dimension. * num_side_sets_g - The number of global side sets. This is output as * a NetCDF dimension. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_init_global(int exoid, int64_t num_nodes_g, int64_t num_elems_g, int64_t num_elem_blks_g, int64_t num_node_sets_g, int64_t num_side_sets_g ) { const char *func_name="ex_put_init_global"; int varid, dimid, status; char errmsg[MAX_ERR_LENGTH]; int int_type = NC_INT; int id_type = NC_INT; if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { int_type = NC_INT64; } if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { id_type = NC_INT64; } /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Put NetCDF file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file ID %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the file version */ if ((status=ex_put_nemesis_version(exoid)) < 0) return (status); /* Define dimension for number of global nodes */ if ((status = nc_def_dim(exoid, DIM_NUM_NODES_GLOBAL, num_nodes_g, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_NODES_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define dimension for number of global elements */ if ((status = nc_def_dim(exoid, DIM_NUM_ELEMS_GLOBAL, num_elems_g, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_ELEMS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* * Output the number of global element blocks. This is output as a * dimension since the vector of global element block IDs is sized * by this quantity. */ if ((status = nc_def_dim(exoid, DIM_NUM_ELBLK_GLOBAL, num_elem_blks_g, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_ELBLK_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define the element block IDs variable. */ if ((status = nc_def_var(exoid, VAR_ELBLK_IDS_GLOBAL, id_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file ID %d", VAR_ELBLK_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define the element block counts variable. */ if ((status = nc_def_var(exoid, VAR_ELBLK_CNT_GLOBAL, int_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file ID %d", VAR_ELBLK_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* * Output the number of global node sets. This is output as a * dimension since the vector of global element block IDs is sized * by this quantity. */ if (num_node_sets_g > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_NS_GLOBAL, num_node_sets_g, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_NS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define the variable for output of global node set IDs */ if ((status = nc_def_var(exoid, VAR_NS_IDS_GLOBAL, id_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file ID %d", VAR_NS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variable for global node counts in each global node set */ if ((status = nc_def_var(exoid, VAR_NS_NODE_CNT_GLOBAL, int_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file ID %d", VAR_NS_NODE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returing */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* * Define variable for global dist. factor count in each global * node set */ if ((status = nc_def_var(exoid, VAR_NS_DF_CNT_GLOBAL, int_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file ID %d", VAR_NS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returing */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_node_sets_g > 0)" */ /* * Output the number of global side sets. This is output as a * dimension since the vector of global element block IDs is sized * by this quantity. */ if (num_side_sets_g > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_SS_GLOBAL, num_side_sets_g, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_SS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define the variable for output of global side set IDs */ if ((status = nc_def_var(exoid, VAR_SS_IDS_GLOBAL, id_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file id %d", VAR_SS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* * Define the variable for count of global number of sides in the * global side sets. */ if ((status = nc_def_var(exoid, VAR_SS_SIDE_CNT_GLOBAL, int_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file id %d", VAR_SS_SIDE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* * Define the variable for count of global dist. factors in the * global side sets. */ if ((status = nc_def_var(exoid, VAR_SS_DF_CNT_GLOBAL, int_type, 1, &dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable definition for \"%s\" into file id %d", VAR_SS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_side_sets_g > 0)" */ /* End define mode */ if (ex_leavedef(exoid, func_name) != EX_NOERR) return (EX_FATAL); return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_init_info.c000066400000000000000000000141171225312213100232320ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_init_info() ***************************************************************************** * This function writes information about the processors for which the * decomposition was performed. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_proc - The number of processors in the decomposition. * num_proc_in_f - The number of processors the file contains * information for. * ftype - The type of Nemesis file. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_init_info(int exoid, int num_proc, int num_proc_in_f, char *ftype ) { const char *func_name="ex_put_init_info"; int dimid, varid; int ltempsv; int lftype; int status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Check the file type */ if (!ftype) { exerrval = EX_MSG; sprintf(errmsg, "Error: NULL file type input for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Set the file type */ if (ftype[0] == 'p' || ftype[0] == 'P') lftype = 0; else if (ftype[0] == 's' || ftype[0] == 'S') lftype = 1; else { exerrval = EX_MSG; sprintf(errmsg, "Error: unknown file type requested for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Put file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file ID %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Define dimension for the number of processors */ if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS, &dimid)) != NC_NOERR) { ltempsv = num_proc; if ((status = nc_def_dim(exoid, DIM_NUM_PROCS, ltempsv, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_PROCS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* If this is a parallel file then the status vectors are size 1 */ if (nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &dimid) != NC_NOERR) { ltempsv = num_proc_in_f; if ((status = nc_def_dim(exoid, DIM_NUM_PROCS_F, ltempsv, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Output the file type */ if (nc_inq_varid(exoid, VAR_FILE_TYPE, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_FILE_TYPE, NC_INT, 0, NULL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define file type in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if (ex_leavedef(exoid, func_name) != EX_NOERR) return (EX_FATAL); if ((status = nc_put_var1_int(exoid, varid, NULL, &lftype)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to output file type variable in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { if (ex_leavedef(exoid, func_name) != EX_NOERR) return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_loadbal_param.c000066400000000000000000000543261225312213100240400ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_loadbal_param() ***************************************************************************** * This function outputs the load balance parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_int_nodes - The number of internal FEM nodes. * num_bor_nodes - The number of border FEM nodes. * num_ext_nodes - The number of external FEM nodes. * num_int_elems - The number of internal FEM elements. * num_bor_elems - The number of border FEM elements. * num_node_cmaps - The number of nodal communication maps. * num_elem_cmaps - The number of elemental communication maps. * processor - The processor the file being read was written for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_loadbal_param(int exoid, int64_t num_int_nodes, int64_t num_bor_nodes, int64_t num_ext_nodes, int64_t num_int_elems, int64_t num_bor_elems, int64_t num_node_cmaps, int64_t num_elem_cmaps, int processor ) { const char *func_name="ex_put_loadbal_param"; int status, varid; int dimid_npf, dimid[3]; int varid_nm[3], varid_em[2]; char ftype[2]; int nmstat, ltempsv; char errmsg[MAX_ERR_LENGTH]; int id_type = NC_INT; int map_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { id_type = NC_INT64; } if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_type = NC_INT64; } /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to get file type from file ID %d\n", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* make sure that this is a parallel file */ if (ftype[0] != 'p') { exerrval = EX_MSG; sprintf(errmsg, "Error: function for use with parallel files only, file ID %d\n", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the dimension ID for the number of processors storing * information in this file. */ if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &dimid_npf)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Put NetCDF file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the file version */ if ((status=ex_put_nemesis_version(exoid)) < 0) return (status); /* Define the status variables for the nodal vectors */ if (nc_inq_varid(exoid, VAR_INT_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_INT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Set the dimension for status vectors */ if (nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_BOR_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } if (nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_EXT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Define the variable IDs for the elemental status vectors */ if (nc_inq_varid(exoid, VAR_INT_E_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_INT_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } if (nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_BOR_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: Failed to define variable \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Get the variable ID for the nodal status vectors */ if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid_nm[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid_nm[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid_nm[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variable for the internal element information */ if (num_int_elems > 0) { ltempsv = num_int_elems; if ((status = nc_def_dim(exoid, DIM_NUM_INT_ELEMS, ltempsv, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_ELEM_MAP_INT, map_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_int_elems > 0)" */ /* Get the variable IDs for the elemental status vectors */ if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid_em[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid_em[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Define variable for the border element information */ if (num_bor_elems > 0) { ltempsv = num_bor_elems; if ((status = nc_def_dim(exoid, DIM_NUM_BOR_ELEMS, ltempsv, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_ELEM_MAP_BOR, map_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_bor_elems > 0)" */ if (num_int_nodes > 0) { /* Define variable for vector of internal FEM node IDs */ ltempsv = num_int_nodes; if ((status = nc_def_dim(exoid, DIM_NUM_INT_NODES, ltempsv, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_INT, map_type, 1, &dimid[0], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_int_nodes > 0)" */ if (num_bor_nodes > 0) { /* Define variable for vector of border FEM node IDs */ ltempsv = num_bor_nodes; if ((status = nc_def_dim(exoid, DIM_NUM_BOR_NODES, ltempsv, &dimid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_BOR, map_type, 1, &dimid[1], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_bor_nodes > 0)" */ if (num_ext_nodes > 0) { /* Define dimension for vector of external FEM node IDs */ ltempsv = num_ext_nodes; if ((status = nc_def_dim(exoid, DIM_NUM_EXT_NODES, ltempsv, &dimid[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_EXT, map_type, 1, &dimid[2], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); } /* End "if (num_ext_nodes > 0)" */ /* Add the nodal communication map count */ if (num_node_cmaps > 0) { ltempsv = num_node_cmaps; if ((status = nc_def_dim(exoid, DIM_NUM_N_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension \"%s\" in file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add the ID vector */ if ((status = nc_def_var(exoid, VAR_N_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* Add the status vector */ if ((status = nc_def_var(exoid, VAR_N_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_node_cmaps > 0)" */ /* Add the nodal communication map count */ if (num_elem_cmaps > 0) { ltempsv = num_elem_cmaps; if ((status = nc_def_dim(exoid, DIM_NUM_E_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add variables for elemental communication maps */ if ((status = nc_def_var(exoid, VAR_E_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); if ((status = nc_def_var(exoid, VAR_E_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_elem_cmaps > 0)" */ /* Leave define mode */ if (ex_leavedef(exoid, func_name) != EX_NOERR) return (EX_FATAL); /* ** Set up status vector for internal node map ** NOTE(9/26/96): this function is no longer valid ** for scaler files, so no need to check for file type */ if (num_int_nodes == 0) { /* NULL set for internal nodes */ nmstat = 0; if ((status = nc_put_var_int(exoid, varid_nm[0], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for int node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { nmstat = 1; if ((status = nc_put_var_int(exoid, varid_nm[0], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for int node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_int_nodes == 0)" */ /* Set up status vector for border node map */ if (num_bor_nodes == 0) { /* NULL set for border nodes */ nmstat = 0; if ((status = nc_put_var_int(exoid, varid_nm[1], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for bor node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { /* Set the status indicating non-NULL size */ nmstat = 1; if ((status = nc_put_var_int(exoid, varid_nm[1], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for bor node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_bor_nodes == 0)" */ /* Set up status vector for external node map */ if (num_ext_nodes == 0) { /* NULL set for external nodes */ nmstat = 0; if ((status = nc_put_var_int(exoid, varid_nm[2], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for ext node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { /* Set the status indicating non-NULL size */ nmstat = 1; if ((status = nc_put_var_int(exoid, varid_nm[2], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for ext node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_ext_nodes == 0)" */ /* Set up status vector for internal element map */ if (num_int_elems == 0) { /* NULL set for internal elements */ nmstat = 0; if ((status = nc_put_var_int(exoid, varid_em[0], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for int elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { /* Set the status indicating non-NULL size */ nmstat = 1; if ((status = nc_put_var_int(exoid, varid_em[0], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for int elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_int_elems == 0)" */ /* Set up status vector for border element map */ if (num_bor_elems == 0) { /* NULL set for internal elements */ nmstat = 0; if ((status = nc_put_var_int(exoid, varid_em[1], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for bor elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } else { /* Set the status indicating non-NULL size */ nmstat = 1; if ((status = nc_put_var_int(exoid, varid_em[1], &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status for bor elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (num_bor_elems == 0)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_loadbal_param_cc.c000066400000000000000000000746711225312213100245120ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_loadbal_param_cc() ***************************************************************************** * This function outputs the concatenated list of load-balance parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * num_int_nodes - Vector of number of internal FEM nodes for * "num_proc_in_f" processors. * num_bor_nodes - Vector of number of border FEM nodes for * "num_proc_in_f" processors. * num_ext_nodes - Vector of number of external FEM nodes for * "num_proc_in_f" processors. * num_int_elems - Vector of number of internal FEM elems for * "num_proc_in_f" processors. * num_bor_elems - Vector of number of border FEM elems for * "num_proc_in_f" processors. * num_node_cmaps - Vector of number of nodal communication maps * for "num_proc_in_f" processors. * num_elem_cmaps - Vector of number of elemental communication maps * for "num_proc_in_f" processors. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #ifndef NC_INT64 #define NC_INT64 NC_INT #endif int ex_put_loadbal_param_cc(int exoid, void_int *num_int_nodes, void_int *num_bor_nodes, void_int *num_ext_nodes, void_int *num_int_elems, void_int *num_bor_elems, void_int *num_node_cmaps, void_int *num_elem_cmaps ) { const char *func_name="ex_put_loadbal_param_cc"; int status; int iproc, varid, dimid_npf, dimid[3]; int num_proc, num_proc_in_f; int varid_nm[3], varid_em[2]; int varid_idx[7] = {0, 0, 0, 0, 0, 0, 0}; size_t start[1]; char ftype[2]; int oldfill; #if defined(NC_NETCDF4) int64_t num_int_elem = 0, num_int_node = 0, num_bor_elem = 0; int64_t num_bor_node = 0, num_ext_node = 0; int64_t num_n_cmaps = 0, num_e_cmaps = 0; #else int num_int_elem = 0, num_int_node = 0, num_bor_elem = 0; int num_bor_node = 0, num_ext_node = 0; int num_n_cmaps = 0, num_e_cmaps = 0; #endif int nmstat; char errmsg[MAX_ERR_LENGTH]; int format; int index_type = NC_INT; int map_type = NC_INT; int id_type = NC_INT; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_type = NC_INT64; } if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { id_type = NC_INT64; } /* See if using NC_FORMAT_NETCDF4 format... */ nc_inq_format(exoid, &format); if ((ex_int64_status(exoid) & EX_BULK_INT64_DB) || (format == NC_FORMAT_NETCDF4)) { index_type = NC_INT64; } /* Get the processor information from the file */ if (ex_get_init_info(exoid, &num_proc, &num_proc_in_f, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: Unable to get processor info from file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Get the dimension ID for the number of processors storing * information in this file. */ if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &dimid_npf)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_PROCS_F, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Put NetCDF file into define mode */ if ((status = nc_redef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Set the fill mode */ if ((status = nc_set_fill(exoid, NC_NOFILL, &oldfill)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file ID %d into no-fill mode", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the file version */ if ((status=ex_put_nemesis_version(exoid)) < 0) return (status); /* Output the file type */ if (nc_inq_varid(exoid, VAR_FILE_TYPE, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_FILE_TYPE, NC_INT, 0, NULL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define file type in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Define the status variables for the nodal vectors */ if (nc_inq_varid(exoid, VAR_INT_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_INT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Set the dimension for status vectors */ if (nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_BOR_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } if (nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_EXT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Define the variable IDs for the elemental status vectors */ if (nc_inq_varid(exoid, VAR_INT_E_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_INT_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } if (nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid) != NC_NOERR) { if ((status = nc_def_var(exoid, VAR_BOR_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: Failed to define variable \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* Get the variable ID for the nodal status vectors */ if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid_nm[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid_nm[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid_nm[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Get the variable IDs for the elemental status vectors */ if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid_em[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid_em[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* mms: NEW STUFF HERE */ /* ** first need to loop through the processors in this ** file and get the counts of the element and cmap lists */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { for(iproc=0; iproc < num_proc_in_f; iproc++) { num_int_elem += ((int64_t*)num_int_elems)[iproc]; num_int_node += ((int64_t*)num_int_nodes)[iproc]; num_bor_elem += ((int64_t*)num_bor_elems)[iproc]; num_bor_node += ((int64_t*)num_bor_nodes)[iproc]; num_ext_node += ((int64_t*)num_ext_nodes)[iproc]; num_e_cmaps += ((int64_t*)num_elem_cmaps)[iproc]; num_n_cmaps += ((int64_t*)num_node_cmaps)[iproc]; } } else { for(iproc=0; iproc < num_proc_in_f; iproc++) { num_int_elem += ((int*)num_int_elems)[iproc]; num_int_node += ((int*)num_int_nodes)[iproc]; num_bor_elem += ((int*)num_bor_elems)[iproc]; num_bor_node += ((int*)num_bor_nodes)[iproc]; num_ext_node += ((int*)num_ext_nodes)[iproc]; num_e_cmaps += ((int*)num_elem_cmaps)[iproc]; num_n_cmaps += ((int*)num_node_cmaps)[iproc]; } } /* Define variable for the internal element information */ if (num_int_elem > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_INT_ELEMS, num_int_elem, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_ELEM_MAP_INT, map_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* and the index variable */ if ((status = nc_def_var(exoid, VAR_ELEM_MAP_INT_IDX, index_type, 1, &dimid_npf, &varid_idx[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_int_elem > 0)" */ /* Define variable for the border element information */ if (num_bor_elem > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_BOR_ELEMS, num_bor_elem, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_ELEM_MAP_BOR, map_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* and the index variable */ if ((status = nc_def_var(exoid, VAR_ELEM_MAP_BOR_IDX, index_type, 1, &dimid_npf, &varid_idx[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_ELEM_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_bor_elem > 0)" */ if (num_int_node > 0) { /* Define variable for vector of internal FEM node IDs */ if ((status = nc_def_dim(exoid, DIM_NUM_INT_NODES, num_int_node, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_INT, map_type, 1, &dimid[0], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* and the index variable */ if ((status = nc_def_var(exoid, VAR_NODE_MAP_INT_IDX, index_type, 1, &dimid_npf, &varid_idx[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_int_node > 0)" */ if (num_bor_node > 0) { /* Define variable for vector of border FEM node IDs */ if ((status = nc_def_dim(exoid, DIM_NUM_BOR_NODES, num_bor_node, &dimid[1])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_BOR, map_type, 1, &dimid[1], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* and the index variable */ if ((status = nc_def_var(exoid, VAR_NODE_MAP_BOR_IDX, index_type, 1, &dimid_npf, &varid_idx[3])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_bor_node > 0)" */ if (num_ext_node > 0) { /* Define dimension for vector of external FEM node IDs */ if ((status = nc_def_dim(exoid, DIM_NUM_EXT_NODES, num_ext_node, &dimid[2])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to dimension \"%s\" in file id %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_NODE_MAP_EXT, map_type, 1, &dimid[2], &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } ex_compress_variable(exoid, varid, 1); /* and the index variable */ if ((status = nc_def_var(exoid, VAR_NODE_MAP_EXT_IDX, index_type, 1, &dimid_npf, &varid_idx[4])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_NODE_MAP_EXT_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_ext_node > 0)" */ /* Output the communication map dimensions */ if (num_n_cmaps > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_N_CMAPS, num_n_cmaps, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension \"%s\" in file ID %d", DIM_NUM_N_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add variables for communication maps */ if ((status = nc_def_var(exoid, VAR_N_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_N_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* and the index variable */ if ((status = nc_def_var(exoid, VAR_N_COMM_INFO_IDX, index_type, 1, &dimid_npf, &varid_idx[5])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_n_cmaps > 0)" */ if (num_e_cmaps > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_E_CMAPS, num_e_cmaps, &dimid[0])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to add dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* Add variables for elemental communication maps */ if ((status = nc_def_var(exoid, VAR_E_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_E_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } if ((status = nc_def_var(exoid, VAR_E_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_E_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } /* and the index variable */ if ((status = nc_def_var(exoid, VAR_E_COMM_INFO_IDX, index_type, 1, &dimid_npf, &varid_idx[6])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define variable \"%s\" in file ID %d", VAR_E_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); /* Leave define mode before returning */ ex_leavedef(exoid, func_name); return (EX_FATAL); } } /* End "if (num_e_cmaps > 0)" */ /* Leave define mode */ if (ex_leavedef(exoid, func_name) != EX_NOERR) return (EX_FATAL); /* need to reset these counters */ num_int_elem = 0; num_int_node = 0; num_bor_elem = 0; num_bor_node = 0; num_ext_node = 0; num_n_cmaps = 0; num_e_cmaps = 0; /* Update the status vectors */ for(iproc=0; iproc < num_proc_in_f; iproc++) { size_t nin; size_t nbn; size_t nen; size_t nie; size_t nbe; size_t nnc; size_t nec; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { nie = ((int64_t*)num_int_elems)[iproc]; nin = ((int64_t*)num_int_nodes)[iproc]; nbe = ((int64_t*)num_bor_elems)[iproc]; nbn = ((int64_t*)num_bor_nodes)[iproc]; nen = ((int64_t*)num_ext_nodes)[iproc]; nec = ((int64_t*)num_elem_cmaps)[iproc]; nnc = ((int64_t*)num_node_cmaps)[iproc]; } else { nie = ((int*)num_int_elems)[iproc]; nin = ((int*)num_int_nodes)[iproc]; nbe = ((int*)num_bor_elems)[iproc]; nbn = ((int*)num_bor_nodes)[iproc]; nen = ((int*)num_ext_nodes)[iproc]; nec = ((int*)num_elem_cmaps)[iproc]; nnc = ((int*)num_node_cmaps)[iproc]; } start[0] = iproc; if (nin > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, varid_nm[0], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status int node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nbn > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, varid_nm[1], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status bor node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nen > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, varid_nm[2], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status ext node map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nie > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, varid_em[0], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status int elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nbe > 0) nmstat = 1; else nmstat = 0; if ((status = nc_put_var1_int(exoid, varid_em[1], start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output status bor elem map in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* now fill the index variables */ if (varid_idx[0] > 0) { /* increment to the next starting position */ num_int_elem += nie; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[0], start, (long long*)&num_int_elem); #else status = nc_put_var1_int(exoid, varid_idx[0], start, &num_int_elem); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output internal element map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[1] > 0) { /* increment to the next starting position */ num_bor_elem += nbe; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[1], start, (long long*)&num_bor_elem); #else status = nc_put_var1_int(exoid, varid_idx[1], start, &num_bor_elem); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output border element map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[2] > 0) { /* increment to the next starting position */ num_int_node += nin; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[2], start, (long long*)&num_int_node); #else status = nc_put_var1_int(exoid, varid_idx[2], start, &num_int_node); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output internal node map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[3] > 0) { /* increment to the next starting position */ num_bor_node += nbn; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[3], start, (long long*)&num_bor_node); #else status = nc_put_var1_int(exoid, varid_idx[3], start, &num_bor_node); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output border node map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[4] > 0) { /* increment to the next starting position */ num_ext_node += nen; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[4], start, (long long*)&num_ext_node); #else status = nc_put_var1_int(exoid, varid_idx[4], start, &num_ext_node); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output external node map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[5] > 0) { /* increment to the next starting position */ num_n_cmaps += nnc; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[5], start, (long long*)&num_n_cmaps); #else status = nc_put_var1_int(exoid, varid_idx[5], start, &num_n_cmaps); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output node communication map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } if (varid_idx[6] > 0) { /* increment to the next starting position */ num_e_cmaps += nec; #if defined(NC_NETCDF4) status = nc_put_var1_longlong(exoid, varid_idx[6], start, (long long*)&num_e_cmaps); #else status = nc_put_var1_int(exoid, varid_idx[6], start, &num_e_cmaps); #endif if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output elem communication map index in file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } } /* End "for(iproc=0; iproc < num_proc_in_f; iproc++)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_map.c000066400000000000000000000135721225312213100220350ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * int* elem_map element order map array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! \deprecated Use ex_put_num_map() instead. The function ex_put_map() writes out the optional element order map to the database. See #ElementOrderMap for a description of the element order map. The function ex_put_init() must be invoked before this call is made. In case of an error, ex_put_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - an element map already exists in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] elem_map The element order map. The following code generates a default element order map and outputs it to an open exodus file. This is a trivial case and included just for illustration. Since this map is optional, it should be written out only if it contains something other than the default map. \code int error, exoid; int *elem_map = (int *)calloc(num_elem, sizeof(int)); for (i=0; i < num_elem; i++) { elem_map[i] = i+1; } error = ex_put_map(exoid, elem_map); \endcode */ int ex_put_map (int exoid, const void_int *elem_map) { int numelemdim, dims[1], mapid, status; int map_int_type; 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 (nc_inq_dimid(exoid, DIM_NUM_ELEM, &numelemdim) != NC_NOERR) { return (EX_NOERR); } /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_map",errmsg,exerrval); return (EX_FATAL); } /* create a variable array in which to store the element map */ dims[0] = numelemdim; map_int_type = NC_INT; if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_int_type = NC_INT64; } if ((status = nc_def_var(exoid, VAR_MAP, map_int_type, 1, dims, &mapid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: element map already exists in file id %d", exoid); ex_err("ex_put_map",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create element map array in file id %d", exoid); ex_err("ex_put_map",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, mapid, 1); /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_map",errmsg,exerrval); return (EX_FATAL); } /* write out the element order map */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_var_longlong(exoid, mapid, elem_map); } else { status = nc_put_var_int(exoid, mapid, elem_map); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store element map in file id %d", exoid); ex_err("ex_put_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_map",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_map_param.c000066400000000000000000000250441225312213100232120ustar00rootroot00000000000000/* * 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 * * 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" #include #include /*! * defines the number of node and element maps. It is more efficient * to define both of these at the same time; however, they can be * defined in separate calls by setting only one of the counts to a * non-zero value. It is an error to redefine the number of node or * element maps. * \param exoid exodus file id * \param num_node_maps number of node maps * \param num_elem_maps number of element maps */ int ex_put_map_param (int exoid, int num_node_maps, int num_elem_maps) { int dim[2], dimid, strdim, varid, status; int var_nm_id, var_em_id; int i; char errmsg[MAX_ERR_LENGTH]; int id_type = NC_INT; int int_type = NC_INT; exerrval = 0; /* clear error code */ if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { id_type = NC_INT64; } if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { int_type = NC_INT64; } /* return if these have been defined before */ if ( (num_node_maps > 0 && ((nc_inq_dimid (exoid, DIM_NUM_NM, &dimid)) == NC_NOERR)) || (num_elem_maps > 0 && ((nc_inq_dimid (exoid, DIM_NUM_EM, &dimid)) == NC_NOERR)) ) { exerrval = EX_MSG; sprintf(errmsg, "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 ((status = nc_inq_dimid (exoid, DIM_STR_NAME, &strdim)) != NC_NOERR) { exerrval = status; 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 ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_map_param",errmsg,exerrval); return (EX_FATAL); } /* node maps: */ if (num_node_maps > 0) { if ((status = nc_def_dim(exoid, DIM_NUM_NM, num_node_maps, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of node maps in file id %d",exoid); ex_err("ex_put_map_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* node maps id array: */ dim[0] = dimid; if ((status = nc_def_var(exoid, VAR_NM_PROP(1), id_type, 1, dim, &var_nm_id)) != NC_NOERR) { exerrval = status; 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 ((status=nc_put_att_text(exoid, var_nm_id, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { exerrval = status; 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 (nc_def_var(exoid, VAR_NAME_NM, NC_CHAR, 2, dim, &varid) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define node map name array in file id %d",exoid); ex_err("ex_put_map_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* determine number of nodes */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: couldn't determine number of nodes in file id %d", exoid); ex_err("ex_put_node_map",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } dim[0] = dimid; /* create variable array in which to store the node maps */ for (i=0; i < num_node_maps; i++) { if ((status = nc_def_var(exoid,VAR_NODE_MAP(i+1),int_type,1,dim,&varid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: node map %d already defined in file id %d", i,exoid); ex_err("ex_put_node_map",errmsg,exerrval); } else { exerrval = status; 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 */ } ex_compress_variable(exoid, varid, 1); } } /* element maps: */ if (num_elem_maps > 0) { if ((status = nc_def_dim (exoid, DIM_NUM_EM, num_elem_maps,&dimid)) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_var(exoid, VAR_EM_PROP(1), id_type, 1, dim, &var_em_id)) != NC_NOERR) { exerrval = status; 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 ((status=nc_put_att_text(exoid, var_em_id, ATT_PROP_NAME, 3, "ID")) != NC_NOERR) { exerrval = status; 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 ((status = nc_def_var(exoid, VAR_NAME_EM, NC_CHAR, 2, dim, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define element map name array in file id %d",exoid); ex_err("ex_put_map_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* determine number of elements */ if ((status = nc_inq_dimid(exoid, DIM_NUM_ELEM, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: couldn't determine number of elements in file id %d", exoid); ex_err("ex_put_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 ((status = nc_def_var(exoid,VAR_ELEM_MAP(i+1),int_type,1,dim, &varid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: element map %d already defined in file id %d", i,exoid); ex_err("ex_put_elem_map",errmsg,exerrval); } else { exerrval = status; 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 */ } ex_compress_variable(exoid, varid, 1); } } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete variable definitions in file id %d",exoid); ex_err("ex_put_map_param",errmsg,exerrval); return (EX_FATAL); } /* Fill the id arrays with EX_INVALID_ID */ { int maxset = num_node_maps > num_elem_maps ? num_node_maps : num_elem_maps; int *invalid_ids = malloc(maxset*sizeof(int)); for (i=0; i < maxset; i++) { invalid_ids[i] = EX_INVALID_ID; } if (num_node_maps > 0) { status = nc_put_var_int(exoid, var_nm_id, invalid_ids); assert(status == NC_NOERR); } if (num_elem_maps > 0) { status = nc_put_var_int(exoid, var_em_id, invalid_ids); assert(status == NC_NOERR); } free(invalid_ids); } } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_map_param",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_attr.c000066400000000000000000000054641225312213100225500ustar00rootroot00000000000000/* * 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_n_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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated use ex_put_partial_attr() * * writes the attributes for an edge/face/element block * \param exoid exodus file id * \param blk_type block type * \param blk_id block id * \param attrib array of attributes */ int ex_put_n_attr (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_entity, int64_t num_entity, const void *attrib) { return ex_put_partial_attr(exoid, blk_type, blk_id, start_entity, num_entity, attrib); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_coord.c000066400000000000000000000062341225312213100227000ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expcor - ex_put_n_coord * * entry conditions - * input parameters: * int exoid exodus file id * int start_node_num starting index (1-based) of coordinates to be written. * int num_nodes number of nodes to write coordinates for. * float* x_coord X coord array * float* y_coord y coord array * float* z_coord z coord array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" /*! * \deprecated Use ex_put_partial_coord() instead. * writes the coordinates of some of the nodes in the model * Only writes the 'non-null' arrays. * \param exoid exodus file id * \param start_node_num the starting index (1-based) of the coordinates to be written * \param num_nodes the number of nodes to write coordinates for. * \param x_coor x coord array * \param y_coor y coord array * \param z_coor z coord array */ int ex_put_n_coord (int exoid, int64_t start_node_num, int64_t num_nodes, const void *x_coor, const void *y_coor, const void *z_coor) { return ex_put_partial_coord(exoid, start_node_num, num_nodes, x_coor, y_coor, z_coor); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_elem_attr.c000066400000000000000000000061341225312213100235450ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_elem_attr() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID. * start_elem_num - The starting index of the elements to be * obtained. * num_elems - The number of FEM elements to read coords for. * attrib - Pointer to the attribute vector. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /* * \deprecated Use ex_put_partial_attr() instead. */ int ex_put_n_elem_attr (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void *attrib) { return ex_put_partial_attr(exoid, EX_ELEM_BLOCK, elem_blk_id, start_elem_num, num_elems, attrib); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_elem_conn.c000066400000000000000000000057411225312213100235330ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_elem_conn() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID. * start_elem_num - The starting index of the elements to be * obtained. * num_elems - The number of FEM elements to read coords for. * connect - Pointer to the connectivity vector. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" /*! * \deprecated Use ex_put_partial_elem_conn() instead. */ int ex_put_n_elem_conn (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, const void_int *connect) { return ex_put_partial_elem_conn(exoid, elem_blk_id, start_elem_num, num_elems, connect); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_elem_num_map.c000066400000000000000000000051621225312213100242270ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_pennm - ex_put_n_elem_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent first entry in elem_map * int num_ents number of entries in node_map * int* elem_map element numbering map array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" /* * writes out a portion of the element numbering map to the database; * this allows element numbers to be non-contiguous */ int ex_put_n_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *elem_map) { return ex_put_partial_id_map(exoid, EX_ELEM_MAP, start_ent, num_ents, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_nodal_var.c000066400000000000000000000063231225312213100235360ustar00rootroot00000000000000/* * 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_n_nodal_var * * entry conditions - * input parameters: * int exoid exodus file id * int time_step whole time step number * int nodel_var_index index of desired nodal variable * int start_node index (1-based) of first node to put * int num_nodes number of nodal points * float* nodal_var_vals array of nodal variable values * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the values of a single nodal variable for a partial block at * one single time step to the database; assume the first time step * and nodal variable index is 1 * \param exoid exodus file id * \param time_step whole time step number * \param nodal_var_index index of desired nodal variable * \param start_node index of first node to write data for (1-based) * \param num_nodes number of nodal points * \param nodal_var_vals array of nodal variable values */ int ex_put_n_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, const void *nodal_var_vals) { return ex_put_partial_nodal_var(exoid, time_step, nodal_var_index, start_node, num_nodes, nodal_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_node_num_map.c000066400000000000000000000051251225312213100242310ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_pnnnm - ex_put_n_node_num_map * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent first entry in node_map * int num_ents number of entries in node_map * int* node_map node numbering map * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /* * writes out the node numbering map to the database; allows node numbers * to be non-contiguous */ int ex_put_n_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *node_map) { return ex_put_partial_id_map(exoid, EX_NODE_MAP, start_ent, num_ents, node_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_node_set.c000066400000000000000000000060361225312213100233720ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_node_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to read. * start_node_num - The starting index of the nodes to be read. * num_nodes - The number of nodes to read in. * node_set_node_list - List of node IDs in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include "exodusII.h" /* * \deprecated Use ex_put_partial_set() instead */ int ex_put_n_node_set (int exoid, ex_entity_id node_set_id, int64_t start_node_num, int64_t num_nodes, const void_int *node_set_node_list) { return ex_put_partial_set(exoid, EX_NODE_SET, node_set_id, start_node_num, num_nodes, node_set_node_list, NULL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_node_set_df.c000066400000000000000000000063431225312213100240440ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_node_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to write. * start_num - The starting index of the df's to be written. * num_df_to_get - The number of distribution factors to write out. * node_set_dist_fact - List of node distribution factors in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated Use ex_put_partial_set_dist_fact() */ int ex_put_n_node_set_df (int exoid, ex_entity_id node_set_id, int64_t start_num, int64_t num_df_to_get, void *node_set_dist_fact) { return ex_put_partial_set_dist_fact(exoid, EX_NODE_SET, node_set_id, start_num, num_df_to_get, node_set_dist_fact); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_one_attr.c000066400000000000000000000063101225312213100234000ustar00rootroot00000000000000/* * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expoea - ex_put_n_one_attr * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type object type (edge, face, elem block) * int obj_id object id (edge, face, elem block ID) * int attrib_index index of attribute to write * float* attrib array of attributes * * exit conditions - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated Use ex_put_partial_one_attr() instead. * writes the specified attribute for a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param start_num the starting index of the attributes to be written * \param num_ent the number of entities to write attributes for. * \param attrib_index index of attribute to write * \param attrib array of attributes */ int ex_put_n_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, const void *attrib ) { return ex_put_partial_one_attr(exoid, obj_type, obj_id, start_num, num_ent, attrib_index, attrib); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_side_set.c000066400000000000000000000064701225312213100233730ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_side_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to read. * start_side_num - The starting index of the sides to be read. * num_sides - The number of sides to read in. * side_set_elem_list - List of element IDs in side set. * side_set_side_list - List of side IDs in side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! * /deprecated use ex_put_partial_set() instead */ int ex_put_n_side_set (int exoid, ex_entity_id side_set_id, int64_t start_side_num, int64_t num_sides, const void_int *side_set_elem_list, const void_int *side_set_side_list) { return ex_put_partial_set(exoid, EX_SIDE_SET, side_set_id, start_side_num, num_sides, side_set_elem_list, side_set_side_list); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_side_set_df.c000066400000000000000000000063211225312213100240370ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_n_side_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to written. * start_num - The starting index of the df's to be written. * num_df_to_get - The number of sides to write. * side_set_dist_fact - List of distribution factors for the side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated use ex_put_partial_set_dist_fact() instead */ int ex_put_n_side_set_df (int exoid, ex_entity_id side_set_id, int64_t start_num, int64_t num_df_to_get, void *side_set_dist_fact) { return ex_put_partial_set_dist_fact(exoid, EX_SIDE_SET, side_set_id, start_num, num_df_to_get, side_set_dist_fact); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_n_var.c000066400000000000000000000070511225312213100223600ustar00rootroot00000000000000/* * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expvar - ex_put_var * * entry conditions - * input parameters: * int exoid exodus file id * int time_step time step number * int var_type type (edge block, face block, edge set, ... ) * int var_index element variable index * int obj_id element block id * int start_num starting index of the variables to be written * int num_ent number of entities to write variables for. * * exit conditions - * * * exit conditions - * * revision history - * * *****************************************************************************/ #include #include "exodusII.h" #include "exodusII_int.h" /*! * \deprecated use ex_put_partial_var() instead * writes the values of a single variable for a partial block at one time * step to the database; assume the first time step and variable index * are 1 * \param exoid exodus file id * \param time_step time step number * \param var_type type (edge block, face block, edge set, ... ) * \param var_index element variable index * \param obj_id element block id * \param start_index index of first entity in block to write (1-based) * \param num_entities number of entries in this block/set * \param var_vals the values to be written */ int ex_put_n_var (int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, const void *var_vals) { return ex_put_partial_var(exoid, time_step, var_type, var_index, obj_id, start_index, num_entities, var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_name.c000066400000000000000000000112431225312213100221710ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the name of the specified entity to the database. The entity * with id `entity_id` must exist before calling ex_put_name(). * * \param exoid exodus file id * \param obj_type object type * \param entity_id id of entity name to write * \param name ptr to entity name */ int ex_put_name (int exoid, ex_entity_type obj_type, ex_entity_id entity_id, const char *name) { int status; int varid, ent_ndx; char errmsg[MAX_ERR_LENGTH]; const char *routine = "ex_put_name"; const char *vobj; exerrval = 0; /* clear error code */ switch(obj_type) { case EX_EDGE_BLOCK: vobj = VAR_NAME_ED_BLK; break; case EX_FACE_BLOCK: vobj = VAR_NAME_FA_BLK; break; case EX_ELEM_BLOCK: vobj = VAR_NAME_EL_BLK; break; case EX_NODE_SET: vobj = VAR_NAME_NS; break; case EX_SIDE_SET: vobj = VAR_NAME_SS; break; case EX_EDGE_SET: vobj = VAR_NAME_ES; break; case EX_FACE_SET: vobj = VAR_NAME_FS; break; case EX_ELEM_SET: vobj = VAR_NAME_ELS; break; case EX_NODE_MAP: vobj = VAR_NAME_NM; break; case EX_EDGE_MAP: vobj = VAR_NAME_EDM; break; case EX_FACE_MAP: vobj = VAR_NAME_FAM; break; case EX_ELEM_MAP: vobj = VAR_NAME_EM; break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid); ex_err(routine,errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, vobj, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s names in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } ent_ndx = ex_id_lkup(exoid, obj_type, entity_id); if (exerrval == EX_LOOKUPFAIL) { /* could not find the element block id */ exerrval = EX_FATAL; sprintf(errmsg, "Error: %s id %"PRId64" not found in file id %d", ex_name_of_object(obj_type), entity_id, exoid); ex_err("ex_put_name",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 */ status = ex_put_name_internal(exoid, varid, ent_ndx-1, name, obj_type, "", routine); return(status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_names.c000066400000000000000000000103251225312213100223540ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the entity names to the database * \param exoid exodus file id * \param obj_type object type * \param names ptr array of entity names */ int ex_put_names (int exoid, ex_entity_type obj_type, char* names[]) { int status; int varid; size_t num_entity; char errmsg[MAX_ERR_LENGTH]; const char *vname = NULL; const char *routine = "ex_put_names"; exerrval = 0; /* clear error code */ switch (obj_type) { /* ======== BLOCKS ========= */ case EX_EDGE_BLOCK: vname = VAR_NAME_ED_BLK; break; case EX_FACE_BLOCK: vname = VAR_NAME_FA_BLK; break; case EX_ELEM_BLOCK: vname = VAR_NAME_EL_BLK; break; /* ======== SETS ========= */ case EX_NODE_SET: vname = VAR_NAME_NS; break; case EX_EDGE_SET: vname = VAR_NAME_ES; break; case EX_FACE_SET: vname = VAR_NAME_FS; break; case EX_SIDE_SET: vname = VAR_NAME_SS; break; case EX_ELEM_SET: vname = VAR_NAME_ELS; break; /* ======== MAPS ========= */ case EX_NODE_MAP: vname = VAR_NAME_NM; break; case EX_EDGE_MAP: vname = VAR_NAME_EDM; break; case EX_FACE_MAP: vname = VAR_NAME_FAM; break; case EX_ELEM_MAP: vname = VAR_NAME_EM; break; /* ======== ERROR (Invalid type) ========= */ default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid type specified in file id %d", exoid); ex_err(routine,errmsg,exerrval); return(EX_FATAL); } ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type), &num_entity, &varid, routine); if ((status = nc_inq_varid(exoid, vname, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s names in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } /* write EXODUS entitynames */ status = ex_put_names_internal(exoid, varid, num_entity, names, obj_type, "", routine); return(status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_nodal_var.c000066400000000000000000000131371225312213100232220ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_put_nodal_var() writes the values of a single nodal variable for a single time step. The function ex_put_variable_param() must be invoked before this call is made. Because nodal variables are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_nodal_var() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - ex_put_variable_param() not called previously specifying the number of nodal variables. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number, as described under ex_put_time(). This is essentially a counter that is incremented when results variables are output. The first time step is 1. \param[in] nodal_var_index The index of the nodal variable. The first variable has an index of 1. \param[in] num_nodes The number of nodal points. \param[in] nodal_var_vals Array of \c num_nodes values of the \c nodal_var_index-th nodal variable for the \c time_step-th time step. As an example, the following code segment writes all the nodal variables for a single time step: \code int num_nod_vars, num_nodes, error, exoid, time_step; float *nodal_var_vals; \comment{write nodal variables} nodal_var_vals = (float *) calloc(num_nodes, sizeof(float)); for (k=1; k <= num_nod_vars; k++) { for (j=0; j < num_nodes; j++) { \comment{application code fills in this array} nodal_var_vals[j] = 10.0; } error = ex_put_nodal_var(exoid, time_step, k, num_nodes, nodal_var_vals); } \endcode */ int ex_put_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t num_nodes, const void *nodal_var_vals) { int status; int varid; size_t start[3], count[3]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if (ex_large_model(exoid) == 0) { /* write values of the nodal variable */ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variables in file id %d", exoid); ex_err("ex_put_nodal_var",errmsg,exerrval); 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 ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err("ex_put_nodal_var",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = 0; count[0] = 1; count[1] = num_nodes; } if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store nodal variables in file id %d", exoid); ex_err("ex_put_nodal_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_nodal_var_slab.c000066400000000000000000000121421225312213100242160ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_nodal_var_slab() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * time_step - The time step to write this data to. * nodal_var_index - The index of this nodal variable. * start_pos - The start point for outputting data. The first * value is 0. * num_vals - The number of values to be output. * nodal_var_vals - Pointer to the vector of values to be output. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #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_slab (int exoid, int time_step, int nodal_var_index, int64_t start_pos, int64_t num_vals, void *nodal_var_vals) { int status; int varid; size_t start[3], count[3]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire previously defined variable -- if not found assume that the new separate 'blob' per nodal var storage is being used */ if (ex_large_model(exoid) == 0) { /* write values of the nodal variable */ if ((status = nc_inq_varid (exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err("ex_put_nodal_var_slab",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --nodal_var_index; start[2] = --start_pos; count[0] = 1; count[1] = 1; count[2] = num_vals; } else { /* nodal variables stored separately, find variable for this variable index */ if ((status = nc_inq_varid (exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err("ex_put_nodal_var_slab",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --start_pos; count[0] = 1; count[1] = num_vals; } if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store nodal variables in file id %d", exoid); ex_err("ex_put_nodal_var_slab",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_cmap.c000066400000000000000000000176051225312213100232060ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ /* Function(s) contained in this file: * ex_put_node_cmap() **************************************************************************** * This function outputs a nodal communication map. **************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * map_id - The ID of the nodal communication map to retrieve. * node_ids - Pointer to vector containing the FEM node IDs * that make up this communication map. * proc_ids - Pointer to vector containing the processors IDs * associated with each of the nodes in this nodal * communication map. * processor - The processor the file is being written for. */ /****************************************************************************/ /****************************************************************************/ /****************************************************************************/ #include #include #include #include int ex_put_node_cmap(int exoid, ex_entity_id map_id, void_int *node_ids, void_int *proc_ids, int processor ) { const char *func_name="ex_put_node_cmap"; int map_idx, varid, dimid, status; size_t start[1], count[1], ret_val; int64_t varidx[2]; int value; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* get the index for the comm map information variables */ if (ex_get_idx(exoid, VAR_N_COMM_INFO_IDX, varidx, processor) == -1) { sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_INFO_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the index for this map_id */ if ((map_idx=ne_id_lkup(exoid, VAR_N_COMM_IDS, varidx, map_id)) == -1) { sprintf(errmsg, "Error: failed to find index for variable \"%s\" in file ID %d", VAR_N_COMM_IDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Find out if this is a NULL comm map by checking it's entry in * the status vector. */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = map_idx; if ((status = nc_get_var1_int(exoid, varid, start, &value)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: unable to get variable \"%s\" from file ID %d", VAR_N_COMM_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (value == 0) return(EX_NOERR); /* NULL set */ /* now I need to get the comm map data index */ if (ex_get_idx(exoid, VAR_N_COMM_DATA_IDX, varidx, map_idx) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_N_COMM_DATA_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension of the cmap data */ if (varidx[1] == -1) { /* Get the size of the comm maps */ if ((status = nc_inq_dimid(exoid, DIM_NCNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get dimension ID for \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &ret_val)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NCNT_CMAP, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = ret_val; } /* "if (varidx[1]==-1)" */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; /* Output the node IDs for this comm map */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_NIDS, &varid )) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, node_ids); } else { status = nc_put_vara_int(exoid, varid, start, count, node_ids); } if (status != NC_NOERR) { fprintf(stderr, "Start, Count = %lu\t%lu\n", (unsigned long)start[0], (unsigned long)count[0]); exerrval = status; sprintf(errmsg, "Error: failed to output vector \"%s\" in file ID %d", VAR_N_COMM_NIDS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the processor IDs for this map */ if ((status = nc_inq_varid(exoid, VAR_N_COMM_PROC, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, proc_ids); } else { status = nc_put_vara_int(exoid, varid, start, count, proc_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_N_COMM_PROC, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_map.c000066400000000000000000000051771225312213100230440ustar00rootroot00000000000000/* * 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 * * 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 * \param exoid exodus file id * \param map_id node map id * \param node_map node map * \deprecated Use ex_put_num_map()(exoid, EX_NODE_MAP, map_id, node_map) */ int ex_put_node_map (int exoid, ex_entity_id map_id, const void_int *node_map) { return ex_put_num_map( exoid, EX_NODE_MAP, map_id, node_map ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_num_map.c000066400000000000000000000063471225312213100237230ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_id_map()(exoid, EX_NODE_MAP, node_map) The function ex_put_node_num_map() writes out the optional node number map to the database. See Section LocalNodeIds for a description of the node number map. The function ex_put_init() must be invoked before this call is made. \return In case of an error, ex_put_node_num_map() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - a node number map already exists in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_map The node number map. The following code generates a default node number map and outputs it to an open exodus file. This is a trivial case and included just for illustration. Since this map is optional, it should be written out only if it contains something other than the default map. \code int error, exoid; int *node_map = (int *)calloc(num_nodes, sizeof(int)); for (i=1; i <= num_nodes; i++) node_map[i-1] = i; error = ex_put_node_num_map(exoid, node_map); \comment{Equivalent using non-deprecated function} error = ex_put_id_map(exoid, EX_NODE_MAP, node_map); \endcode */ int ex_put_node_num_map (int exoid, const void_int *node_map) { return ex_put_id_map(exoid, EX_NODE_MAP, node_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_set.c000066400000000000000000000060031225312213100230470ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_set()(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL) The function ex_put_node_set() writes the node list for a single node set. The function ex_put_node_set_param() must be called before this routine is invoked. \return In case of an error, ex_put_node_set() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - ex_put_node_set_param() not called previously. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_id The node set ID. \param[in] node_set_node_list Array containing the node list for the node set. Internal node IDs are used in this list (See Section LocalNodeIds). Refer to the description of ex_put_node_set_param() for a sample code segment to write out a node set. */ int ex_put_node_set (int exoid, ex_entity_id node_set_id, const void_int *node_set_node_list) { return ex_put_set(exoid, EX_NODE_SET, node_set_id, node_set_node_list, NULL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_set_dist_fact.c000066400000000000000000000065051225312213100250760ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_set_dist_fact()(exoid, EX_NODE_SET, node_set_id, node_set_dist_fact) The function ex_put_node_set_dist_fact() writes node set distribution factors for a single node set. The function ex_put_node_set_param() must be called before this routine is invoked. Because the distribution factors are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_node_set_dist_fact() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - ex_put_node_set_param() not called previously. - a call to ex_put_node_set_param() specified zero distribution factors. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_id The node set ID. \param[in] node_set_dist_fact Array containing the distribution factors in the node set. Refer to the description of ex_put_node_set_param() for a sample code segment to write out the distribution factors for a node set. */ int ex_put_node_set_dist_fact (int exoid, ex_entity_id 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_node_set_param.c000066400000000000000000000106541225312213100242360ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" /*! \deprecated Use ex_put_set_param()(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_dist_in_set) The function ex_put_node_set_param() writes the node set ID, the number of nodes which describe a single node set, and the number of node set distribution factors for the node set. \return In case of an error, ex_put_node_set_param() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - the number of node sets specified in the call to ex_put_init() was zero or has been exceeded. - a node set with the same ID has already been stored. - the specified number of distribution factors is not zero and is not equal to the number of nodes. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] node_set_id The node set ID. \param[in] num_nodes_in_set The number of nodes in the node set. \param[in] num_dist_in_set The number of distribution factors in the node set. This should be either 0 (zero) for no factors, or should equal \c num_nodes_in_set. The following code segment will write out a node set to an open exodus file : \code int id, num_nodes_in_set, num_dist_in_set, error, exoid, *node_list; float *dist_fact; \comment{write node set parameters} id = 20; num_nodes_in_set = 5; num_dist_in_set = 5; error = ex_put_node_set_param(exoid, id, num_nodes_in_set, num_dist_in_set); \comment{write node set node list} node_list = (int *) calloc (num_nodes_in_set, sizeof(int)); node_list[0] = 100; node_list[1] = 101; node_list[2] = 102; node_list[3] = 103; node_list[4] = 104; error = ex_put_node_set(exoid, id, node_list); \comment{write node set distribution factors} dist_fact = (float *) calloc (num_dist_in_set, sizeof(float)); 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_dist_fact(exoid, id, dist_fact); \comment{Same result using non-deprecated functions} error = ex_put_set_param(exoid, EX_NODE_SET, id, num_nodes_in_set, num_dist_in_set); error = ex_put_set(exoid, EX_NODE_SET, id, node_list); error = ex_put_set_dist_fact(exoid, EX_NODE_SET, id, dist_fact); \endcode */ int ex_put_node_set_param (int exoid, ex_entity_id node_set_id, int64_t num_nodes_in_set, int64_t num_dist_in_set) { return ex_put_set_param(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_dist_in_set); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_ns_param_global.c000066400000000000000000000137161225312213100244000ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_ns_param_global() ***************************************************************************** * This function outputs the global node-set parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * global_ids - Pointer to a vector of global node-set IDs. * node_cnts - Pointer to a vector of global node counts in * each global node set. * df_cnts - Pointer to a vector of global distribution * factors in each global node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_ns_param_global(int exoid, void_int *global_ids, void_int *node_cnts, void_int *df_cnts ) { const char *func_name="ex_put_ns_param_global"; int varid, status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the variable ID for the vector of global node set IDs */ if ((status = nc_inq_varid(exoid, VAR_NS_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of global node set IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, varid, global_ids); } else { status = nc_put_var_int(exoid, varid, global_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" to file ID %d", VAR_NS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the vector of global node-set node counts */ if ((status = nc_inq_varid(exoid, VAR_NS_NODE_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_NODE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of global node counts in each global node set */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, varid, node_cnts); } else { status = nc_put_var_int(exoid, varid, node_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable \"%s\" in file ID %d", VAR_NS_NODE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the number of dist. factors in each node set */ if ((status = nc_inq_varid(exoid, VAR_NS_DF_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of dist. factor counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, varid, df_cnts); } else { status = nc_put_var_int(exoid, varid, df_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_NS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_nset_var.c000066400000000000000000000066071225312213100231020ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #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 * \param exoid exodus file id * \param time_step time step number * \param nset_var_index nodeset variable index * \param nset_id nodeset id * \param num_nodes_this_nset number of nodes in this nodeset * \param nset_var_vals the values to be written * \deprecated Use ex_put_var()(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_nodes_this_nset, nset_var_vals) */ int ex_put_nset_var (int exoid, int time_step, int nset_var_index, ex_entity_id nset_id, int64_t num_nodes_this_nset, const void *nset_var_vals) { return ex_put_var(exoid, time_step, EX_NODE_SET, nset_var_index, nset_id, num_nodes_this_nset, nset_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_nset_var_tab.c000066400000000000000000000067151225312213100237300ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #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 * \param exoid exodus file id * \param num_nset number of nodesets * \param num_nset_var number of nodeset variables * \param nset_var_tab nodeset variable truth table array * \deprecated Use ex_put_truth_table()(exoid, EX_NODE_SET, num_nset, num_nset_var, nset_var_tab) */ int ex_put_nset_var_tab (int exoid, int num_nset, int num_nset_var, int *nset_var_tab) { return ex_put_truth_table(exoid, EX_NODE_SET, num_nset, num_nset_var, nset_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_num_map.c000066400000000000000000000222461225312213100227120ustar00rootroot00000000000000/* * 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 * * 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 - * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* 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). * \param exoid exodus file id * \param map_type type of map (node,edge,face,elem) * \param map_id id to associate with new map * \param map map set value array */ int ex_put_num_map ( int exoid, ex_entity_type map_type, ex_entity_id map_id, const void_int *map ) { int dimid, varid; int map_int_type; size_t start[1]; int ldum; int num_maps; size_t num_entries; int cur_num_maps; char errmsg[MAX_ERR_LENGTH]; const char* dnumentries; const char* dnummaps; const char* vmapids; const char* vmap; int status; exerrval = 0; /* clear error code */ switch ( map_type ) { case EX_NODE_MAP: dnumentries = DIM_NUM_NODES; dnummaps = DIM_NUM_NM; vmapids = VAR_NM_PROP(1); break; case EX_EDGE_MAP: dnumentries = DIM_NUM_EDGE; dnummaps = DIM_NUM_EDM; vmapids = VAR_EDM_PROP(1); break; case EX_FACE_MAP: dnumentries = DIM_NUM_FACE; dnummaps = DIM_NUM_FAM; vmapids = VAR_FAM_PROP(1); break; case EX_ELEM_MAP: dnumentries = DIM_NUM_ELEM; dnummaps = DIM_NUM_EM; vmapids = VAR_EM_PROP(1); 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 (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR ) { return (EX_NOERR); } /* first check if any maps are specified */ if ((status = nc_inq_dimid (exoid, dnummaps, &dimid)) != NC_NOERR ) { exerrval = status; sprintf(errmsg, "Error: no %ss specified in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check for duplicate map id entry */ ex_id_lkup(exoid,map_type,map_id); if (exerrval != EX_LOOKUPFAIL) /* found the map id */ { sprintf(errmsg, "Error: %s %"PRId64" already defined in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_put_num_map",errmsg,exerrval); return(EX_FATAL); } /* Get number of maps initialized for this file */ if ((status = nc_inq_dimlen(exoid,dimid,&num_entries)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %ss in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } num_maps = num_entries; /* Keep track of the total number of maps defined using a counter stored in a linked list keyed by exoid. NOTE: ex_get_file_item is used to find the number of maps for a specific file and returns that value. */ cur_num_maps = ex_get_file_item(exoid, ex_get_counter_list(map_type)); if (cur_num_maps >= num_maps) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of %ss (%d) specified in file id %d", ex_name_of_object(map_type),num_maps,exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* NOTE: ex_inc_file_item is used to find the number of maps for a specific file and returns that value incremented. */ cur_num_maps = ex_inc_file_item(exoid, ex_get_counter_list(map_type)); /* write out information to previously defined variable */ /* first get id of variable */ if ((status = nc_inq_varid (exoid, vmapids, &varid)) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* then, write out map id */ start[0] = cur_num_maps; ldum = (int)map_id; if ((status = nc_put_var1_int(exoid, varid, start, &ldum)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id %"PRId64" in file id %d", ex_name_of_object(map_type),map_id,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; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized map type in switch: %d in file id %d", map_type,exoid); ex_err("ex_putt_n_one_attr",errmsg,EX_MSG); return (EX_FATAL); } /* locate variable array in which to store the map */ if ((status = nc_inq_varid(exoid,vmap,&varid)) != NC_NOERR) { int dims[2]; /* determine number of entries */ if ((status = nc_inq_dimid (exoid, dnumentries, &dimid)) == -1 ) { exerrval = status; sprintf(errmsg, "Error: couldn't determine number of %s entries in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_redef( exoid )) != NC_NOERR ) { exerrval = status; sprintf(errmsg, "Error: failed to place file id %d into define mode", exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check type to be used for maps... */ map_int_type = NC_INT; if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_int_type = NC_INT64; } dims[0] = dimid; if ((status = nc_def_var( exoid, vmap, map_int_type, 1, dims, &varid )) == -1 ) { exerrval = status; sprintf(errmsg, "Error: failed to define map %s in file id %d", vmap, exoid); ex_err("ex_put_num_map",errmsg,exerrval); } ex_compress_variable(exoid, varid, 1); if ((status = nc_enddef(exoid)) != NC_NOERR ) { /* exit define mode */ sprintf( errmsg, "Error: failed to complete definition for file id %d", exoid ); ex_err( "ex_put_num_map", errmsg, exerrval ); varid = -1; /* force early exit */ } if ( varid == -1 ) /* we couldn't define variable and have prepared error message. */ return (EX_FATAL); } /* write out the map */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_var_longlong(exoid, varid, map); } else { status = nc_put_var_int(exoid, varid, map); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_one_attr.c000066400000000000000000000164411225312213100230710ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the specified attribute for a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param attrib_index index of attribute to write * \param attrib array of attributes */ int ex_put_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int attrib_index, const void *attrib ) { int status; int attrid, obj_id_ndx, temp; size_t num_entries_this_obj, num_attr; size_t start[2], count[2]; ptrdiff_t stride[2]; char errmsg[MAX_ERR_LENGTH]; const char* dnumobjent; const char* dnumobjatt; const char* vattrbname; exerrval = 0; /* clear error code */ /* Determine index of obj_id in id array */ if (obj_type != EX_NODAL) { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_put_one_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this element block */ } else { sprintf(errmsg, "Error: no %s id %"PRId64" in id array in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_one_attr",errmsg,exerrval); return (EX_FATAL); } } } switch (obj_type) { case EX_SIDE_SET: dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vattrbname = VAR_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vattrbname = VAR_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vattrbname = VAR_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vattrbname = VAR_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vattrbname = VAR_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjent = DIM_NUM_NODES; dnumobjatt = DIM_NUM_ATT_IN_NBLK; vattrbname = VAR_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vattrbname = VAR_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx); vattrbname = VAR_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx); vattrbname = VAR_ATTRIB(obj_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_put_one_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } /* inquire id's of previously defined dimensions */ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_put_one_attr") != NC_NOERR) return EX_FATAL; if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_put_one_attr") != NC_NOERR) return EX_FATAL; if (attrib_index < 1 || attrib_index > (int)num_attr) { exerrval = EX_FATAL; sprintf(errmsg, "Error: Invalid attribute index specified: %d. Valid range is 1 to %d for %s %"PRId64" in file id %d", attrib_index, (int)num_attr, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_one_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attribute variable for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_put_one_attr",errmsg,exerrval); return (EX_FATAL); } /* write out the attributes */ 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 (ex_comp_ws(exoid) == 4) { status = nc_put_vars_float(exoid, attrid, start, count, stride, attrib); } else { status = nc_put_vars_double(exoid, attrid, start, count, stride, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put attribute %d for %s %"PRId64" in file id %d", attrib_index, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_one_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_one_elem_attr.c000066400000000000000000000056571225312213100241020ustar00rootroot00000000000000/* * 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 * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the specified attribute for an element block * \param exoid exodus file id * \param elem_blk_id element block id * \param attrib_index index of attribute to write * \param attrib array of attributes * \deprecated Use ex_put_one_attr()(exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib) */ int ex_put_one_elem_attr (int exoid, ex_entity_id elem_blk_id, int attrib_index, const void *attrib) { return ex_put_one_attr( exoid, EX_ELEM_BLOCK, elem_blk_id, attrib_index, attrib ); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_attr.c000066400000000000000000000167421225312213100237500ustar00rootroot00000000000000/* * 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_partial_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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the attributes for an edge/face/element block * \param exoid exodus file id * \param blk_type block type * \param blk_id block id * \param attrib array of attributes */ int ex_put_partial_attr (int exoid, ex_entity_type blk_type, ex_entity_id blk_id, int64_t start_entity, int64_t num_entity, const void *attrib) { int status; int attrid; int blk_id_ndx = 0; int numattrdim; size_t start[2], count[2]; size_t num_attr; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if ( blk_type != EX_NODAL ) { /* Determine index of blk_id in VAR_ID_EL_BLK array */ blk_id_ndx = ex_id_lkup(exoid,blk_type,blk_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this block */ } else { sprintf(errmsg, "Error: no %s id %"PRId64" in in file id %d", ex_name_of_object(blk_type), blk_id, exoid); ex_err("ex_put_attr",errmsg,exerrval); return (EX_FATAL); } } } switch (blk_type) { case EX_SIDE_SET: status = nc_inq_varid (exoid, VAR_SSATTRIB(blk_id_ndx), &attrid); break; case EX_NODE_SET: status = nc_inq_varid (exoid, VAR_NSATTRIB(blk_id_ndx), &attrid); break; case EX_EDGE_SET: status = nc_inq_varid (exoid, VAR_ESATTRIB(blk_id_ndx), &attrid); break; case EX_FACE_SET: status = nc_inq_varid (exoid, VAR_FSATTRIB(blk_id_ndx), &attrid); break; case EX_ELEM_SET: status = nc_inq_varid (exoid, VAR_ELSATTRIB(blk_id_ndx), &attrid); break; case EX_NODAL: status = nc_inq_varid (exoid, VAR_NATTRIB, &attrid); break; case EX_EDGE_BLOCK: status = nc_inq_varid (exoid, VAR_EATTRIB(blk_id_ndx), &attrid); break; case EX_FACE_BLOCK: status = nc_inq_varid (exoid, VAR_FATTRIB(blk_id_ndx), &attrid); break; case EX_ELEM_BLOCK: status = nc_inq_varid (exoid, VAR_ATTRIB(blk_id_ndx), &attrid); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", blk_type,exoid); ex_err("ex_put_partial_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attribute variable for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_partial_attr",errmsg,exerrval); return (EX_FATAL); } /* Determine number of attributes */ switch (blk_type) { case EX_SIDE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_SS(blk_id_ndx), &numattrdim); break; case EX_NODE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NS(blk_id_ndx), &numattrdim); break; case EX_EDGE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ES(blk_id_ndx), &numattrdim); break; case EX_FACE_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FS(blk_id_ndx), &numattrdim); break; case EX_ELEM_SET: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_ELS(blk_id_ndx), &numattrdim); break; case EX_NODAL: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_NBLK, &numattrdim); break; case EX_EDGE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_EBLK(blk_id_ndx), &numattrdim); break; case EX_FACE_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_FBLK(blk_id_ndx), &numattrdim); break; case EX_ELEM_BLOCK: status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(blk_id_ndx), &numattrdim); break; default: /* No need for error message, handled in previous switch; just to quiet compiler. */ return (EX_FATAL); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: number of attributes not defined for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_partial_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_partial_attr",errmsg,exerrval); return (EX_FATAL); } /* write out the attributes */ start[0] = --start_entity; start[1] = 0; count[0] = num_entity; count[1] = num_attr; if (count[0] == 0) start[0] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, attrid, start, count, attrib); } else { status = nc_put_vara_double(exoid, attrid, start, count, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put attributes for %s %"PRId64" in file id %d", ex_name_of_object(blk_type),blk_id,exoid); ex_err("ex_put_partial_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_coord.c000066400000000000000000000201671225312213100241000ustar00rootroot00000000000000/* * 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_partial_coord * * entry conditions - * input parameters: * int exoid exodus file id * int start_node_num starting index (1-based) of coordinates to be written. * int num_nodes number of nodes to write coordinates for. * float* x_coord X coord array * float* y_coord y coord array * float* z_coord z coord array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the coordinates of some of the nodes in the model * Only writes the 'non-null' arrays. * \param exoid exodus file id * \param start_node_num the starting index (1-based) of the coordinates to be written * \param num_nodes the number of nodes to write coordinates for. * \param x_coor x coord array * \param y_coor y coord array * \param z_coor z coord array */ int ex_put_partial_coord (int exoid, int64_t start_node_num, int64_t num_nodes, const void *x_coor, const void *y_coor, const void *z_coor) { int status; int coordid; int coordidx, coordidy, coordidz; int numnoddim, ndimdim; int64_t num_nod; size_t i, num_dim, start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid(exoid, DIM_NUM_NODES, &numnoddim)) != NC_NOERR) { /* If not found, then this file is storing 0 nodes. Return immediately */ return (EX_NOERR); } { size_t tmp; if ((status = nc_inq_dimlen(exoid, numnoddim, &tmp)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: inquire failed to return number of nodes in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } num_nod = tmp; } if ((status = nc_inq_dimid(exoid, DIM_NUM_DIM, &ndimdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of dimensions in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, ndimdim, &num_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of dimensions in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } if (start_node_num + num_nodes -1 > num_nod) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: start index (%"PRId64") + node count (%"PRId64") is larger than total number of nodes (%"PRId64") in file id %d", start_node_num, num_nodes, num_nod, exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } --start_node_num; /* write out the coordinates */ if (ex_large_model(exoid) == 0) { if ((status = nc_inq_varid(exoid, VAR_COORD, &coordid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate nodal coordinates in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } for (i=0; i 1) { if ((status = nc_inq_varid(exoid, VAR_COORD_Y, &coordidy)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate y nodal coordinates in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidy = 0; } if (num_dim > 2) { if ((status = nc_inq_varid(exoid, VAR_COORD_Z, &coordidz)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate z nodal coordinates in file id %d", exoid); ex_err("ex_put_partial_coord",errmsg,exerrval); return (EX_FATAL); } } else { coordidz = 0; } /* write out the coordinates */ for (i=0; i #include "exodusII.h" #include "exodusII_int.h" /* * writes the attributes for an element block */ int ex_put_partial_elem_attr (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, void *attrib) { int status; int numelbdim, numattrdim, attrid, elem_blk_id_ndx; size_t num_elem_this_blk, num_attr, start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */ if ((elem_blk_id_ndx = ex_id_lkup(exoid, EX_ELEM_BLOCK, elem_blk_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes allowed for NULL block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this element block */ } else { sprintf(errmsg, "Error: no element block id %"PRId64" in %s array in file id %d", elem_blk_id, VAR_ID_EL_BLK, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx), &numelbdim)) != NC_NOERR) { if (status == NC_EBADDIM) { exerrval = status; sprintf(errmsg, "Error: no element block with id %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate number of elements for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_dimlen(exoid, numelbdim, &num_elem_this_blk)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of elements for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid(exoid, DIM_NUM_ATT_IN_BLK(elem_blk_id_ndx), &numattrdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: number of attributes not defined for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,EX_MSG); return (EX_FATAL); /* number of attributes not defined */ } if ((status = nc_inq_dimlen(exoid, numattrdim, &num_attr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of attributes for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_ATTRIB(elem_blk_id_ndx), &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attribute variable for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } /* do some error checking */ if (num_elem_this_blk < (start_elem_num + num_elems - 1)) { exerrval = status; sprintf(errmsg, "Error: requested attributes from too many elements in block %"PRId64, elem_blk_id); ex_err("ex_put_partial_elem_attr",errmsg, exerrval); return(EX_FATAL); } /* write out the attributes */ start[0] = --start_elem_num; start[1] = 0; count[0] = num_elems; count[1] = num_attr; if (count[0] == 0) start[0] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, attrid, start, count, attrib); } else { status = nc_put_vara_double(exoid, attrid, start, count, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put attributes for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_elem_conn.c000066400000000000000000000147161225312213100247340ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_partial_elem_conn() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * elem_blk_id - The element block ID. * start_elem_num - The starting index of the elements to be * obtained. * num_elems - The number of FEM elements to read coords for. * connect - Pointer to the connectivity vector. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * writes the connectivity array for an element block */ int ex_put_partial_elem_conn (int exoid, ex_entity_id elem_blk_id, int64_t start_elem_num, int64_t num_elems, const void_int *connect) { int numelbdim, nelnoddim, connid, elem_blk_id_ndx, status; size_t num_elem_this_blk, num_nod_per_elem, start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* Determine index of elem_blk_id in VAR_ID_EL_BLK array */ if ((elem_blk_id_ndx = ex_id_lkup(exoid, EX_ELEM_BLOCK, elem_blk_id)) == -1) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: connectivity array not allowed for NULL element block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate element block id %"PRId64" in %s array in file id %d", elem_blk_id,VAR_ID_EL_BLK, exoid); ex_err("ex_put_partial_elem_conn",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_NUM_EL_IN_BLK(elem_blk_id_ndx), &numelbdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of elements in block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg, exerrval); return(EX_FATAL); } if ((status = nc_inq_dimlen(exoid, numelbdim, &num_elem_this_blk)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of elements in block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_PER_EL(elem_blk_id_ndx), &nelnoddim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes/elem in block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_dimlen (exoid, nelnoddim, &num_nod_per_elem)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes/elem in block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_CONN(elem_blk_id_ndx), &connid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate connectivity array for element block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg, exerrval); return(EX_FATAL); } /* do some error checking */ if (num_elem_this_blk < (start_elem_num + num_elems - 1)) { exerrval = status; sprintf(errmsg, "Error: requested connectivity from too many elements in block, %"PRId64, elem_blk_id); ex_err("ex_put_partial_elem_conn",errmsg, exerrval); return(EX_FATAL); } /* write out the connectivity array */ start[0] = --start_elem_num; start[1] = 0; count[0] = num_elems; count[1] = num_nod_per_elem; if (count[0] == 0) start[0] = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, connid, start, count, connect); } else { status = nc_put_vara_int(exoid, connid, start, count, connect); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to write connectivity array for block %"PRId64" in file id %d", elem_blk_id, exoid); ex_err("ex_put_partial_elem_conn",errmsg, exerrval); return(EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_elem_map.c000066400000000000000000000054741225312213100245550ustar00rootroot00000000000000/* * 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 * * 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 /* for free() */ /*! * writes an element map; this is a vector of integers of length number * of elements * \deprecated Use ex_put_partial_num_map()(exoid, EX_ELEM_MAP, map_id, ent_start, ent_count, elem_map) instead */ int ex_put_partial_elem_map (int exoid, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, const void_int *elem_map) { return ex_put_partial_num_map(exoid, EX_ELEM_MAP, map_id, ent_start, ent_count, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_elem_num_map.c000066400000000000000000000051761225312213100254330ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_pennm - ex_put_partial_elem_num_map * * environment - UNIX * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent first entry in elem_map * int num_ents number of entries in node_map * int* elem_map element numbering map array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" /* * writes out a portion of the element numbering map to the database; * this allows element numbers to be non-contiguous */ int ex_put_partial_elem_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *elem_map) { return ex_put_partial_id_map(exoid, EX_ELEM_MAP, start_ent, num_ents, elem_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_id_map.c000066400000000000000000000161231225312213100242200ustar00rootroot00000000000000/* * Copyright (c) 2007 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expenm - ex_put_partial_id_map * * entry conditions - * input parameters: * int exoid exodus file id * ex_entity_type obj_type * int* elem_map element numbering map array * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes out a portion of the entity numbering map to the database; * this allows the entity numbers to be non-contiguous. This map is * used for mapping between local and global entity ids. * \param exoid exodus file id * \param map_type * \param start_entity_num * \param num_entities * \param map element numbering map array */ int ex_put_partial_id_map (int exoid, ex_entity_type map_type, int64_t start_entity_num, int64_t num_entities, const void_int *map) { int dimid, mapid, status, dims[1]; int map_int_type; size_t start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; const char* tname; const char* dnumentries; const char* vmap; exerrval = 0; /* clear error code */ if (num_entities == 0 && !ex_is_parallel(exoid)) return EX_NOERR; switch ( map_type ) { case EX_NODE_MAP: tname = "node"; dnumentries = DIM_NUM_NODES; vmap = VAR_NODE_NUM_MAP; break; case EX_EDGE_MAP: tname = "edge"; dnumentries = DIM_NUM_EDGE; vmap = VAR_EDGE_NUM_MAP; break; case EX_FACE_MAP: tname = "face"; dnumentries = DIM_NUM_FACE; vmap = VAR_FACE_NUM_MAP; break; case EX_ELEM_MAP: tname = "element"; dnumentries = DIM_NUM_ELEM; vmap = VAR_ELEM_NUM_MAP; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Bad map type (%d) specified for file id %d", map_type, exoid ); ex_err( "ex_put_partial_id_map", errmsg, exerrval ); return (EX_FATAL); } /* Make sure the file contains entries */ if (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR) { /* Error -- if we made it this far, num_entities is > 0, * but the dimension 'dnumentries' is not defined which * indicates that either the entity count is zero, or * there is an error in that the dimension has not yet * been defined. Note that in parallel, num_entities could * be zero on a processor, but non-zero globally. */ exerrval = EX_BADPARAM; sprintf(errmsg, "Error: The %s count is %ld, but the %s dimension is not defined on file id %d.", tname, num_entities, dnumentries, exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); return (EX_FATAL); } /* define the map if it doesn't already exist... */ if (nc_inq_varid (exoid, vmap, &mapid) != NC_NOERR) { if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); return (EX_FATAL); } /* create a variable array in which to store the id map */ dims[0] = dimid; /* Check type to be used for maps... */ map_int_type = NC_INT; if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) { map_int_type = NC_INT64; } if ((status = nc_def_var(exoid, vmap, map_int_type, 1, dims, &mapid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: %s numbering map already exists in file id %d", tname, exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to create %s id map in file id %d", tname, exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, mapid, 1); /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); return (EX_FATAL); } } /* write out the entity numbering map */ start[0] = start_entity_num-1; count[0] = num_entities; if (num_entities == 0) start[0] = 0; /* write out the entity numbering map */ if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, mapid, start, count, map); } else { status = nc_put_vara_int(exoid, mapid, start, count, map); } if (status!= NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s numbering map in file id %d", tname, exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_partial_id_map",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_nodal_var.c000066400000000000000000000114421225312213100247330ustar00rootroot00000000000000/* * 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_partial_nodal_var * * entry conditions - * input parameters: * int exoid exodus file id * int time_step whole time step number * int nodel_var_index index of desired nodal variable * int start_node index (1-based) of first node to put * int num_nodes number of nodal points * float* nodal_var_vals array of nodal variable values * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the values of a single nodal variable for a partial block at * one single time step to the database; assume the first time step * and nodal variable index is 1 * \param exoid exodus file id * \param time_step whole time step number * \param nodal_var_index index of desired nodal variable * \param start_node index of first node to write data for (1-based) * \param num_nodes number of nodal points * \param nodal_var_vals array of nodal variable values */ int ex_put_partial_nodal_var (int exoid, int time_step, int nodal_var_index, int64_t start_node, int64_t num_nodes, const void *nodal_var_vals) { int status; int varid; size_t start[3], count[3]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if (ex_large_model(exoid) == 0) { /* write values of the nodal variable */ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variables in file id %d", exoid); ex_err("ex_put_partial_nodal_var",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --nodal_var_index; start[2] = --start_node; count[0] = 1; count[1] = 1; count[2] = num_nodes; } else { /* nodal variables stored separately, find variable for this variable index */ if ((status = nc_inq_varid(exoid, VAR_NOD_VAR_NEW(nodal_var_index), &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Warning: could not find nodal variable %d in file id %d", nodal_var_index, exoid); ex_err("ex_put_partial_nodal_var",errmsg,exerrval); return (EX_WARN); } start[0] = --time_step; start[1] = --start_node; count[0] = 1; count[1] = num_nodes; if (num_nodes == 0) start[1] = 0; } if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, nodal_var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, nodal_var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store nodal variables in file id %d", exoid); ex_err("ex_put_partial_nodal_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_node_num_map.c000066400000000000000000000051411225312213100254260ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /***************************************************************************** * * ne_pnnnm - ex_put_partial_node_num_map * * entry conditions - * input parameters: * int exoid exodus file id * int start_ent first entry in node_map * int num_ents number of entries in node_map * int* node_map node numbering map * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /* * writes out the node numbering map to the database; allows node numbers * to be non-contiguous */ int ex_put_partial_node_num_map (int exoid, int64_t start_ent, int64_t num_ents, const void_int *node_map) { return ex_put_partial_id_map(exoid, EX_NODE_MAP, start_ent, num_ents, node_map); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_node_set.c000066400000000000000000000146571225312213100246010ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_partial_node_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to read. * start_node_num - The starting index of the nodes to be read. * num_nodes - The number of nodes to read in. * node_set_node_list - List of node IDs in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * writes the node list for a single node set */ int ex_put_partial_node_set (int exoid, ex_entity_id node_set_id, int64_t start_node_num, int64_t num_nodes, const void_int *node_set_node_list) { int dimid, node_list_id, node_set_id_ndx, status; size_t num_nodes_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any node sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no node sets specified in file id %d", exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of node set id in VAR_NS_IDS array */ if ((node_set_id_ndx = ex_id_lkup(exoid, EX_NODE_SET, node_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL node set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate node set id %"PRId64" in VAR_NS_IDS array in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_NS(node_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes in set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_nodes_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_node_num < 0 || start_node_num > num_nodes_in_set) { fprintf(stderr, "ERROR: Invalid input to function ex_get_partial_node_set!\n"); return -1; } if (num_nodes < 0) { fprintf(stderr, "ERROR: Invalid number of nodes in nodes set!\n"); return -1; } /* start_node_num now starts at 1, not 0 */ if ((start_node_num + num_nodes - 1) > num_nodes_in_set) { fprintf(stderr, "ERROR: request larger than number of nodes in set!\n"); return -1; } /* inquire if variable for node set node list has been defined */ if ((status = nc_inq_varid (exoid, VAR_NODE_NS(node_set_id_ndx), &node_list_id)) != NC_NOERR) { /* variable doesn't exist */ exerrval = status; sprintf(errmsg, "Error: failed to locate node set %"PRId64" node list in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } /* write out the node list array */ start[0] = --start_node_num; count[0] = num_nodes; if (count[0] == 0) start[0] = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, node_list_id, start, count, node_set_node_list); } else { status = nc_put_vara_int(exoid, node_list_id, start, count, node_set_node_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store node set %"PRId64" node list in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_node_set_df.c000066400000000000000000000160511225312213100252400ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_partial_node_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * node_set_id - ID of node set to write. * start_num - The starting index of the df's to be written. * num_df_to_get - The number of distribution factors to write out. * node_set_dist_fact - List of node distribution factors in node set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * writes the node set distribution factors for a single node set */ int ex_put_partial_node_set_df (int exoid, ex_entity_id node_set_id, int64_t start_num, int64_t num_df_to_get, void *node_set_dist_fact) { int status; int dimid, dist_id, node_set_id_ndx; size_t num_nodes_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any node sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NS, &dimid)) < 0) { exerrval = status; sprintf(errmsg, "Error: no node sets specified in file id %d", exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of node set id in VAR_NS_IDS array */ if ((node_set_id_ndx = ex_id_lkup(exoid, EX_NODE_SET, node_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL node set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate node set id %"PRId64" in VAR_NS_IDS array in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_NUM_NOD_NS(node_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of nodes in node set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_nodes_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of nodes in set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_num < 0 || start_num > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } if (num_df_to_get < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of nodes in nodes set!"); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* start_num now starts at 1, not 0 */ if ((start_num + num_df_to_get - 1) > num_nodes_in_set) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of nodes in set!"); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } /* find id of distribution factors variable */ if ((status = nc_inq_varid (exoid, VAR_FACT_NS(node_set_id_ndx), &dist_id)) != NC_NOERR) { if (status == NC_ENOTVAR) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: no dist factors defined for node set %"PRId64" in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate node set %"PRId64" dist factors in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } } /* write out the distribution factors array */ start[0] = --start_num; count[0] = num_df_to_get; if (count[0] == 0) start[0] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, dist_id, start, count, node_set_dist_fact); } else { status = nc_put_vara_double(exoid, dist_id, start, count, node_set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store node set %"PRId64" dist factors in file id %d", node_set_id, exoid); ex_err("ex_put_partial_node_set_df",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_num_map.c000066400000000000000000000224671225312213100244330ustar00rootroot00000000000000/* * 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_num_map * * 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 *map map * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! * writes a map; this is a vector of integers of length number of mesh * objects of that type (element, node, face, edge) */ int ex_put_partial_num_map (int exoid, ex_entity_type map_type, ex_entity_id map_id, int64_t ent_start, int64_t ent_count, const void_int *map) { int status; int dimid, varid, map_ndx, map_exists; size_t start[1]; size_t num_maps, num_mobj, count[1]; int cur_num_maps; char errmsg[MAX_ERR_LENGTH]; const char* dnumentries; const char* dnummaps; const char* vmapids; const char* vmap; exerrval = 0; /* clear error code */ switch ( map_type ) { case EX_NODE_MAP: dnumentries = DIM_NUM_NODES; dnummaps = DIM_NUM_NM; vmapids = VAR_NM_PROP(1); break; case EX_EDGE_MAP: dnumentries = DIM_NUM_EDGE; dnummaps = DIM_NUM_EDM; vmapids = VAR_EDM_PROP(1); break; case EX_FACE_MAP: dnumentries = DIM_NUM_FACE; dnummaps = DIM_NUM_FAM; vmapids = VAR_FAM_PROP(1); break; case EX_ELEM_MAP: dnumentries = DIM_NUM_ELEM; dnummaps = DIM_NUM_EM; vmapids = VAR_EM_PROP(1); 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 (nc_inq_dimid (exoid, dnumentries, &dimid) != NC_NOERR ) { return (EX_NOERR); } /* first check if any maps are specified */ if ((status = nc_inq_dimid (exoid, dnummaps, &dimid)) != NC_NOERR ) { exerrval = status; sprintf(errmsg, "Error: no %ss specified in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check for duplicate map id entry */ ex_id_lkup(exoid,map_type,map_id); if (exerrval == EX_LOOKUPFAIL) { /* did not find the map id */ map_exists = 0; /* Map is being defined */ } else { map_exists = 1; /* A portion of this map has already been written */ } /* Check for duplicate map id entry */ if (!map_exists) { /* Get number of maps initialized for this file */ if ((status = nc_inq_dimlen(exoid,dimid,&num_maps)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of %ss in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_partial_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 element maps for a specific file and returns that value. */ cur_num_maps = ex_get_file_item(exoid, ex_get_counter_list(map_type)); if (cur_num_maps >= (int)num_maps) { exerrval = EX_FATAL; sprintf(errmsg, "Error: exceeded number of %ss (%"ST_ZU") specified in file id %d", ex_name_of_object(map_type),num_maps,exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* NOTE: ex_inc_file_item is used to find the number of element maps for a specific file and returns that value incremented. */ cur_num_maps = ex_inc_file_item(exoid, ex_get_counter_list(map_type)); } else { map_ndx = ex_id_lkup(exoid,map_type,map_id); cur_num_maps = map_ndx-1; } /* determine number of elements */ if ((status = nc_inq_dimid(exoid, dnumentries, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: couldn't determine number of mesh objects in file id %d", exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_mobj)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of mesh objects in file id %d", exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (ent_start <= 0 || ent_start > num_mobj) { exerrval = EX_FATAL; sprintf(errmsg, "Error: start count is invalid in file id %d", exoid); ex_err("ex_put_partial_num_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_num_map",errmsg,exerrval); return (EX_FATAL); } if (ent_start+ent_count-1 > num_mobj) { exerrval = EX_FATAL; sprintf(errmsg, "Error: start+count-1 is larger than mesh object count in file id %d", exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* write out information to previously defined variable */ /* first get id of variable */ if ((status = nc_inq_varid (exoid, vmapids, &varid)) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s ids in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_num_map",errmsg,exerrval); return (EX_FATAL); } /* then, write out map id */ if (!map_exists) { start[0] = cur_num_maps; { if ((status = nc_put_var1_longlong(exoid, varid, start, (long long*)&map_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id %"PRId64" in file id %d", ex_name_of_object(map_type),map_id,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; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized map type in switch: %d in file id %d", map_type,exoid); ex_err("ex_putt_partial_one_attr",errmsg,EX_MSG); return (EX_FATAL); } /* locate variable array in which to store the map */ if ((status = nc_inq_varid(exoid,vmap, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s %"PRId64" in file id %d", ex_name_of_object(map_type),map_id,exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } /* write out the map */ start[0] = ent_start-1; count[0] = ent_count; if (count[0] == 0) start[0] = 0; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, map); } else { status = nc_put_vara_int(exoid, varid, start, count, map); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s in file id %d", ex_name_of_object(map_type),exoid); ex_err("ex_put_partial_num_map",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_one_attr.c000066400000000000000000000175121225312213100246050ustar00rootroot00000000000000/* * 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_partial_one_attr * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type object type (edge, face, elem block) * int obj_id object id (edge, face, elem block ID) * int attrib_index index of attribute to write * float* attrib array of attributes * * exit conditions - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the specified attribute for a block * \param exoid exodus file id * \param obj_type object type (edge, face, elem block) * \param obj_id object id (edge, face, elem block ID) * \param start_num the starting index of the attributes to be written * \param num_ent the number of entities to write attributes for. * \param attrib_index index of attribute to write * \param attrib array of attributes */ int ex_put_partial_one_attr( int exoid, ex_entity_type obj_type, ex_entity_id obj_id, int64_t start_num, int64_t num_ent, int attrib_index, const void *attrib ) { int status; int attrid, obj_id_ndx, temp; size_t num_entries_this_obj, num_attr; size_t start[2], count[2]; ptrdiff_t stride[2]; char errmsg[MAX_ERR_LENGTH]; const char* dnumobjent; const char* dnumobjatt; const char* vattrbname; exerrval = 0; /* clear error code */ /* Determine index of obj_id in id array */ if (obj_type != EX_NODAL) { obj_id_ndx = ex_id_lkup(exoid,obj_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no attributes allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_put_partial_one_attr",errmsg,EX_NULLENTITY); return (EX_WARN); /* no attributes for this element block */ } else { sprintf(errmsg, "Error: no %s id %"PRId64" in id array in file id %d", ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } } } switch (obj_type) { case EX_SIDE_SET: dnumobjent = DIM_NUM_SIDE_SS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_SS(obj_id_ndx); vattrbname = VAR_SSATTRIB(obj_id_ndx); break; case EX_NODE_SET: dnumobjent = DIM_NUM_NOD_NS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_NS(obj_id_ndx); vattrbname = VAR_NSATTRIB(obj_id_ndx); break; case EX_EDGE_SET: dnumobjent = DIM_NUM_EDGE_ES(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ES(obj_id_ndx); vattrbname = VAR_ESATTRIB(obj_id_ndx); break; case EX_FACE_SET: dnumobjent = DIM_NUM_FACE_FS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FS(obj_id_ndx); vattrbname = VAR_FSATTRIB(obj_id_ndx); break; case EX_ELEM_SET: dnumobjent = DIM_NUM_ELE_ELS(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_ELS(obj_id_ndx); vattrbname = VAR_ELSATTRIB(obj_id_ndx); break; case EX_NODAL: dnumobjent = DIM_NUM_NODES; dnumobjatt = DIM_NUM_ATT_IN_NBLK; vattrbname = VAR_NATTRIB; break; case EX_EDGE_BLOCK: dnumobjent = DIM_NUM_ED_IN_EBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_EBLK(obj_id_ndx); vattrbname = VAR_EATTRIB(obj_id_ndx); break; case EX_FACE_BLOCK: dnumobjent = DIM_NUM_FA_IN_FBLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_FBLK(obj_id_ndx); vattrbname = VAR_FATTRIB(obj_id_ndx); break; case EX_ELEM_BLOCK: dnumobjent = DIM_NUM_EL_IN_BLK(obj_id_ndx); dnumobjatt = DIM_NUM_ATT_IN_BLK(obj_id_ndx); vattrbname = VAR_ATTRIB(obj_id_ndx); break; default: exerrval = 1005; sprintf(errmsg, "Internal Error: unrecognized object type in switch: %d in file id %d", obj_type,exoid); ex_err("ex_putt_partial_one_attr",errmsg,EX_MSG); return (EX_FATAL); } /* inquire id's of previously defined dimensions */ if (ex_get_dimension(exoid, dnumobjent,"entries", &num_entries_this_obj, &temp, "ex_put_partial_one_attr") != NC_NOERR) return EX_FATAL; if (start_num + num_ent -1 > num_entries_this_obj) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: start index (%"PRId64") + count (%"PRId64") is larger than total number of entities (%"ST_ZU") in file id %d", start_num, num_ent, num_entries_this_obj, exoid); ex_err("ex_put_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } if (ex_get_dimension(exoid, dnumobjatt,"attributes", &num_attr, &temp, "ex_put_partial_one_attr") != NC_NOERR) return EX_FATAL; if (attrib_index < 1 || attrib_index > (int)num_attr) { exerrval = EX_FATAL; sprintf(errmsg, "Error: Invalid attribute index specified: %d. Valid range is 1 to %"ST_ZU" for %s %"PRId64" in file id %d", attrib_index, num_attr, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(exoid, vattrbname, &attrid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate attribute variable for %s %"PRId64" in file id %d", ex_name_of_object(obj_type),obj_id,exoid); ex_err("ex_put_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } /* write out the attributes */ start[0] = start_num-1; start[1] = attrib_index-1; count[0] = num_ent; count[1] = 1; stride[0] = 1; stride[1] = num_attr; if (count[0] == 0) start[0] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vars_float(exoid, attrid, start, count, stride, attrib); } else { status = nc_put_vars_double(exoid, attrid, start, count, stride, attrib); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put attribute %d for %s %"PRId64" in file id %d", attrib_index, ex_name_of_object(obj_type), obj_id, exoid); ex_err("ex_put_partial_one_attr",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_set.c000066400000000000000000000163221225312213100235630ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! * writes the set entry list and set extra list for a single set * \param exoid exodus file id * \param set_type set type * \param set_id set id * \param *set_entry_list array of entries in set. Set to NULL to not write. * \param *set_extra_list array of extras in set. Set to NULL to not write. */ int ex_put_partial_set (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t num_to_put, const void_int *set_entry_list, const void_int *set_extra_list) { int dimid, status; int entry_list_id, extra_list_id, set_id_ndx; size_t start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; char* entryptr = NULL; char* extraptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no %ss defined in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid, set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(set_type),set_id,exoid); ex_err("ex_put_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { entryptr = VAR_NODE_NS(set_id_ndx); extraptr = NULL; } else if (set_type == EX_EDGE_SET) { entryptr = VAR_EDGE_ES(set_id_ndx); extraptr = VAR_ORNT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { entryptr = VAR_FACE_FS(set_id_ndx); extraptr = VAR_ORNT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { entryptr = VAR_ELEM_SS(set_id_ndx); extraptr = VAR_SIDE_SS(set_id_ndx); } else if (set_type == EX_ELEM_SET) { entryptr = VAR_ELEM_ELS(set_id_ndx); extraptr = NULL; } /* inquire id's of previously defined variables */ if ((status = nc_inq_varid(exoid, entryptr, &entry_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } /* only do for edge, face and side sets */ if (extraptr) { if ((status = nc_inq_varid(exoid, extraptr, &extra_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* write out the entry list and extra list arrays */ if (set_entry_list != NULL || ex_is_parallel(exoid)) { start[0] = offset-1; count[0] = num_to_put; if (count[0] == 0) start[0] = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, entry_list_id, start, count, set_entry_list); } else { status = nc_put_vara_int(exoid, entry_list_id, start, count, set_entry_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* only do for edge, face and side sets */ if (extraptr && set_extra_list != NULL ) { start[0] = offset-1; count[0] = num_to_put; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, extra_list_id, start, count, set_extra_list); } else { status = nc_put_vara_int(exoid, extra_list_id, start, count, set_extra_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* warn if extra data was sent in for node sets and elem sets */ if ((set_type == EX_NODE_SET || set_type == EX_ELEM_SET) && set_extra_list != NULL) { sprintf(errmsg, "Warning: extra list was ignored for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_put_set",errmsg,EX_MSG); return(EX_WARN); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_set_dist_fact.c000066400000000000000000000141441225312213100256030ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expssd - ex_put_partial_set_dist_fact * * entry conditions - * input parameters: * int exoid exodus file id * int set_type set type * int set_id set id * int offset index (1-based) of first dist factor to write * int num_to_put number of dist factors to write. * void* set_dist_fact array of dist factors for set * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the partial distribution factors for a single set * \param exoid exodus file id * \param set_type set type * \param set_id set id * \param offset index (1-based) of first dist factor to write * \param num_to_put number of dist factors to write. * \param *set_dist_fact array of dist factors for set */ int ex_put_partial_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t offset, int64_t num_to_put, const void *set_dist_fact) { int status; int dimid, set_id_ndx; int dist_id; size_t start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; char* factptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no %ss specified in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_fact",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */ factptr = VAR_FACT_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { factptr = VAR_FACT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { factptr = VAR_FACT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { factptr = VAR_FACT_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { factptr = VAR_FACT_ELS(set_id_ndx); } /* find id of distribution factors variable */ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) { /* this test is only needed for node set because we're using DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/ if (status == NC_ENOTVAR) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: no dist factors defined for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate dist factors list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } start[0] = offset-1; count[0] = num_to_put; if (num_to_put == 0) start[0] = 0; /* write out the distribution factors array */ if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, dist_id, start, count, set_dist_fact); } else { status = nc_put_vara_double(exoid, dist_id, start, count, set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store dist factors for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_partial_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_side_set.c000066400000000000000000000173641225312213100245760ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_partial_side_set() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to read. * start_side_num - The starting index of the sides to be read. * num_sides - The number of sides to read in. * side_set_elem_list - List of element IDs in side set. * side_set_side_list - List of side IDs in side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #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_partial_side_set (int exoid, ex_entity_id side_set_id, int64_t start_side_num, int64_t num_sides, const void_int *side_set_elem_list, const void_int *side_set_side_list) { int status; int dimid; int elem_list_id, side_list_id, side_set_id_ndx; size_t num_side_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no side sets defined in file id %d", exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of side set id in VAR_SS_IDS array */ if ((side_set_id_ndx = ex_id_lkup(exoid, EX_SIDE_SET, side_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set id %"PRId64" in VAR_SS_IDS array in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SIDE_SS(side_set_id_ndx), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of sides in side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, &num_side_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of sides in side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of side numbers */ if (start_side_num < 0 || (num_sides > 0 && start_side_num > num_side_in_set)) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if (num_sides < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of elements in side set!"); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* start_side_num now starts at 1, not 0 */ if ((start_side_num + num_sides) > num_side_in_set+1) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of elements in set!"); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* inquire id's of previously defined variables */ if ((status = nc_inq_varid (exoid, VAR_ELEM_SS(side_set_id_ndx), &elem_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate element list for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_SIDE_SS(side_set_id_ndx), &side_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate side list for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } /* write out the element list and side list arrays */ start[0] = --start_side_num; count[0] = num_sides; if (num_sides == 0) start[0] = 0; if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, elem_list_id, start, count, side_set_elem_list); } else { status = nc_put_vara_int(exoid, elem_list_id, start, count, side_set_elem_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store element list for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_vara_longlong(exoid, side_list_id, start, count, side_set_side_list); } else { status = nc_put_vara_int(exoid, side_list_id, start, count, side_set_side_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store side list for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_side_set_df.c000066400000000000000000000160141225312213100252360ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * * ex_put_partial_side_set_df() * ***************************************************************************** * * Variable Index: * * exoid - The NetCDF ID of an already open NemesisI file. * side_set_id - ID of side set to written. * start_num - The starting index of the df's to be written. * num_df_to_get - The number of sides to write. * side_set_dist_fact - List of distribution factors for the side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include "exodusII.h" #include "exodusII_int.h" /* * writes the distribution factors for a single side set */ int ex_put_partial_side_set_df (int exoid, ex_entity_id side_set_id, int64_t start_num, int64_t num_df_to_get, void *side_set_dist_fact) { int status; int dimid, side_set_id_ndx; int dist_id; size_t num_df_in_set, start[1], count[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* first check if any side sets are specified */ if ((status = nc_inq_dimid (exoid, DIM_NUM_SS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no side sets specified in file id %d", exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of side set id in VAR_SS_IDS array */ if ((side_set_id_ndx = ex_id_lkup(exoid, EX_SIDE_SET, side_set_id)) < 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_side_set_fact",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate side set id %"PRId64" in VAR_SS_IDS array in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } } /* inquire id's of previously defined dimension and variable */ if ((status = nc_inq_dimid (exoid, DIM_NUM_DF_SS(side_set_id_ndx), &dimid)) != NC_NOERR) { if (status == NC_EBADDIM) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: no dist factors defined for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate number of dist factors in side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_dimlen(exoid, dimid, &num_df_in_set)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get number of dist factors in side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* Check input parameters for a valid range of numbers */ if (start_num < 0 || (num_df_to_get > 0 && start_num > num_df_in_set)) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid input"); ex_err("ex_put_partial_side_set_df", errmsg, exerrval); return (EX_FATAL); } if (num_df_to_get < 0) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid number of df's to put!"); ex_err("ex_put_partial_side_set_df", errmsg, exerrval); return (EX_FATAL); } /* start_num now starts at 1, not 0 */ if ((start_num + num_df_to_get) > num_df_in_set+1) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: request larger than number of df's in set!"); ex_err("ex_put_partial_side_set_df", errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid (exoid, VAR_FACT_SS(side_set_id_ndx), &dist_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate dist factors list for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } /* write out the distribution factors array */ start[0] = --start_num; count[0] = num_df_to_get; if (num_df_to_get == 0) start[0] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, dist_id, start, count, side_set_dist_fact); } else { status = nc_put_vara_double(exoid, dist_id, start, count, side_set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store dist factors for side set %"PRId64" in file id %d", side_set_id, exoid); ex_err("ex_put_partial_side_set_df",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_partial_var.c000066400000000000000000000264111225312213100235600ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! * writes the values of a single variable for a partial block at one time * step to the database; assume the first time step and variable index * are 1 * \param exoid exodus file id * \param time_step time step number * \param var_type type (edge block, face block, edge set, ... ) * \param var_index element variable index * \param obj_id element block id * \param start_index index of first entity in block to write (1-based) * \param num_entities number of entries in this block/set * \param var_vals the values to be written */ int ex_put_partial_var (int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t start_index, int64_t num_entities, const void *var_vals) { int varid, dimid,time_dim, numobjdim, dims[2], obj_id_ndx; size_t num_obj; size_t num_obj_var; size_t num_entity; size_t start[2], count[2]; int *obj_var_truth_tab; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ #define EX_LOOK_UP_VAR(VOBJID,VVAR,VOBJTAB,DNUMOBJ,DNUMOBJVAR) \ /* Determine index of obj_id in VOBJID array */ \ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id); \ if (exerrval != 0) \ { \ if (exerrval == EX_NULLENTITY) \ { \ sprintf(errmsg, \ "Warning: no variables allowed for NULL block %"PRId64" in file id %d", \ obj_id,exoid); \ ex_err("ex_put_partial_var",errmsg,EX_NULLENTITY); \ return (EX_WARN); \ } \ else \ { \ sprintf(errmsg, \ "Error: failed to locate %s id %"PRId64" in %s array in file id %d", \ ex_name_of_object(var_type), obj_id, VOBJID, exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ } \ \ if ((status = nc_inq_varid (exoid, VVAR(var_index,obj_id_ndx), &varid)) != NC_NOERR) \ { \ if (status == NC_ENOTVAR) /* variable doesn't exist, create it! */ \ { \ /* check for the existance of an TNAME variable truth table */ \ if (nc_inq_varid(exoid, VOBJTAB, &varid) == NC_NOERR) { \ /* find out number of TNAMEs and TNAME variables */ \ status = ex_get_dimension(exoid, DNUMOBJ, ex_name_of_object(var_type), &num_obj, &dimid, "ex_put_partial_var"); \ if (status != NC_NOERR) return status; \ \ status = ex_get_dimension(exoid, DNUMOBJVAR, ex_name_of_object(var_type), &num_obj_var, &dimid, "ex_put_partial_var"); \ if (status != NC_NOERR) return status; \ \ if (!(obj_var_truth_tab = malloc(num_obj*num_obj_var*sizeof(int)))) \ { \ exerrval = EX_MEMFAIL; \ sprintf(errmsg, \ "Error: failed to allocate memory for %s variable truth table in file id %d", \ ex_name_of_object(var_type), exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ \ /* read in the TNAME variable truth table */ \ if ((status = nc_get_var_int (exoid, varid, obj_var_truth_tab)) != NC_NOERR) \ { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to get truth table from file id %d", exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ \ if(obj_var_truth_tab[num_obj_var*(obj_id_ndx-1)+var_index-1] \ == 0L) \ { \ free(obj_var_truth_tab); \ exerrval = EX_BADPARAM; \ sprintf(errmsg, \ "Error: Invalid %s variable %d, %s %"PRId64" in file id %d", \ ex_name_of_object(var_type), var_index, ex_name_of_object(var_type), obj_id, exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ free(obj_var_truth_tab); \ } \ \ if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to locate time dimension in file id %d", exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ goto error_ret; /* exit define mode and return */ \ } \ \ ex_get_dimension(exoid, ex_dim_num_entries_in_object(var_type, obj_id_ndx), \ ex_name_of_object(var_type), &num_entity, &numobjdim, "ex_put_partial_var"); \ \ /* variable doesn't exist so put file into define mode */ \ if ((status = nc_redef (exoid)) != NC_NOERR) { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to put file id %d into define mode", exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ \ /* define netCDF variable to store TNAME variable values */ \ dims[0] = time_dim; \ dims[1] = numobjdim; \ if ((status = nc_def_var(exoid, VVAR(var_index,obj_id_ndx), \ nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) \ { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define %s variable %d in file id %d", \ ex_name_of_object(var_type), var_index,exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ goto error_ret; \ } \ ex_compress_variable(exoid, varid, 2); \ \ /* leave define mode */ \ \ if ((status = nc_enddef (exoid)) != NC_NOERR) \ { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to complete %s variable %s definition to file id %d", \ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx), exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ } \ else \ { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to locate %s variable %s in file id %d", \ ex_name_of_object(var_type), VVAR(var_index,obj_id_ndx),exoid); \ ex_err("ex_put_partial_var",errmsg,exerrval); \ return (EX_FATAL); \ } \ } switch (var_type) { case EX_GLOBAL: if ( num_entities <= 0 ) { exerrval = EX_MSG; sprintf(errmsg, "Warning: no global variables specified for file id %d", exoid); ex_err("ex_put_glob_vars",errmsg,exerrval); return (EX_WARN); } /* inquire previously defined variable */ if ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) { if (status == NC_ENOTVAR) { exerrval = status; sprintf(errmsg, "Error: no global variables defined in file id %d", exoid); ex_err("ex_put_glob_vars",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to get global variables parameters in file id %d", exoid); ex_err("ex_put_glob_vars",errmsg,exerrval); } return (EX_FATAL); } break; case EX_NODAL: return ex_put_partial_nodal_var(exoid, time_step, var_index, start_index, num_entities, var_vals); break; case EX_EDGE_BLOCK: EX_LOOK_UP_VAR(VAR_ID_ED_BLK,VAR_EDGE_VAR,VAR_EBLK_TAB,DIM_NUM_ED_BLK,DIM_NUM_EDG_VAR); break; case EX_FACE_BLOCK: EX_LOOK_UP_VAR(VAR_ID_FA_BLK,VAR_FACE_VAR,VAR_FBLK_TAB,DIM_NUM_FA_BLK,DIM_NUM_FAC_VAR); break; case EX_ELEM_BLOCK: EX_LOOK_UP_VAR(VAR_ID_EL_BLK,VAR_ELEM_VAR,VAR_ELEM_TAB,DIM_NUM_EL_BLK,DIM_NUM_ELE_VAR); break; case EX_NODE_SET: EX_LOOK_UP_VAR(VAR_NS_IDS,VAR_NS_VAR,VAR_NSET_TAB,DIM_NUM_NS,DIM_NUM_NSET_VAR); break; case EX_EDGE_SET: EX_LOOK_UP_VAR(VAR_ES_IDS,VAR_ES_VAR,VAR_ESET_TAB,DIM_NUM_ES,DIM_NUM_ESET_VAR); break; case EX_FACE_SET: EX_LOOK_UP_VAR(VAR_FS_IDS,VAR_FS_VAR,VAR_FSET_TAB,DIM_NUM_FS,DIM_NUM_FSET_VAR); break; case EX_SIDE_SET: EX_LOOK_UP_VAR(VAR_SS_IDS,VAR_SS_VAR,VAR_SSET_TAB,DIM_NUM_SS,DIM_NUM_SSET_VAR); break; case EX_ELEM_SET: EX_LOOK_UP_VAR(VAR_ELS_IDS,VAR_ELS_VAR,VAR_ELSET_TAB,DIM_NUM_ELS,DIM_NUM_ELSET_VAR); break; default: exerrval = EX_MSG; sprintf( errmsg, "Error: invalid variable type (%d) specified for file id %d", var_type, exoid ); ex_err( "ex_put_partial_var", errmsg, exerrval ); return (EX_FATAL); } /* store element variable values */ start[0] = --time_step; start[1] = start_index-1; if ( var_type == EX_GLOBAL ) { /* global variables may be written * - all at once (by setting var_index to 1 and num_entries_this_obj to num_glob, or * - one at a time (by setting var_index to the desired index and num_entries_this_obj to 1. */ count[0] = var_index; } else { count[0] = 1; } count[1] = num_entities; if (count[1] == 0) start[1] = 0; if (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s %"PRId64" variable %d in file id %d", ex_name_of_object(var_type), obj_id, var_index,exoid); ex_err("ex_put_partial_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) /* exit define mode */ { sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_partial_var",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_processor_elem_maps.c000066400000000000000000000216761225312213100253250ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_elem_map() ***************************************************************************** * This function outputs the elemental map. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * elem_mapi - Vector of internal element IDs. * elem_mapb - Vector of border element IDs. * processor - The processor ID for which info is to be read. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_processor_elem_maps(int exoid, void_int *elem_mapi, void_int *elem_mapb, int processor ) { const char *func_name="ex_put_processor_elem_maps"; char ftype[2]; int status, dimid, varid; size_t start[1], count[1]; int64_t varidx[2]; int nmstat; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: unable to find file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the status of the internal element map */ if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_INT_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_ELEM_MAP_INT_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the size of the internal element map */ if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_INT_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_ELEM_MAP_INT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the map */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, elem_mapi); } else { status = nc_put_vara_int(exoid, varid, start, count, elem_mapi); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_ELEM_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ /* Get the status of the border element map */ if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 's') start[0] = processor; else start[0] = 0; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file %d", VAR_BOR_E_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_ELEM_MAP_BOR_IDX, varidx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_ELEM_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (varidx[1] == -1) { /* Get the size of the border element map */ if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_ELEMS, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_BOR_ELEMS, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_ELEM_MAP_BOR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the map */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, elem_mapb); } else { status = nc_put_vara_int(exoid, varid, start, count, elem_mapb); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_ELEM_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_processor_node_maps.c000066400000000000000000000272231225312213100253220ustar00rootroot00000000000000/* * Copyright (c) 1998 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 function outputs the nodal map. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * node_mapi - Pointer to vector containing the internal FEM * nodal IDs. * node_mapb - Pointer to vector containing the border FEM * nodal IDs. * node_mape - Pointer to vector containing the external FEM * nodal IDs. * proc_id - The processor the file is being written for. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_processor_node_maps(int exoid, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int proc_id ) { const char *func_name="ex_put_processor_node_maps"; int status, varid, dimid; char ftype[2]; size_t start[1], count[1]; int64_t varidx[2]; int nmstat; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the file type */ if (ex_get_file_type(exoid, ftype) != EX_NOERR) { exerrval = EX_MSG; sprintf(errmsg, "Error: unable to find file type for file ID %d", exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = proc_id; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file %d", VAR_INT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Write out the internal node-number map */ if (nmstat == 1) { /* get the index */ if (ex_get_idx(exoid, VAR_NODE_MAP_INT_IDX, varidx, proc_id) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_INT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_INT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_INT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_INT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, node_mapi); } else { status = nc_put_vara_int(exoid, varid, start, count, node_mapi); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_NODE_MAP_INT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = proc_id; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file %d", VAR_BOR_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* Write out the border node-number map */ /* get the index */ if (ex_get_idx(exoid, VAR_NODE_MAP_BOR_IDX, varidx, proc_id) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_BOR_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_BOR_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_BOR_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_BOR, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the map */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, node_mapb); } else { status = nc_put_vara_int(exoid, varid, start, count, node_mapb); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_NODE_MAP_BOR, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ /* Get the status of this node map */ if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (ftype[0] == 'p') start[0] = 0; else start[0] = proc_id; if ((status = nc_get_var1_int(exoid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file %d", VAR_EXT_N_STAT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* Write out the external node-number map */ if (ex_get_idx(exoid, VAR_NODE_MAP_EXT_IDX, varidx, proc_id) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_NODE_MAP_EXT_IDX, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* check if I need to get the dimension */ if (varidx[1] == -1) { if ((status = nc_inq_dimid(exoid, DIM_NUM_EXT_NODES, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_dimlen(exoid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_EXT_NODES, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } varidx[1] = count[0]; } if ((status = nc_inq_varid(exoid, VAR_NODE_MAP_EXT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the map */ start[0] = varidx[0]; count[0] = varidx[1] - varidx[0]; if (ex_int64_status(exoid) & EX_MAPS_INT64_API) { status = nc_put_vara_longlong(exoid, varid, start, count, node_mape); } else { status = nc_put_vara_int(exoid, varid, start, count, node_mape); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_NODE_MAP_EXT, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } } /* End "if (nmstat == 1)" */ return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_prop.c000066400000000000000000000344611225312213100222400ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /*! The function ex_put_prop() stores an integer object property value to a single element block, node set, or side set. Although it is not necessary to invoke ex_put_prop_names(), since ex_put_prop() will allocate space within the data file if it hasn't been previously allocated, it is more efficient to use ex_put_prop_names() if there is more than one property to store. \see Efficiency for a discussion of efficiency issues. It should be noted that the interpretation of the values of the integers stored as properties is left to the application code. In general, a zero (0) means the object does not have the specified property (or is not in the specified group); a nonzero value means the object does have the specified property. When space is allocated for the properties using ex_put_prop_names() or ex_put_prop(), the properties are initialized to zero (0). Because the ID of an element block, node set, or side set is just another property (named \b ID), this routine can be used to change the value of an ID. This feature must be used with caution, though, because changing the ID of an object to the ID of another object of the same type (element block, node set, or side set) would cause two objects to have the same ID, and thus only the first would be accessible. Therefore, ex_put_prop() issues a warning if a user attempts to give two objects the same ID. \return In case of an error, ex_put_prop() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - invalid object type specified. - a warning is issued if a user attempts to change the ID of an object to the ID of an existing object of the same type. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[in] obj_id The element block, node set, or side set ID. \param[in] prop_name The name of the property for which the value will be stored. Maximum length of this string is \p MAX_STR_LENGTH . \param[in] value The value of the property.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
For an example of code to write out an object property, refer to the description for ex_put_prop_names(). */ int ex_put_prop (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, ex_entity_id value) { int status; int oldfill = 0; int temp; int found = FALSE; int num_props, i, dimid, propid, dims[1]; int int_type; size_t start[1]; size_t prop_name_len, name_length; char name[MAX_VAR_NAME_LENGTH+1]; char tmpstr[MAX_STR_LENGTH+1]; char dim_name[MAX_VAR_NAME_LENGTH+1]; long 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); if (num_props > 1) { /* any properties other than the default 1? */ for (i=1; i<=num_props; i++) { switch (obj_type) { case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(i)); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(i)); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(i)); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(i)); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(i)); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(i)); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(i)); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(i)); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(i)); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(i)); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(i)); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(i)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_put_prop",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property array id in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } /* compare stored attribute name with passed property name */ memset(tmpstr, 0, MAX_STR_LENGTH+1); if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property name in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } if (strcmp(tmpstr, prop_name) == 0) { found = TRUE; break; } } } /* if property array has not been created, create it */ if (!found) { name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH)+1; /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } /* create a variable with a name xx_prop#, where # is the new number */ /* of the property */ switch (obj_type){ case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_EL_BLK); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_FA_BLK); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_ED_BLK); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_NS); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_ES); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_FS); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_ELS); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_SS); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_EM); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_FAM); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_EDM); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(num_props+1)); strcpy (dim_name, DIM_NUM_NM); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_put_prop",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } /* inquire id of previously defined dimension (number of objects) */ if ((status = nc_inq_dimid(exoid, dim_name, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of objects in file id %d", exoid); ex_err("ex_put_prop",errmsg, exerrval); goto error_ret; /* Exit define mode and return */ } dims[0] = dimid; nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */ int_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } if ((status = nc_def_var(exoid, name, int_type, 1, dims, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create property array variable in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } vals[0] = 0; /* fill value */ /* create attribute to cause variable to fill with zeros per routine spec */ if ((status = nc_put_att_longlong(exoid, propid, _FillValue, int_type, 1, vals)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create property name fill attribute in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } /* Check that the property name length is less than MAX_NAME_LENGTH */ prop_name_len = strlen(prop_name)+1; if (prop_name_len > name_length) { fprintf(stderr, "Warning: The property name '%s' is too long.\n\tIt will be truncated from %d to %d characters\n", prop_name, (int)prop_name_len-1, (int)name_length-1); prop_name_len = name_length; } /* store property name as attribute of property array variable */ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME, prop_name_len, (void*)prop_name)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store property name %s in file id %d", prop_name,exoid); ex_err("ex_put_prop",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } ex_update_max_name_length(exoid, prop_name_len-1); /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to leave define mode in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } nc_set_fill(exoid, oldfill, &temp); /* default: nofill */ } /* find index into property array using obj_id; put value in property */ /* array at proper index; ex_id_lkup returns an index that is 1-based,*/ /* but netcdf expects 0-based arrays so subtract 1 */ /* special case: property name ID - check for duplicate ID assignment */ if (strcmp("ID",prop_name) == 0) { start[0] = ex_id_lkup (exoid, obj_type, value); if (exerrval != EX_LOOKUPFAIL) /* found the id */ { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: attempt to assign duplicate %s ID %"PRId64" in file id %d", ex_name_of_object(obj_type), value, exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_WARN); } } start[0] = ex_id_lkup (exoid, obj_type, obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no properties allowed for NULL %s id %"PRId64" in file id %d", ex_name_of_object(obj_type), obj_id,exoid); ex_err("ex_put_prop",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to find value %"PRId64" in %s property array in file id %d", obj_id, ex_name_of_object(obj_type), exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } } start[0] = start[0] - 1; /* value is of type 'ex_entity_id' which is a typedef to int64_t or long long */ status = nc_put_var1_longlong(exoid, propid, start, (long long*)&value); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store property value in file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: nc_set_fill(exoid, oldfill, &temp); /* default: nofill */ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_prop",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_prop_array.c000066400000000000000000000263551225312213100234410ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include #include /* for free() */ /*! The function ex_put_prop_array() stores an array of ({num_elem_blk}, \c num_node_sets, or \c num_side_sets) integer property values for all element blocks, node sets, or side sets. The order of the values in the array must correspond to the order in which the element blocks, node sets, or side sets were introduced into the file. For instance, if the parameters for element block with ID 20 were written to a file (via ex_put_elem_block()), and then parameters for element block with ID 10, followed by the parameters for element block with ID 30, the first, second, and third elements in the property array would correspond to element block 20, element block 10, and element block 30, respectively. One should note that this same functionality (writing properties to multiple objects) can be accomplished with multiple calls to ex_put_prop(). Although it is not necessary to invoke ex_put_prop_names(), since ex_put_prop_array() will allocate space within the data file if it hasn't been previously allocated, it is more efficient to use ex_put_prop_names() if there is more than one property to store. \see See Efficiency for a discussion of efficiency issues. \return In case of an error, ex_put_prop_array() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - invalid object type specified. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[in] prop_name The name of the property for which the values will be stored. Maximum length of this string is \p MAX_STR_LENGTH . \param[in] values An array of property values.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
For an example of code to write an array of object properties, refer to the description for ex_put_prop_names(). */ int ex_put_prop_array (int exoid, ex_entity_type obj_type, const char *prop_name, const void_int *values) { int oldfill = 0; int temp; int num_props, i, propid, dimid, dims[1], status; int found = FALSE; int int_type; size_t num_obj; char name[MAX_VAR_NAME_LENGTH+1]; char tmpstr[MAX_STR_LENGTH+1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* check if property has already been created */ num_props = ex_get_num_props(exoid, obj_type); /* inquire id of previously defined dimension (number of objects) */ status = ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type), &num_obj, &dimid, "ex_put_prop_array"); if (status != NC_NOERR) return status; for (i=1; i<=num_props; i++) { switch (obj_type){ case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(i)); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(i)); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(i)); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(i)); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(i)); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(i)); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(i)); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(i)); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(i)); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(i)); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(i)); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(i)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return(EX_FATAL); } if ((status = nc_inq_varid(exoid, name, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property array id in file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return (EX_FATAL); } /* compare stored attribute name with passed property name */ memset(tmpstr, 0, MAX_STR_LENGTH+1); if ((status = nc_get_att_text(exoid, propid, ATT_PROP_NAME, tmpstr)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get property name in file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return (EX_FATAL); } if (strcmp(tmpstr, prop_name) == 0) { found = TRUE; break; } } /* if property array has not been created, create it */ if (!found) { /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return (EX_FATAL); } /* create a variable with a name xx_prop#, where # is the new number */ /* of properties */ switch (obj_type){ case EX_ELEM_BLOCK: strcpy (name, VAR_EB_PROP(num_props+1)); break; case EX_FACE_BLOCK: strcpy (name, VAR_FA_PROP(num_props+1)); break; case EX_EDGE_BLOCK: strcpy (name, VAR_ED_PROP(num_props+1)); break; case EX_NODE_SET: strcpy (name, VAR_NS_PROP(num_props+1)); break; case EX_EDGE_SET: strcpy (name, VAR_ES_PROP(num_props+1)); break; case EX_FACE_SET: strcpy (name, VAR_FS_PROP(num_props+1)); break; case EX_ELEM_SET: strcpy (name, VAR_ELS_PROP(num_props+1)); break; case EX_SIDE_SET: strcpy (name, VAR_SS_PROP(num_props+1)); break; case EX_ELEM_MAP: strcpy (name, VAR_EM_PROP(num_props+1)); break; case EX_FACE_MAP: strcpy (name, VAR_FAM_PROP(num_props+1)); break; case EX_EDGE_MAP: strcpy (name, VAR_EDM_PROP(num_props+1)); break; case EX_NODE_MAP: strcpy (name, VAR_NM_PROP(num_props+1)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_put_prop_array",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } dims[0] = dimid; nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */ int_type = NC_INT; if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } if ((status = nc_def_var(exoid, name, int_type, 1, dims, &propid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to create property array variable in file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } nc_set_fill(exoid, oldfill, &temp); /* default: nofill */ /* store property name as attribute of property array variable */ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME, strlen(prop_name)+1, prop_name)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store property name %s in file id %d", prop_name,exoid); ex_err("ex_put_prop_array",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to leave define mode in file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return (EX_FATAL); } } /* put num_obj values in property array */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, propid, values); } else { status = nc_put_var_int(exoid, propid, values); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store property values in file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: nc_set_fill(exoid, oldfill, &temp); /* default: nofill */ if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_prop_array",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_prop_names.c000066400000000000000000000246041225312213100234210ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /*! The function ex_put_prop_names() writes object property names and allocates space for object property arrays used to assign integer properties to element blocks, node sets, or side sets. The property arrays are initialized to zero (0). Although this function is optional, since ex_put_prop() will allocate space within the data file if it hasn't been previously allocated, it is more efficient to use ex_put_prop_names() if there is more than one property to store. \see Efficiency for a discussion of efficiency issues. \return In case of an error, ex_put_prop_names() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - data file not initialized properly with call to ex_put_init(). - invalid object type specified. - no object of the specified type is stored in the file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Type of object; use one of the options in the table below. \param[in] num_props The number of integer properties to be assigned to all of the objects of the type specified (element blocks, node sets, or side sets). \param[in] prop_names Array containing \c num_props names (of maximum length of \p MAX_STR_LENGTH ) of properties to be stored.
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
\c EX_ELEM_MAP Element Map entity type
\c EX_NODE_MAP Node Map entity type
\c EX_EDGE_MAP Edge Map entity type
\c EX_FACE_MAP Face Map entity type
For instance, suppose a user wanted to assign the 1st, 3rd, and 5th element blocks (those element blocks stored 1st, 3rd, and 5th, regardless of their ID) to a group (property) called \b TOP, and the 2nd, 3rd, and 4th element blocks to a group called \b LSIDE. This could be accomplished with the following code: \code #include "exodusII.h"; char* prop_names[2]; int top_part[] = {1,0,1,0,1}; int lside_part[] = {0,1,1,1,0}; int id[] = {10, 20, 30, 40, 50}; prop_names[0] = "TOP"; prop_names[1] = "LSIDE"; \comment{This call to ex_put_prop_names is optional, but more efficient} ex_put_prop_names (exoid, EX_ELEM_BLOCK, 2, prop_names); \comment{The property values can be output individually thus} for (i=0; i < 5; i++) { ex_put_prop (exoid, EX_ELEM_BLOCK, id[i], prop_names[0], top_part[i]); ex_put_prop (exoid, EX_ELEM_BLOCK, id[i], prop_names[1], lside_part[i]); } \comment{Alternatively, the values can be output as an array} ex_put_prop_array (exoid, EX_ELEM_BLOCK, prop_names[0], top_part); ex_put_prop_array (exoid, EX_ELEM_BLOCK, prop_names[1], lside_part); \endcode */ int ex_put_prop_names (int exoid, ex_entity_type obj_type, int num_props, char **prop_names) { int status; int oldfill, temp; int i, propid, dimid, dims[1]; size_t name_length, prop_name_len; char name[MAX_VAR_NAME_LENGTH+1]; long long vals[1]; int max_name_len = 0; int int_type = NC_INT; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ if (ex_int64_status(exoid) & EX_IDS_INT64_DB) { int_type = NC_INT64; } /* Get the name string length */ name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH)+1; /* inquire id of previously defined dimension (number of objects) */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(obj_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate number of %s in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_put_prop_names",errmsg, exerrval); return(EX_FATAL); } nc_set_fill(exoid, NC_FILL, &oldfill); /* fill with zeros per routine spec */ /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg,"Error: failed to place file id %d into define mode",exoid); ex_err("ex_put_prop_names",errmsg,exerrval); return (EX_FATAL); } /* define num_props variables; we postpend the netcdf variable name with */ /* a counter starting at 2 because "xx_prop1" is reserved for the id array*/ dims[0] = dimid; for (i=0; i name_length) { fprintf(stderr, "Warning: The property name '%s' is too long.\n\tIt will be truncated from %d to %d characters\n", prop_names[i], (int)prop_name_len-1, (int)name_length-1); prop_name_len = name_length; } if (prop_name_len > max_name_len) max_name_len = prop_name_len; /* store property name as attribute of property array variable */ if ((status = nc_put_att_text(exoid, propid, ATT_PROP_NAME, prop_name_len, prop_names[i])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store property name %s in file id %d", prop_names[i],exoid); ex_err("ex_put_prop_names",errmsg,exerrval); goto error_ret; /* Exit define mode and return */ } } /* leave define mode */ if ((status = nc_enddef(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to leave define mode in file id %d", exoid); ex_err("ex_put_prop_names",errmsg,exerrval); return (EX_FATAL); } /* Update the maximum_name_length attribute on the file. */ ex_update_max_name_length(exoid, max_name_len-1); nc_set_fill(exoid, oldfill, &temp); /* default: turn off fill */ return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_prop_names",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_qa.c000066400000000000000000000175151225312213100216620ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /*! The function ex_put_qa() writes the QA records to the database. Each QA record contains four \c MAX_STR_LENGTH-byte character strings. The character strings are: - the analysis code name - the analysis code QA descriptor - the analysis date - the analysis time \return In case of an error, ex_put_qa() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - QA records already exist in file. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] num_qa_records The number of QA records. \param[in] qa_record Array containing the QA records. To only define the number of qa records instead of defining and outputting, pass NULL for qa_record argument. The following code segment will write out two QA records: \code #include "exodusII.h" int num_qa_rec, error, exoid; char *qa_record[2][4]; \comment{write QA records} num_qa_rec = 2; qa_record[0][0] = "TESTWT1"; qa_record[0][1] = "testwt1"; 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); \endcode */ int ex_put_qa (int exoid, int num_qa_records, char* qa_record[][4]) { int status; int i, j, strdim, num_qa_dim, varid, n4dim; int dims[3]; size_t start[3], count[3]; char errmsg[MAX_ERR_LENGTH]; int rootid = exoid & EX_FILE_ID_MASK; exerrval = 0; /* clear error code */ /* only do this if there are records */ if (num_qa_records > 0) { /* See if the number of qa records has already been defined. Assume that if the DIM_NUM_QA dimension exists, then the VAR_QA_TITLE variable also exists... */ status = nc_inq_dimid(rootid, DIM_NUM_QA, &num_qa_dim); if (status != NC_NOERR) { /* inquire previously defined dimensions */ if ((status = nc_inq_dimid(rootid, DIM_STR, &strdim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate string length in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid(rootid, DIM_N4, &n4dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate record length in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); return (EX_FATAL); } /* put file into define mode */ if ((status = nc_redef(rootid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", rootid); ex_err("ex_put_qa",errmsg,exerrval); return (EX_FATAL); } /* define dimensions */ if ((status = nc_def_dim(rootid,DIM_NUM_QA,num_qa_records, &num_qa_dim)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { /* duplicate entry? */ exerrval = status; sprintf(errmsg, "Error: qa records already exist in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define qa record array size in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } /* define variable */ dims[0] = num_qa_dim; dims[1] = n4dim; dims[2] = strdim; if ((status = nc_def_var(rootid, VAR_QA_TITLE, NC_CHAR, 3, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define qa record array in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } /* leave define mode */ if ((status = nc_enddef (rootid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); return (EX_FATAL); } } else { if ((status = nc_inq_varid(rootid, VAR_QA_TITLE, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find qa records variable in file id %d", rootid); ex_err("ex_put_qa",errmsg,exerrval); return (EX_FATAL); } } if (qa_record != NULL) { /* write out QA records */ for (i=0; i /* for free() */ /*! * writes the set entry list and set extra list for a single set * \param exoid exodus file id * \param set_type set type * \param set_id set id * \param *set_entry_list array of entries in set. Set to NULL to not write. * \param *set_extra_list array of extras in set. Set to NULL to not write. */ int ex_put_set (int exoid, ex_entity_type set_type, ex_entity_id set_id, const void_int *set_entry_list, const void_int *set_extra_list) { int dimid, status; int entry_list_id, extra_list_id, set_id_ndx; char errmsg[MAX_ERR_LENGTH]; char* entryptr = NULL; char* extraptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no %ss defined in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid, set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(set_type),set_id,exoid); ex_err("ex_put_set",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { entryptr = VAR_NODE_NS(set_id_ndx); extraptr = NULL; } else if (set_type == EX_EDGE_SET) { entryptr = VAR_EDGE_ES(set_id_ndx); extraptr = VAR_ORNT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { entryptr = VAR_FACE_FS(set_id_ndx); extraptr = VAR_ORNT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { entryptr = VAR_ELEM_SS(set_id_ndx); extraptr = VAR_SIDE_SS(set_id_ndx); } else if (set_type == EX_ELEM_SET) { entryptr = VAR_ELEM_ELS(set_id_ndx); extraptr = NULL; } /* inquire id's of previously defined variables */ if ((status = nc_inq_varid(exoid, entryptr, &entry_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } /* only do for edge, face and side sets */ if (extraptr) { if ((status = nc_inq_varid(exoid, extraptr, &extra_list_id)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* write out the entry list and extra list arrays */ if (set_entry_list != NULL) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, entry_list_id, set_entry_list); } else { status = nc_put_var_int(exoid, entry_list_id, set_entry_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store entry list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* only do for edge, face and side sets */ if (extraptr && set_extra_list != NULL ) { if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, extra_list_id, set_extra_list); } else { status = nc_put_var_int(exoid, extra_list_id, set_extra_list); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store extra list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set",errmsg,exerrval); return (EX_FATAL); } } /* warn if extra data was sent in for node sets and elem sets */ if ((set_type == EX_NODE_SET || set_type == EX_ELEM_SET) && set_extra_list != NULL) { sprintf(errmsg, "Warning: extra list was ignored for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_put_set",errmsg,EX_MSG); return(EX_WARN); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_set_dist_fact.c000066400000000000000000000131041225312213100240620ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the distribution factors for a single set * \param exoid exodus file id * \param set_type set type * \param set_id set id * \param *set_dist_fact array of dist factors for set */ int ex_put_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, const void *set_dist_fact) { int status; int dimid, set_id_ndx; int dist_id; char errmsg[MAX_ERR_LENGTH]; char* factptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no %ss specified in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_fact",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */ factptr = VAR_FACT_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { factptr = VAR_FACT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { factptr = VAR_FACT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { factptr = VAR_FACT_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { factptr = VAR_FACT_ELS(set_id_ndx); } /* find id of distribution factors variable */ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) { /* this test is only needed for node set because we're using DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/ if (status == NC_ENOTVAR) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: no dist factors defined for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate dist factors list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* write out the distribution factors array */ if (ex_comp_ws(exoid) == 4) { status = nc_put_var_float(exoid, dist_id, set_dist_fact); } else { status = nc_put_var_double(exoid, dist_id, set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store dist factors for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_set_param.c000066400000000000000000000064201225312213100232250ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the set id and the number of entries which describe a single set * \param exoid exodus file id * \param set_type the type of set * \param set_id set id * \param num_entries_in_set number of entries in the set * \param num_dist_fact_in_set number of distribution factors in the set */ int ex_put_set_param (int exoid, ex_entity_type set_type, ex_entity_id set_id, int64_t num_entries_in_set, int64_t num_dist_fact_in_set) { struct ex_set set[1]; set[0].type = set_type; set[0].id = set_id; set[0].num_entry = num_entries_in_set; set[0].num_distribution_factor = num_dist_fact_in_set; set[0].entry_list = NULL; set[0].extra_list = NULL; set[0].distribution_factor_list = NULL; return ex_put_sets(exoid, 1, set); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_sets.c000066400000000000000000000317601225312213100222350ustar00rootroot00000000000000/* * Copyright (c) 2012 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /* for free() */ /*! * writes the set parameters and optionally set data for 1 or more sets * \param exoid exodus file id * \param set_count number of sets to write * \param *sets array of ex_set structures */ int ex_put_sets (int exoid, size_t set_count, const struct ex_set *sets) { size_t i; int needs_define = 0; int set_stat; int dimid, varid, status, dims[1]; int set_id_ndx; size_t start[1]; int cur_num_sets; char errmsg[MAX_ERR_LENGTH]; int* sets_to_define = NULL; char* numentryptr = NULL; char* entryptr = NULL; char* extraptr = NULL; char* idsptr = NULL; char* statptr = NULL; char* numdfptr = NULL; char* factptr = NULL; size_t int_size; exerrval = 0; /* clear error code */ sets_to_define = malloc(set_count*sizeof(int)); /* Note that this routine can be called: 1) just define the sets 2) just output the set data (after a previous call to define) 3) define and output the set data in one call. */ for (i=0; i < set_count; i++) { /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(sets[i].type), &dimid)) != NC_NOERR) { if (status == NC_EBADDIM) { exerrval = status; sprintf(errmsg, "Error: no %ss defined for file id %d", ex_name_of_object(sets[i].type), exoid); ex_err("ex_put_sets",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate %ss defined in file id %d", ex_name_of_object(sets[i].type), exoid); ex_err("ex_put_sets",errmsg,exerrval); } return (EX_FATAL); } set_id_ndx = ex_id_lkup(exoid, sets[i].type, sets[i].id); if (exerrval != EX_LOOKUPFAIL) { /* found the side set id, so set is already defined... */ sets_to_define[i] = 0; continue; } else { needs_define++; sets_to_define[i] = 1; } } if (needs_define > 0) { /* put netcdf file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } for (i=0; i < set_count; i++) { if (sets_to_define[i] == 0) continue; /* NOTE: ex_inc_file_item finds the current number of sets defined for a specific file and returns that value incremented. */ cur_num_sets=ex_inc_file_item(exoid, ex_get_counter_list(sets[i].type)); set_id_ndx = cur_num_sets + 1; sets_to_define[i] = set_id_ndx; if (sets[i].num_entry == 0) continue; /* setup pointers based on set_type */ if (sets[i].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 (sets[i].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 (sets[i].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 (sets[i].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); } else if (sets[i].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); } /* define dimensions and variables */ if ((status = nc_def_dim(exoid, numentryptr, sets[i].num_entry, &dimid)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { sprintf(errmsg, "Error: %s %"PRId64" -- size already defined in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } else { sprintf(errmsg, "Error: failed to define number of entries in %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } goto error_ret; } int_size = sizeof(int); if (ex_int64_status(exoid) & EX_BULK_INT64_DB) { int_size = sizeof(int64_t); } /* create variable array in which to store the entry lists */ dims[0] = dimid; if ((status = nc_def_var(exoid, entryptr, int_size, 1, dims, &varid)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { sprintf(errmsg, "Error: entry list already exists for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } else { sprintf(errmsg, "Error: failed to create entry list for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 1); if (extraptr) { if ((status = nc_def_var(exoid, extraptr, int_size, 1, dims, &varid)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { sprintf(errmsg, "Error: extra list already exists for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id, exoid); ex_err("ex_put_sets",errmsg,exerrval); } else { sprintf(errmsg, "Error: failed to create extra list for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 1); } /* Create distribution factors variable if required */ if (sets[i].num_distribution_factor > 0) { if (sets[i].type != EX_SIDE_SET) { /* but sets[i].num_distribution_factor must equal number of nodes */ if (sets[i].num_distribution_factor != sets[i].num_entry) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # dist fact (%"PRId64") not equal to # nodes (%"PRId64") in node set %"PRId64" file id %d", sets[i].num_distribution_factor, sets[i].num_entry, sets[i].id, exoid); ex_err("ex_put_sets",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } else { /* resuse dimid from entry lists */ if ((status = nc_def_dim(exoid, numdfptr, sets[i].num_distribution_factor, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define number of dist factors in %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } } /* create variable array in which to store the set distribution factors */ dims[0] = dimid; if ((status = nc_def_var(exoid, factptr, nc_flt_code(exoid), 1, dims, &varid)) != NC_NOERR) { exerrval = status; if (status == NC_ENAMEINUSE) { sprintf(errmsg, "Error: dist factors list already exists for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } else { sprintf(errmsg, "Error: failed to create dist factors list for %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id,exoid); ex_err("ex_put_sets",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); } } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } /* Output the set ids and status... */ for (i=0; i < set_count; i++) { /* setup pointers based on sets[i].type */ if (sets[i].type == EX_NODE_SET) { idsptr = VAR_NS_IDS; statptr = VAR_NS_STAT; } else if (sets[i].type == EX_EDGE_SET) { idsptr = VAR_ES_IDS; statptr = VAR_ES_STAT; } else if (sets[i].type == EX_FACE_SET) { idsptr = VAR_FS_IDS; statptr = VAR_FS_STAT; } else if (sets[i].type == EX_SIDE_SET) { idsptr = VAR_SS_IDS; statptr = VAR_SS_STAT; } else if (sets[i].type == EX_ELEM_SET) { idsptr = VAR_ELS_IDS; statptr = VAR_ELS_STAT; } /* first: get id of set id variable */ if ((status = nc_inq_varid(exoid, idsptr, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id, exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } /* write out set id */ start[0] = sets_to_define[i]-1; status = nc_put_var1_longlong(exoid, varid, start, (long long*)&sets[i].id); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s id %"PRId64" in file id %d", ex_name_of_object(sets[i].type), sets[i].id, exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } set_stat = (sets[i].num_entry == 0) ? 0 : 1; if ((status = nc_inq_varid(exoid, statptr, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s status in file id %d", ex_name_of_object(sets[i].type), exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_put_var1_int(exoid, varid, start, &set_stat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s %"PRId64" status to file id %d", ex_name_of_object(sets[i].type), sets[i].id, exoid); ex_err("ex_put_sets",errmsg,exerrval); return (EX_FATAL); } } free(sets_to_define); } /* Sets are now all defined; see if any set data needs to be output... */ status = EX_NOERR; for (i=0; i < set_count; i++) { int stat; if (sets[i].entry_list != NULL || sets[i].extra_list != NULL) { /* NOTE: ex_put_set will write the warning/error message... */ stat = ex_put_set(exoid, sets[i].type, sets[i].id, sets[i].entry_list, sets[i].extra_list); if (stat != EX_NOERR) status = EX_FATAL; } if (sets[i].distribution_factor_list != NULL) { /* NOTE: ex_put_set_dist_fact will write the warning/error message... */ stat = ex_put_set_dist_fact(exoid, sets[i].type, sets[i].id, sets[i].distribution_factor_list); if (stat != EX_NOERR) status = EX_FATAL; } } return (status); /* Fatal error: exit definition mode and return */ error_ret: free(sets_to_define); if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_sets",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_side_set.c000066400000000000000000000057541225312213100230620ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the side set element list and side set side list for a single side set * \param exoid exodus file id * \param side_set_id side set id * \param *side_set_elem_list array of elements in side set * \param *side_set_side_list array of sides in side set * \deprecated Use ex_put_set()(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list) */ int ex_put_side_set (int exoid, ex_entity_id side_set_id, const void_int *side_set_elem_list, const void_int *side_set_side_list) { return ex_put_set(exoid, EX_SIDE_SET, side_set_id, side_set_elem_list, side_set_side_list); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_side_set_dist_fact.c000066400000000000000000000055001225312213100250670ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the distribution factors for a single side set * \param exoid exodus file id * \param side_set_id side set id * \param *side_set_dist_fact array of dist factors for side set * \deprecated Use ex_put_set_dist_fact()(exoid, EX_SIDE_SET, side_set_id, side_set_dist_fact) */ int ex_put_side_set_dist_fact (int exoid, ex_entity_id 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_side_set_param.c000066400000000000000000000061431225312213100242330ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #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 * \param exoid exodus file id * \param side_set_id side set id * \param num_side_in_set number of sides in the side set * \param num_dist_fact_in_set number of distribution factors in the side set * \deprecated Use ex_put_set_param()(exoid, EX_SIDE_SET, side_set_id, num_side_in_set, num_dist_fact_in_set) */ int ex_put_side_set_param (int exoid, ex_entity_id side_set_id, int64_t num_side_in_set, int64_t 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); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_ss_param_global.c000066400000000000000000000137311225312213100244020ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ /* Function(s) contained in this file: * ex_put_ss_param_global() ***************************************************************************** * This function outputs the global side-set parameters. ***************************************************************************** * Variable Index: * exoid - The NetCDF ID of an already open NemesisI file. * global_ids - Pointer to a vector of global side-set IDs. * side_cnts - Pointer to a vector of global side counts in * each global side set. * df_cnts - Pointer to a vector of global distribution * factors in each global side set. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include int ex_put_ss_param_global(int exoid, void_int *global_ids, void_int *side_cnts, void_int *df_cnts ) { const char *func_name="ex_put_ss_param_global"; int varid; int status; char errmsg[MAX_ERR_LENGTH]; /*-----------------------------Execution begins-----------------------------*/ exerrval = 0; /* clear error code */ /* Get the variable ID for the vector of global side set IDs */ if ((status = nc_inq_varid(exoid, VAR_SS_IDS_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of global side set IDs */ if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_put_var_longlong(exoid, varid, global_ids); } else { status = nc_put_var_int(exoid, varid, global_ids); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" to file ID %d", VAR_SS_IDS_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the vector of global side-set side counts */ if ((status = nc_inq_varid(exoid, VAR_SS_SIDE_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_SIDE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of global side counts in each global side set */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, varid, side_cnts); } else { status = nc_put_var_int(exoid, varid, side_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put variable \"%s\" in file ID %d", VAR_SS_SIDE_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the variable ID for the number of dist. factors in each side set */ if ((status = nc_inq_varid(exoid, VAR_SS_DF_CNT_GLOBAL, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" in file ID %d", VAR_SS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Output the vector of dist. factor counts */ if (ex_int64_status(exoid) & EX_BULK_INT64_API) { status = nc_put_var_longlong(exoid, varid, df_cnts); } else { status = nc_put_var_int(exoid, varid, df_cnts); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to output variable \"%s\" in file ID %d", VAR_SS_DF_CNT_GLOBAL, exoid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_sset_var.c000066400000000000000000000066121225312213100231030ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #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 * \param exoid exodus file id * \param time_step time step number * \param sset_var_index sideset variable index * \param sset_id sideset id * \param num_faces_this_sset number of faces in this sideset * \param sset_var_vals the variable values to be written * \deprecated Use ex_put_var()(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_faces_this_sset, sset_var_vals) */ int ex_put_sset_var (int exoid, int time_step, int sset_var_index, ex_entity_id sset_id, int64_t num_faces_this_sset, const void *sset_var_vals) { return ex_put_var(exoid, time_step, EX_SIDE_SET, sset_var_index, sset_id, num_faces_this_sset, sset_var_vals); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_sset_var_tab.c000066400000000000000000000067421225312213100237350ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #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 * \param exoid exodus file id * \param num_sset number of sidesets * \param num_sset_var number of sideset variables * \param *sset_var_tab sideset variable truth table array * \deprecated Use ex_put_truth_table()(exoid, EX_SIDE_SET, num_sset, num_sset_var, sset_var_tab) */ int ex_put_sset_var_tab (int exoid, int num_sset, int num_sset_var, int *sset_var_tab) { return ex_put_truth_table(exoid, EX_SIDE_SET, num_sset, num_sset_var, sset_var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_time.c000066400000000000000000000076161225312213100222200ustar00rootroot00000000000000/* * 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. * */ #include #include "exodusII.h" #include "exodusII_int.h" /*! The function ex_put_time() writes the time value for a specified time step. Because time values are floating point values, the application code must declare the array passed to be the appropriate type (\c float or \c double) to match the compute word size passed in ex_create() or ex_open(). \return In case of an error, ex_put_time() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] time_step The time step number. This is essentially a counter that is incremented only when results variables are output to the data file. The first time step is 1. \param[in] time_value The time at the specified time step. The following code segment will write out the simulation time value at simulation time step n: \code int error, exoid, n; float time_value; \comment{write time value} error = ex_put_time (exoid, n, &time_value); \endcode */ int ex_put_time (int exoid, int time_step, const void *time_value) { int status; int varid; size_t start[1]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* inquire previously defined variable */ if ((status = nc_inq_varid(exoid, VAR_WHOLE_TIME, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time variable in file id %d", exoid); ex_err("ex_put_time",errmsg,exerrval); return (EX_FATAL); } /* store time value */ start[0] = --time_step; if (ex_comp_ws(exoid) == 4) { status = nc_put_var1_float(exoid, varid, start, time_value); } else { status = nc_put_var1_double(exoid, varid, start, time_value); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store time value in file id %d", exoid); ex_err("ex_put_time",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_truth_table.c000066400000000000000000000305201225312213100235650ustar00rootroot00000000000000/* * 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_truth_table * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type object type * int num_blk number of blocks * int num_var number of variables * int* variable_table variable truth table array * * exit conditions - * * revision history - * * *****************************************************************************/ #include #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 * \param exoid exodus file id * \param obj_type object type * \param num_blk number of blocks * \param num_var number of variables * \param *var_tab variable truth table array */ int ex_put_truth_table (int exoid, ex_entity_type obj_type, int num_blk, int num_var, int *var_tab) { int numelblkdim, numelvardim, timedim, dims[2], varid; char *sta_type, *tab_type; size_t num_entity = 0; size_t num_var_db = 0; int *stat_vals; int i, j, k; int status; char errmsg[MAX_ERR_LENGTH]; const char* routine = "ex_put_truth_table"; /* * The ent_type and the var_name are used to build the netcdf * variables name. Normally this is done via a macro defined in * exodusII_int.h */ const char* ent_type = NULL; const char* var_name = NULL; const char* ent_size = NULL; exerrval = 0; /* clear error code */ ex_get_dimension(exoid, ex_dim_num_objects(obj_type), ex_name_of_object(obj_type), &num_entity, &numelblkdim, routine); if (obj_type == EX_ELEM_BLOCK) { ex_get_dimension(exoid, DIM_NUM_ELE_VAR, "element variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_ELEM_TAB, &varid); var_name = "vals_elem_var"; ent_type = "eb"; ent_size = "num_el_in_blk"; sta_type = VAR_STAT_EL_BLK; tab_type = VAR_ELEM_TAB; } else if (obj_type == EX_EDGE_BLOCK) { ex_get_dimension(exoid, DIM_NUM_EDG_VAR, "edge block variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_EBLK_TAB, &varid); var_name = "vals_edge_var"; ent_type = "eb"; ent_size = "num_ed_in_blk"; sta_type = VAR_STAT_ED_BLK; tab_type = VAR_EBLK_TAB; } else if (obj_type == EX_FACE_BLOCK) { ex_get_dimension(exoid, DIM_NUM_FAC_VAR, "face block variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_FBLK_TAB, &varid); var_name = "vals_face_var"; ent_type = "fb"; ent_size = "num_fa_in_blk"; sta_type = VAR_STAT_FA_BLK; tab_type = VAR_FBLK_TAB; } else if (obj_type == EX_SIDE_SET) { ex_get_dimension(exoid, DIM_NUM_SSET_VAR, "sideset variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_SSET_TAB, &varid); var_name = "vals_sset_var"; ent_type = "ss"; ent_size = "num_side_ss"; sta_type = VAR_SS_STAT; tab_type = VAR_SSET_TAB; } else if (obj_type == EX_NODE_SET) { ex_get_dimension(exoid, DIM_NUM_NSET_VAR, "nodeset variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_NSET_TAB, &varid); var_name = "vals_nset_var"; ent_type = "ns"; ent_size = "num_nod_ns"; sta_type = VAR_NS_STAT; tab_type = VAR_NSET_TAB; } else if (obj_type == EX_EDGE_SET) { ex_get_dimension(exoid, DIM_NUM_ESET_VAR, "edge set variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_ESET_TAB, &varid); var_name = "vals_eset_var"; ent_type = "es"; ent_size = "num_edge_es"; sta_type = VAR_ES_STAT; tab_type = VAR_ESET_TAB; } else if (obj_type == EX_FACE_SET) { ex_get_dimension(exoid, DIM_NUM_FSET_VAR, "face set variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_FSET_TAB, &varid); var_name = "vals_fset_var"; ent_type = "fs"; ent_size = "num_face_fs"; sta_type = VAR_FS_STAT; tab_type = VAR_FSET_TAB; } else if (obj_type == EX_ELEM_SET) { ex_get_dimension(exoid, DIM_NUM_ELSET_VAR, "element set variables", &num_var_db, &numelvardim, routine); nc_inq_varid (exoid, VAR_ELSET_TAB, &varid); var_name = "vals_elset_var"; ent_type = "es"; ent_size = "num_ele_els"; sta_type = VAR_ELS_STAT; tab_type = VAR_ELSET_TAB; } else { /* invalid variable type */ exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid variable type %d specified in file id %d", obj_type, exoid); ex_err("ex_get_varid",errmsg,exerrval); return (EX_WARN); } if ((int)num_entity != num_blk) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # of %s doesn't match those defined in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_get_var_tab",errmsg,exerrval); return (EX_FATAL); } if ((int)num_var_db != num_var) { exerrval = EX_FATAL; sprintf(errmsg, "Error: # of %s variables doesn't match those defined in file id %d", ex_name_of_object(obj_type), exoid); ex_err("ex_get_var_tab",errmsg,exerrval); return (EX_FATAL); } /* Get status array for later use */ if (!(stat_vals = malloc(num_blk*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for %s status array for file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } status = nc_inq_varid (exoid, sta_type, &varid); /* get variable id of status array */ if (status == NC_NOERR) { /* if status array exists (V 2.01+), use it, otherwise assume object exists to be backward compatible */ if ((status = nc_get_var_int (exoid, varid, stat_vals)) != NC_NOERR) { exerrval = status; free(stat_vals); sprintf(errmsg, "Error: failed to get %s status array from file id %d", ex_name_of_object(obj_type), exoid); ex_err("put_var_tab",errmsg,exerrval); return (EX_FATAL); } } else { /* status array doesn't exist (V2.00), dummy one up for later checking */ for(i=0;i #include "exodusII.h" #include "exodusII_int.h" static int ex_look_up_var(int exoid, ex_entity_type var_type, int var_index, ex_entity_id obj_id, const char *VOBJID, const char *VOBJTAB, const char *DNUMOBJ, const char *DNUMOBJVAR, int *varid) { int status; int obj_id_ndx; int dimid,time_dim, numobjdim, dims[2]; size_t num_obj; size_t num_obj_var; size_t num_entity; int *obj_var_truth_tab; char errmsg[MAX_ERR_LENGTH]; /* Determine index of obj_id in VOBJID array */ obj_id_ndx = ex_id_lkup(exoid,var_type,obj_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no variables allowed for NULL block %"PRId64" in file id %d", obj_id,exoid); ex_err("ex_put_var",errmsg,EX_NULLENTITY); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in %s array in file id %d", ex_name_of_object(var_type), obj_id, VOBJID, exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } } if ((status = nc_inq_varid (exoid, ex_name_var_of_object(var_type, var_index, obj_id_ndx), varid)) != NC_NOERR) { if (status == NC_ENOTVAR) {/* variable doesn't exist, create it! */ /* check for the existance of an TNAME variable truth table */ if (nc_inq_varid(exoid, VOBJTAB, varid) == NC_NOERR) { /* find out number of TNAMEs and TNAME variables */ status = ex_get_dimension(exoid, DNUMOBJ, ex_name_of_object(var_type), &num_obj, &dimid, "ex_put_var"); if (status != NC_NOERR) return status; status = ex_get_dimension(exoid, DNUMOBJVAR, ex_name_of_object(var_type), &num_obj_var, &dimid, "ex_put_var"); if (status != NC_NOERR) return status; if (!(obj_var_truth_tab = malloc(num_obj*num_obj_var*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for %s variable truth table in file id %d", ex_name_of_object(var_type), exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } /* read in the TNAME variable truth table */ if ((status = nc_get_var_int (exoid, *varid, obj_var_truth_tab)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get truth table from file id %d", exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } if(obj_var_truth_tab[num_obj_var*(obj_id_ndx-1)+var_index-1] == 0L) { free(obj_var_truth_tab); exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid %s variable %d, %s %"PRId64" in file id %d", ex_name_of_object(var_type), var_index, ex_name_of_object(var_type), obj_id, exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } free(obj_var_truth_tab); } if ((status = nc_inq_dimid(exoid, DIM_TIME, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time dimension in file id %d", exoid); ex_err("ex_put_var",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_get_dimension(exoid, ex_dim_num_entries_in_object(var_type, obj_id_ndx), ex_name_of_object(var_type), &num_entity, &numobjdim, "ex_put_var"); /* variable doesn't exist so put file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } /* define netCDF variable to store TNAME variable values */ dims[0] = time_dim; dims[1] = numobjdim; if ((status = nc_def_var(exoid, ex_name_var_of_object(var_type, var_index, obj_id_ndx), nc_flt_code(exoid), 2, dims, varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define %s variable %d in file id %d", ex_name_of_object(var_type), var_index,exoid); ex_err("ex_put_var",errmsg,exerrval); goto error_ret; } ex_compress_variable(exoid, *varid, 2); /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete %s variable %s definition to file id %d", ex_name_of_object(var_type), ex_name_var_of_object(var_type, var_index, obj_id_ndx), exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } } else { exerrval = status; sprintf(errmsg, "Error: failed to locate %s variable %s in file id %d", ex_name_of_object(var_type), ex_name_var_of_object(var_type, var_index, obj_id_ndx), exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } } return (EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if (nc_enddef (exoid) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_var",errmsg,exerrval); } return (EX_FATAL); } /*! * writes the values of a single variable for one entity at one time * step to the database; assume the first time step and variable index * are 1 * \param exoid exodus file id * \param time_step time step number * \param var_type type (edge block, face block, edge set, ... ) * \param var_index variable index * \param obj_id entity block id * \param num_entries_this_obj number of entries in this block/set * \param var_vals the values to be written */ int ex_put_var (int exoid, int time_step, ex_entity_type var_type, int var_index, ex_entity_id obj_id, int64_t num_entries_this_obj, const void *var_vals) { int varid; size_t start[2], count[2]; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ 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 ((status = nc_inq_varid (exoid, VAR_GLO_VAR, &varid)) != NC_NOERR) { if (status == NC_ENOTVAR) { exerrval = status; sprintf(errmsg, "Error: no global variables defined in file id %d", exoid); ex_err("ex_put_glob_vars",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to get global variables parameters in file id %d", exoid); ex_err("ex_put_glob_vars",errmsg,exerrval); } return (EX_FATAL); } break; case EX_NODAL: return ex_put_nodal_var(exoid, time_step, var_index, num_entries_this_obj, var_vals); break; case EX_EDGE_BLOCK: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_ID_ED_BLK,VAR_EBLK_TAB,DIM_NUM_ED_BLK,DIM_NUM_EDG_VAR, &varid); break; case EX_FACE_BLOCK: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_ID_FA_BLK,VAR_FBLK_TAB,DIM_NUM_FA_BLK,DIM_NUM_FAC_VAR, &varid); break; case EX_ELEM_BLOCK: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_ID_EL_BLK,VAR_ELEM_TAB,DIM_NUM_EL_BLK,DIM_NUM_ELE_VAR, &varid); break; case EX_NODE_SET: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_NS_IDS,VAR_NSET_TAB,DIM_NUM_NS,DIM_NUM_NSET_VAR, &varid); break; case EX_EDGE_SET: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_ES_IDS,VAR_ESET_TAB,DIM_NUM_ES,DIM_NUM_ESET_VAR, &varid); break; case EX_FACE_SET: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_FS_IDS,VAR_FSET_TAB,DIM_NUM_FS,DIM_NUM_FSET_VAR, &varid); break; case EX_SIDE_SET: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_SS_IDS,VAR_SSET_TAB,DIM_NUM_SS,DIM_NUM_SSET_VAR, &varid); break; case EX_ELEM_SET: status = ex_look_up_var(exoid, var_type, var_index, obj_id, VAR_ELS_IDS,VAR_ELSET_TAB,DIM_NUM_ELS,DIM_NUM_ELSET_VAR, &varid); 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); } if (status != EX_NOERR) { return status; } /* 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 (ex_comp_ws(exoid) == 4) { status = nc_put_vara_float(exoid, varid, start, count, var_vals); } else { status = nc_put_vara_double(exoid, varid, start, count, var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s %"PRId64" variable %d in file id %d", ex_name_of_object(var_type), obj_id, var_index,exoid); ex_err("ex_put_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_var_name.c000066400000000000000000000060471225312213100230470ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include /*! * writes the name of a particular results variable to the database * \param exoid exodus file id * \param *var_type variable type: G,N, or E * \param var_num variable number name to write 1..num_var * \param *var_name ptr of variable name * \deprecated use ex_put_variable_name()(exoid, obj_type, var_num, *var_name) */ int ex_put_var_name (int exoid, const char *var_type, int var_num, const char *var_name) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return ex_put_variable_name(exoid, obj_type, var_num, var_name); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_var_names.c000066400000000000000000000060121225312213100232220ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include /*! * writes the names of the results variables to the database * \param exoid exodus file id * \param *var_type variable type: G,N, or E * \param num_vars # of variables to read * \param *var_names ptr array of variable names * \deprecated Use ex_put_variable_names()(exoid, obj_type, num_vars, var_names) */ int ex_put_var_names (int exoid, const char *var_type, int num_vars, char* var_names[]) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return ex_put_variable_names(exoid, obj_type, num_vars, var_names); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_var_param.c000066400000000000000000000055731225312213100232320ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expvp - ex_put_var_param * * entry conditions - * input parameters: * int exoid exodus file id * char* var_type variable type G,N, or E * int* num_vars number of variables in database * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include /*! * writes the number and names of global, nodal, or element variables * that will be written to the database * \param exoid exodus file id * \param var_type variable type G,N, or E * \param num_vars number of variables in database * \deprecated Use ex_put_variable_param()(exoid, obj_type, num_vars) */ int ex_put_var_param (int exoid, const char *var_type, int num_vars) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return (ex_put_variable_param(exoid, obj_type, num_vars)); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_var_tab.c000066400000000000000000000070351225312213100226730ustar00rootroot00000000000000/* * 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 * * 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 - * * *****************************************************************************/ #include #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 * \param exoid exodus file id * \param *var_type 'e', 'm', 's' element, nodeset, sideset * \param num_blk number of blocks * \param num_var number of variables * \param *var_tab variable truth table array * \deprecated Use ex_put_truth_table()(exoid, obj_type, num_blk, num_var, var_tab) */ int ex_put_var_tab (int exoid, const char *var_type, int num_blk, int num_var, int *var_tab) { ex_entity_type obj_type; obj_type = ex_var_type_to_ex_entity_type(*var_type); return ex_put_truth_table(exoid, obj_type, num_blk, num_var, var_tab); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_variable_name.c000066400000000000000000000103451225312213100240400ustar00rootroot00000000000000/* * Copyright (c) 2006 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expvnm - ex_put_variable_name * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type variable type: G,N, or E * int var_num variable number name to write 1..num_var * char* var_name ptr of variable name * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include /*! * writes the name of a particular results variable to the database * \param exoid exodus file id * \param obj_type variable type * \param var_num variable number name to write 1..num_var * \param *var_name ptr of variable name */ int ex_put_variable_name (int exoid, ex_entity_type obj_type, int var_num, const char *var_name) { int status; int varid; char errmsg[MAX_ERR_LENGTH]; const char* vname; exerrval = 0; /* clear error code */ /* inquire previously defined variables */ switch (obj_type) { case EX_GLOBAL: vname = VAR_NAME_GLO_VAR; break; case EX_NODAL: vname = VAR_NAME_NOD_VAR; break; case EX_EDGE_BLOCK: vname = VAR_NAME_EDG_VAR; break; case EX_FACE_BLOCK: vname = VAR_NAME_FAC_VAR; break; case EX_ELEM_BLOCK: vname = VAR_NAME_ELE_VAR; break; case EX_NODE_SET: vname = VAR_NAME_NSET_VAR; break; case EX_EDGE_SET: vname = VAR_NAME_ESET_VAR; break; case EX_FACE_SET: vname = VAR_NAME_FSET_VAR; break; case EX_SIDE_SET: vname = VAR_NAME_SSET_VAR; break; case EX_ELEM_SET: vname = VAR_NAME_ELSET_VAR; break; default: exerrval = EX_BADPARAM; sprintf( errmsg, "Error: Invalid variable type (%d) given for file id %d", obj_type, exoid ); ex_err( "ex_put_variable_name", errmsg, exerrval ); return (EX_WARN); } if ((status = nc_inq_varid(exoid, vname, &varid)) != NC_NOERR) { exerrval = status; sprintf( errmsg, "Warning: no %s variables names stored in file id %d", ex_name_of_object(obj_type), exoid ); ex_err("ex_put_variable_name",errmsg,exerrval); return (EX_WARN); } /* write EXODUS variable name */ status = ex_put_name_internal(exoid, varid, var_num-1, var_name, obj_type, "variable", "ex_put_variable_name"); return(status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_variable_names.c000066400000000000000000000167121225312213100242270ustar00rootroot00000000000000/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expvan - ex_put_variable_names * * entry conditions - * input parameters: * int exoid exodus file id * int obj_type variable type: G,N, or E * int num_vars # of variables to read * char* var_names ptr array of variable names * * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" #include #include #define EX_PUT_NAMES(TNAME,DNUMVAR,VNAMES) \ if ((status = nc_inq_dimid(exoid, DNUMVAR, &dimid)) != NC_NOERR) { \ exerrval = status; \ if (status == NC_EBADDIM) { \ sprintf(errmsg, \ "Error: no " TNAME " variables defined in file id %d", \ exoid); \ ex_err("ex_put_var_names",errmsg,exerrval); \ } else { \ sprintf(errmsg, \ "Error: failed to locate number of " TNAME " variables in file id %d", \ exoid); \ ex_err("ex_put_var_names",errmsg,exerrval); \ } \ return(EX_FATAL); \ } \ \ if ((status = nc_inq_varid(exoid, VNAMES, &varid)) != NC_NOERR) { \ exerrval = status; \ if (status == NC_ENOTVAR) \ { \ sprintf(errmsg, \ "Error: no " TNAME " variable names defined in file id %d", \ exoid); \ ex_err("ex_put_var_names",errmsg,exerrval); \ } else { \ sprintf(errmsg, \ "Error: " TNAME " name variable names not found in file id %d", \ exoid); \ ex_err("ex_put_var_names",errmsg,exerrval); \ } \ return(EX_FATAL); \ } /*! The function ex_put_variable_names() writes the names of the results variables to the database. The names are \p MAX_STR_LENGTH -characters in length. The function ex_put_variable_param() must be called before this function is invoked. \return In case of an error, ex_put_variable_names() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file not initialized properly with call to ex_put_init(). - invalid variable type specified. - ex_put_variable_param() was not called previously or was called with zero variables of the specified type. - ex_put_variable_names() has been called previously for the specified variable type. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Variable indicating the type of variable which is described. Use one of the options in the table below. \param[in] num_vars The number of \c var_type variables that will be written to the database. \param[in] var_names Array of pointers to \c num_vars variable names.
\c EX_GLOBAL} Global entity type
\c EX_NODAL} Nodal entity type
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
The following coding will write out the names associated with the nodal variables: \code int num_nod_vars, error, exoid; char *var_names[2]; \comment{write results variables parameters and names} num_nod_vars = 2; var_names[0] = "disx"; var_names[1] = "disy"; error = ex_put_variable_param (exoid, EX_NODAL, num_nod_vars); error = ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, var_names); \endcode */ int ex_put_variable_names (int exoid, ex_entity_type obj_type, int num_vars, char* var_names[]) { int varid, dimid, status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ switch (obj_type) { case EX_GLOBAL: EX_PUT_NAMES( "global",DIM_NUM_GLO_VAR, VAR_NAME_GLO_VAR); break; case EX_NODAL: EX_PUT_NAMES( "nodal",DIM_NUM_NOD_VAR, VAR_NAME_NOD_VAR); break; case EX_EDGE_BLOCK: EX_PUT_NAMES( "edge",DIM_NUM_EDG_VAR, VAR_NAME_EDG_VAR); break; case EX_FACE_BLOCK: EX_PUT_NAMES( "face",DIM_NUM_FAC_VAR, VAR_NAME_FAC_VAR); break; case EX_ELEM_BLOCK: EX_PUT_NAMES( "element",DIM_NUM_ELE_VAR, VAR_NAME_ELE_VAR); break; case EX_NODE_SET: EX_PUT_NAMES( "node set",DIM_NUM_NSET_VAR, VAR_NAME_NSET_VAR); break; case EX_EDGE_SET: EX_PUT_NAMES( "edge set",DIM_NUM_ESET_VAR, VAR_NAME_ESET_VAR); break; case EX_FACE_SET: EX_PUT_NAMES( "face set",DIM_NUM_FSET_VAR, VAR_NAME_FSET_VAR); break; case EX_SIDE_SET: EX_PUT_NAMES( "side set",DIM_NUM_SSET_VAR, VAR_NAME_SSET_VAR); break; case EX_ELEM_SET: EX_PUT_NAMES("element set",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid variable type %d specified in file id %d", obj_type, exoid); ex_err("ex_put_var_names",errmsg,exerrval); return(EX_FATAL); } /* write EXODUS variable names */ status = ex_put_names_internal(exoid, varid, num_vars, var_names, obj_type, "variable", "ex_put_var_names"); return(status); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_put_variable_param.c000066400000000000000000000317561225312213100242310ustar00rootroot00000000000000/* * 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. * */ #include "exodusII.h" #include "exodusII_int.h" #include /*! \cond INTERNAL */ #define EX_PREPARE_RESULT_VAR(TNAME,DIMNAME,VARNAMEVAR) \ if ((status = nc_def_dim(exoid, DIMNAME, num_vars, &dimid)) != NC_NOERR) { \ if (status == NC_ENAMEINUSE) { \ exerrval = status; \ sprintf(errmsg, \ "Error: " TNAME " variable name parameters are already defined in file id %d", \ exoid); \ ex_err("ex_put_var_param",errmsg,exerrval); \ } else { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define number of " TNAME " variables in file id %d", \ exoid); \ ex_err("ex_put_var_param",errmsg,exerrval); \ } \ goto error_ret; /* exit define mode and return */ \ } \ /* Now define TNAME variable name variable */ \ dims[0] = dimid; \ dims[1] = dim_str_name; \ if ((status = nc_def_var (exoid, VARNAMEVAR, NC_CHAR, 2, dims, &varid)) != NC_NOERR) { \ if (status == NC_ENAMEINUSE) { \ exerrval = status; \ sprintf(errmsg, \ "Error: " TNAME " variable names are already defined in file id %d", \ exoid); \ ex_err("ex_put_variable_param",errmsg,exerrval); \ } else { \ exerrval = status; \ sprintf(errmsg, \ "Error: failed to define " TNAME " variable names in file id %d", \ exoid); \ ex_err("ex_put_variable_param",errmsg,exerrval); \ } \ goto error_ret; /* exit define mode and return */ \ } /*! \endcond */ /*! The function ex_put_variable_param() writes the number of global, nodal, nodeset, sideset, edge, face, or element variables that will be written to the database. \return In case of an error, ex_put_variable_param() returns a negative number; a warning will return a positive number. Possible causes of errors include: - data file not properly opened with call to ex_create() or ex_open() - data file opened for read only. - invalid variable type specified. - data file not initialized properly with call to ex_put_init(). - this routine has already been called with the same variable type; redefining the number of variables is not allowed. - a warning value is returned if the number of variables is specified as zero. \param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open(). \param[in] obj_type Variable indicating the type of variable which is described. Use one of the #ex_entity_type types specified in the table below. \param[in] num_vars The number of \c var_type variables that will be written to the database.
\c EX_GLOBAL Global entity type
\c EX_NODAL Nodal entity type
\c EX_NODE_SET Node Set entity type
\c EX_EDGE_BLOCK Edge Block entity type
\c EX_EDGE_SET Edge Set entity type
\c EX_FACE_BLOCK Face Block entity type
\c EX_FACE_SET Face Set entity type
\c EX_ELEM_BLOCK Element Block entity type
\c EX_ELEM_SET Element Set entity type
\c EX_SIDE_SET Side Set entity type
For example, the following code segment initializes the data file to store global variables: \code int num_glo_vars, error, exoid; \comment{write results variables parameters} num_glo_vars = 3; error = ex_put_variable_param (exoid, EX_GLOBAL, num_glo_vars); \endcode */ int ex_put_variable_param (int exoid, ex_entity_type obj_type, int num_vars) { int time_dim, num_nod_dim, dimid, dim_str_name, varid; int dims[3]; char errmsg[MAX_ERR_LENGTH]; int status; exerrval = 0; /* clear error code */ /* if no variables are to be stored, return with warning */ if (num_vars == 0) { exerrval = EX_MSG; sprintf(errmsg, "Warning: zero %s variables specified for file id %d", ex_name_of_object(obj_type),exoid); ex_err("ex_put_variable_param",errmsg,exerrval); return (EX_WARN); } if ( obj_type != EX_NODAL && obj_type != EX_NODE_SET && obj_type != EX_EDGE_BLOCK && obj_type != EX_EDGE_SET && obj_type != EX_FACE_BLOCK && obj_type != EX_FACE_SET && obj_type != EX_ELEM_BLOCK && obj_type != EX_ELEM_SET && obj_type != EX_SIDE_SET && obj_type != EX_GLOBAL) { exerrval = EX_BADPARAM; sprintf(errmsg, "Error: Invalid variable type %d specified in file id %d", obj_type, exoid); ex_err("ex_put_variable_param",errmsg,exerrval); return (EX_WARN); } /* inquire previously defined dimensions */ if ((status = nc_inq_dimid (exoid, DIM_TIME, &time_dim)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate time dimension in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); return (EX_FATAL); } if ((status = nc_inq_dimid (exoid, DIM_NUM_NODES, &num_nod_dim)) != NC_NOERR) { if (obj_type == EX_NODAL) { return (EX_NOERR); /* Probably no nodes on database (e.g., badly load-balanced parallel run) */ } } if ((status = nc_inq_dimid (exoid, DIM_STR_NAME, &dim_str_name)) < 0) { exerrval = status; sprintf(errmsg, "Error: failed to get name string length in file id %d",exoid); ex_err("ex_put_variable_param",errmsg,exerrval); return (EX_FATAL); } /* put file into define mode */ if ((status = nc_redef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to put file id %d into define mode", exoid); ex_err("ex_get_var_param",errmsg,exerrval); return (EX_FATAL); } /* define dimensions and variables */ if (obj_type == EX_GLOBAL) { EX_PREPARE_RESULT_VAR("global",DIM_NUM_GLO_VAR,VAR_NAME_GLO_VAR); dims[0] = time_dim; dims[1] = dimid; if ((status = nc_def_var (exoid, VAR_GLO_VAR, nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define global variables in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); } else if (obj_type == EX_NODAL) { /* * There are two ways to store the nodal variables. The old way * * was a blob (#times,#vars,#nodes), but that was exceeding the * netcdf maximum dataset size for large models. The new way is * to store #vars separate datasets each of size (#times,#nodes) * * We want this routine to be capable of storing both formats * based on some external flag. Since the storage format of the * coordinates have also been changed, we key off of their * storage type to decide which method to use for nodal * variables. If the variable 'coord' is defined, then store old * way; otherwise store new. */ if ((status = nc_def_dim(exoid, DIM_NUM_NOD_VAR, num_vars, &dimid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: nodal variable name parameters are already defined in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define number of nodal variables in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } if (ex_large_model(exoid) == 0) { /* Old way */ dims[0] = time_dim; dims[1] = dimid; dims[2] = num_nod_dim; if ((status = nc_def_var(exoid, VAR_NOD_VAR, nc_flt_code(exoid), 3, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define nodal variables in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); } else { /* New way */ int i; for (i = 1; i <= num_vars; i++) { dims[0] = time_dim; dims[1] = num_nod_dim; if ((status = nc_def_var (exoid, VAR_NOD_VAR_NEW(i), nc_flt_code(exoid), 2, dims, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to define nodal variable %d in file id %d", i, exoid); ex_err("ex_put_variable_param",errmsg,exerrval); goto error_ret; /* exit define mode and return */ } ex_compress_variable(exoid, varid, 2); } } /* Now define nodal variable name variable */ dims[0] = dimid; dims[1] = dim_str_name; if ((status = nc_def_var(exoid, VAR_NAME_NOD_VAR, NC_CHAR, 2, dims, &varid)) != NC_NOERR) { if (status == NC_ENAMEINUSE) { exerrval = status; sprintf(errmsg, "Error: nodal variable names are already defined in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); } else { exerrval = status; sprintf(errmsg, "Error: failed to define nodal variable names in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); } goto error_ret; /* exit define mode and return */ } } /* netCDF variables in which to store the EXODUS obj_type variable values will * be defined in ex_put_*_var_tab or ex_put_*_var; at this point, we * don't know what obj_type variables are valid for which obj_type blocks * (the info that is stored in the obj_type variable truth table) */ else if (obj_type == EX_ELEM_BLOCK) { EX_PREPARE_RESULT_VAR("element",DIM_NUM_ELE_VAR,VAR_NAME_ELE_VAR); } else if (obj_type == EX_NODE_SET) { EX_PREPARE_RESULT_VAR("nodeset",DIM_NUM_NSET_VAR,VAR_NAME_NSET_VAR); } else if (obj_type == EX_SIDE_SET) { EX_PREPARE_RESULT_VAR("sideset",DIM_NUM_SSET_VAR,VAR_NAME_SSET_VAR); } else if (obj_type == EX_EDGE_BLOCK) { EX_PREPARE_RESULT_VAR("edge",DIM_NUM_EDG_VAR,VAR_NAME_EDG_VAR); } else if (obj_type == EX_FACE_BLOCK) { EX_PREPARE_RESULT_VAR("face",DIM_NUM_FAC_VAR,VAR_NAME_FAC_VAR); } else if (obj_type == EX_EDGE_SET) { EX_PREPARE_RESULT_VAR("edgeset",DIM_NUM_ESET_VAR,VAR_NAME_ESET_VAR); } else if (obj_type == EX_FACE_SET) { EX_PREPARE_RESULT_VAR("faceset",DIM_NUM_FSET_VAR,VAR_NAME_FSET_VAR); } else if (obj_type == EX_ELEM_SET) { EX_PREPARE_RESULT_VAR("elementset",DIM_NUM_ELSET_VAR,VAR_NAME_ELSET_VAR); } /* leave define mode */ if ((status = nc_enddef (exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to complete definition in file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); /* Fatal error: exit definition mode and return */ error_ret: if ((status = nc_enddef(exoid)) != NC_NOERR) { /* exit define mode */ sprintf(errmsg, "Error: failed to complete definition for file id %d", exoid); ex_err("ex_put_variable_param",errmsg,exerrval); } return (EX_FATAL); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_update.c000066400000000000000000000050341225312213100216440ustar00rootroot00000000000000/* * 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 * * entry conditions - * input parameters: * int exoid exodus file id * * exit conditions - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * updates an opened EXODUS II file (or EXODUS II history file) * \param exoid exodus file id */ int ex_update (int exoid) { char errmsg[MAX_ERR_LENGTH]; int status; exerrval = 0; /* clear error code */ if ((status = nc_sync(exoid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to update file id %d", exoid); ex_err("ex_update",errmsg,exerrval); return (EX_FATAL); } return(EX_NOERR); } exodusii-6.02.dfsg.1/exodus/cbind/src/ex_utils.c000066400000000000000000001274751225312213100215400ustar00rootroot00000000000000/* * 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 * *****************************************************************************/ #if defined(DEBUG_QSORT) #include #endif #include // for tolower, isspace #include // for errno #include // for size_t #include // for sprintf, NULL, fprintf, etc #include // for free, calloc, malloc, etc #include // for strcpy, strlen #include // for int64_t, ssize_t #include "exodusII.h" // for exerrval, ex_err, etc #include "exodusII_int.h" // for obj_stats, EX_FATAL, etc struct obj_stats* exoII_eb = 0; struct obj_stats* exoII_ed = 0; struct obj_stats* exoII_fa = 0; struct obj_stats* exoII_ns = 0; struct obj_stats* exoII_es = 0; struct obj_stats* exoII_fs = 0; struct obj_stats* exoII_ss = 0; struct obj_stats* exoII_els = 0; struct obj_stats* exoII_em = 0; struct obj_stats* exoII_edm = 0; struct obj_stats* exoII_fam = 0; struct obj_stats* exoII_nm = 0; /***************************************************************************** * * 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]; int ex_check_file_type(const char *path, int *type) { /* Based on (stolen from?) NC_check_file_type from netcdf sources. Type is set to: 1 if this is a netcdf classic file, 2 if this is a netcdf 64-bit offset file, 5 if this is an hdf5 file */ #define MAGIC_NUMBER_LEN 4 char magic[MAGIC_NUMBER_LEN]; *type = 0; /* Get the 4-byte magic from the beginning of the file. */ { FILE *fp; int i; if (!(fp = fopen(path, "r"))) return errno; i = fread(magic, MAGIC_NUMBER_LEN, 1, fp); fclose(fp); if(i != 1) return errno; } /* Ignore the first byte for HDF */ if (magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F') *type = 5; else if (magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') { if (magic[3] == '\001') *type = 1; else if(magic[3] == '\002') *type = 2; } return EX_NOERR; } int ex_set_max_name_length(int exoid, int length) { char errmsg[MAX_ERR_LENGTH]; if (length <= 0) { exerrval = NC_EMAXNAME; sprintf(errmsg, "Error: Max name length must be positive."); ex_err("ex_set_max_name_length",errmsg,exerrval); return (EX_FATAL); } else if (length > NC_MAX_NAME) { exerrval = NC_EMAXNAME; sprintf(errmsg, "Error: Max name length (%d) exceeds netcdf max name size (%d).", length, NC_MAX_NAME); ex_err("ex_set_max_name_length",errmsg,exerrval); return (EX_FATAL); } else { ex_set_option(exoid, EX_OPT_MAX_NAME_LENGTH, length); } return EX_NOERR; } void ex_update_max_name_length(int exoid, int length) { int status; int db_length = 0; int rootid = exoid & EX_FILE_ID_MASK; /* Get current value of the maximum_name_length attribute... */ if ((status = nc_get_att_int(rootid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, &db_length)) != NC_NOERR) { char errmsg[MAX_ERR_LENGTH]; exerrval = status; sprintf(errmsg, "Error: failed to update 'max_name_length' attribute in file id %d", exoid); ex_err("ex_update_max_name_length",errmsg,exerrval); } if (length > db_length) { /* Update with new value... */ nc_put_att_int(rootid, NC_GLOBAL, ATT_MAX_NAME_LENGTH, NC_INT, 1, &length); nc_sync(rootid); } } int ex_put_names_internal(int exoid, int varid, size_t num_entity, char **names, ex_entity_type obj_type, const char *subtype, const char *routine) { size_t i; int status; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; int max_name_len = 0; size_t name_length; /* inquire previously defined dimensions */ name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH)+1; for (i=0; i name_length) { fprintf(stderr, "Warning: The %s %s name '%s' is too long.\n\tIt will be truncated from %d to %d characters\n", ex_name_of_object(obj_type), subtype, names[i], (int)strlen(names[i]), (int)name_length-1); count[1] = name_length; too_long = 1; } if (count[1] > max_name_len) max_name_len = count[1]; if ((status = nc_put_vara_text(exoid, varid, start, count, names[i])) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s names in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } /* Add the trailing null if the variable name was too long */ if (too_long) { start[1] = name_length-1; nc_put_var1_text(exoid, varid, start, "\0"); } } } /* Update the maximum_name_length attribute on the file. */ ex_update_max_name_length(exoid, max_name_len-1); return (EX_NOERR); } int ex_put_name_internal(int exoid, int varid, size_t index, const char *name, ex_entity_type obj_type, const char *subtype, const char *routine) { int status; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; size_t name_length; /* inquire previously defined dimensions */ name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH)+1; if (name != '\0') { int too_long = 0; start[0] = index; start[1] = 0; count[0] = 1; count[1] = strlen(name) + 1; if (count[1] > name_length) { fprintf(stderr, "Warning: The %s %s name '%s' is too long.\n\tIt will be truncated from %d to %d characters\n", ex_name_of_object(obj_type), subtype, name, (int)strlen(name), (int)name_length-1); count[1] = name_length; too_long = 1; } if ((status = nc_put_vara_text(exoid, varid, start, count, name)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store %s name in file id %d", ex_name_of_object(obj_type), exoid); ex_err(routine,errmsg,exerrval); return (EX_FATAL); } /* Add the trailing null if the variable name was too long */ if (too_long) { start[1] = name_length-1; nc_put_var1_text(exoid, varid, start, "\0"); } /* Update the maximum_name_length attribute on the file. */ ex_update_max_name_length(exoid, count[1]-1); } return (EX_NOERR); } int ex_get_names_internal(int exoid, int varid, size_t num_entity, char **names, ex_entity_type obj_type, const char *routine) { size_t i; int status; /* Query size of names on file * Use the smaller of the size on file or user-specified length */ int db_name_size = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); int api_name_size = ex_inquire_int(exoid, EX_INQ_MAX_READ_NAME_LENGTH); int name_size = db_name_size < api_name_size ? db_name_size : api_name_size; for (i=0; i= name && isspace(*end)) end--; *(end+1) = '\0'; } /** ex_catstr - concatenate string/number (where number is converted to ASCII) */ 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); } /** ex_catstr2 - concatenate string1num1string2num2 */ 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_name_of_object(ex_entity_type obj_type) { switch (obj_type) { case EX_COORDINATE: /* kluge so some wrapper functions work */ return "coordinate"; case EX_NODAL: return "nodal"; case EX_EDGE_BLOCK: return "edge block"; case EX_FACE_BLOCK: return "face block"; case EX_ELEM_BLOCK: return "element block"; case EX_NODE_SET: return "node set"; case EX_EDGE_SET: return "edge set"; case EX_FACE_SET: return "face set"; case EX_SIDE_SET: return "side set"; case EX_ELEM_SET: return "element set"; case EX_ELEM_MAP: return "element map"; case EX_NODE_MAP: return "node map"; case EX_EDGE_MAP: return "edge map"; case EX_FACE_MAP: return "face map"; case EX_GLOBAL: return "global"; default: return "invalid type"; } } ex_entity_type ex_var_type_to_ex_entity_type(char var_type) { char var_lower = tolower(var_type); if (var_lower == 'n') return EX_NODAL; else if (var_lower == 'l') return EX_EDGE_BLOCK; else if (var_lower == 'f') return EX_FACE_BLOCK; else if (var_lower == 'e') return EX_ELEM_BLOCK; else if (var_lower == 'm') return EX_NODE_SET; else if (var_lower == 'd') return EX_EDGE_SET; else if (var_lower == 'a') return EX_FACE_SET; else if (var_lower == 's') return EX_SIDE_SET; else if (var_lower == 't') return EX_ELEM_SET; else if (var_lower == 'g') return EX_GLOBAL; else return EX_INVALID; } char* ex_dim_num_objects(ex_entity_type obj_type) { exerrval = 0; /* clear error code */ switch (obj_type) { case EX_NODAL: return DIM_NUM_NODES; case EX_ELEM_BLOCK: return DIM_NUM_EL_BLK; case EX_EDGE_BLOCK: return DIM_NUM_ED_BLK; case EX_FACE_BLOCK: return DIM_NUM_FA_BLK; case EX_NODE_SET: return DIM_NUM_NS; case EX_EDGE_SET: return DIM_NUM_ES; case EX_FACE_SET: return DIM_NUM_FS; case EX_ELEM_SET: return DIM_NUM_ELS; case EX_SIDE_SET: return DIM_NUM_SS; case EX_ELEM_MAP: return DIM_NUM_EM; case EX_FACE_MAP: return DIM_NUM_FAM; case EX_EDGE_MAP: return DIM_NUM_EDM; case EX_NODE_MAP: return DIM_NUM_NM; default: { char errmsg[MAX_ERR_LENGTH]; exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported in call to ex_dim_num_objects", obj_type); ex_err("ex_dim_num_objects",errmsg,exerrval); return (NULL); } } } char* ex_dim_num_entries_in_object( ex_entity_type obj_type, int idx ) { switch (obj_type) { case EX_NODAL: return DIM_NUM_NODES; case EX_EDGE_BLOCK: return DIM_NUM_ED_IN_EBLK(idx); case EX_FACE_BLOCK: 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(ex_entity_type 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(ex_entity_type 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 * * entry conditions - * input parameters: * int exoid exodus file id * ex_entity_type id_type id type name: * elem_ss * node_ns * side_ss * int num id value * * exit conditions - * int return index into table (1-based) * *****************************************************************************/ int ex_id_lkup( int exoid, ex_entity_type id_type, ex_entity_id 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]; int varid, dimid; size_t dim_len, i; int64_t *id_vals=NULL; int *stat_vals=NULL; static int filled=FALSE; struct obj_stats *tmp_stats; int status; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ switch(id_type) { case EX_NODAL: return 0; case EX_GLOBAL: return 0; case EX_ELEM_BLOCK: strcpy(id_table, VAR_ID_EL_BLK); /* id array name */ strcpy(id_dim, DIM_NUM_EL_BLK); /* id array dimension name*/ strcpy(stat_table, VAR_STAT_EL_BLK); /* id status array name */ tmp_stats = ex_get_stat_ptr (exoid, &exoII_eb); break; case EX_NODE_SET: strcpy(id_table, VAR_NS_IDS); strcpy(id_dim, DIM_NUM_NS); strcpy(stat_table, VAR_NS_STAT); tmp_stats = ex_get_stat_ptr (exoid, &exoII_ns); break; case EX_SIDE_SET: strcpy(id_table, VAR_SS_IDS); strcpy(id_dim, DIM_NUM_SS); strcpy(stat_table, VAR_SS_STAT); tmp_stats = ex_get_stat_ptr (exoid, &exoII_ss); break; case EX_ELEM_MAP: strcpy(id_table, VAR_EM_PROP(1)); strcpy(id_dim, DIM_NUM_EM); strcpy(stat_table, ""); tmp_stats = ex_get_stat_ptr (exoid, &exoII_em); break; case EX_NODE_MAP: strcpy(id_table, VAR_NM_PROP(1)); strcpy(id_dim, DIM_NUM_NM); strcpy(stat_table, ""); tmp_stats = ex_get_stat_ptr (exoid, &exoII_nm); break; case EX_EDGE_BLOCK: strcpy(id_table, VAR_ID_ED_BLK); strcpy(id_dim, DIM_NUM_ED_BLK); strcpy(stat_table, VAR_STAT_ED_BLK); tmp_stats = ex_get_stat_ptr (exoid, &exoII_ed); break; case EX_FACE_BLOCK: strcpy(id_table, VAR_ID_FA_BLK); strcpy(id_dim, DIM_NUM_FA_BLK); strcpy(stat_table, VAR_STAT_FA_BLK); tmp_stats = ex_get_stat_ptr (exoid, &exoII_fa); break; case EX_EDGE_SET: strcpy(id_table, VAR_ES_IDS); strcpy(id_dim, DIM_NUM_ES); strcpy(stat_table, VAR_ES_STAT); tmp_stats = ex_get_stat_ptr (exoid, &exoII_es); break; case EX_FACE_SET: strcpy(id_table, VAR_FS_IDS); strcpy(id_dim, DIM_NUM_FS); strcpy(stat_table, VAR_FS_STAT); tmp_stats = ex_get_stat_ptr (exoid, &exoII_fs); break; case EX_ELEM_SET: strcpy(id_table, VAR_ELS_IDS); strcpy(id_dim, DIM_NUM_ELS); strcpy(stat_table, VAR_ELS_STAT); tmp_stats = ex_get_stat_ptr (exoid, &exoII_els); break; case EX_EDGE_MAP: strcpy(id_table, VAR_EDM_PROP(1)); strcpy(id_dim, DIM_NUM_EDM); strcpy(stat_table, ""); tmp_stats = ex_get_stat_ptr (exoid, &exoII_edm); break; case EX_FACE_MAP: strcpy(id_table, VAR_FAM_PROP(1)); strcpy(id_dim, DIM_NUM_FAM); strcpy(stat_table, ""); tmp_stats = ex_get_stat_ptr (exoid, &exoII_fam); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: unsupported id array type %d for file id %d", id_type, 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 ((status = nc_inq_dimid(exoid,id_dim,&dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate id array dimension in file id %d", exoid); ex_err("ex_id_lkup",errmsg,exerrval); return (EX_FATAL); } /* Next get value of dimension */ if ((status = nc_inq_dimlen(exoid,dimid,&dim_len)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s array length in file id %d", id_table,exoid); ex_err("ex_id_lkup",errmsg,exerrval); return (EX_FATAL); } /* get variable id of id array */ if ((status = nc_inq_varid (exoid, id_table, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to locate %s array in file id %d", id_table, exoid); ex_err("ex_id_lkup",errmsg,exerrval); return (EX_FATAL); } /* allocate space for id array and initialize to zero to ensure that the higher bits don't contain garbage while copy from ints */ if (!(id_vals = calloc(dim_len,sizeof(int64_t)))) { 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); } if (ex_int64_status(exoid) & EX_IDS_INT64_API) { status = nc_get_var_longlong (exoid, varid, (long long*)id_vals); } else { int *id_vals_int; if (!(id_vals_int = malloc(dim_len*sizeof(int)))) { exerrval = EX_MEMFAIL; sprintf(errmsg, "Error: failed to allocate memory for temporary array id_vals_int for file id %d", exoid); ex_err("ex_id_lkup",errmsg,exerrval); return (EX_FATAL); } status = nc_get_var_int(exoid, varid, (int *)id_vals_int); if (status == NC_NOERR) { for (i=0;ivalid_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) /* 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 (nc_inq_varid (exoid, stat_table, &varid) == NC_NOERR) { /* 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(dim_len*sizeof(int)))) { 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); } if ((status = nc_get_var_int (exoid, varid, stat_vals)) != NC_NOERR) { exerrval = status; free(stat_vals); sprintf(errmsg, "Error: failed to get %s array from file id %d", 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(-((int)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) */ } /****************************************************************************** * * ex_get_stat_ptr - returns a pointer to a structure of object ids * *****************************************************************************/ /*! 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 *ex_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); } /****************************************************************************** * * ex_rm_stat_ptr - removes a pointer to a structure of object ids * *****************************************************************************/ /*! 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 ex_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 */ } } /* structures to hold number of blocks of that type for each file id */ static struct list_item* ed_ctr_list = 0; /* edge blocks */ static struct list_item* fa_ctr_list = 0; /* face blocks */ static struct list_item* eb_ctr_list = 0; /* element blocks */ /* structures to hold number of sets of that type for each file id */ static struct list_item* ns_ctr_list = 0; /* node sets */ static struct list_item* es_ctr_list = 0; /* edge sets */ static struct list_item* fs_ctr_list = 0; /* face sets */ static struct list_item* ss_ctr_list = 0; /* side sets */ static struct list_item* els_ctr_list = 0; /* element sets */ /* structures to hold number of maps of that type for each file id */ static struct list_item* nm_ctr_list = 0; /* node maps */ static struct list_item* edm_ctr_list = 0; /* edge maps */ static struct list_item* fam_ctr_list = 0; /* face maps */ static struct list_item* em_ctr_list = 0; /* element maps */ struct list_item** ex_get_counter_list(ex_entity_type obj_type) { switch(obj_type) { case EX_ELEM_BLOCK: return &eb_ctr_list; case EX_NODE_SET: return &ns_ctr_list; case EX_SIDE_SET: return &ss_ctr_list; case EX_ELEM_MAP: return &em_ctr_list; case EX_NODE_MAP: return &nm_ctr_list; case EX_EDGE_BLOCK: return &ed_ctr_list; case EX_FACE_BLOCK: return &fa_ctr_list; case EX_EDGE_SET: return &es_ctr_list; case EX_FACE_SET: return &fs_ctr_list; case EX_ELEM_SET: return &els_ctr_list; case EX_EDGE_MAP: return &edm_ctr_list; case EX_FACE_MAP: return &fam_ctr_list; default: return (NULL); } } /****************************************************************************** * * ex_inc_file_item - increment file item * *****************************************************************************/ /*! 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 * *****************************************************************************/ /*! 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 * *****************************************************************************/ /*! 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 * *****************************************************************************/ int ex_get_num_props (int exoid, ex_entity_type obj_type) { int cntr, varid; 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_FACE_MAP: strcpy (var_name, VAR_FAM_PROP(cntr+1)); break; case EX_EDGE_MAP: strcpy (var_name, VAR_EDM_PROP(cntr+1)); break; case EX_NODE_MAP: strcpy (var_name, VAR_NM_PROP(cntr+1)); break; default: exerrval = EX_BADPARAM; sprintf(errmsg, "Error: object type %d not supported; file id %d", obj_type, exoid); ex_err("ex_get_prop_names",errmsg,exerrval); return(EX_FATAL); } if (nc_inq_varid (exoid, var_name, &varid) != NC_NOERR) { /* no variable with this name; return cntr which is now the number of */ /* properties for this type of entity */ return (cntr); } cntr++; } } int ex_get_cpu_ws(void) { return(sizeof(float)); } /* swap - interchange v[i] and v[j] */ static void ex_swap (int v[], int i, int j) { int temp; temp = v[i]; v[i] = v[j]; v[j] = temp; } static void ex_swap64 (int64_t v[], int64_t i, int64_t j) { int64_t 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 static int ex_int_median3(int v[], int iv[], int left, int right) { ssize_t center; center = ((ssize_t)left + (ssize_t)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]; } static int64_t ex_int_median3_64(int64_t v[], int64_t iv[], int64_t left, int64_t right) { int64_t center; center = (left + right) / 2; if (v[iv[left]] > v[iv[center]]) ex_swap64(iv, left, center); if (v[iv[left]] > v[iv[right]]) ex_swap64(iv, left, right); if (v[iv[center]] > v[iv[right]]) ex_swap64(iv, center, right); ex_swap64(iv, center, right-1); return iv[right-1]; } static 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); } } static void ex_int_iqsort64(int64_t v[], int64_t iv[], int64_t left, int64_t right) { int64_t pivot; int64_t i, j; if (left + EX_QSORT_CUTOFF <= right) { pivot = ex_int_median3_64(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_swap64(iv, i, j); } else { break; } } ex_swap64(iv, i, right-1); ex_int_iqsort64(v, iv, left, i-1); ex_int_iqsort64(v, iv, i+1, right); } } static 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 compression_level; int compress = 1; int shuffle = file->shuffle; #if 0 if (type == 2) shuffle = 0; #endif if (deflate_level > 0 && (file->file_type == 2 || file->file_type == 3)) { nc_def_var_deflate(exoid, varid, shuffle, compress, deflate_level); } #if 0 if (type != 3) { nc_var_par_access(exoid, varid, NC_COLLECTIVE); } #endif } #endif } exodusii-6.02.dfsg.1/exodus/cbind/test/000077500000000000000000000000001225312213100177105ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cbind/test/CMakeLists.txt000066400000000000000000000035441225312213100224560ustar00rootroot00000000000000ADD_DEFINITIONS(-DUSING_CMAKE) 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 exoIIv2c ) 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 testwt-one-attrib testwt-partial testrd-nsided testwt-nsided testrd-nfaced testwt-nfaced create_mesh rd_wt_mesh test_nemesis testwt-long-name testrd-long-name) 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} exoIIv2c ) 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} ) exodusii-6.02.dfsg.1/exodus/cbind/test/CreateEdgeFace.c000066400000000000000000000476721225312213100226430ustar00rootroot00000000000000#include "exodusII.h" #include #include #include #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. }; const char* coordsNames[] = { "X", "Y", "Z" }; int conn1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4 }; int conn2[] = { 1, 2, 3, 5 }; int econn1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 17, 18, 19, 20 }; 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 }; const char* eblk_names[] = { "Eli_WALLACH", "Angelo_NOVI" }; const char* edblk_names[] = { "Aldo_GIUFFRE" }; const char* fablk_names[] = { "Livio_LORENZON", "Claudio_SCARCHILLI", "John_BARTHA" }; const char* nmap_names[] = { "Luigi_PISTILLI" }; const char* edmap_names[] = { "Antonio_CASALE" }; const char* famap_names[] = { "Sandro_SCARCHILLI" }; const char* emap_names[] = { "Benito_STEFANELLI" }; /* ======== Sets ========= */ int nset_nodes[] = { 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 }; const char* elset_names[] = { "Clint_EASTWOOD", "Lee_VAN_CLEEF" }; const char* nset_names[] = { "Ennio_MORRICONE" }; const char* eset_names[] = { "Rada_RASSIMOV" }; const char* fset_names[] = { "Enzo_PETITO" }; const char* sset_names[] = { "Luciano_VINCENZONI" }; /* ======== Attributes ========= */ const char* edge_attr_names1[] = {"Sergio_LEONE"}; const char* face_attr_names1[] = {"GOOD"}; const char* face_attr_names2[] = {"BAD"}; const char* face_attr_names3[] = {"UGLY"}; const 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 */ 3, /* num_elem */ 2, /* 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 edgeBlocks[1]; ex_block faceBlocks[3]; ex_block elemBlocks[2]; ex_var_params varParams; ex_opts (EX_VERBOSE | EX_ABORT ); edgeBlocks[0].type = EX_EDGE_BLOCK; edgeBlocks[0].id = 100; edgeBlocks[0].num_entry = 20; edgeBlocks[0].num_nodes_per_entry = 2; edgeBlocks[0].num_attribute = 1; strcpy(edgeBlocks[0].topology, "EDGE2"); faceBlocks[0].type = EX_FACE_BLOCK; faceBlocks[0].id = 500; faceBlocks[0].num_entry = 2; faceBlocks[0].num_nodes_per_entry = 4; faceBlocks[0].num_attribute = 1; strcpy(faceBlocks[0].topology, "QUAD4"); faceBlocks[1].type = EX_FACE_BLOCK; faceBlocks[1].id = 600; faceBlocks[1].num_entry = 1; faceBlocks[1].num_nodes_per_entry = 4; faceBlocks[1].num_attribute = 1; strcpy(faceBlocks[1].topology, "QUAD4"); faceBlocks[2].type = EX_FACE_BLOCK; faceBlocks[2].id = 700; faceBlocks[2].num_entry = 8; faceBlocks[2].num_nodes_per_entry = 4; faceBlocks[2].num_attribute = 1; strcpy(faceBlocks[2].topology, "QUAD4"); elemBlocks[0].type = EX_ELEM_BLOCK; elemBlocks[0].id = 200; elemBlocks[0].num_entry = 2; elemBlocks[0].num_nodes_per_entry = 8; elemBlocks[0].num_edges_per_entry = 12; elemBlocks[0].num_faces_per_entry = 6; elemBlocks[0].num_attribute = 2; strcpy(elemBlocks[0].topology, "HEX8"); elemBlocks[1].type = EX_ELEM_BLOCK; elemBlocks[1].id = 201; elemBlocks[1].num_entry = 1; elemBlocks[1].num_nodes_per_entry = 4; elemBlocks[1].num_edges_per_entry = 0; elemBlocks[1].num_faces_per_entry = 0; elemBlocks[1].num_attribute = 0; strcpy(elemBlocks[1].topology, "TET4"); varParams.edge_var_tab = (int*)malloc(2 * sizeof(int)); varParams.face_var_tab = (int*)malloc(3 * sizeof(int)); varParams.elem_var_tab = (int*)malloc(2 * sizeof(int)); varParams.nset_var_tab = (int*)0; varParams.eset_var_tab = (int*)0; varParams.fset_var_tab = (int*)malloc(1 * sizeof(int)); varParams.sset_var_tab = (int*)0; varParams.elset_var_tab = (int*)0; varParams.num_glob = 2; varParams.num_node = 1; varParams.num_edge = 2; varParams.edge_var_tab[0] = 1; varParams.edge_var_tab[1] = 1; varParams.num_face = 1; varParams.face_var_tab[0] = 1; varParams.face_var_tab[1] = 1; varParams.face_var_tab[2] = 1; varParams.num_elem = 1; varParams.elem_var_tab[0] = 1; varParams.elem_var_tab[1] = 0; varParams.num_nset = 0; varParams.num_eset = 0;; varParams.num_fset = 1; varParams.fset_var_tab[0] = 1; varParams.num_sset = 0; varParams.num_elset = 0; exoid = ex_create( EX_TEST_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize ); if ( exoid <= 0 ) { fprintf( stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FILENAME ); return 1; } EXCHECK( ex_put_init_ext( exoid, &modelParams ), "Unable to initialize database.\n" ); { int blk; for ( blk = 0; blk < modelParams.num_edge_blk; ++blk ) { EXCHECK( ex_put_block_param( exoid, edgeBlocks[blk]), "Unable to write edge block" ); } for ( blk = 0; blk < modelParams.num_face_blk; ++blk ) { EXCHECK( ex_put_block_param( exoid, faceBlocks[blk]), "Unable to write face block" ); } for ( blk = 0; blk < modelParams.num_elem_blk; ++blk ) { EXCHECK( ex_put_block_param( exoid, elemBlocks[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, (char**)coordsNames ), "Unable to write coordinate names.\n" ); /* =============== Connectivity ================== */ /* *** NEW API *** */ EXCHECK( ex_put_conn( exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0 ), "Unable to write edge block connectivity.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0 ), "Unable to write face block 1 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0 ), "Unable to write face block 2 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0 ), "Unable to write face block 3 connectivity.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1 ), "Unable to write elem block 1 connectivity.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0 ), "Unable to write elem block 2 connectivity.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_names( exoid, EX_EDGE_BLOCK, (char**)edblk_names ), "Unable to write edge block names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_BLOCK, (char**)fablk_names ), "Unable to write face block names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_BLOCK, (char**) eblk_names ), "Unable to write element block names.\n" ); /* =============== Number Maps ================== */ /* *** NEW API *** */ 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, (char**) nmap_names ), "Unable to write node map names.\n" ); EXCHECK( ex_put_names( exoid, EX_EDGE_MAP, (char**)edmap_names ), "Unable to write edge map names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_MAP, (char**)famap_names ), "Unable to write face map names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_MAP, (char**) emap_names ), "Unable to write element map names.\n" ); /* =============== Attribute names ================ */ /* *** NEW API *** */ EXCHECK( ex_put_attr_names( exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char**)edge_attr_names1 ), "Unable to write edge block 1 attribute names.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char**)face_attr_names1 ), "Unable to write face block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char**)face_attr_names2 ), "Unable to write face block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char**)face_attr_names3 ), "Unable to write face block 1 attribute names.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char**)elem_attr_names1 ), "Unable to write elem block 1 attribute names.\n" ); /* =============== Attribute values =============== */ /* *** NEW API *** */ EXCHECK( ex_put_attr( exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1 ), "Unable to write edge block 1 attribute values.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1 ), "Unable to write face block 1 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2 ), "Unable to write face block 1 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3 ), "Unable to write face block 1 attribute values.\n" ); /* *** NEW API *** */ EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1 ), "Unable to write elem block 1 attribute values.\n" ); /* =============== Set parameters ================= */ /* *** NEW API *** */ EXCHECK( ex_put_names( exoid, EX_NODE_SET, (char**)nset_names ), "Unable to write node set names.\n" ); EXCHECK( ex_put_names( exoid, EX_EDGE_SET, (char**)eset_names ), "Unable to write edge set names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_SET, (char**)fset_names ), "Unable to write face set names.\n" ); EXCHECK( ex_put_names( exoid, EX_SIDE_SET, (char**)sset_names ), "Unable to write side set names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_SET, (char**)elset_names ), "Unable to write element set names.\n" ); { ex_set allSets[1+1+1+1+2]; ex_set *nodeSets = &allSets[0]; ex_set *edgeSets = &allSets[1]; ex_set *faceSets = &allSets[2]; ex_set *sideSets = &allSets[3]; ex_set *elemSets = &allSets[4]; nodeSets[0].type = EX_NODE_SET; nodeSets[0].id = 1000; nodeSets[0].num_entry = 3; nodeSets[0].num_distribution_factor = 0; nodeSets[0].entry_list = nset_nodes; nodeSets[0].extra_list = NULL; nodeSets[0].distribution_factor_list = NULL; edgeSets[0].type = EX_EDGE_SET; edgeSets[0].id = 1200; edgeSets[0].num_entry = 6; edgeSets[0].num_distribution_factor = 6; edgeSets[0].entry_list = eset_edges; edgeSets[0].extra_list = eset_orient; edgeSets[0].distribution_factor_list = eset_df; faceSets[0].type = EX_FACE_SET; faceSets[0].id = 1400; faceSets[0].num_entry = 2; faceSets[0].num_distribution_factor = 0; faceSets[0].entry_list = fset_faces; faceSets[0].extra_list = fset_orient; faceSets[0].distribution_factor_list = NULL; sideSets[0].type = EX_SIDE_SET; sideSets[0].id = 1400; sideSets[0].num_entry = 5; sideSets[0].num_distribution_factor = 0; sideSets[0].entry_list = sset_elems; sideSets[0].extra_list = sset_sides; sideSets[0].distribution_factor_list = NULL; elemSets[0].type = EX_ELEM_SET; elemSets[0].id = 1800; elemSets[0].num_entry = 1; elemSets[0].num_distribution_factor = 0; elemSets[0].entry_list = &elset_elems[0]; elemSets[0].extra_list = NULL; elemSets[0].distribution_factor_list = NULL; elemSets[1].type = EX_ELEM_SET; elemSets[1].id = 1900; elemSets[1].num_entry = 1; elemSets[1].num_distribution_factor = 0; elemSets[1].entry_list = &elset_elems[1]; elemSets[1].extra_list = NULL; elemSets[1].distribution_factor_list = NULL; if ( concatSets ) { EXCHECK( ex_put_sets(exoid, 1+2+1+1+1, allSets), "Unable to output concatenated sets.\n" ); } else { EXCHECK( ex_put_sets( exoid, 1, nodeSets), "Unable to write node sets.\n" ); EXCHECK( ex_put_sets( exoid, 1, edgeSets), "Unable to write edge sets.\n" ); EXCHECK( ex_put_sets( exoid, 1, faceSets), "Unable to write face sets.\n" ); EXCHECK( ex_put_sets( exoid, 1, sideSets), "Unable to write side sets.\n" ); EXCHECK( ex_put_sets( exoid, 2, elemSets), "Unable to write element sets.\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; } #if !defined(USING_CMAKE) int main( int argc, char* argv[] ) { return cCreateEdgeFace(argc, argv); } #endif exodusii-6.02.dfsg.1/exodus/cbind/test/Imakefile000066400000000000000000000136141225312213100215260ustar00rootroot00000000000000### 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 = -Wl,-R../src -L../src -lexodus LOCALEXO = ../src/libexodus.a LIBS = $(LOCALEXO) -L$(USRLIBDIR) $(NETCDF) $(EXTRANETCDFLIB) #if defined(ParallelAwareExodus) PARTEST = testrd_par #endif 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 \ testwt-one-attrib create_mesh rd_wt_mesh \ testwt-partial testwt-nsided testrd-nsided testwt-nfaced \ testrd-nfaced testwt-long-name testrd-long-name \ testwt-groups testrd-groups \ oned twod MakeTestData test_nemesis $(PARTEST) #if 0 CreateEdgeFace ReadEdgeFace #endif all:: check #if defined(ParallelAwareExodus) LOCALPAREXO = ../parallel/libexodus_par.a PLIBS = $(LOCALPAREXO) $(LOCALEXO) -L$(USRLIBDIR) $(NETCDF) $(EXTRANETCDFLIB) NormalProgramTarget(testrd_par, testrd_par.o, $(LOCALEXO), /**/, $(PLIBS)) #endif NormalProgramTarget(oned, oned.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(twod, twod.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(MakeTestData,MakeTestData.o, $(LOCALEXO), /**/, $(LIBS)) 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(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-long-name,testwt-long-name.o,$(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testrd-long-name,testrd-long-name.o,$(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-zeroe, testwt-zeroe.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-zeron, testwt-zeron.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-one-attrib, testwt-one-attrib.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-partial, testwt-partial.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-nsided, testwt-nsided.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testrd-nsided, testrd-nsided.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-nfaced, testwt-nfaced.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testrd-nfaced, testrd-nfaced.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testwt-groups, testwt-groups.o, $(LOCALEXO), /**/, $(LIBS)) NormalProgramTarget(testrd-groups, testrd-groups.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)) NormalProgramTarget(test_nemesis, test_nemesis.o, $(LOCALEXO), /**/, $(LIBS)) testall: testall.in1 $(CONFIGDIR)/$(MACROFILE) rm -f testall $(ETCDIR)/MsubCmd +R"@<" -R">@" testall.in1 >testall test: check check: $(PROGS) testall csh -f ./testall ExtraStuffToClean(*.res) ExtraStuffToClean(*.exo) ExtraStuffToClean(test.output) ExtraStuffToClean(testall) exodusii-6.02.dfsg.1/exodus/cbind/test/MakeTestData.c000066400000000000000000001062141225312213100223670ustar00rootroot00000000000000#include "exodusII.h" #include #include #include #if 0 int mymode = EX_MAPS_INT64_DB|EX_MAPS_INT64_API|EX_BULK_INT64_DB|EX_BULK_INT64_API|EX_IDS_INT64_API|EX_IDS_INT64_DB; typedef int64_t INT; #else int mymode = 0; typedef int INT; #endif #define EX_TEST_FILENAME "ExodusTestData.e" /* ================ Coordinate Frames ================ */ int cf_ids[2] = {20, 13}; double pt_coords[9*2] = {1,0,0, 1,0,1, 2,0,0, 0,0,0, 1,0,0, 0,1,0}; char tags[2]={'r', 'c'}; /* ======== 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. }; const char* coordsNames[] = { "X", "Y", "Z" }; INT conn1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4 }; INT conn2[] = { 1, 2, 3, 5 }; INT conn3[] = { 12, 11, 10, 9 }; INT conn4[] = {1, 3, 5, 7, 9, 11}; /* Sphere */ INT conn5[] = {12, 8, 11, 7, 10, 6, 9, 5}; /* Beam */ 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 nmap2[] = { 120, 110, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10 }; 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[] = { 10, 20, 30, 44, 91,92,93,94,95,96, 88, 87, 86, 85 }; const char* eblk_names[] = { "Eli_WALLACH", "Angelo_NOVI", "A_Shell", "Some_Sphere_Elements", "Reinforcement" }; const char* edblk_names[] = { "Aldo_GIUFFRE" }; const char* fablk_names[] = { "Livio_LORENZON", "Claudio_SCARCHILLI", "John_BARTHA" }; const char* nmap_names[] = { "Luigi_PISTILLI" }; const char* edmap_names[] = { "Antonio_CASALE" }; const char* famap_names[] = { "Sandro_SCARCHILLI" }; const char* emap_names[] = { "Benito_STEFANELLI" }; /* ======== Sets ========= */ INT nset_nodes[] = { 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 sset1_elems[] = { 4, 4, 4 }; INT sset1_sides[] = { 1, 3, 5 }; INT elset_elems[] = { 1, 2 }; const char* elset_names[] = { "Clint_EASTWOOD", "Lee_VAN_CLEEF" }; const char* nset_names[] = { "Ennio_MORRICONE" }; const char* eset_names[] = { "Rada_RASSIMOV" }; const char* fset_names[] = { "Enzo_PETITO" }; const char* sset_names[] = { "Luciano_VINCENZONI", "A_Very_Long_Name_That_Tests_Capability_for_Long_Names" }; /* ======== Attributes ========= */ const char* node_attr_names[] = {"Influence_Diameter"}; const char* edge_attr_names1[] = {"Sergio_LEONE"}; const char* face_attr_names1[] = {"GOOD"}; const char* face_attr_names2[] = {"BAD"}; const char* face_attr_names3[] = {"UGLY"}; const char* elem_attr_names1[] = { "SPAGHETTI", "WESTERN" }; const char* elem_attr_names3[] = { "Thickness" }; const char* elem_attr_names4[] = { "Radius", "Volume" }; const char* elem_attr_names5[] = { "Area", "I_1", "I_2", "J", "V_x", "V_y", "V_z" }; const char* elem_var_names[] = {"my_stress_xx_1", "my_stress_yy_1", "my_stress_zz_1", "my_stress_xy_1", "my_stress_yz_1", "my_stress_zx_1", "my_stress_xx_2", "my_stress_yy_2", "my_stress_zz_2", "my_stress_xy_2", "my_stress_yz_2", "my_stress_zx_2", "von_mises_which_is_calculated_the_standard_way_from_stress", "tension" }; const char* nset_var_names[] = {"var_name.xx", "var_name.yy", "var_name.zz", "var_name.xy", "var_name.yz", "var_name.zx"}; const char* sset_var_names[] = {"stressxx", "stressyy", "stresszz", "stressxy", "stressyz", "stresszx"}; 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 node_attr_values[] = { 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2., 1.}; 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. }; double elem_attr_values4[] = { .10, 0.0, .11, 0.0, .12, 0.0, .13, 0.0, .14, 0.0, .15, 0.0 }; double elem_attr_values5[] = { /* 4 elements, 7 attributes/element */ 1.0, 10.0, 11.0, 12.0, 0.0, 0.0, 1.0, 1.1, 10.1, 11.1, 12.1, 1.0, 0.0, 0.0, 1.2, 10.2, 11.2, 12.2, 0.0, 1.0, 0.0, 1.3, 10.3, 11.3, 12.3, 1.0, 1.0, 1.0 }; /* ======== Results variables ========= */ /* (2 time steps) */ double vals_glo_var[2][3] = { { 36., 37., 38.}, { 42., 43., 44.} }; 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_var[2][2*6*2] = { { 8.0, 8.0, 8.1, 8.1, 8.2, 8.2, 8.3, 8.3, 8.4, 8.4, 8.5, 8.5, 18.0, 18.0, 18.1, 18.1, 18.2, 18.2, 18.3, 18.3, 18.4, 18.4, 18.5, 18.5 }, { -7.0, -7.0, -7.1, -7.1, -7.2, -7.2, -7.3, -7.3, -7.4, -7.4, -7.5, -7.5, -7.0, -17.0, -17.1, -17.1, -17.2, -17.2, -17.3, -17.3, -17.4, -17.4, -17.5, -17.5 } }; double vals_elem_var1[2][1] = { { 88.8 }, { 99.9 } }; double vals_tension[2][4] = { { 1000., 2000., 3000., 4000. }, { 2000., 4000., 6000., 8000. } }; /* 2 time planes, 6 elements, 3 variables */ double vals_elem_var2[2][6*3] = { { 1.01, 1.02, 1.03, 2.01, 2.02, 2.03, 3.01, 3.02, 3.03, 4.01, 4.02, 4.03, 5.01, 5.02, 5.03, 6.01, 6.02, 6.03 }, {11.01,11.02,11.03,12.01,12.02,12.03,13.01,13.02,13.03,14.01,14.02,14.03,15.01,15.02,15.03,16.01,16.02,16.03 } }; double vals_nset_var[2][3*6] = { { 8.0, 8.1, 8.2, 7.0, 7.1, 7.2, 6.0, 6.1, 6.2, 5.0, 5.1, 5.2, 4.0, 4.1, 4.2, 3.0, 3.1, 3.2}, { -8.0, -8.1, -8.2, -7.0, -7.1, -7.2, -6.0, -6.1, -6.2, -5.0, -5.1, -5.2, -4.0, -4.1, -4.2, -3.0, -3.1, -3.2}, }; double vals_sset_var[2][5*6] = { { 18.0, 18.1, 18.2, 18.3, 18.4, 17.0, 17.1, 17.2, 17.3, 17.4, 16.0, 16.1, 16.2, 16.3, 16.4, 15.0, 15.1, 15.2, 15.3, 15.4, 14.0, 14.1, 14.2, 14.3, 14.4, 13.0, 13.1, 13.2, 13.3, 13.4}, { -18.0, -18.1, -18.2, -18.3, -18.4, -17.0, -17.1, -17.2, -17.3, -17.4, -16.0, -16.1, -16.2, -16.3, -16.4, -15.0, -15.1, -15.2, -15.3, -15.4, -14.0, -14.1, -14.2, -14.3, -14.4, -13.0, -13.1, -13.2, -13.3, -13.4}, }; 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; int i; ex_opts(EX_VERBOSE); 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 */ 14, /* num_elem */ 5, /* num_elem_blk */ 1, /* num_node_sets */ 1, /* num_edge_sets */ 1, /* num_face_sets */ 2, /* 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; ex_var_params varParams; blockParams.edge_blk_id = (int*)malloc(1 * sizeof(INT)); blockParams.num_edge_this_blk = (int*)malloc(1 * sizeof(int)); blockParams.num_nodes_per_edge = (int*)malloc(1 * sizeof(int)); blockParams.num_attr_edge = (int*)malloc(1 * sizeof(int)); blockParams.face_blk_id = (int*)malloc(3 * sizeof(INT)); blockParams.num_face_this_blk = (int*)malloc(3 * sizeof(int)); blockParams.num_nodes_per_face = (int*)malloc(3 * sizeof(int)); blockParams.num_attr_face = (int*)malloc(3 * sizeof(int)); blockParams.elem_blk_id = (int*)malloc(5 * sizeof(INT)); blockParams.num_elem_this_blk = (int*)malloc(5 * sizeof(int)); blockParams.num_nodes_per_elem = (int*)malloc(5 * sizeof(int)); blockParams.num_edges_per_elem = (int*)malloc(5 * sizeof(int)); blockParams.num_faces_per_elem = (int*)malloc(5 * sizeof(int)); blockParams.num_attr_elem = (int*)malloc(5 * sizeof(int)); blockParams.edge_type = (char**)malloc(1 * sizeof(char*)); blockParams.edge_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.face_type = (char**)malloc(3 * sizeof(char*)); blockParams.face_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.face_type[1] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.face_type[2] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.elem_type = (char**)malloc(5 * sizeof(char*)); blockParams.elem_type[0] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.elem_type[1] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.elem_type[2] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.elem_type[3] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); blockParams.elem_type[4] = (char*)malloc((MAX_STR_LENGTH+1) * sizeof(char)); ((INT*)blockParams.edge_blk_id)[0] = 100; blockParams.num_edge_this_blk[0] = 20; blockParams.num_nodes_per_edge[0] = 2; blockParams.num_attr_edge[0] = 1; ((INT*)blockParams.face_blk_id)[0] = 500; ((INT*)blockParams.face_blk_id)[1] = 600; ((INT*)blockParams.face_blk_id)[2] = 700; blockParams.num_face_this_blk[0] = 2; blockParams.num_face_this_blk[1] = 1; blockParams.num_face_this_blk[2] = 8; blockParams.num_nodes_per_face[0] = 4; blockParams.num_nodes_per_face[1] = 4; blockParams.num_nodes_per_face[2] = 4; blockParams.num_attr_face[0] = 1; blockParams.num_attr_face[1] = 1; blockParams.num_attr_face[2] = 1; ((INT*)blockParams.elem_blk_id)[0] = 200; ((INT*)blockParams.elem_blk_id)[1] = 201; ((INT*)blockParams.elem_blk_id)[2] = 100; ((INT*)blockParams.elem_blk_id)[3] = 500; ((INT*)blockParams.elem_blk_id)[4] = 2147483647; blockParams.num_elem_this_blk[0] = 2; blockParams.num_elem_this_blk[1] = 1; blockParams.num_elem_this_blk[2] = 1; blockParams.num_elem_this_blk[3] = 6; blockParams.num_elem_this_blk[4] = 4; blockParams.num_nodes_per_elem[0] = 8; blockParams.num_nodes_per_elem[1] = 4; blockParams.num_nodes_per_elem[2] = 4; blockParams.num_nodes_per_elem[3] = 1; blockParams.num_nodes_per_elem[4] = 2; blockParams.num_edges_per_elem[0] = 12; blockParams.num_edges_per_elem[1] = 0; blockParams.num_edges_per_elem[2] = 0; blockParams.num_edges_per_elem[3] = 0; blockParams.num_edges_per_elem[4] = 0; blockParams.num_faces_per_elem[0] = 6; blockParams.num_faces_per_elem[1] = 0; blockParams.num_faces_per_elem[2] = 0; blockParams.num_faces_per_elem[3] = 0; blockParams.num_faces_per_elem[4] = 0; blockParams.num_attr_elem[0] = 2; blockParams.num_attr_elem[1] = 0; blockParams.num_attr_elem[2] = 1; blockParams.num_attr_elem[3] = 2; blockParams.num_attr_elem[4] = 7; blockParams.define_maps = 0; strcpy(blockParams.edge_type[0], "EDGE2"); strcpy(blockParams.face_type[0], "QUAD4"); strcpy(blockParams.face_type[1], "QUAD4"); strcpy(blockParams.face_type[2], "QUAD4"); strcpy(blockParams.elem_type[0], "HEX8"); strcpy(blockParams.elem_type[1], "TET4"); strcpy(blockParams.elem_type[2], "SHELL"); strcpy(blockParams.elem_type[3], "SPHERE"); strcpy(blockParams.elem_type[4], "beam"); varParams.edge_var_tab = (int*)malloc(2 * sizeof(int)); varParams.face_var_tab = (int*)malloc(3 * sizeof(int)); varParams.elem_var_tab = (int*)0; varParams.nset_var_tab = (int*)0; varParams.eset_var_tab = (int*)0; varParams.fset_var_tab = (int*)malloc(1 * sizeof(int)); varParams.sset_var_tab = (int*)0; varParams.elset_var_tab = (int*)0; varParams.num_glob = 2; varParams.num_node = 1; varParams.num_edge = 2; varParams.edge_var_tab[0] = 1; varParams.edge_var_tab[1] = 1; varParams.num_face = 1; varParams.face_var_tab[0] = 1; varParams.face_var_tab[1] = 1; varParams.face_var_tab[2] = 1; varParams.num_elem = 1; varParams.num_nset = 0; varParams.num_eset = 0;; varParams.num_fset = 1; varParams.fset_var_tab[0] = 1; varParams.num_sset = 0; varParams.num_elset = 0; exoid = ex_create( EX_TEST_FILENAME, EX_CLOBBER|mymode, &appWordSize, &diskWordSize ); if ( exoid <= 0 ) { fprintf( stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FILENAME ); return 1; } ex_set_max_name_length(exoid, 80); EXCHECK( ex_put_init_ext( exoid, &modelParams ), "Unable to initialize database.\n" ); /* Add a coordinate frame just to give test coverage... */ EXCHECK( ex_put_coordinate_frames(exoid, 2, cf_ids, pt_coords, tags), "Unable to output coordinate frame.\n"); 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, ((INT*)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, ((INT*)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, ((INT*)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_attr_param(exoid, EX_NODAL, 0, 1), "Unable to put nodal attributes.\n" ); EXCHECK( ex_put_coord( exoid, (void*)coordsX, (void*)coordsY, (void*)coordsZ ), "Unable to write coordinates.\n" ); EXCHECK( ex_put_coord_names( exoid, (char**)coordsNames ), "Unable to write coordinate names.\n" ); /* =============== Connectivity ================== */ EXCHECK( ex_put_conn( exoid, EX_EDGE_BLOCK, ((INT*)blockParams.edge_blk_id)[0], ebconn1, 0, 0 ), "Unable to write edge block connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[0], fbconn1, 0, 0 ), "Unable to write face block 1 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[1], fbconn2, 0, 0 ), "Unable to write face block 2 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[2], fbconn3, 0, 0 ), "Unable to write face block 3 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[0], conn1, econn1, fconn1 ), "Unable to write elem block 1 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[1], conn2, 0, 0 ), "Unable to write elem block 2 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[2], conn3, 0, 0 ), "Unable to write elem block 3 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[3], conn4, 0, 0 ), "Unable to write elem block 4 connectivity.\n" ); EXCHECK( ex_put_conn( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[4], conn5, 0, 0 ), "Unable to write elem block 5 connectivity.\n" ); EXCHECK( ex_put_names( exoid, EX_EDGE_BLOCK, (char**)edblk_names ), "Unable to write edge block names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_BLOCK, (char**)fablk_names ), "Unable to write face block names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_BLOCK, (char**) eblk_names ), "Unable to write element block names.\n" ); /* =============== Number Maps ================== */ 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" ); EXCHECK( ex_put_names( exoid, EX_NODE_MAP, (char**) nmap_names ), "Unable to write node map names.\n" ); EXCHECK( ex_put_names( exoid, EX_EDGE_MAP, (char**)edmap_names ), "Unable to write edge map names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_MAP, (char**)famap_names ), "Unable to write face map names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_MAP, (char**) emap_names ), "Unable to write element map names.\n" ); /* =============== Id Maps ================== */ EXCHECK( ex_put_id_map( exoid, EX_NODE_MAP, nmap2 ), "Unable to write node id map.\n" ); EXCHECK( ex_put_id_map( exoid, EX_EDGE_MAP, edmap1 ), "Unable to write edge id map.\n" ); EXCHECK( ex_put_id_map( exoid, EX_FACE_MAP, famap1 ), "Unable to write face id map.\n" ); EXCHECK( ex_put_id_map( exoid, EX_ELEM_MAP, emap1 ), "Unable to write element id map.\n" ); /* =============== Attribute names ================ */ EXCHECK( ex_put_attr_names( exoid, EX_EDGE_BLOCK, ((INT*)blockParams.edge_blk_id)[0], (char**)edge_attr_names1 ), "Unable to write edge block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_NODAL, 0, (char**)node_attr_names), "Unable to write nodal attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[0], (char**)face_attr_names1 ), "Unable to write face block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[1], (char**)face_attr_names2 ), "Unable to write face block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_FACE_BLOCK, ((INT*)blockParams.face_blk_id)[2], (char**)face_attr_names3 ), "Unable to write face block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[0], (char**)elem_attr_names1 ), "Unable to write elem block 1 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[2], (char**)elem_attr_names3 ), "Unable to write elem block 3 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[3], (char**)elem_attr_names4 ), "Unable to write elem block 4 attribute names.\n" ); EXCHECK( ex_put_attr_names( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[4], (char**)elem_attr_names5 ), "Unable to write elem block 5 attribute names.\n" ); /* =============== Attribute values =============== */ EXCHECK( ex_put_attr( exoid, EX_EDGE_BLOCK, ((INT*)blockParams.edge_blk_id)[0], edge_attr_values1 ), "Unable to write edge block 1 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_NODAL, 0, node_attr_values ), "Unable to write node attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_FACE_BLOCK, ((INT*)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, ((INT*)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, ((INT*)blockParams.face_blk_id)[2], face_attr_values3 ), "Unable to write face block 1 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[0], elem_attr_values1 ), "Unable to write elem block 1 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[2], elem_attr_values1 ), "Unable to write elem block 3 attribute values.\n" ); for (i=0; i < 6; i++) { elem_attr_values4[2*i+1] = 4.0 / 3.0 * 3.14 * elem_attr_values4[2*i] * elem_attr_values4[2*i] * elem_attr_values4[2*i]; } EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[3], elem_attr_values4 ), "Unable to write elem block 3 attribute values.\n" ); EXCHECK( ex_put_attr( exoid, EX_ELEM_BLOCK, ((INT*)blockParams.elem_blk_id)[4], elem_attr_values5 ), "Unable to write elem block 4 attribute values.\n" ); /* =============== Set parameters ================= */ /* *** NEW API *** */ EXCHECK( ex_put_names( exoid, EX_NODE_SET, (char**)nset_names ), "Unable to write node set names.\n" ); EXCHECK( ex_put_names( exoid, EX_EDGE_SET, (char**)eset_names ), "Unable to write edge set names.\n" ); EXCHECK( ex_put_names( exoid, EX_FACE_SET, (char**)fset_names ), "Unable to write face set names.\n" ); EXCHECK( ex_put_names( exoid, EX_SIDE_SET, (char**)sset_names ), "Unable to write side set names.\n" ); EXCHECK( ex_put_names( exoid, EX_ELEM_SET, (char**)elset_names ), "Unable to write element set names.\n" ); if ( concatSets ) { ex_set_specs setParams; setParams.sets_ids = (int*)malloc(2*sizeof(INT)); setParams.num_entries_per_set = (int*)malloc(2*sizeof(int)); setParams.num_dist_per_set = (int*)malloc(2*sizeof(int)); setParams.sets_entry_index = (int*)malloc(2*sizeof(int)); setParams.sets_dist_index = (int*)malloc(2*sizeof(int)); setParams.sets_entry_list = (INT*)malloc(6*sizeof(INT)); setParams.sets_extra_list = (INT*)malloc(6*sizeof(INT)); setParams.sets_dist_fact = (double*)malloc(6*sizeof(double)); ((INT*)setParams.sets_ids)[0] = 1000; ((INT*)setParams.num_entries_per_set)[0] = 3; ((INT*)setParams.num_dist_per_set)[0] = 0; ((INT*)setParams.sets_entry_index)[0] = 0; ((INT*)setParams.sets_dist_index)[0] = 0; { INT* entry_list = setParams.sets_entry_list; entry_list[0] = nset_nodes[0]; entry_list[1] = nset_nodes[1]; entry_list[2] = nset_nodes[2]; } EXCHECK( ex_put_concat_sets( exoid, EX_NODE_SET, &setParams ), "Unable to write node sets.\n" ); ((INT*)setParams.sets_ids)[0] = 1200; ((INT*)setParams.num_entries_per_set)[0] = 6; ((INT*)setParams.num_dist_per_set)[0] = 6; ((INT*)setParams.sets_entry_index)[0] = 0; ((INT*)setParams.sets_dist_index)[0] = 0; { INT* entry_list = setParams.sets_entry_list; INT* extra_list = setParams.sets_extra_list; entry_list[0] = eset_edges[0]; entry_list[1] = eset_edges[1]; entry_list[2] = eset_edges[2]; entry_list[3] = eset_edges[3]; entry_list[4] = eset_edges[4]; entry_list[5] = eset_edges[5]; extra_list[0] = eset_orient[0]; extra_list[1] = eset_orient[1]; extra_list[2] = eset_orient[2]; extra_list[3] = eset_orient[3]; extra_list[4] = eset_orient[4]; extra_list[5] = eset_orient[5]; } memcpy(setParams.sets_dist_fact, eset_df, sizeof(eset_df)/sizeof(eset_df[0])); EXCHECK( ex_put_concat_sets( exoid, EX_EDGE_SET, &setParams ), "Unable to write edge sets.\n" ); ((INT*)setParams.sets_ids)[0] = 1400; ((INT*)setParams.num_entries_per_set)[0] = 2; ((INT*)setParams.num_dist_per_set)[0] = 0; ((INT*)setParams.sets_entry_index)[0] = 0; ((INT*)setParams.sets_dist_index)[0] = 0; { INT *entry_list = setParams.sets_entry_list; INT *extra_list = setParams.sets_extra_list; entry_list[0] = fset_faces[0]; entry_list[1] = fset_faces[1]; extra_list[0] = fset_orient[0]; extra_list[1] = fset_orient[1]; } EXCHECK( ex_put_concat_sets( exoid, EX_FACE_SET, &setParams ), "Unable to write face sets.\n" ); ((INT*)setParams.sets_ids)[0] = 1400; ((INT*)setParams.sets_ids)[1] = 1441; ((INT*)setParams.num_entries_per_set)[0] = 5; ((INT*)setParams.num_entries_per_set)[1] = 3; ((INT*)setParams.num_dist_per_set)[0] = 0; ((INT*)setParams.num_dist_per_set)[1] = 0; ((INT*)setParams.sets_entry_index)[0] = 0; ((INT*)setParams.sets_entry_index)[5] = 0; ((INT*)setParams.sets_dist_index)[0] = 0; memcpy(setParams.sets_entry_list, sset_elems, sizeof(sset_elems)/sizeof(sset_elems[0])); memcpy(setParams.sets_extra_list, sset_sides, sizeof(sset_sides)/sizeof(sset_sides[0])); EXCHECK( ex_put_concat_sets( exoid, EX_SIDE_SET, &setParams ), "Unable to write side sets.\n" ); ((INT*)setParams.sets_ids)[0] = 1800; ((INT*)setParams.sets_ids)[1] = 1900; ((INT*)setParams.num_entries_per_set)[0] = 1; ((INT*)setParams.num_entries_per_set)[1] = 1; ((INT*)setParams.num_dist_per_set)[0] = 0; ((INT*)setParams.num_dist_per_set)[1] = 0; ((INT*)setParams.sets_entry_index)[0] = 0; ((INT*)setParams.sets_entry_index)[1] = 1; ((INT*)setParams.sets_dist_index)[0] = 0; ((INT*)setParams.sets_dist_index)[1] = 0; memcpy(setParams.sets_entry_list, elset_elems, sizeof(elset_elems)/sizeof(elset_elems[0])); EXCHECK( ex_put_concat_sets( exoid, EX_ELEM_SET, &setParams ), "Unable to write element sets.\n" ); } else { 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" ); 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" ); 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" ); 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" ); EXCHECK( ex_put_set_param( exoid, EX_SIDE_SET, 1661, 3, 0 ), "Unable to write side set params.\n" ); EXCHECK( ex_put_set( exoid, EX_SIDE_SET, 1661, sset1_elems, sset1_sides ), "Unable to write side set.\n" ); 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 ========= */ if ( concatResult ) { EXCHECK( ex_put_all_var_param_ext( exoid, &varParams ), "Unable to write result variable parameter information.\n" ); } else { EXCHECK( ex_put_variable_param( exoid, EX_GLOBAL, 3 ), "Unable to write global result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_NODAL, 1 ), "Unable to write nodal result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_ELEM_BLOCK, 14 ), "Unable to write element result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_EDGE_BLOCK, 2 ), "Unable to write edge result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_FACE_BLOCK, 1 ), "Unable to write face result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_FACE_SET, 1 ), "Unable to write faceset result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_SIDE_SET, 6 ), "Unable to write sideset result variable parameters.\n" ); EXCHECK( ex_put_variable_param( exoid, EX_NODE_SET, 6 ), "Unable to write nodeset result variable parameters.\n" ); } /* =============== Result variable names ========== */ /* *** NEW API *** */ EXCHECK( ex_put_variable_name( exoid, EX_GLOBAL, 1, "A_vector_X" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_GLOBAL, 2, "A_vector_Y" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_GLOBAL, 3, "A_vector_Z" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_NODAL, 1, "RHO" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_EDGE_BLOCK, 1, "GAMMA1" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_EDGE_BLOCK, 2, "GAMMA2" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_FACE_BLOCK, 1, "PHI" ), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_names( exoid, EX_ELEM_BLOCK, 14, (char**)elem_var_names), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_names( exoid, EX_SIDE_SET, 6, (char**)sset_var_names), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_names( exoid, EX_NODE_SET, 6, (char**)nset_var_names), "Unable to write variable name.\n" ); EXCHECK( ex_put_variable_name( exoid, EX_FACE_SET, 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, 13, 201, 1, &vals_elem_var1[0] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 1, EX_ELEM_BLOCK, 14, 2147483647, 4, &vals_tension[0] ), "Unable to write elem block 1 var 1.\n" ); for(i=0; i < 6; i++){ /* There are 2 elements in the block and 12 variables (a composite tensor x 2) */ EXCHECK( ex_put_var( exoid, 1, EX_ELEM_BLOCK, i+1, 200, 2, &vals_elem_var[0][2*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 1, EX_ELEM_BLOCK, i+7, 200, 2, &vals_elem_var[0][12+2*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 1, EX_NODE_SET, i+1, 1000, 3, &vals_nset_var[0][3*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 1, EX_SIDE_SET, i+1, 1600, 5, &vals_sset_var[0][5*i] ), "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, 13, 201, 1, &vals_elem_var1[1] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 2, EX_ELEM_BLOCK, 14, 2147483647, 4, &vals_tension[1] ), "Unable to write elem block 1 var 1.\n" ); for(i=0; i < 6; i++){ EXCHECK( ex_put_var( exoid, 2, EX_ELEM_BLOCK, i+1, 200, 2, &vals_elem_var[1][2*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 2, EX_ELEM_BLOCK, i+7, 200, 2, &vals_elem_var[1][12+2*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 2, EX_NODE_SET, i+1, 1000, 3, &vals_nset_var[1][3*i] ), "Unable to write elem block 1 var 1.\n" ); EXCHECK( ex_put_var( exoid, 2, EX_SIDE_SET, i+1, 1600, 5, &vals_sset_var[1][5*i] ), "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; } #if !defined(USING_CMAKE) int main( int argc, char* argv[] ) { return cCreateEdgeFace(argc, argv); } #endif exodusii-6.02.dfsg.1/exodus/cbind/test/Makefile.standalone000066400000000000000000000146341225312213100235070ustar00rootroot00000000000000# 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../.. -lexodus LOCALEXO = ../../libexodus.a LIBS = $(LOCALEXO) $(NETCDF_LIB) -lm 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 \ testwt-one-attrib create_mesh rd_wt_mesh \ testwt-partial testwt-nsided testrd-nsided testwt-nfaced \ testrd-nfaced testwt-long-name testrd-long-name \ oned twod MakeTestData test_nemesis all:: check oned: oned.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) oned.o $(LDFLAGS) $(LIBS) twod: twod.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) twod.o $(LDFLAGS) $(LIBS) MakeTestData: MakeTestData.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) MakeTestData.o $(LDFLAGS) $(LIBS) testwt: testwt.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt.o $(LDFLAGS) $(LIBS) testwt_clb: testwt_clb.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt_clb.o $(LDFLAGS) $(LIBS) testwtd: testwtd.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwtd.o $(LDFLAGS) $(LIBS) testrd: testrd.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd.o $(LDFLAGS) $(LIBS) testrd1: testrd1.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd1.o $(LDFLAGS) $(LIBS) testrdd: testrdd.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrdd.o $(LDFLAGS) $(LIBS) testwt1: testwt1.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt1.o $(LDFLAGS) $(LIBS) testwt2: testwt2.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt2.o $(LDFLAGS) $(LIBS) testwtm: testwtm.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwtm.o $(LDFLAGS) $(LIBS) testwt_ss: testwt_ss.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt_ss.o $(LDFLAGS) $(LIBS) testwt_nossnsdf: testwt_nossnsdf.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt_nossnsdf.o $(LDFLAGS) $(LIBS) testrd_ss: testrd_ss.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd_ss.o $(LDFLAGS) $(LIBS) testrdwt: testrdwt.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrdwt.o $(LDFLAGS) $(LIBS) testcp: testcp.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testcp.o $(LDFLAGS) $(LIBS) testcpd: testcpd.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testcpd.o $(LDFLAGS) $(LIBS) testcp_nl : testcp_nl.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testcp_nl.o $(LDFLAGS) $(LIBS) testcp_ln : testcp_ln.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testcp_ln.o $(LDFLAGS) $(LIBS) testwt_nc: testwt_nc.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt_nc.o $(LDFLAGS) $(LIBS) testrd_nc: testrd_nc.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd_nc.o $(LDFLAGS) $(LIBS) testwt-long-name: testwt-long-name.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-long-name.o $(LDFLAGS) $(LIBS) testrd-long-name: testrd-long-name.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd-long-name.o $(LDFLAGS) $(LIBS) testwt-zeroe: testwt-zeroe.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-zeroe.o $(LDFLAGS) $(LIBS) testwt-zeron: testwt-zeron.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-zeron.o $(LDFLAGS) $(LIBS) testwt-one-attrib: testwt-one-attrib.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-one-attrib.o $(LDFLAGS) $(LIBS) testwt-partial: testwt-partial.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-partial.o $(LDFLAGS) $(LIBS) testwt-nsided: testwt-nsided.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-nsided.o $(LDFLAGS) $(LIBS) testrd-nsided: testrd-nsided.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd-nsided.o $(LDFLAGS) $(LIBS) testwt-nfaced: testwt-nfaced.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testwt-nfaced.o $(LDFLAGS) $(LIBS) testrd-nfaced: testrd-nfaced.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) testrd-nfaced.o $(LDFLAGS) $(LIBS) create_mesh: create_mesh.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) create_mesh.o $(LDFLAGS) $(LIBS) rd_wt_mesh: rd_wt_mesh.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) rd_wt_mesh.o $(LDFLAGS) $(LIBS) CreateEdgeFace: CreateEdgeFace.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) CreateEdgeFace.o $(LDFLAGS) $(LIBS) ReadEdgeFace: ReadEdgeFace.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) ReadEdgeFace.o $(LDFLAGS) $(LIBS) test_nemesis: test_nemesis.o $(LOCALEXO) $(CC) -o $@ $(CFLAGS) test_nemesis.o $(LDFLAGS) $(LIBS) test: check check: $(PROGS) csh ./testall.standalone ${NCDUMP} 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 exodusii-6.02.dfsg.1/exodus/cbind/test/ReadEdgeFace.c000066400000000000000000000332351225312213100223010ustar00rootroot00000000000000#include "exodusII.h" #include #include /* for malloc(), free() */ #include #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 ); \ } ex_entity_type 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 }; ex_inquiry 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: %"PRId64"\n" "Nodes: %"PRId64"\n" "Edges: %"PRId64"\n" "Faces: %"PRId64"\n" "Elements: %"PRId64"\n" "Edge Blocks: %"PRId64"\n" "Face Blocks: %"PRId64"\n" "Element Blocks: %"PRId64"\n" "Node Sets: %"PRId64"\n" "Edge Sets: %"PRId64"\n" "Face Sets: %"PRId64"\n" "Side Sets: %"PRId64"\n" "Element Sets: %"PRId64"\n" "Node Maps: %"PRId64"\n" "Edge Maps: %"PRId64"\n" "Face Maps: %"PRId64"\n" "Element Maps: %"PRId64"\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 ); num_timesteps = ex_inquire_int( exoid, EX_INQ_TIME ); /* *** 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; default: num_entries = 0; } 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; } #if !defined(USING_CMAKE) int main( int argc, char* argv[] ) { return cReadEdgeFace(argc, argv); } #endif exodusii-6.02.dfsg.1/exodus/cbind/test/create_mesh.c000066400000000000000000001010231225312213100223300ustar00rootroot00000000000000/* * 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. * */ #include #include #include #include #include #include "exodusII.h" #define DEFAULT_FILE_NAME "mesh" #define DEFAULT_MAP_ORIGIN 1 #define DEFAULT_NUM_DOMAINS 1 #define DEFAULT_NUM_ELEMENTS 1000000 #define DEFAULT_NUM_FIELDS 0 #define DEFAULT_NUM_TIMESTEPS 1 #define MAX_STRING_LEN 128 #define NUM_BYTES_PER_INT 4 #define NUM_NODES_PER_ELEM 8 #define EXODUSII_FILE_TYPE ".e" typedef double realtyp; typedef int64_t INT; INT StringToCount(char * size_str) { INT size = 0; char range; int rc; rc = sscanf(size_str, "%"PRId64"%c", &size, &range); if (rc == 2) { switch ((int)range) { case 'k': case 'K': size *= 1000; break; case 'm': case 'M': size *= 1000000; break; case 'g': case 'G': size *= 1000000000; break; } } else if (rc == 0) { size = -1; } return(size); } /* StringToCount() */ void get_file_name(const char* base, const char* ext, int rank, int nprocs, const char* other,char *output); /* We need to do a cube-root to find the number of elements on each * side of the cube, but don't want to link in -lm just for * this. Use this routine which is better than * a brute force approach. Found at * http://www.hackersdelight.org/HDcode/icbrt.c */ INT icbrt(unsigned x) { INT s; unsigned y, b; s = 30; y = 0; while(s >= 0) { /* Do 11 times. */ y = 2*y; b = (3*y*(y + 1) + 1) << s; s = s - 3; if (x >= b) { x = x - b; y = y + 1; } } return y; } /* Prototypes */ 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( realtyp *x, realtyp *y, realtyp *z, 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, int *compression_level, int *shuffle, int *int64bit ); 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, realtyp *x, realtyp *y, realtyp *z, INT *connect, int compression_level, int shuffle, int int64bit ); void create_node_map (INT len_map, INT len_connect, INT *domain_connect, INT *node_map, INT *loc_num_nodes, INT map_origin); 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; int compression_level = 0; int shuffle = 0; int int64bit = 0; size_t size; realtyp *x; realtyp *y; realtyp *z; 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, &compression_level, &shuffle, &int64bit); /* Create Coordinates and Connectivity Array */ num_elements_1d = icbrt(num_elements); num_nodes = (num_elements_1d + 1) * (num_elements_1d + 1) * (num_elements_1d + 1); x = malloc( num_nodes * sizeof( realtyp ) ); y = malloc( num_nodes * sizeof( realtyp ) ); z = malloc( num_nodes * sizeof( realtyp ) ); assert(x != NULL && y != NULL && z != NULL); num_elements = num_elements_1d * num_elements_1d * num_elements_1d; size = (size_t)NUM_NODES_PER_ELEM * num_elements * sizeof( INT ); assert(size > 0); connect = malloc(size); assert(connect != NULL); fprintf(stderr, "Creating a 3D mesh of %"PRId64" hex elements and %"PRId64" nodes.\n", num_elements, num_nodes); make_mesh(x, y, z, connect, map_origin, num_elements_1d); fprintf(stderr, "\t...Mesh topology created.\n"); /* * 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, z, connect, compression_level, shuffle, int64bit ); } free(x); free(y); free(z); 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 *compression_level, int *shuffle, int *int64bit ) { 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( "-compress", argv[arg] ) == 0 ) { if ( ++arg < argc ) *compression_level = atoi( argv[arg] ); } else if ( strcmp( "-shuffle", argv[arg] ) == 0 ) { *shuffle = 1; } else if ( strcmp( "-64", argv[arg] ) == 0 ) { *int64bit = 1; } 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 = StringToCount( 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( " Can suffix with 'k', 'm', 'g' for thousand, million, billion\n"); printf( " elements/file = elements/number_of_domains. \n" ); printf( " Default: %d \n", DEFAULT_NUM_ELEMENTS); printf( "-p domains number of domains. Default: %d \n", DEFAULT_NUM_DOMAINS ); printf( "-compress val set compression to level 'val' [0..9] \n" ); printf( "-shuffle enable hdf5-shuffle \n" ); printf( "-64 enable 64-bit integers \n" ); 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( realtyp *x, realtyp *y, realtyp *z, INT *connect, INT map_origin, INT num_elements_1d ) { size_t i, j, k, m, base, cnt; size_t elp1sq = (num_elements_1d+1) * (num_elements_1d+1); /* create global coordinates */ for (m=0, k=0; m < (num_elements_1d+1); m++) { for (i=0; i < (num_elements_1d+1); i++) { for (j=0; j < (num_elements_1d+1); j++, k++) { x[k] = (realtyp)j; y[k] = (realtyp)i; z[k] = (realtyp)m; } } } /* build connectivity array (node list) for mesh */ for (m=0, k=0, cnt=0; m < num_elements_1d; m++) { for (i=0, k=0; i < num_elements_1d; i++) { for (j=0; j < num_elements_1d; j++, k++) { base = (m*elp1sq) + k + i + map_origin; connect[cnt++] = base; connect[cnt++] = base+1; connect[cnt++] = base+num_elements_1d+2; connect[cnt++] = base+num_elements_1d+1; connect[cnt++] = elp1sq + base; connect[cnt++] = elp1sq + base+1; connect[cnt++] = elp1sq + base+num_elements_1d+2; connect[cnt++] = elp1sq + base+num_elements_1d+1; } } } } /* end of make_mesh() */ /*********************************************************************** ***********************************************************************/ 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, realtyp *x, realtyp *y, realtyp *z, INT *connect, int compression_level, int shuffle, int int64bit ) { int CPU_word_size=sizeof(realtyp); int IO_word_size=sizeof(realtyp); int exoid, err, num_dim, num_elem_blk, num_node_sets, num_side_sets; INT i, j, t, index, loc_num_elements, loc_num_nodes, len_connect; INT *elem_map = NULL, *node_map = NULL, *domain_connect = NULL, *loc_connect = NULL; int *elem_var_tab; INT accum_num_elements = 0; INT loc_node_size = -1; realtyp *loc_xcoords = NULL; realtyp *loc_ycoords = NULL; realtyp *loc_zcoords = NULL; realtyp *globals = NULL; char temporary_name[MAX_STRING_LEN]; char **var_name; accum_num_elements = 0; for (i=0; i 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 ); } else { loc_num_elements = num_elements; loc_num_nodes = num_nodes; } if ( debug ) { fprintf(stderr, "\n\n\n"); fprintf(stderr, "\n domain: %"PRId64"\n", i); fprintf(stderr, "\n loc_num_elements: %"PRId64"\n", loc_num_elements); fprintf(stderr, "\n loc_num_nodes: %"PRId64"\n", loc_num_nodes); } num_dim = 3; 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 (num_domains > 1) { if (loc_num_nodes > loc_node_size) { loc_xcoords = realloc(loc_xcoords, loc_num_nodes * sizeof(realtyp)); loc_ycoords = realloc(loc_ycoords, loc_num_nodes * sizeof(realtyp)); loc_zcoords = realloc(loc_zcoords, loc_num_nodes * sizeof(realtyp)); loc_node_size = loc_num_nodes; } for (j=0; j 1 ? TRUE : FALSE; write_map = TRUE; num_elem_per_block[0] = loc_num_elements; num_node_per_elem[0] = NUM_NODES_PER_ELEM; num_attr_per_block[0] = 0; err = ex_put_concat_elem_block (exoid, ids, names, num_elem_per_block, num_node_per_elem, num_attr_per_block, write_map); } #else err = ex_put_elem_block (exoid, 10000000000, "hex", loc_num_elements, NUM_NODES_PER_ELEM, 0); #endif if (err) { fprintf(stderr, "after ex_put_elem_block, error = %d\n", err); ex_close (exoid); exit(-1); } if (num_domains > 1) { err = ex_put_elem_conn (exoid, 100000, loc_connect); } else { err = ex_put_elem_conn (exoid, 100000, connect); } if (err) { fprintf(stderr, "after ex_put_elem_conn, error = %d\n", err); ex_close (exoid); exit(-1); } if ( debug ) { fprintf(stderr, "\tConnectivity output.\n"); } /* write out element and node maps */ if (num_domains > 1) { err = ex_put_id_map (exoid, EX_NODE_MAP, node_map); if (err) { fprintf(stderr, "after ex_put_id_map, error = %d\n", err); ex_close (exoid); exit(-1); } err = ex_put_id_map (exoid, EX_ELEM_MAP, elem_map); if (err) { fprintf(stderr, "after ex_put_id_map, error = %d\n", err); ex_close (exoid); exit(-1); } if ( debug ) { fprintf(stderr, "\tMaps output.\n"); } } /* write out simulated results fields; 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 0) { globals = malloc(num_global_fields * sizeof(realtyp)); var_name = malloc (num_global_fields * sizeof(char *)); for (j=0; j 0) { free(elem_var_tab); var_name = malloc (num_element_fields * sizeof(char *)); for (j=0; j 0) { fprintf(stderr, "Domain %"PRId64"/%"PRId64", Writing Timestep: ", i+1, num_domains); for (t=0; t 0) { err = ex_put_var(exoid, t+1, EX_GLOBAL, 1, 0, num_global_fields, globals); if (err) { fprintf(stderr, "after ex_put_global_var, error = %d\n", err); ex_close (exoid); exit(-1); } } for (j=0; j 1) { free( domain_connect ); free( elem_map ); free( loc_connect ); free( loc_xcoords ); free( loc_ycoords ); free( loc_zcoords ); free( node_map ); } if (num_global_fields > 0) free(globals); } /*********************************************************************** * * 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 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> 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); } } exodusii-6.02.dfsg.1/exodus/cbind/test/exodus_unit_tests.gold000066400000000000000000000045141225312213100243530ustar00rootroot00000000000000************************************************************************ ************************************************************************ testwt - single precision write test... testrd - single precision read test... testcp_ss - single-to-single precision copy test... testcp_sd - single-to-double precision copy test... testcp_ln - large model to normal model single precision copy test... testcp_nl - normal_model to large_model single precision copy test... testwt_clb - single precision write test using concatenated puts... testwtd - double precision write test... testrdd - double precision read test... testcp_dd - double-to-double precision copy test... testcp_ds - double-to-single precision copy test... testwt1 - single precision write files with several side sets... testwt1 ... [Expect WEDGE6 warning from this test] testrd1 - single precision read test of a file with several side sets... testrd1 ... [Expect file create failure error, NOCLOBBER] testrd1 ... [Expect failure locating elem var 1 for elem block 12] testwt_ss - write files to test side sets... testwt_ss ... [Expect WEDGE6 warning from this test] testrd_ss - read test of a file with several side sets... testrd_ss ... [Expect warning for NULL sidesets 30 and 31] testwt2 - single precision write 2 files (simultaneously open) test... testrdwt - read from one and write to another (simutaneously open) file... testwt_nc - write x y z components of coordinates separately... testrd_nc - read x y z components of coordinates separately... testwt-zeron - write file with zero nodes and elements... testrd - read test of file with zero nodes and elements... testwt-zeroe - write file with zero elements... testrd - read test of file with zero elements... testwt-one-attrib - read/write test of element attributes - read one at a time... testwt-nsided - write file with nsided elements... testrd-nsided - read file with nsided elements... testwt-nfaced - write file with nfaced elements... testrd-nfaced - read file with nfaced elements... testwt-long-name - write file with long (64-character) names... testrd - read long name file truncating to 32 characters on read... testrd-long-name - read long name file... test_nemesis - read long name file... ************************************************************************ ************************************************************************ exodusii-6.02.dfsg.1/exodus/cbind/test/makedmp000066400000000000000000000102141225312213100212470ustar00rootroot00000000000000# 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 exodusii-6.02.dfsg.1/exodus/cbind/test/oned.c000066400000000000000000000326271225312213100210130ustar00rootroot00000000000000/* * 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. * * *****************************************************************************/ #include #include #include #include "exodusII.h" #define EXCHECK(FUNC) \ do { if ( (FUNC) < 0 ) {\ fprintf(stderr, "Error code %d returned after calling " #FUNC "\n"); \ exit(1); \ } else {\ fprintf(stderr, "Called " #FUNC " successfully\n"); \ }\ } while (0) 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_nodes_in_nset[10]; int num_node_sets, num_side_sets; int i, j, k, m, *elem_map, *connect; int node_list[100]; int ebids[10], nsids[10]; int num_qa_rec, num_info; int num_glo_vars, num_nod_vars, num_ele_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 *nset_var_vals; float time_value; float x[100]; float attrib[10], dist_fact[100]; char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3]; char *block_names[10], *nset_names[10]; char *prop_names[2], *attrib_names[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("oned.e", /* 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 oned.e, exoid = %d\n", exoid); printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size); EXCHECK(ex_set_max_name_length(exoid, 40)); /* ncopts = NC_VERBOSE; */ /* initialize file with parameters */ num_dim = 1; num_nodes = 10; num_elem = 10; /* 9 lines plus a point */ num_elem_blk = 3; num_node_sets = 2; num_side_sets = 0; EXCHECK(ex_put_init (exoid, title, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets)); for (i=0; i < num_nodes; i++) { x[i] = exp((float)i/10.0); } EXCHECK(ex_put_coord (exoid, x, NULL, NULL)); coord_names[0] = "xcoor"; EXCHECK(ex_put_coord_names (exoid, coord_names)); /* Add nodal attributes */ EXCHECK(ex_put_attr_param(exoid, EX_NODAL, 0, 1)); EXCHECK(ex_put_one_attr(exoid, EX_NODAL, 0, 1, x)); attrib_names[0] = "Node_attr_1"; EXCHECK(ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names)); /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); for (i=1; i<=num_elem; i++) { elem_map[i-1] = 10*i; } EXCHECK(ex_put_map (exoid, elem_map)); free (elem_map); /* write element block parameters */ block_names[0] = "left_side"; block_names[1] = "right_side"; block_names[2] = "center"; num_elem_in_block[0] = 4; num_elem_in_block[1] = 5; num_elem_in_block[2] = 1; num_nodes_per_elem[0] = 2; num_nodes_per_elem[1] = 2; num_nodes_per_elem[2] = 1; ebids[0] = 10; ebids[1] = 20; ebids[2] = 30; EXCHECK(ex_put_elem_block (exoid, ebids[0], "line", num_elem_in_block[0], num_nodes_per_elem[0], 1)); EXCHECK(ex_put_elem_block (exoid, ebids[1], "line", num_elem_in_block[1], num_nodes_per_elem[1], 1)); EXCHECK(ex_put_elem_block (exoid, ebids[2], "point", num_elem_in_block[2], num_nodes_per_elem[2], 0)); /* Write element block names */ EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, block_names)); /* write element block properties */ prop_names[0] = "DENSITY"; EXCHECK(ex_put_prop_names(exoid,EX_ELEM_BLOCK,1,prop_names)); EXCHECK(ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], prop_names[0], 1.345)); EXCHECK(ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], prop_names[0], 10.995)); EXCHECK(ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], prop_names[0], 0.001)); /* write element connectivity */ connect = (int *) calloc(18, sizeof(int)); for (i=0; i < num_elem*2; i+=2) { connect[i] = i/2+1; connect[i+1] = i/2+2; } EXCHECK(ex_put_conn (exoid, EX_ELEM_BLOCK, ebids[0], connect, NULL, NULL)); EXCHECK(ex_put_conn (exoid, EX_ELEM_BLOCK, ebids[1], connect+8, NULL, NULL)); /* Circle */ connect[0] = 5; EXCHECK(ex_put_conn (exoid, EX_ELEM_BLOCK, ebids[2], connect, NULL, NULL)); /* write element block attributes */ for (i=0; i < num_elem; i++) { attrib[i] = 3.14159 * i; } EXCHECK(ex_put_attr (exoid, EX_ELEM_BLOCK, ebids[0], attrib)); EXCHECK(ex_put_attr (exoid, EX_ELEM_BLOCK, ebids[1], attrib+num_elem_in_block[0])); attrib_names[0] = "THICKNESS"; EXCHECK(ex_put_attr_names (exoid, EX_ELEM_BLOCK, ebids[0], attrib_names)); attrib_names[0] = "WIDTH"; EXCHECK(ex_put_attr_names (exoid, EX_ELEM_BLOCK, ebids[1], attrib_names)); /* write individual node sets */ num_nodes_in_nset[0] = 5; num_nodes_in_nset[1] = 3; nsids[0] = 20; nsids[1] = 21; EXCHECK(ex_put_node_set_param (exoid, nsids[0], 5, 5)); node_list[0] = 1; node_list[1] = 3; node_list[2] = 5; node_list[3] = 7; node_list[4] = 9; 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; EXCHECK(ex_put_node_set (exoid, nsids[0], node_list)); EXCHECK(ex_put_node_set_dist_fact (exoid, nsids[0], dist_fact)); EXCHECK(ex_put_node_set_param (exoid, nsids[1], 3, 3)); node_list[0] = 2; node_list[1] = 4; node_list[2] = 6; dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0; EXCHECK(ex_put_node_set (exoid, nsids[1], node_list)); EXCHECK(ex_put_node_set_dist_fact (exoid, nsids[1], dist_fact)); /* Write node set names */ nset_names[0] = "all_odd_nodes"; nset_names[1] = "some_even_nodes"; EXCHECK(ex_put_names(exoid, EX_NODE_SET, nset_names)); EXCHECK(ex_put_prop(exoid, EX_NODE_SET, nsids[0], "FACE", 4)); EXCHECK(ex_put_prop(exoid, EX_NODE_SET, nsids[1], "FACE", 5)); prop_array[0] = 1000; prop_array[1] = 2000; EXCHECK(ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array)); /* Add nodeset attributes */ EXCHECK(ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1)); EXCHECK(ex_put_attr(exoid, EX_NODE_SET, nsids[0], x)); attrib_names[0] = "Nodeset_attribute"; EXCHECK(ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names)); /* 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] = " "; EXCHECK(ex_put_qa (exoid, num_qa_rec, qa_record)); /* 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] = " "; EXCHECK(ex_put_info (exoid, num_info, info)); /* write results variables parameters and names */ num_glo_vars = 1; var_names[0] = "glo_vars"; EXCHECK(ex_put_variable_param (exoid, EX_GLOBAL, num_glo_vars)); EXCHECK(ex_put_variable_names (exoid, EX_GLOBAL, num_glo_vars, var_names)); num_nod_vars = 2; /* 12345678901234567890123456789012 */ var_names[0] = "node_variable_a_very_long_name_0"; var_names[1] = "nod_var1"; EXCHECK(ex_put_variable_param (exoid, EX_NODAL, num_nod_vars)); EXCHECK(ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, var_names)); num_ele_vars = 3; /* 0 1 2 3 */ /* 12345678901234567890123456789012 */ var_names[0] = "this_variable_name_is_short"; var_names[1] = "this_variable_name_is_just_right"; var_names[2] = "this_variable_name_is_tooooo_long"; EXCHECK(ex_put_variable_param (exoid, EX_ELEM_BLOCK, num_ele_vars)); EXCHECK(ex_put_variable_names (exoid, EX_ELEM_BLOCK, num_ele_vars, var_names)); num_nset_vars = 3; var_names[0] = "ns_var0"; var_names[1] = "ns_var1"; var_names[2] = "ns_var2"; EXCHECK(ex_put_variable_param (exoid, EX_NODE_SET, num_nset_vars)); EXCHECK(ex_put_variable_names (exoid, EX_NODE_SET, num_nset_vars, var_names)); /* write element variable truth table */ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int)); k = 0; for (i=0; i #endif #ifdef HAVE_PARALLEL #include #else #include #include #endif #include #include #include #include #include #include #include #include #include #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 8 #define QUIT FALSE #define WRITE_FILE_TYPE "new" /* * Prototypes */ typedef double realtyp; 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 *ndim, int num_domains, int *num_nodal_fields, int *num_global_fields, int *num_element_fields, int *num_timesteps, int sleep_time, int num_iterations, int *num_nodes, int **node_map, int *num_elems, int **elem_map, realtyp **x_coords, realtyp **y_coords, realtyp **z_coords, int **loc_connect ); int write_exo_mesh ( char *file_name, int rank, int ndim, int num_domains, int num_nodal_fields, int num_global_fields, int num_element_fields, int num_timesteps, int files_per_domain, int sleep_time, int num_iterations, int loc_num_nodes, int *node_map, int loc_num_elems, int *elem_map, realtyp *x_coords, realtyp *y_coords, realtyp *z_coords, int *loc_connect, int close_files); double my_timer() { double t1 = 0.0; #if !defined(__LIBCATAMOUNT__) #ifdef HAVE_PARALLEL t1 = MPI_Wtime(); #else clock_t ctime = clock(); t1 = ctime / (double)CLOCKS_PER_SEC; #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 = NULL; #ifdef HAVE_PARALLEL MPI_Info mpi_info_object = MPI_INFO_NULL; /* Copy of MPI Info object. */ #endif int *elem_map = NULL; 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. */ realtyp *x_coords = NULL; realtyp *y_coords = NULL; realtyp *z_coords = NULL; int ndim; #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 = (1 == parse_input(argc, argv, &exodus, &close_files, file_name, &num_nodal_fields, &num_global_fields, &num_element_fields, &files_per_domain, &num_iterations, &sleep_time)); } /* * 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(0); } #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 3D Benchmark\n\n" ); fprintf(stderr, " Number of Domains\t\t%8d\n", num_domains ); fprintf(stderr, " Number of Files/Domain\t%8d\n", files_per_domain ); fprintf(stderr, " Number of Iterations\t\t%8d\n", num_iterations ); #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 = NULL; if (0 == read_exo_mesh(file_name, rank, &ndim, num_domains, &num_nodal_fields, &num_global_fields, &num_element_fields, &num_timesteps, sleep_time, num_iterations, &loc_num_nodes, &node_map, &loc_num_elems, &elem_map, &x_coords, &y_coords, &z_coords, &loc_connect) ) { write_exo_mesh(file_name, rank, ndim, num_domains, num_nodal_fields, num_global_fields, num_element_fields, num_timesteps, files_per_domain, sleep_time, num_iterations, loc_num_nodes, node_map, loc_num_elems, elem_map, x_coords, y_coords, z_coords, loc_connect, close_files); free( elem_map ); free( loc_connect ); free( node_map ); free( x_coords ); free( y_coords ); free( z_coords ); } } #ifdef HAVE_PARALLEL 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(1); } else { fprintf(stderr, "Unknown option: %s\n", argv[arg] ); fprintf(stderr, "Enter rd_wt_mesh -h for description of valid options.\n" ); return(1); } } return(0); } /*********************************************************************** ***********************************************************************/ int read_exo_mesh (char *file_name, int rank, int *num_dim, int num_domains, int *num_nodal_fields, int *num_global_fields, int *num_element_fields, int *num_timesteps, int sleep_time, int num_iterations, int *num_nodes, int **node_map, int *num_elems, int **elem_map, realtyp **x_coords, realtyp **y_coords, realtyp **z_coords, int **connect ) { int CPU_word_size=sizeof(realtyp); int IO_word_size=0; int exoid, err, num_elem_blk, num_node_sets, num_side_sets; int num_nodes_per_elem, num_attrs, num_vars, i, iter; size_t len_connect; size_t file_size; struct stat file_status; size_t glob_file_size; size_t glob_raw_data_vol; size_t raw_data_vol = 0; float version; realtyp *globals = NULL; double tstart, tend, t_tmp1, t_tmp2; double raw_read_time, max_raw_read_time=0.0, min_raw_read_time=DBL_MAX; 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 0) { globals = malloc(*num_global_fields * sizeof(realtyp)); assert(globals); } err = ex_get_variable_param (exoid, EX_ELEM_BLOCK, &num_vars); if (err) { printf ("after ex_get_var_param, error = %d\n", err); ex_close (exoid); return( 1 ); } *num_element_fields = num_vars; /* read number of timesteps */ *num_timesteps = ex_inquire_int (exoid, EX_INQ_TIME); 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_var (exoid, t+1, EX_NODAL, i, 0, *num_nodes, *x_coords); t_tmp2 = my_timer(); raw_read_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(realtyp)*(*num_nodes); if (err) { printf ("after ex_get_nodal_var, error = %d\n", err); ex_close (exoid); return( 1 ); } } t_tmp1 = my_timer(); err = ex_get_var (exoid, t+1, EX_GLOBAL, 0, 0, *num_global_fields, globals); t_tmp2 = my_timer(); raw_read_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(realtyp) * *num_global_fields; if (err) { printf ("after ex_get_glob_vars, error = %d\n", err); ex_close (exoid); return( 1 ); } for (i=1; i <= *num_element_fields; i++) { t_tmp1 = my_timer(); err = ex_get_var (exoid, t+1, EX_ELEM_BLOCK, i, 10, *num_elems, *x_coords); t_tmp2 = my_timer(); raw_read_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(realtyp) * (*num_elems); if (err) { printf ("after ex_get_elem_var, error = %d\n", err); ex_close (exoid); return( 1 ); } } } if (rank == 0) { fprintf(stderr,"\n"); } } err = ex_close (exoid); if (err) { printf ("after ex_close, error = %d\n", err); return ( 1 ); } 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_LONG, 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( 1 ); } else file_size = file_status.st_size; #ifdef HAVE_PARALLEL MPI_Allreduce(&file_size, &glob_file_size, 1, MPI_LONG, 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 %14ld \n", (long)glob_file_size); fprintf(stderr, " Raw Data %14ld \n", (long)glob_raw_data_vol); fprintf(stderr, " Difference %14ld (%5.2f%%) \n", (long)(glob_file_size - glob_raw_data_vol), (1.0*glob_file_size-1.0*glob_raw_data_vol)/(0.01*glob_file_size) ); fprintf(stderr, " \n" ); fprintf(stderr, " Times (sec) \t Minimum\t Maximum\t Average\n" ); fprintf(stderr, " Raw Data Read (sec) \t%8.4g\t%8.4g\t%8.4g \n", 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", (double)glob_raw_data_vol / max_raw_read_time / MBYTES, (double)glob_raw_data_vol / min_raw_read_time / MBYTES, (double)glob_raw_data_vol / cum_raw_read_time / MBYTES * num_iterations); fprintf(stderr, " Raw + Meta Data Read (MiB/sec)\t \t \t%8.4g \n", (double)glob_file_size / cum_total_time / MBYTES * num_iterations ); } if (*num_global_fields > 0) free(globals); return(0); } /*********************************************************************** ***********************************************************************/ int write_exo_mesh (char *file_name, int rank, int num_dim, int num_domains, int num_nodal_fields, int num_global_fields, int num_element_fields, int num_timesteps, int files_per_domain, int sleep_time, int num_iterations, int num_nodes, int *node_map, int num_elems, int *elem_map, realtyp *x_coords, realtyp *y_coords, realtyp *z_coords, int *connect, int close_files ) { int CPU_word_size = sizeof(realtyp); int IO_word_size = sizeof(realtyp); int j, t, npd, err, num_elem_blk, num_node_sets, num_side_sets; int iter; int *elem_var_tab = NULL; size_t file_size; struct stat file_status; size_t glob_file_size; size_t glob_raw_data_vol; size_t raw_data_vol = 0; realtyp *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 = NULL; char **nvar_name = NULL; char **evar_name = NULL; int *exoid = NULL; exoid = malloc(files_per_domain * sizeof(int)); raw_open_close_time = 0.0; for (iter=0; iter 1 ? TRUE : FALSE; num_elem_per_block[0] = num_elems; num_node_per_elem[0] = NUM_NODES_PER_ELEM; num_attr_per_block[0] = 0; err = ex_put_concat_elem_block (exoid[npd], ids, names, num_elem_per_block, num_node_per_elem, num_attr_per_block, write_map); } #else err = ex_put_block (exoid[npd], EX_ELEM_BLOCK, 10, "hex", num_elems, NUM_NODES_PER_ELEM, 0, 0, 0); #endif if (err) { printf ("after ex_put_elem_block, error = %d\n", err); ex_close (exoid[npd]); return( 1 ); } t_tmp1 = my_timer(); err = ex_put_coord (exoid[npd], x_coords, y_coords, z_coords); t_tmp2 = my_timer(); raw_write_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(realtyp)*num_dim * num_nodes; if (err) { printf ("after ex_put_coord, error = %d\n", err); ex_close (exoid[npd]); return( 1 ); } 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 += sizeof(int) * num_elems * NUM_NODES_PER_ELEM; if (err) { printf ("after ex_put_elem_conn, error = %d\n", err); ex_close (exoid[npd]); return( 1); } /* write out element and node maps */ t_tmp1 = my_timer(); err = ex_put_id_map (exoid[npd], EX_NODE_MAP, node_map); t_tmp2 = my_timer(); raw_write_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(int)*num_nodes; if (err) { printf ("after ex_put_id_map, error = %d\n", err); ex_close (exoid[npd]); return( 1 ); } t_tmp1 = my_timer(); err = ex_put_id_map (exoid[npd], EX_ELEM_MAP, elem_map); t_tmp2 = my_timer(); raw_write_time += t_tmp2-t_tmp1; raw_data_vol += sizeof(int)*num_elems; if (err) { printf ("after ex_put_id_map, error = %d\n", err); ex_close (exoid[npd]); return( 1 ); } /* write out simulated results fields; we'll just write out the x coordinate field 'num_element_fields' times */ if (num_element_fields > 0) { if (npd == 0) { elem_var_tab = malloc(num_element_fields * sizeof(int)); assert(elem_var_tab); for (j = 0; j < num_element_fields; j++) elem_var_tab[j] = 1; } } 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(1); } if (num_nodal_fields > 0) { if (npd == 0) { nvar_name = malloc (num_nodal_fields * sizeof(char *)); assert(nvar_name); for (j=0; j 0) { if (npd == 0) { globals = malloc(num_global_fields * sizeof(realtyp)); gvar_name = malloc (num_global_fields * sizeof(char *)); for (j=0; j 0) { if (npd == 0) { evar_name = malloc (num_element_fields * sizeof(char *)); for (j=0; j 0) { if ( rank == 0 ) { fprintf (stderr, "\nWriting Timestep: "); } for (t=0; t 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_var (exoid[npd], t+1, EX_GLOBAL, 1, 0, num_global_fields, globals); t_tmp2 = my_timer(); raw_write_time += t_tmp2-t_tmp1; if (err) { fprintf(stderr, "after ex_put_global_var, error = %d\n", err); ex_close (exoid[npd]); exit(1); } } for (j=0; j 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 += sizeof(realtyp)*(((size_t)num_nodes*num_nodal_fields) + (num_elems * num_element_fields) + (num_global_fields)) * num_timesteps*files_per_domain; } /* end of for (iter...) */ #ifdef HAVE_PARALLEL MPI_Allreduce( &raw_data_vol, &glob_raw_data_vol, 1, MPI_LONG, MPI_SUM, MPI_COMM_WORLD ); #else glob_raw_data_vol = raw_data_vol; #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( 1 ); } else file_size = file_status.st_size * files_per_domain; #ifdef HAVE_PARALLEL MPI_Allreduce (&file_size, &glob_file_size, 1, MPI_LONG, 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 %14ld \n", (long)glob_file_size); fprintf(stderr, " Raw Data %14ld \n", (long)glob_raw_data_vol); fprintf(stderr, " Difference %14ld (%5.2f%%) \n", (long)(glob_file_size - glob_raw_data_vol), (1.0*glob_file_size-1.0*glob_raw_data_vol)/(0.01*glob_file_size) ); fprintf(stderr, " \n" ); fprintf(stderr, " Times \t Minimum\t Maximum\t Average\n" ); fprintf(stderr, " Raw Data Write (sec) \t%8.4g\t%8.4g\t%8.4g \n", 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", (double)glob_raw_data_vol / max_raw_write_time / MBYTES, (double)glob_raw_data_vol / min_raw_write_time / MBYTES, (double)glob_raw_data_vol / cum_raw_write_time / MBYTES * num_iterations); fprintf(stderr, " Raw + Meta Data Write (MiB/sec) \t \t%8.4g\n", (double)glob_file_size / cum_total_time / MBYTES * num_iterations ); } free(exoid); if (num_global_fields > 0) free(globals); return(0); } /*****************************************************************************/ 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); } } exodusii-6.02.dfsg.1/exodus/cbind/test/test.dmp000066400000000000000000000600341225312213100213740ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 7 ; num_node_sets = 2 ; num_side_sets = 5 ; num_att_in_nblk = 2 ; num_el_in_blk1 = 1 ; num_nod_per_el1 = 4 ; num_att_in_blk1 = 1 ; 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_att_in_ns1 = 1 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; float nattrb(num_nodes, num_att_in_nblk) ; char nattrib_name(num_att_in_nblk, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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" ; float nsattrb1(num_nod_ns1, num_att_in_ns1) ; char nsattrib_name1(num_att_in_ns1, len_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; char name_nset_var(num_nset_var, len_name) ; char name_sset_var(num_sset_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ; eb_names = "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" ; coor_names = "xcoor", "ycoor", "zcoor" ; nattrb = 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 1, 0, 0, 10, 0, 10, 0, 1, 0, 1, 10, 10, 10, 10, 10, 1, 10, 0, 0, 1, 0, 10, 0, 7, 5, 3, 0, 6, 0, 0, 0, 3, 2, 6, 2, 0, 2, 2.7, 1.7, 6, 1.7, 5.7, 1.7, 3.7, 0, 0, 0, 10, 0, 10, 10 ; nattrib_name = "Node_attr_1", "Node_attr_2" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; attrib1 = 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; dist_fact_ns2 = 1.1, 2.1, 3.1 ; ns_prop2 = 4, 5 ; ns_prop3 = 1000, 2000 ; nsattrb1 = 0, 1, 1, 0, 1 ; nsattrib_name1 = "Nodeset_attribute" ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33, 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, 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, 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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97, 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 = "this_variable_name_is_short", "this_variable_name_is_just_right", "this_variable_name_is_tooooo_lon" ; 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test.exo_c000066400000000000000000000040311225312213100217040ustar00rootroot00000000000000CDF  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@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®@ exodusii-6.02.dfsg.1/exodus/cbind/test/test1.dmp000066400000000000000000000344211225312213100214560ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int nm_prop1(num_node_maps) ; nm_prop1:name = "ID" ; char nmap_names(num_node_maps, len_name) ; int node_map1(num_nodes) ; int em_prop1(num_elem_maps) ; em_prop1:name = "ID" ; char emap_names(num_elem_maps, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is testwt1" ; :maximum_name_length = 32 ; 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 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 100, 50, 3, 6, 0, 3, 6, 0 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 100, 50, 0, 0, 0, 2, 2, 2 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 0, 20, 6, 0, 0, 6, 2, 0 ; eb_names = "", "", "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 3.43, 3.52, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.54, 2.56, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.81, 2.84, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 3.08, 3.12, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 3.62, 3.68, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 3.89, 3.96, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 4.16, 4.24, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 4.43, 4.52, 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test2-1.dmp000066400000000000000000000266151225312213100216230ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test2-2.dmp000066400000000000000000000265721225312213100216260ustar00rootroot00000000000000netcdf test2 { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is test 2" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test2.dmp000066400000000000000000000127231225312213100214600ustar00rootroot00000000000000netcdf test2 { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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." ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test_clb.dmp000066400000000000000000000566541225312213100222310ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; int connect1(num_el_in_blk1, num_nod_per_el1) ; connect1:elem_type = "quad" ; char attrib_name1(num_att_in_blk1, len_name) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; int connect2(num_el_in_blk2, num_nod_per_el2) ; connect2:elem_type = "quad" ; char attrib_name2(num_att_in_blk2, len_name) ; float attrib2(num_el_in_blk2, num_att_in_blk2) ; int connect3(num_el_in_blk3, num_nod_per_el3) ; connect3:elem_type = "hex" ; char attrib_name3(num_att_in_blk3, len_name) ; float attrib3(num_el_in_blk3, num_att_in_blk3) ; int connect4(num_el_in_blk4, num_nod_per_el4) ; connect4:elem_type = "tetra" ; char attrib_name4(num_att_in_blk4, len_name) ; float attrib4(num_el_in_blk4, num_att_in_blk4) ; int connect5(num_el_in_blk5, num_nod_per_el5) ; connect5:elem_type = "wedge" ; char attrib_name5(num_att_in_blk5, len_name) ; float attrib5(num_el_in_blk5, num_att_in_blk5) ; int connect6(num_el_in_blk6, num_nod_per_el6) ; connect6:elem_type = "tetra" ; char attrib_name6(num_att_in_blk6, len_name) ; float attrib6(num_el_in_blk6, num_att_in_blk6) ; int connect7(num_el_in_blk7, num_nod_per_el7) ; connect7:elem_type = "tri" ; char attrib_name7(num_att_in_blk7, len_name) ; float attrib7(num_el_in_blk7, num_att_in_blk7) ; 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_name) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ; eb_names = "", "", "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; connect1 = 1, 2, 3, 4 ; attrib_name1 = "" ; attrib1 = 3.1416 ; connect2 = 5, 6, 7, 8 ; attrib_name2 = "" ; attrib2 = 6.1416 ; connect3 = 9, 10, 11, 12, 13, 14, 15, 16 ; attrib_name3 = "" ; attrib3 = 6.1416 ; connect4 = 17, 18, 19, 20 ; attrib_name4 = "" ; attrib4 = 6.1416 ; connect5 = 21, 22, 23, 24, 25, 26 ; attrib_name5 = "" ; attrib5 = 6.1416 ; connect6 = 17, 18, 19, 20, 27, 28, 30, 29 ; attrib_name6 = "" ; attrib6 = 6.1416 ; connect7 = 31, 32, 33 ; attrib_name7 = "" ; attrib7 = 6.1416 ; eb_prop2 = 10, 20, 30, 40, 50, 60, 70 ; eb_prop3 = _, _, _, _, _, _, _ ; node_ns1 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.29, 1.3, 1.31, 1.32, 1.33, 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, 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, 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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 3.43, 3.52, 3.61, 3.7, 3.79, 3.88, 3.97, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4, 4.1, 4.2, 4.3 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.29, 2.3, 2.31, 2.32, 2.33, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.54, 2.56, 2.58, 2.6, 2.62, 2.64, 2.66, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.81, 2.84, 2.87, 2.9, 2.93, 2.96, 2.99, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 3.08, 3.12, 3.16, 3.2, 3.24, 3.28, 3.32, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, 3.45, 3.5, 3.55, 3.6, 3.65, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 3.62, 3.68, 3.74, 3.8, 3.86, 3.92, 3.98, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 3.89, 3.96, 4.03, 4.1, 4.17, 4.24, 4.31, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 4.16, 4.24, 4.32, 4.4, 4.48, 4.56, 4.64, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 4.43, 4.52, 4.61, 4.7, 4.79, 4.88, 4.97, 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/test_nemesis.c000066400000000000000000000704441225312213100225670ustar00rootroot00000000000000/* * Copyright (c) 1998 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 the source code for the program used to test the * Nemesis distribution. ***************************************************************************** * Written By: Gary L. Hennigan (SNL, 1421) ***************************************************************************** * Functions contained in this file: * main() - Entry point and main calling program. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include /* Constants for init_global functions */ #define NNG 100 #define NEG 50 #define NEBG 5 #define NEBCG 10 #define NNSG 2 #define NSSG 3 /* Constants for load-balance functions */ #define NPROC 10 #define NPROCF NPROC #define NINTN 200 #define NBORN 10 #define NEXTN 5 #define NINTE 100 #define NBORE 20 #define NNCMAP 4 #define NECMAP 2 /* Constants for communication map */ #define NCNTCM 20 #define ECNTCM 17 int main(int argc, char *argv[]) { /* Local function calls */ int ne_test_glbp(int); int ne_test_piinf(int); int ne_test_pinig(int); int ne_test_pelbid(int); int ne_test_pnsp(int); int ne_test_pssp(int); int ne_test_pnm(int); int ne_test_pem(int); int ne_test_pcmp(int); int ne_test_pncm(int); int ne_test_pecm(int); int ne_test_giinf(int); int ne_test_ginig(int); int ne_test_gelbid(int); int ne_test_gnsp(int); int ne_test_gssp(int); int ne_test_gnm(int); int ne_test_gem(int); int ne_test_gncm(int); int ne_test_gecm(int); int ne_test_plbpc(int); int ne_test_pcmpc(int); /* Unitialized local variables */ int ne_file_id; char test_direc[256], file_name[256]; float version; /* Initialized local variables */ int mode3 = EX_CLOBBER; int mode4 = EX_CLOBBER|EX_NETCDF4|EX_NOCLASSIC; char *yo="main"; int io_ws=0, cpu_ws=0, t_pass=0, t_fail=0; int debug_flag=0; /*-----------------------------Execution Begins-----------------------------*/ /* Get the location of the temporary file to use for the test */ if (argc <= 1) { /* Nothing specified. Use defaults. */ strcpy(file_name, "./ne_test.exo"); } else if (argc == 2) { /* Test for the help flag */ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "-?") == 0) { /* Output the help line */ printf("Usage:\n\tne_test \n"); exit(0); } /* Test for the debug flag */ else if (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "-d") == 0) { printf("****DEBUG MODE****\n"); ex_opts(EX_VERBOSE | EX_DEBUG); strcpy(file_name, "./ne_test.exo"); debug_flag = 1; } /* Else get the directory name and assign default name */ else { strcpy(test_direc, argv[1]); if (test_direc[strlen(test_direc)-1] != '/') { strcpy(file_name, test_direc); strcat(file_name, "/ne_test.exo"); } else { strcpy(file_name, test_direc); strcat(file_name, "ne_test.exo"); } } } else if (argc == 3) { /* Both directory and file name specified */ strcpy(test_direc, argv[1]); if (test_direc[strlen(test_direc)-1] == '/') { strcpy(file_name, test_direc); strcat(file_name, "/"); strcat(file_name, argv[2]); } else { strcpy(file_name, test_direc); strcat(file_name, argv[2]); } } /*---------------------------------------------------------------------------*/ /* OUTPUT TEST SECTION */ /*---------------------------------------------------------------------------*/ printf("*********************Output Tests***********************\n"); /* Create the ExodusII/Nemesis file */ printf("creating ExodusII file..."); fflush(stdout); /* Attempt to create a netcdf4-format file; if it fails, then assume that the netcdf library does not support that mode and fall back to classic netcdf3 format. If that fails, issue an error and die. */ if ((ne_file_id=ex_create(file_name, mode4, &cpu_ws, &io_ws)) < 0) { /* netcdf4 create failed, try netcdf3 */ if ((ne_file_id=ex_create(file_name, mode3, &cpu_ws, &io_ws)) < 0) { printf("FAILED\n"); t_fail++; fprintf(stderr, "[%s]: ERROR, unable to create test file \"%s\"!\n", yo, file_name); exit(-1); } } printf("successful\n"); fflush(stdout); t_pass++; /* Test the output of initial information */ printf("testing init info output..."); fflush(stdout); if (ne_test_piinf(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of initial global information */ printf("testing global init info output..."); fflush(stdout); if (ne_test_pinig(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global element block IDs */ printf("testing global element block ID output..."); fflush(stdout); if (ne_test_pelbid(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global node-set info */ printf("testing global node-set params output..."); fflush(stdout); if (ne_test_pnsp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global side-set info */ printf("testing global side-set params output..."); fflush(stdout); if (ne_test_pssp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the concatenated load-balance parameters */ printf("testing concatenated load balance info output..."); fflush(stdout); if (ne_test_plbpc(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); } else { printf("succesful\n"); fflush(stdout); } /* Test the output of the node map */ printf("testing node map output..."); fflush(stdout); if (ne_test_pnm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the element map */ printf("testing element map output..."); fflush(stdout); if (ne_test_pem(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the concatenated communication map params */ printf("testing concatenated communication map params output..."); fflush(stdout); if (ne_test_pcmpc(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test nodal communication map output */ printf("testing nodal communication map output..."); fflush(stdout); if (ne_test_pncm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test elemental communication map output */ printf("testing elemental communication map output..."); fflush(stdout); if (ne_test_pecm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Close the ExodusII/Nemesis test file */ printf("closing ExodusII file..."); fflush(stdout); if (ex_close(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name); exit(-1); } printf("successful\n"); fflush(stdout); t_pass++; /*---------------------------------------------------------------------------*/ /* INPUT TEST SECTION */ /*---------------------------------------------------------------------------*/ printf("**********************Input Tests***********************\n"); /* Re-open the ExodusII/NemesisI file */ printf("reopening ExodusII file..."); fflush(stdout); if (ex_open(file_name, EX_READ, &cpu_ws, &io_ws, &version) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of of the initial information */ printf("testing init info input..."); fflush(stdout); if (ne_test_giinf(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of initial global information */ printf("testing global init info input..."); fflush(stdout); if (ne_test_ginig(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global element block IDs */ printf("testing global element block IDs input..."); fflush(stdout); if (ne_test_gelbid(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global node-set params */ printf("testing global node-set params input..."); fflush(stdout); if (ne_test_gnsp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global side-set params */ printf("testing global side-set params input..."); fflush(stdout); if (ne_test_gssp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of load-balance params */ printf("testing load-balance params input..."); fflush(stdout); if (ne_test_glbp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of the node map */ printf("testing node map input..."); fflush(stdout); if (ne_test_gnm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of element map */ printf("testing element map input..."); fflush(stdout); if (ne_test_gem(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of nodal communication maps */ printf("testing nodal communication map input..."); fflush(stdout); if (ne_test_gncm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of elemental communication maps */ printf("testing elemental communication map input..."); fflush(stdout); if (ne_test_gecm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Close the ExodusII/Nemesis test file */ printf("closing ExodusII file..."); fflush(stdout); if (ex_close(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name); exit(-1); } printf("successful\n"); fflush(stdout); t_pass++; /* Output a test summary */ printf("\n"); printf("Tests Passed: %d\n", t_pass); printf("Tests Failed: %d\n", t_fail); return 0; } /*****************************************************************************/ int ne_test_piinf(int fileid) { char ftype[3]; strcpy(ftype, "s"); return (ex_put_init_info(fileid, NPROC, NPROCF, ftype)); } /*****************************************************************************/ int ne_test_pinig(int fileid) { int nng=NNG, neg=NEG, nebg=NEBG, nnsg=NNSG, nssg=NSSG; /*-----------------------------Execution Begins-----------------------------*/ return (ex_put_init_global(fileid, nng, neg, nebg, nnsg, nssg)); } /*****************************************************************************/ int ne_test_pelbid(int fileid) { int i, elblk_ids[NEBG], elblk_cnt[NEBG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NEBG; i++) { elblk_ids[i]=(i+1); elblk_cnt[i]=NEBCG; } return (ex_put_eb_info_global(fileid, elblk_ids, elblk_cnt)); } /*****************************************************************************/ int ne_test_pnsp(int fileid) { int i, global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NNSG; i++) { global_ids[i]=2*(i+1); global_n_cnts[i]=3*(i+1); global_df_cnts[i]=1; } return (ex_put_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts)); } /*****************************************************************************/ int ne_test_pssp(int fileid) { int i, global_ids[NSSG], global_el_cnts[NSSG], global_df_cnts[NSSG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NSSG; i++) { global_ids[i]=3*(i+1); global_el_cnts[i]=2*(i+1); global_df_cnts[i]=1; } return (ex_put_ss_param_global(fileid, global_ids, global_el_cnts, global_df_cnts)); } /*****************************************************************************/ int ne_test_pnm(int fileid) { int iproc, j, error, j1=0; int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NINTN; node_mapi[j++]=j1++); for(j=0; j < NBORN; node_mapb[j++]=j1++); for(j=0; j < NEXTN; node_mape[j++]=j1++); j1 = 0; error = ex_put_processor_node_maps(fileid, node_mapi, node_mapb, node_mape, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pem(int fileid) { int iproc, j, error, j1=0; int elem_mapi[NINTE], elem_mapb[NBORE]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NINTE; elem_mapi[j++]=j1++); for(j=0; j < NBORE; elem_mapb[j++]=j1++); j1 = 0; error = ex_put_processor_elem_maps(fileid, elem_mapi, elem_mapb, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pcmp(int fileid) { int i, iproc, error; int node_map_ids[NNCMAP], node_map_node_cnts[NNCMAP]; int elem_map_ids[NECMAP], elem_map_elem_cnts[NECMAP]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NNCMAP; i++) { node_map_ids[i]=(i+1); node_map_node_cnts[i]=NCNTCM; } for(i=0; i < NECMAP; i++) { elem_map_ids[i]=2*(i+1); elem_map_elem_cnts[i]=ECNTCM; } error = ex_put_cmap_params(fileid, node_map_node_cnts, node_map_ids, elem_map_elem_cnts, elem_map_ids, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pncm(int fileid) { int i, iproc, error; int node_map_ids[NNCMAP], node_ids[NCNTCM], proc_ids[NCNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NNCMAP; i++) { node_map_ids[i]=(i+1); } for(i=0; i < NCNTCM; i++) { node_ids[i] = 2*(i+1); proc_ids[i] = 3*(i+1); } for(i=0; i < NNCMAP; i++) { error = ex_put_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc); if (error < 0) return error; } } return 0; } /*****************************************************************************/ int ne_test_pecm(int fileid) { int i, iproc, error; int elem_map_ids[NECMAP], elem_ids[ECNTCM], side_ids[ECNTCM]; int proc_ids[ECNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NECMAP; i++) { elem_map_ids[i]=2*(i+1); } for(i=0; i < ECNTCM; i++) { elem_ids[i] = 2*(i+1); side_ids[i] = 3*(i+1); proc_ids[i] = 4*(i+1); } for(i=0; i < NECMAP; i++) { error = ex_put_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc); if (error < 0) return error; } } return 0; } /*****************************************************************************/ int ne_test_giinf(int fileid) { int error, nproc, nprocf; char ftype[2]; /*-----------------------------Execution Begins-----------------------------*/ error = ex_get_init_info(fileid, &nproc, &nprocf, ftype); if (error < 0) return error; if (nproc != NPROC) return -1; if (nprocf != NPROCF) return -1; if (strcmp(ftype, "s") != 0) return -1; return 0; } /*****************************************************************************/ int ne_test_ginig(int fileid) { int error; int num_nodes_g, num_elems_g, num_elem_blks_g, num_ns_g, num_ss_g; /*-----------------------------Execution Begins-----------------------------*/ error = ex_get_init_global(fileid, &num_nodes_g, &num_elems_g, &num_elem_blks_g, &num_ns_g, &num_ss_g); if (error < 0) return error; if (num_nodes_g != NNG) return -1; if (num_elems_g != NEG) return -1; if (num_elem_blks_g != NEBG) return -1; if (num_ns_g != NNSG) return -1; if (num_ss_g != NSSG) return -1; return 0; } /*****************************************************************************/ int ne_test_gelbid(int fileid) { int i, error; int el_blk_ids[NEBG], el_blk_cnt[NEBG]; /*-----------------------------Execution Begins-----------------------------*/ error = ex_get_eb_info_global(fileid, el_blk_ids, el_blk_cnt); if (error < 0) return error; for(i=0; i < NEBG; i++) { if (el_blk_ids[i] != (i+1)) return -1; if (el_blk_cnt[i] != NEBCG) return -1; } return 0; } /*****************************************************************************/ int ne_test_gnsp(int fileid) { int i, error; int global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG]; /*-----------------------------Execution Begins-----------------------------*/ error = ex_get_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts); if (error < 0) return error; for(i=0; i < NNSG; i++) { if (global_ids[i] != 2*(i+1)) return -1; if (global_n_cnts[i] != 3*(i+1)) return -1; if (global_df_cnts[i] != 1 ) return -1; } return 0; } /*****************************************************************************/ int ne_test_gssp(int fileid) { int i, error; int global_ids[NSSG], global_e_cnts[NSSG], global_df_cnts[NSSG]; /*-----------------------------Execution Begins-----------------------------*/ error = ex_get_ss_param_global(fileid, global_ids, global_e_cnts, global_df_cnts); if (error < 0) return error; for(i=0; i < NSSG; i++) { if (global_ids[i] != 3*(i+1)) return -1; if (global_e_cnts[i] != 2*(i+1)) return -1; if (global_df_cnts[i] != 1 ) return -1; } return 0; } /*****************************************************************************/ int ne_test_glbp(int fileid) { int iproc, error; int nintn, nborn, nextn, ninte, nbore, nncmap, necmap; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ex_get_loadbal_param(fileid, &nintn, &nborn, &nextn, &ninte, &nbore, &nncmap, &necmap, iproc); if (error < 0) return error; if (nintn != NINTN ) return -1; if (nborn != NBORN ) return -1; if (nextn != NEXTN ) return -1; if (ninte != NINTE ) return -1; if (nbore != NBORE ) return -1; if (nncmap != NNCMAP) return -1; if (necmap != NECMAP) return -1; } return 0; } /*****************************************************************************/ int ne_test_gnm(int fileid) { int iproc, j, error, j1=0; int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ex_get_processor_node_maps(fileid, node_mapi, node_mapb, node_mape, iproc); if (error < 0) return error; for(j=0; j < NINTN; j++) { if (node_mapi[j] != j1++) return -1; } for(j=0; j < NBORN; j++) { if (node_mapb[j] != j1++) return -1; } for(j=0; j < NEXTN; j++) { if (node_mape[j] != j1++) return -1; } j1 = 0; } return 0; } /*****************************************************************************/ int ne_test_gem(int fileid) { int iproc, j, error, j1=0; int elem_mapi[NINTE], elem_mapb[NBORE]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ex_get_processor_elem_maps(fileid, elem_mapi, elem_mapb, iproc); if (error < 0) return error; for(j=0; j < NINTE; j++) { if (elem_mapi[j] != j1++) return -1; } for(j=0; j < NBORE; j++) { if (elem_mapb[j] != j1++) return -1; } j1 = 0; } return 0; } /*****************************************************************************/ int ne_test_gncm(int fileid) { int i, j, iproc, error; int node_map_ids[NNCMAP], node_map_cnts[NNCMAP]; int node_ids[NCNTCM], proc_ids[NCNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ex_get_cmap_params(fileid, node_map_ids, node_map_cnts, NULL, NULL, iproc); if (error < 0) return error; for(i=0; i < NNCMAP; i++) { error = ex_get_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc); if (error < 0) return error; for(j=0; j < NCNTCM; j++) { if (node_ids[j] != 2*(j+1)) return -1; if (proc_ids[j] != 3*(j+1)) return -1; } } } return 0; } /*****************************************************************************/ int ne_test_gecm(int fileid) { int i, j, iproc, error; int elem_ids[ECNTCM], elem_map_cnts[NECMAP], proc_ids[ECNTCM]; int side_ids[ECNTCM], elem_map_ids[NECMAP]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ex_get_cmap_params(fileid, NULL, NULL, elem_map_ids, elem_map_cnts, iproc); if (error < 0) return error; for(i=0; i < NECMAP; i++) { error = ex_get_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc); if (error < 0) return error; for(j=0; j < ECNTCM; j++) { if (elem_ids[j] != 2*(j+1)) return -1; if (side_ids[j] != 3*(j+1)) return -1; if (proc_ids[j] != 4*(j+1)) return -1; } } } return 0; } /*****************************************************************************/ int ne_test_plbpc(int fileid) { int iproc; int num_int_nodes[NPROCF], num_bor_nodes[NPROCF], num_ext_nodes[NPROCF]; int num_int_elems[NPROCF], num_bor_elems[NPROCF]; int num_node_cmaps[NPROCF], num_elem_cmaps[NPROCF]; /*-----------------------------Execution Begins-----------------------------*/ /* Set up the vectors */ for(iproc=0; iproc < NPROCF; iproc++) { num_int_nodes[iproc] = NINTN; num_bor_nodes[iproc] = NBORN; num_ext_nodes[iproc] = NEXTN; num_int_elems[iproc] = NINTE; num_bor_elems[iproc] = NBORE; num_node_cmaps[iproc] = NNCMAP; num_elem_cmaps[iproc] = NECMAP; } return (ex_put_loadbal_param_cc(fileid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps)); } /*****************************************************************************/ int ne_test_pcmpc(int fileid) { int iproc, j, n_cntr, e_cntr; int nmap_ids[NNCMAP*NPROCF], nmap_n_cnts[NNCMAP*NPROCF]; int nmap_proc_ptr[NPROCF+1]; int emap_ids[NECMAP*NPROCF], emap_e_cnts[NECMAP*NPROCF]; int emap_proc_ptr[NPROCF+1]; /*-----------------------------Execution Begins-----------------------------*/ nmap_proc_ptr[0] = 0; emap_proc_ptr[0] = 0; n_cntr = 0; e_cntr = 0; for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NNCMAP; j++) { nmap_ids[n_cntr] = (j+1); nmap_n_cnts[n_cntr++] = NCNTCM; } for(j=0; j < NECMAP; j++) { emap_ids[e_cntr] = 2*(j+1); emap_e_cnts[e_cntr++] = ECNTCM; } nmap_proc_ptr[iproc+1] = nmap_proc_ptr[iproc] + NNCMAP; emap_proc_ptr[iproc+1] = emap_proc_ptr[iproc] + NECMAP; } return (ex_put_cmap_params_cc(fileid, nmap_ids, nmap_n_cnts, nmap_proc_ptr, emap_ids, emap_e_cnts, emap_proc_ptr)); } exodusii-6.02.dfsg.1/exodus/cbind/test/test_nemesis.dmp000066400000000000000000000024231225312213100231150ustar00rootroot00000000000000*********************Output Tests*********************** creating ExodusII file... successful testing init info output...successful testing global init info output...successful testing global element block ID output...successful testing global node-set params output...successful testing global side-set params output...successful testing concatenated load balance info output...succesful testing node map output...successful testing element map output...successful testing concatenated communication map params output...successful testing nodal communication map output...successful testing elemental communication map output...successful closing ExodusII file...successful **********************Input Tests*********************** reopening ExodusII file...successful testing init info input...successful testing global init info input...successful testing global element block IDs input...successful testing global node-set params input...successful testing global side-set params input...successful testing load-balance params input...successful testing node map input...successful testing element map input...successful testing nodal communication map input...successful testing elemental communication map input...successful closing ExodusII file...successful Tests Passed: 24 Tests Failed: 0 exodusii-6.02.dfsg.1/exodus/cbind/test/testall.in000066400000000000000000000271751225312213100217240ustar00rootroot00000000000000# 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 SUFFIX = "" set BINDIR = @CMAKE_CURRENT_BINARY_DIR@ set SRCDIR = @CMAKE_CURRENT_SOURCE_DIR@ set NCDUMP = @NETCDF_NCDUMP@ set DIFF = "diff -w" echo "************************************************************************" echo "************************************************************************" rm -f test.output echo "testwt - single precision write test..." echo "begin testwt" > test.output ${PREFIX} ${BINDIR}/testwt${SUFFIX} >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt.res echo "testrd - single precision read test..." echo "begin testrd" >> test.output ${PREFIX} ${BINDIR}/testrd${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd.dmp | tee testrd.res echo "end testrd" >> test.output echo "testcp_ss - single-to-single precision copy test..." echo "begin testcp_ss" >> test.output ${PREFIX} ${BINDIR}/testcp${SUFFIX} >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res echo "testcp_sd - single-to-double precision copy test..." echo "begin testcp_sd" >> test.output ${PREFIX} ${BINDIR}/testcpd${SUFFIX} >> test.output echo "end testcp_sd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res echo "testcp_ln - large model to normal model single precision copy test..." echo "begin testcp_ln" >> test.output ${PREFIX} ${BINDIR}/testcp_ln${SUFFIX} >> test.output echo "end testcp_ln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ln.dmp | tee testcp_ln.res echo "testcp_nl - normal_model to large_model single precision copy test..." echo "begin testcp_nl" >> test.output ${PREFIX} ${BINDIR}/testcp_nl${SUFFIX} >> test.output echo "end testcp_nl" >> test.output ${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res echo "testwt_clb - single precision write test using concatenated puts..." echo "begin testwt_clb" >> test.output ${PREFIX} ${BINDIR}/testwt_clb${SUFFIX} >> test.output echo "end testwt_clb" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res echo "testwtd - double precision write test..." echo "begin testwtd" >> test.output ${PREFIX} ${BINDIR}/testwtd${SUFFIX} >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testd.dmp | tee testwtd.res echo "testrdd - double precision read test..." echo "begin testrdd" >> test.output ${PREFIX} ${BINDIR}/testrdd${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrdd.dmp | tee testrdd.res echo "end testrdd" >> test.output echo "testcp_dd - double-to-double precision copy test..." echo "begin testcp_dd" >> test.output ${PREFIX} ${BINDIR}/testcpd${SUFFIX} >> test.output echo "end testcp_dd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res echo "testcp_ds - double-to-single precision copy test..." echo "begin testcp_ds" >> test.output ${PREFIX} ${BINDIR}/testcp${SUFFIX} >> test.output echo "end testcp_ds" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res echo "testwt1 - single precision write files with several side sets..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${BINDIR}/testwt1${SUFFIX} >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test1.dmp | tee testwt1.res echo "testrd1 - single precision read test of a file with several side sets..." echo "testrd1 ... [Expect file create failure error, NOCLOBBER]" echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" echo "begin testrd1" >> test.output ${PREFIX} ${BINDIR}/testrd1${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd1.dmp | tee testrd1.res echo "end testrd1" >> test.output echo "testwt_ss - write files to test side sets..." echo "testwt_ss ... [Expect WEDGE6 warning from this test]" echo "begin testwt_ss" >> test.output ${PREFIX} ${BINDIR}/testwt_ss${SUFFIX} >> test.output echo "end testwt_ss" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res echo "testrd_ss - read test of a file with several side sets..." echo "testrd_ss ... [Expect warning for NULL sidesets 30 and 31]" echo "begin testrd_ss" >> test.output ${PREFIX} ${BINDIR}/testrd_ss${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res echo "end testrd_ss" >> test.output echo "testwt2 - single precision write 2 files (simultaneously open) test..." echo "begin testwt2" >> test.output ${PREFIX} ${BINDIR}/testwt2${SUFFIX} >> test.output echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res echo "testrdwt - read from one and write to another (simutaneously open) file..." echo "begin testrdwt" >> test.output ${PREFIX} ${BINDIR}/testrdwt${SUFFIX} >> test.output echo "end testrdwt" >> test.output ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2.dmp | tee testrdwt.res echo "testwt_nc - write x y z components of coordinates separately..." echo "begin testwt_nc" >> test.output ${PREFIX} ${BINDIR}/testwt_nc${SUFFIX} >> test.output echo "end testwt_nc" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt_nc.res echo "testrd_nc - read x y z components of coordinates separately..." echo "begin testrd_nc" >> test.output ${PREFIX} ${BINDIR}/testrd_nc${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res echo "end testrd" >> test.output echo "testwt-zeron - write file with zero nodes and elements..." echo "begin testwt-zeron" >> test.output ${PREFIX} ${BINDIR}/testwt-zeron${SUFFIX} >> test.output echo "end testwt-zeron" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res echo "testrd - read test of file with zero nodes and elements..." echo "begin testrd zero nodes" >> test.output ${PREFIX} ${BINDIR}/testrd${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res echo "end testrd zero nodes" >> test.output echo "testwt-zeroe - write file with zero elements..." echo "begin testwt-zeroe" >> test.output ${PREFIX} ${BINDIR}/testwt-zeroe${SUFFIX} >> test.output echo "end testwt-zeroe" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res echo "testrd - read test of file with zero elements..." echo "begin testrd zero elements" >> test.output ${PREFIX} ${BINDIR}/testrd${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res echo "end testrd zero elements" >> test.output echo "testwt-one-attrib - read/write test of element attributes - read one at a time..." echo "begin testwt-one-attrib - read attributes one at a time" >> test.output ${PREFIX} ${BINDIR}/testwt-one-attrib${SUFFIX} | tee testrd_zeroe.res echo "end testwt-one-attrib - read attributes one at a time" >> test.output echo "testwt-nsided - write file with nsided elements..." echo "begin testwt-nsided" >> test.output ${PREFIX} ${BINDIR}/testwt-nsided${SUFFIX} >> test.output echo "end testwt-nsided" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nsided.dmp | tee testwt-nsided.res echo "testrd-nsided - read file with nsided elements..." echo "begin testrd-nsided" >> test.output ${PREFIX} ${BINDIR}/testrd-nsided${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nsided.dmp | tee testrd-nsided.res echo "end testrd-nsided" >> test.output echo "testwt-nfaced - write file with nfaced elements..." echo "begin testwt-nfaced" >> test.output ${PREFIX} ${BINDIR}/testwt-nfaced${SUFFIX} >> test.output echo "end testwt-nfaced" >> test.output ${NCDUMP} -d5,5 test-nfaced.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nfaced.dmp | tee testwt-nfaced.res echo "testrd-nfaced - read file with nfaced elements..." echo "begin testrd-nfaced" >> test.output ${PREFIX} ${BINDIR}/testrd-nfaced${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nfaced.dmp | tee testrd-nfaced.res echo "end testrd-nfaced" >> test.output echo "testwt-long-name - write file with long (64-character) names..." echo "begin testwt-long-name" >> test.output ${PREFIX} ${BINDIR}/testwt-long-name${SUFFIX} >> test.output echo "end testwt-long-name" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-long-name.dmp | tee testwt-long-name.res echo "testrd - read long name file truncating to 32 characters on read..." echo "begin testrd (truncate)" >> test.output ${PREFIX} ${BINDIR}/testrd${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nm32.dmp | tee testrd-nm32.res echo "end testrd (truncate)" >> test.output echo "testrd-long-name - read long name file..." echo "begin testrd-long-name" >> test.output ${PREFIX} ${BINDIR}/testrd-long-name${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/testrd-long-name.dmp | tee testrd-long-name.res echo "end testrd-long-name" >> test.output echo "test_nemesis - read long name file..." echo "begin test_nemesis" >> test.output ${PREFIX} ${BINDIR}/test_nemesis${SUFFIX} | grep -v version | ${DIFF} - ${SRCDIR}/test_nemesis.dmp | tee test_nemesis.res echo "end test_nemesis" >> test.output echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/cbind/test/testall.in1000066400000000000000000000264151225312213100220010ustar00rootroot00000000000000# 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 SRCDIR = . set NCDUMP = @@/ncdump set DIFF = "diff -w" echo "************************************************************************" echo "************************************************************************" rm -f test.output echo "testwt - single precision write test..." echo "begin testwt" > test.output ${PREFIX} ${SRCDIR}/testwt >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt.res echo "testrd - single precision read test..." echo "begin testrd" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd.dmp | tee testrd.res echo "end testrd" >> test.output echo "testcp_ss - single-to-single precision copy test..." echo "begin testcp_ss" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res echo "testcp_sd - single-to-double precision copy test..." echo "begin testcp_sd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_sd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res echo "testcp_ln - large model to normal model single precision copy test..." echo "begin testcp_ln" >> test.output ${PREFIX} ${SRCDIR}/testcp_ln >> test.output echo "end testcp_ln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ln.dmp | tee testcp_ln.res echo "testcp_nl - normal_model to large_model single precision copy test..." echo "begin testcp_nl" >> test.output ${PREFIX} ${SRCDIR}/testcp_nl >> test.output echo "end testcp_nl" >> test.output ${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res echo "testwt_clb - single precision write test using concatenated puts..." echo "begin testwt_clb" >> test.output ${PREFIX} ${SRCDIR}/testwt_clb >> test.output echo "end testwt_clb" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res echo "testwtd - double precision write test..." echo "begin testwtd" >> test.output ${PREFIX} ${SRCDIR}/testwtd >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testd.dmp | tee testwtd.res echo "testrdd - double precision read test..." echo "begin testrdd" >> test.output ${PREFIX} ${SRCDIR}/testrdd | grep -v version | ${DIFF} - ${SRCDIR}/testrdd.dmp | tee testrdd.res echo "end testrdd" >> test.output echo "testcp_dd - double-to-double precision copy test..." echo "begin testcp_dd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_dd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res echo "testcp_ds - double-to-single precision copy test..." echo "begin testcp_ds" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ds" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res echo "testwt1 - single precision write files with several side sets..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test1.dmp | tee testwt1.res echo "testrd1 - single precision read test of a file with several side sets..." echo "testrd1 ... [Expect file create failure error, NOCLOBBER]" echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" echo "begin testrd1" >> test.output ${PREFIX} ${SRCDIR}/testrd1 | grep -v version | ${DIFF} - ${SRCDIR}/testrd1.dmp | tee testrd1.res echo "end testrd1" >> test.output echo "testwt_ss - write files to test side sets..." echo "testwt_ss ... [Expect WEDGE6 warning from this test]" echo "begin testwt_ss" >> test.output ${PREFIX} ${SRCDIR}/testwt_ss >> test.output echo "end testwt_ss" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res echo "testrd_ss - read test of a file with several side sets..." echo "testrd_ss ... [Expect warning for NULL sidesets 30 and 31]" echo "begin testrd_ss" >> test.output ${PREFIX} ${SRCDIR}/testrd_ss | grep -v version | ${DIFF} - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res echo "end testrd_ss" >> test.output echo "testwt2 - single precision write 2 files (simultaneously open) test..." echo "begin testwt2" >> test.output ${PREFIX} ${SRCDIR}/testwt2 >> test.output echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res echo "testrdwt - read from one and write to another (simutaneously open) file..." echo "begin testrdwt" >> test.output ${PREFIX} ${SRCDIR}/testrdwt >> test.output echo "end testrdwt" >> test.output ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2.dmp | tee testrdwt.res echo "testwt_nc - write x y z components of coordinates separately..." echo "begin testwt_nc" >> test.output ${PREFIX} ${SRCDIR}/testwt_nc >> test.output echo "end testwt_nc" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt_nc.res echo "testrd_nc - read x y z components of coordinates separately..." echo "begin testrd_nc" >> test.output ${PREFIX} ${SRCDIR}/testrd_nc | grep -v version | ${DIFF} - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res echo "end testrd" >> test.output echo "testwt-zeron - write file with zero nodes and elements..." echo "begin testwt-zeron" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeron >> test.output echo "end testwt-zeron" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res echo "testrd - read test of file with zero nodes and elements..." echo "begin testrd zero nodes" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res echo "end testrd zero nodes" >> test.output echo "testwt-zeroe - write file with zero elements..." echo "begin testwt-zeroe" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeroe >> test.output echo "end testwt-zeroe" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res echo "testrd - read test of file with zero elements..." echo "begin testrd zero elements" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res echo "end testrd zero elements" >> test.output echo "testwt-one-attrib - read/write test of element attributes - read one at a time..." echo "begin testwt-one-attrib - read attributes one at a time" >> test.output ${PREFIX} ${SRCDIR}/testwt-one-attrib | tee testrd_zeroe.res echo "end testwt-one-attrib - read attributes one at a time" >> test.output echo "testwt-nsided - write file with nsided elements..." echo "begin testwt-nsided" >> test.output ${PREFIX} ${SRCDIR}/testwt-nsided >> test.output echo "end testwt-nsided" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nsided.dmp | tee testwt-nsided.res echo "testrd-nsided - read file with nsided elements..." echo "begin testrd-nsided" >> test.output ${PREFIX} ${SRCDIR}/testrd-nsided | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nsided.dmp | tee testrd-nsided.res echo "end testrd-nsided" >> test.output echo "testwt-nfaced - write file with nfaced elements..." echo "begin testwt-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testwt-nfaced >> test.output echo "end testwt-nfaced" >> test.output ${NCDUMP} -d5,5 test-nfaced.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nfaced.dmp | tee testwt-nfaced.res echo "testrd-nfaced - read file with nfaced elements..." echo "begin testrd-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testrd-nfaced | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nfaced.dmp | tee testrd-nfaced.res echo "end testrd-nfaced" >> test.output echo "testwt-long-name - write file with long (64-character) names..." echo "begin testwt-long-name" >> test.output ${PREFIX} ${SRCDIR}/testwt-long-name >> test.output echo "end testwt-long-name" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-long-name.dmp | tee testwt-long-name.res echo "testrd - read long name file truncating to 32 characters on read..." echo "begin testrd (truncate)" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nm32.dmp | tee testrd-nm32.res echo "end testrd (truncate)" >> test.output echo "testrd-long-name - read long name file..." echo "begin testrd-long-name" >> test.output ${PREFIX} ${SRCDIR}/testrd-long-name | grep -v version | ${DIFF} - ${SRCDIR}/testrd-long-name.dmp | tee testrd-long-name.res echo "end testrd-long-name" >> test.output echo "test_nemesis - read long name file..." echo "begin test_nemesis" >> test.output ${PREFIX} ${SRCDIR}/test_nemesis | grep -v version | ${DIFF} - ${SRCDIR}/test_nemesis.dmp | tee test_nemesis.res echo "end test_nemesis" >> test.output echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/cbind/test/testall.standalone000066400000000000000000000265001225312213100234350ustar00rootroot00000000000000# 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. if ($#argv == 0) then set NCDUMP = `which ncdump` else set NCDUMP = $1 endif #set PREFIX = "valgrind --tool=memcheck" set PREFIX = "" set SRCDIR = . set DIFF = "diff -w" echo "************************************************************************" echo "************************************************************************" rm -f test.output echo "testwt - single precision write test..." echo "begin testwt" > test.output ${PREFIX} ${SRCDIR}/testwt >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt.res echo "testrd - single precision read test..." echo "begin testrd" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd.dmp | tee testrd.res echo "end testrd" >> test.output echo "testcp_ss - single-to-single precision copy test..." echo "begin testcp_ss" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res echo "testcp_sd - single-to-double precision copy test..." echo "begin testcp_sd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_sd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_sd.dmp | tee testcp_sd.res echo "testcp_ln - large model to normal model single precision copy test..." echo "begin testcp_ln" >> test.output ${PREFIX} ${SRCDIR}/testcp_ln >> test.output echo "end testcp_ln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ln.dmp | tee testcp_ln.res echo "testcp_nl - normal_model to large_model single precision copy test..." echo "begin testcp_nl" >> test.output ${PREFIX} ${SRCDIR}/testcp_nl >> test.output echo "end testcp_nl" >> test.output ${NCDUMP} -d5,5 testcp_nl.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_nl.dmp | tee testcp_nl.res echo "testwt_clb - single precision write test using concatenated puts..." echo "begin testwt_clb" >> test.output ${PREFIX} ${SRCDIR}/testwt_clb >> test.output echo "end testwt_clb" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test_clb.dmp | tee testwt_clb.res echo "testwtd - double precision write test..." echo "begin testwtd" >> test.output ${PREFIX} ${SRCDIR}/testwtd >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testd.dmp | tee testwtd.res echo "testrdd - double precision read test..." echo "begin testrdd" >> test.output ${PREFIX} ${SRCDIR}/testrdd | grep -v version | ${DIFF} - ${SRCDIR}/testrdd.dmp | tee testrdd.res echo "end testrdd" >> test.output echo "testcp_dd - double-to-double precision copy test..." echo "begin testcp_dd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_dd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_dd.dmp | tee testcp_dd.res echo "testcp_ds - double-to-single precision copy test..." echo "begin testcp_ds" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ds" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | ${DIFF} - ${SRCDIR}/testcp_ds.dmp | tee testcp_ds.res echo "testwt1 - single precision write files with several side sets..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test1.dmp | tee testwt1.res echo "testrd1 - single precision read test of a file with several side sets..." echo "testrd1 ... [Expect file create failure error, NOCLOBBER]" echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" echo "begin testrd1" >> test.output ${PREFIX} ${SRCDIR}/testrd1 | grep -v version | ${DIFF} - ${SRCDIR}/testrd1.dmp | tee testrd1.res echo "end testrd1" >> test.output echo "testwt_ss - write files to test side sets..." echo "testwt_ss ... [Expect WEDGE6 warning from this test]" echo "begin testwt_ss" >> test.output ${PREFIX} ${SRCDIR}/testwt_ss >> test.output echo "end testwt_ss" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt_ss.dmp | tee testwt_ss.res echo "testrd_ss - read test of a file with several side sets..." echo "testrd_ss ... [Expect warning for NULL sidesets 30 and 31]" echo "begin testrd_ss" >> test.output ${PREFIX} ${SRCDIR}/testrd_ss | grep -v version | ${DIFF} - ${SRCDIR}/testrd_ss.dmp | tee testrd_ss.res echo "end testrd_ss" >> test.output echo "testwt2 - single precision write 2 files (simultaneously open) test..." echo "begin testwt2" >> test.output ${PREFIX} ${SRCDIR}/testwt2 >> test.output echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res echo "testrdwt - read from one and write to another (simutaneously open) file..." echo "begin testrdwt" >> test.output ${PREFIX} ${SRCDIR}/testrdwt >> test.output echo "end testrdwt" >> test.output ${NCDUMP} -d5,5 test2.exo | grep -v version | ${DIFF} - ${SRCDIR}/test2.dmp | tee testrdwt.res echo "testwt_nc - write x y z components of coordinates separately..." echo "begin testwt_nc" >> test.output ${PREFIX} ${SRCDIR}/testwt_nc >> test.output echo "end testwt_nc" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/test.dmp | tee testwt_nc.res echo "testrd_nc - read x y z components of coordinates separately..." echo "begin testrd_nc" >> test.output ${PREFIX} ${SRCDIR}/testrd_nc | grep -v version | ${DIFF} - ${SRCDIR}/testrd_nc.dmp | tee testrd_nc.res echo "end testrd" >> test.output echo "testwt-zeron - write file with zero nodes and elements..." echo "begin testwt-zeron" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeron >> test.output echo "end testwt-zeron" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeron.dmp | tee testwt-zeron.res echo "testrd - read test of file with zero nodes and elements..." echo "begin testrd zero nodes" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeron.dmp | tee testrd_zeron.res echo "end testrd zero nodes" >> test.output echo "testwt-zeroe - write file with zero elements..." echo "begin testwt-zeroe" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeroe >> test.output echo "end testwt-zeroe" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-zeroe.dmp | tee testwt-zeroe.res echo "testrd - read test of file with zero elements..." echo "begin testrd zero elements" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd_zeroe.dmp | tee testrd_zeroe.res echo "end testrd zero elements" >> test.output echo "testwt-one-attrib - read/write test of element attributes - read one at a time..." echo "begin testwt-one-attrib - read attributes one at a time" >> test.output ${PREFIX} ${SRCDIR}/testwt-one-attrib | tee testrd_zeroe.res echo "end testwt-one-attrib - read attributes one at a time" >> test.output echo "testwt-nsided - write file with nsided elements..." echo "begin testwt-nsided" >> test.output ${PREFIX} ${SRCDIR}/testwt-nsided >> test.output echo "end testwt-nsided" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nsided.dmp | tee testwt-nsided.res echo "testrd-nsided - read file with nsided elements..." echo "begin testrd-nsided" >> test.output ${PREFIX} ${SRCDIR}/testrd-nsided | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nsided.dmp | tee testrd-nsided.res echo "end testrd-nsided" >> test.output echo "testwt-nfaced - write file with nfaced elements..." echo "begin testwt-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testwt-nfaced >> test.output echo "end testwt-nfaced" >> test.output ${NCDUMP} -d5,5 test-nfaced.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-nfaced.dmp | tee testwt-nfaced.res echo "testrd-nfaced - read file with nfaced elements..." echo "begin testrd-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testrd-nfaced | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nfaced.dmp | tee testrd-nfaced.res echo "end testrd-nfaced" >> test.output echo "testwt-long-name - write file with long (64-character) names..." echo "begin testwt-long-name" >> test.output ${PREFIX} ${SRCDIR}/testwt-long-name >> test.output echo "end testwt-long-name" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | ${DIFF} - ${SRCDIR}/testwt-long-name.dmp | tee testwt-long-name.res echo "testrd - read long name file truncating to 32 characters on read..." echo "begin testrd (truncate)" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version | ${DIFF} - ${SRCDIR}/testrd-nm32.dmp | tee testrd-nm32.res echo "end testrd (truncate)" >> test.output echo "testrd-long-name - read long name file..." echo "begin testrd-long-name" >> test.output ${PREFIX} ${SRCDIR}/testrd-long-name | grep -v version | ${DIFF} - ${SRCDIR}/testrd-long-name.dmp | tee testrd-long-name.res echo "end testrd-long-name" >> test.output echo "test_nemesis - read long name file..." echo "begin test_nemesis" >> test.output ${PREFIX} ${SRCDIR}/test_nemesis | grep -v version | ${DIFF} - ${SRCDIR}/test_nemesis.dmp | tee test_nemesis.res echo "end test_nemesis" >> test.output echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/cbind/test/testcp.c000066400000000000000000000102641225312213100213610ustar00rootroot00000000000000/* * 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 #include #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 = 0; 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; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_dd.dmp000066400000000000000000000116011225312213100223620ustar00rootroot00000000000000netcdf testcpd { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 coordx(num_nodes) ; double coordy(num_nodes) ; double coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; double attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 8 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_ds.dmp000066400000000000000000000115631225312213100224100ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_ln.c000066400000000000000000000103541225312213100220520ustar00rootroot00000000000000/* * 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 #include #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 = 0; 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; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_ln.dmp000066400000000000000000000147271225312213100224200ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 7 ; num_node_sets = 2 ; num_side_sets = 5 ; num_att_in_nblk = 2 ; num_el_in_blk1 = 1 ; num_nod_per_el1 = 4 ; num_att_in_blk1 = 1 ; 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_att_in_ns1 = 1 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; float nattrb(num_nodes, num_att_in_nblk) ; char nattrib_name(num_att_in_nblk, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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" ; float nsattrb1(num_nod_ns1, num_att_in_ns1) ; char nsattrib_name1(num_att_in_ns1, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 0 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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" ; coor_names = "xcoor", "ycoor", "zcoor" ; nattrb = 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 1, 0, 0, 10, 0, 10, 0, 1, 0, 1, 10, 10, 10, 10, 10, 1, 10, 0, 0, 1, 0, 10, 0, 7, 5, 3, 0, 6, 0, 0, 0, 3, 2, 6, 2, 0, 2, 2.7, 1.7, 6, 1.7, 5.7, 1.7, 3.7, 0, 0, 0, 10, 0, 10, 10 ; nattrib_name = "Node_attr_1", "Node_attr_2" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; attrib1 = 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; dist_fact_ns2 = 1.1, 2.1, 3.1 ; ns_prop2 = 4, 5 ; ns_prop3 = 1000, 2000 ; nsattrb1 = 0, 1, 1, 0, 1 ; nsattrib_name1 = "Nodeset_attribute" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_nl.c000066400000000000000000000103601225312213100220470ustar00rootroot00000000000000/* * 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 #include #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 = 0; 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 ("testcp.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; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_nl.dmp000066400000000000000000000150331225312213100224070ustar00rootroot00000000000000netcdf testcp_nl { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 7 ; num_node_sets = 2 ; num_side_sets = 5 ; num_att_in_nblk = 2 ; num_el_in_blk1 = 1 ; num_nod_per_el1 = 4 ; num_att_in_blk1 = 1 ; 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_att_in_ns1 = 1 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; float nattrb(num_nodes, num_att_in_nblk) ; char nattrib_name(num_att_in_nblk, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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" ; float nsattrb1(num_nod_ns1, num_att_in_ns1) ; char nsattrib_name1(num_att_in_ns1, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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" ; coor_names = "xcoor", "ycoor", "zcoor" ; nattrb = 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 1, 0, 0, 10, 0, 10, 0, 1, 0, 1, 10, 10, 10, 10, 10, 1, 10, 0, 0, 1, 0, 10, 0, 7, 5, 3, 0, 6, 0, 0, 0, 3, 2, 6, 2, 0, 2, 2.7, 1.7, 6, 1.7, 5.7, 1.7, 3.7, 0, 0, 0, 10, 0, 10, 10 ; nattrib_name = "Node_attr_1", "Node_attr_2" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; attrib1 = 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; dist_fact_ns2 = 1.1, 2.1, 3.1 ; ns_prop2 = 4, 5 ; ns_prop3 = 1000, 2000 ; nsattrb1 = 0, 1, 1, 0, 1 ; nsattrib_name1 = "Nodeset_attribute" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_sd.dmp000066400000000000000000000150521225312213100224050ustar00rootroot00000000000000netcdf testcpd { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 7 ; num_node_sets = 2 ; num_side_sets = 5 ; num_att_in_nblk = 2 ; num_el_in_blk1 = 1 ; num_nod_per_el1 = 4 ; num_att_in_blk1 = 1 ; 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_att_in_ns1 = 1 ; 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 coordx(num_nodes) ; double coordy(num_nodes) ; double coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; double nattrb(num_nodes, num_att_in_nblk) ; char nattrib_name(num_att_in_nblk, len_name) ; int elem_map(num_elem) ; double attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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" ; double nsattrb1(num_nod_ns1, num_att_in_ns1) ; char nsattrib_name1(num_att_in_ns1, len_name) ; 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: :floating_point_word_size = 8 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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" ; coor_names = "xcoor", "ycoor", "zcoor" ; nattrb = 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 1, 0, 0, 10, 0, 10, 0, 1, 0, 1, 10, 10, 10, 10, 10, 1, 10, 0, 0, 1, 0, 10, 0, 7, 5, 3, 0, 6, 0, 0, 0, 3, 2, 6, 2, 0, 2, 2.7, 1.7, 6, 1.7, 5.7, 1.7, 3.7, 0, 0, 0, 10, 0, 10, 10 ; nattrib_name = "Node_attr_1", "Node_attr_2" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; attrib1 = 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; dist_fact_ns2 = 1.1, 2.1, 3.1 ; ns_prop2 = 4, 5 ; ns_prop3 = 1000, 2000 ; nsattrb1 = 0, 1, 1, 0, 1 ; nsattrib_name1 = "Nodeset_attribute" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcp_ss.dmp000066400000000000000000000150301225312213100224200ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 7 ; num_node_sets = 2 ; num_side_sets = 5 ; num_att_in_nblk = 2 ; num_el_in_blk1 = 1 ; num_nod_per_el1 = 4 ; num_att_in_blk1 = 1 ; 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_att_in_ns1 = 1 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; float nattrb(num_nodes, num_att_in_nblk) ; char nattrib_name(num_att_in_nblk, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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" ; float nsattrb1(num_nod_ns1, num_att_in_ns1) ; char nsattrib_name1(num_att_in_ns1, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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" ; coor_names = "xcoor", "ycoor", "zcoor" ; nattrb = 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 1, 0, 0, 10, 0, 10, 0, 1, 0, 1, 10, 10, 10, 10, 10, 1, 10, 0, 0, 1, 0, 10, 0, 7, 5, 3, 0, 6, 0, 0, 0, 3, 2, 6, 2, 0, 2, 2.7, 1.7, 6, 1.7, 5.7, 1.7, 3.7, 0, 0, 0, 10, 0, 10, 10 ; nattrib_name = "Node_attr_1", "Node_attr_2" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; attrib1 = 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; dist_fact_ns2 = 1.1, 2.1, 3.1 ; ns_prop2 = 4, 5 ; ns_prop3 = 1000, 2000 ; nsattrb1 = 0, 1, 1, 0, 1 ; nsattrib_name1 = "Nodeset_attribute" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testcpd.c000066400000000000000000000103411225312213100215210ustar00rootroot00000000000000/* * 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 #include #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 = 0; /* 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; } exodusii-6.02.dfsg.1/exodus/cbind/test/testd.dmp000066400000000000000000000266541225312213100215520ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; double coordy(num_nodes) ; double coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; double attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; double vals_glo_var(time_step, num_glo_var) ; double vals_nod_var1(time_step, num_nodes) ; double vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 8 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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 = 10, 11, 12, 13, 14 ; dist_fact_ns1 = 1, 2, 3, 4, 5 ; node_ns2 = 20, 21, 22 ; 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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testrd-groups.c000066400000000000000000001152551225312213100227070ustar00rootroot00000000000000/* * Copyright (c) 2013 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 - * * *****************************************************************************/ #include #include #include #include "netcdf.h" #include "exodusII.h" /* #include "drmd.h" */ int main (int argc, char **argv) { int exoid, root_id, 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 = NULL; int *num_elem_per_set = NULL; int *num_df_per_set = NULL; int *node_ind = NULL; int *elem_ind = NULL; int *df_ind = NULL; int 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 = NULL; int *num_nodes_per_elem = NULL; int *num_attr = NULL; 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; int num_groups, group, group_ids[10]; 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 title_chk[MAX_LINE_LENGTH+1]; char *cdum = 0; char *prop_names[3]; 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-groups.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-groups.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); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* ncopts = NC_VERBOSE; */ /* See how many groups are children of the 'root_id'... */ root_id = exoid; num_groups = ex_inquire_int(root_id, EX_INQ_NUM_CHILD_GROUPS); printf ("file 'test-groups.exo' contains %d groups\n", num_groups); /* Get the group ids for each group... */ ex_get_group_ids(exoid, &idum, group_ids); if (num_groups != idum) { printf ("error - child group mismatch between ex_get_group_ids %d and ex_inquire %d\n", idum, num_groups); } for (group=0; group < num_groups; group++) { /* Get the name of the group... */ float rdum; exoid = group_ids[group]; ex_inquire(exoid, EX_INQ_GROUP_NAME, &idum, &rdum, name); printf ("\tId for group %d, named '%s' is %d\n", group, name, group_ids[group]); /* 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); /* Check that ex_inquire gives same title */ error = ex_inquire (exoid, EX_INQ_TITLE, &idum, &fdum, title_chk); printf (" after ex_inquire, error = %d\n", error); if (strcmp(title, title_chk) != 0) { printf ("error in ex_inquire for EX_INQ_TITLE\n"); } /* read nodal coordinates values and names from database */ x = (float *) calloc(num_nodes, sizeof(float)); if (num_dim >= 2) y = (float *) calloc(num_nodes, sizeof(float)); else y = 0; 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= 2) { printf ("y coords = \n"); for (i=0; i= 3) { printf ("z coords = \n"); for (i=0; i= 2) free (y); if (num_dim >= 3) free (z); for (i=0; i1) printf ("y coord name = '%s'\n", coord_names[1]); if (num_dim >2) printf ("z coord name = '%s'\n", coord_names[2]); for (i=0; i 0) { for (j=0; j 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 0) { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 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 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 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 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 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 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 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 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 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 0) { var_values = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, time_step, var_index, ids[i], num_elem_in_block[i], var_values); printf ("\nafter ex_get_elem_var, error = %3d\n", error); 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 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 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 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 0) free (num_nodes_per_set); } error = ex_close (root_id); printf ("\nafter ex_close, error = %3d\n", error); return 0; } exodusii-6.02.dfsg.1/exodus/cbind/test/testrd-long-name.c000066400000000000000000001145251225312213100232440ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #include #include #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 = NULL; int *num_elem_per_set = NULL; int *num_df_per_set = NULL; int *node_ind = NULL; int *elem_ind = NULL; int *df_ind = NULL; int 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 = NULL; int *num_nodes_per_elem = NULL; int *num_attr = NULL; 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; int max_name_length; 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 title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1]; char title_chk[MAX_LINE_LENGTH+1]; char *cdum = 0; char *prop_names[3]; char *name = NULL; 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); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* Query size of names used in this file */ { int max_all_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); int max_use_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH); printf ("This file can use at most %d-character names\n", max_all_name_length); printf ("The maximum name length used is %d-character names\n", max_use_name_length); max_name_length = max_use_name_length; ex_set_max_name_length(exoid, max_name_length); } name = (char *) calloc(max_name_length+1, sizeof(char)); /* 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); /* Check that ex_inquire gives same title */ error = ex_inquire (exoid, EX_INQ_TITLE, &idum, &fdum, title_chk); printf ("after ex_inquire, error = %3d\n", error); if (strcmp(title, title_chk) != 0) { printf ("error in ex_inquire for EX_INQ_TITLE\n"); } /* 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= 3) { printf ("z coords = \n"); for (i=0; i= 3) free (z); for (i=0; i2) printf ("z coord name = '%s'\n", coord_names[2]); for (i=0; i 0) { for (j=0; j 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 0) { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 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 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 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 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 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 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 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 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 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 0) { var_values = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, time_step, var_index, ids[i], num_elem_in_block[i], var_values); printf ("\nafter ex_get_elem_var, error = %3d\n", error); 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 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 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 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 0) free (num_nodes_per_set); free (name); error = ex_close (exoid); printf ("\nafter ex_close, error = %3d\n", error); return 0; } exodusii-6.02.dfsg.1/exodus/cbind/test/testrd-long-name.dmp000066400000000000000000000373511225312213100236030ustar00rootroot00000000000000 after ex_open I/O word size 4 This file can use at most 127-character names The maximum name length used is 64-character names 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_inquire, error = 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 = 'X coordinate name that is padded to be longer than 32 characters' y coord name = 'Y coordinate name that is padded to be longer than 32 characters' z coord name = 'Z coordinate name that is padded to be longer than 32 characters' after ex_get_attr_param, error = 0 num nodal attributes = 2 after ex_get_attr_names, error = 0 nodal attribute 0 = 'Node_attr_1' after ex_get_one_attr, error = 0 0.0 1.0 1.0 0.0 1.0 2.0 2.0 1.0 0.0 10.0 10.0 1.0 1.0 10.0 10.0 1.0 0.0 1.0 10.0 7.0 3.0 6.0 0.0 3.0 6.0 0.0 2.7 6.0 5.7 3.7 0.0 10.0 10.0 nodal attribute 1 = 'Node_attr_2' after ex_get_one_attr, error = 0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 10.0 10.0 10.0 10.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 2.0 2.0 2.0 1.7 1.7 1.7 0.0 0.0 0.0 10.0 after ex_get_map, error = 0 elem_map(0) = 1 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 = 'Very long name for block_1 that exceeds 32 characters' 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 = 'Very long name for block_2 that exceeds 32 characters' 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 = 'Very long name for block_3 that exceeds 32 characters' 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 = 'Very long name for block_4 that exceeds 32 characters' 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 = 'Very long name for block_5 that exceeds 32 characters' 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 = 'Very long name for block_6 that exceeds 32 characters' 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 = 'Very long name for block_7 that exceeds 32 characters' after ex_inquire, error = 0 There are 3 properties for each element block after ex_get_prop_names, error = 0 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 'The name for the attribute representing the shell thickness' = 3.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 11 attribute 'The name for the attribute representing the shell thickness' = 6.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 12 attribute 'The name for the attribute representing the shell thickness' = 6.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 13 attribute 'The name for the attribute representing the shell thickness' = 6.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 14 attribute 'The name for the attribute representing the shell thickness' = 6.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 15 attribute 'The name for the attribute representing the shell thickness' = 6.1416 after ex_get_elem_attr, error = 0 after ex_get_elem_attr_names, error = 0 element block 16 attribute 'The name for the attribute representing the shell 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 10 11 12 13 14 dist factors for node set 20 1.00 2.00 3.00 4.00 5.00 after ex_get_attr_param, error = 0 num nodeset attributes for nodeset 20 = 1 after ex_get_attr_names, error = 0 nodeset attribute 0 = 'Nodeset_attribute' after ex_get_one_attr, error = 0 0.0 1.0 1.0 0.0 1.0 after ex_get_node_set_param, error = 0 node set 21 parameters: num_nodes = 3 name = 'nset_2' after ex_get_node_set, error = 0 after ex_get_node_set_dist_fact, error = 0 node list for node set 21 20 21 22 dist factors for node set 21 1.10 2.10 3.10 after ex_get_attr_param, error = 0 num nodeset attributes for nodeset 21 = 0 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 = 10 11 12 13 14 20 21 22 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_somewhat_long_name_0' 'node_variable_a_much_longer_name_that_is_not_too_long_name' after ex_get_var_param, error = 0 after ex_get_var_names, error = 0 There are 3 element variables; their names are : 'the_stress_on_the_elements_in_this_block_that_are_active_now' '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 exodusii-6.02.dfsg.1/exodus/cbind/test/testrd-nfaced.c000066400000000000000000000271611225312213100226060ustar00rootroot00000000000000/* * Copyright (c) 2010 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * testrd - read exodus file test-nsided.exo created by testwt-nsided * *****************************************************************************/ #include #include #include #include "netcdf.h" #include #include #include "exodusII.h" int main (int argc, char **argv) { int exoid, num_dim, num_nodes, num_elem_blk; int *num_elem_in_block, *num_face_in_block, *num_nodes_per_elem, *num_edges_per_elem, *num_faces_per_elem, *num_attr; int error, nnodes; int i, j, k; int *connect, *fconnect; int *ids, *nnpe, *nnpf; int num_qa_rec, num_info; int CPU_word_size,IO_word_size; int idum; float *x, *y, *z; float version, fdum; char *coord_names[3], *qa_record[2][4], *info[3]; char *block_names[10]; char *elem_type[10]; char name[MAX_STR_LENGTH+1]; char *cdum = 0; CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 0; /* use what is stored in file */ ex_opts (EX_VERBOSE | EX_ABORT ); /* open EXODUS II files */ exoid = ex_open ("test-nfaced.exo", /* filename path */ EX_READ, /* access mode = READ */ &CPU_word_size, /* CPU word size */ &IO_word_size, /* IO word size */ &version); /* ExodusII library version */ printf ("\nafter ex_open\n"); if (exoid < 0) exit(1); printf ("test.exo is an EXODUSII file; version %4.2f\n", version); printf (" I/O word size %1d\n",IO_word_size); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* read database parameters */ { ex_init_params par; error = ex_get_init_ext (exoid, &par); printf ("after ex_get_init, error = %3d\n", error); printf ("database parameters:\n"); printf ("title = '%s'\n",par.title); printf ("num_dim = %"PRId64"\n",par.num_dim); printf ("num_nodes = %"PRId64"\n",par.num_nodes); printf ("num_edge = %"PRId64"\n",par.num_edge); printf ("num_face = %"PRId64"\n",par.num_face); printf ("num_elem = %"PRId64"\n",par.num_elem); printf ("num_elem_blk = %"PRId64"\n",par.num_elem_blk); printf ("num_node_sets = %"PRId64"\n",par.num_node_sets); printf ("num_side_sets = %"PRId64"\n",par.num_side_sets); num_dim = par.num_dim; num_nodes = par.num_nodes; num_elem_blk = par.num_elem_blk; } assert(num_dim == 3); /* read nodal coordinates values and names from database */ x = (float *) calloc(num_nodes, sizeof(float)); y = (float *) calloc(num_nodes, sizeof(float)); z = (float *) calloc(num_nodes, sizeof(float)); error = ex_get_coord (exoid, x, y, z); printf ("\nafter ex_get_coord, error = %3d\n", error); printf ("x, y, z coords = \n"); for (i=0; i 0) { ids = (int *) calloc(num_elem_blk, sizeof(int)); num_elem_in_block = (int *) calloc(num_elem_blk, sizeof(int)); num_face_in_block = (int *) calloc(num_elem_blk, sizeof(int)); num_nodes_per_elem = (int *) calloc(num_elem_blk, sizeof(int)); num_edges_per_elem = (int *) calloc(num_elem_blk, sizeof(int)); num_faces_per_elem = (int *) calloc(num_elem_blk, sizeof(int)); num_attr = (int *) calloc(num_elem_blk, sizeof(int)); for (i=0; i 0) { if (strcmp(elem_type[i], "NFACED") == 0 || strcmp(elem_type[i], "nfaced") == 0) { int nfaces = 0; connect = (int *) calloc((num_faces_per_elem[i]), sizeof(int)); nnpe = (int *) calloc(num_elem_in_block[i], sizeof(int)); error = ex_get_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ids[i], nnpe); printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error); for (j=0; j < num_elem_in_block[i]; j++) { nfaces += nnpe[j]; } assert(nfaces == num_faces_per_elem[i]); error = ex_get_conn (exoid, EX_ELEM_BLOCK, ids[i], NULL, NULL, connect); printf ("\nafter ex_get_conn, error = %d\n", error); printf ("face connectivity array for elem block %2d\n", ids[i]); nfaces = 0; for (j=0; j < num_elem_in_block[i]; j++) { printf("Element %d, %d faces:\t", j+1, nnpe[j]); for (k=0; k < nnpe[j]; k++) { printf("%3d ", connect[nfaces+k]); } printf("\n"); nfaces += nnpe[j]; } /* Now get the faces and their connectivity... */ /* * Convention is that the faces for an nfaced block are in a * face block which has the same id as the element block... * (Or, at least let's try that for awhile and see if it works...) */ /* NOTE: We are overwriting the element block data here... */ error = ex_get_block (exoid, EX_FACE_BLOCK, ids[i], elem_type[i], &(num_face_in_block[i]), &(num_nodes_per_elem[i]), NULL, NULL, &(num_attr[i])); printf ("\nafter ex_get_block (EX_FACE_BLOCK), error = %d\n", error); error = ex_get_names(exoid, EX_FACE_BLOCK, block_names); printf ("\nafter ex_get_names, error = %3d\n", error); printf ("\tface block id = %2d\n",ids[i]); printf ("\tface block type = '%s'\n", elem_type[i]); printf ("\tnum_face_in_block = %2d\n",num_face_in_block[i]); printf ("\tnum_total_nodes_per_block = %2d\n",num_nodes_per_elem[i]); printf ("\tnum_attr = %2d\n",num_attr[i]); printf ("\tname = '%s'\n",block_names[i]); fconnect = (int *) calloc((num_nodes_per_elem[i]), sizeof(int)); nnpf = (int *) calloc(num_face_in_block[i], sizeof(int)); error = ex_get_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, ids[i], nnpf); printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error); nnodes = 0; for (j=0; j < num_face_in_block[i]; j++) { nnodes += nnpf[j]; } assert(nnodes == num_nodes_per_elem[i]); error = ex_get_conn (exoid, EX_FACE_BLOCK, ids[i], fconnect, NULL, NULL); printf ("\nafter ex_get_conn, error = %d\n", error); printf ("node connectivity array for face block %2d\n", ids[i]); nnodes = 0; for (j=0; j < num_face_in_block[i]; j++) { printf("Face %d, %d nodes:\t", j+1, nnpf[j]); for (k=0; k < nnpf[j]; k++) { printf("%3d ", fconnect[nnodes+k]); } printf("\n"); nnodes += nnpf[j]; } free(fconnect); free(nnpe); free(nnpf); } else { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { free (ids); free (num_nodes_per_elem); free (num_edges_per_elem); free (num_faces_per_elem); free (num_attr); } /* read QA records */ ex_inquire (exoid, EX_INQ_QA, &num_qa_rec, &fdum, cdum); for (i=0; i #include #include #include "netcdf.h" #include #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, nnodes; int i, j, k; int *elem_map = NULL; int *connect = NULL; int *node_list = NULL; int *node_ctr_list = NULL; int *elem_list = NULL; int *side_list = NULL; int *ids = NULL; int *nnpe = NULL; int *num_nodes_per_set = NULL; int *num_elem_per_set = NULL; int *num_df_per_set = NULL; int *node_ind = NULL; int *elem_ind = NULL; int *df_ind = NULL; int 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 = NULL; int num_time_steps; int *num_elem_in_block = NULL; int *num_nodes_per_elem = NULL; int *num_attr = NULL; int num_nodes_in_set, num_elem_in_set; int num_sides_in_set, num_df_in_set; int list_len, elem_list_len, df_list_len; int node_num, time_step, var_index, beg_time, end_time, elem_num; int CPU_word_size,IO_word_size; int num_props, prop_value, *prop_values; 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 *elem_type[10]; char name[MAX_STR_LENGTH+1]; char title[MAX_LINE_LENGTH+1]; char *cdum = 0; char *prop_names[3]; 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-nsided.exo", /* filename path */ EX_READ, /* access mode = READ */ &CPU_word_size, /* CPU word size */ &IO_word_size, /* IO word size */ &version); /* ExodusII library version */ printf ("\nafter ex_open\n"); if (exoid < 0) exit(1); printf ("test.exo is an EXODUSII file; version %4.2f\n", version); printf (" I/O word size %1d\n",IO_word_size); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* read database parameters */ 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= 3) { printf ("z coords = \n"); for (i=0; i= 3) free (z); for (i=0; i 0) { for (j=0; j 0) { ids = (int *) calloc(num_elem_blk, sizeof(int)); num_elem_in_block = (int *) calloc(num_elem_blk, sizeof(int)); num_nodes_per_elem = (int *) calloc(num_elem_blk, sizeof(int)); num_attr = (int *) calloc(num_elem_blk, sizeof(int)); for (i=0; i 0) { if (strcmp(elem_type[i], "NSIDED") == 0 || strcmp(elem_type[i], "nsided") == 0) { connect = (int *) calloc((num_nodes_per_elem[i]), sizeof(int)); nnpe = (int *) calloc(num_elem_in_block[i], sizeof(int)); error = ex_get_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ids[i], nnpe); printf ("\nafter ex_get_entity_count_per_polyhedra, error = %d\n", error); nnodes = 0; for (j=0; j < num_elem_in_block[i]; j++) { nnodes += nnpe[j]; } assert(nnodes == num_nodes_per_elem[i]); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); nnodes = 0; for (j=0; j < num_elem_in_block[i]; j++) { printf("Element %d, %d nodes:\t", j+1, nnpe[j]); for (k=0; k < nnpe[j]; k++) { printf("%3d ", connect[nnodes+k]); } printf("\n"); nnodes += nnpe[j]; } free(nnpe); } else { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 0) { error = ex_inquire(exoid, EX_INQ_SS_ELEM_LEN, &elem_list_len, &fdum, cdum); printf ("\nafter ex_inquire: EX_INQ_SS_ELEM_LEN = %d, error = %d\n", elem_list_len, error); error = ex_inquire(exoid, EX_INQ_SS_DF_LEN, &df_list_len, &fdum, cdum); printf ("\nafter ex_inquire: EX_INQ_SS_DF_LEN = %d, error = %d\n", df_list_len, error); } /* 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 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 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 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 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 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 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 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 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 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 0) { var_values = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, time_step, var_index, ids[i], num_elem_in_block[i], var_values); printf ("\nafter ex_get_elem_var, error = %3d\n", error); 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 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 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 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 0) free (num_nodes_per_set); for (i=0; i #include #include #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 = NULL; int *num_elem_per_set = NULL; int *num_df_per_set = NULL; int *node_ind = NULL; int *elem_ind = NULL; int *df_ind = NULL; int 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 = NULL; int *num_nodes_per_elem = NULL; int *num_attr = NULL; 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 title_chk[MAX_LINE_LENGTH+1]; char *cdum = 0; char *prop_names[3]; 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); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* ncopts = NC_VERBOSE; */ /* read database parameters */ 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); /* Check that ex_inquire gives same title */ error = ex_inquire (exoid, EX_INQ_TITLE, &idum, &fdum, title_chk); printf (" after ex_inquire, error = %d\n", error); if (strcmp(title, title_chk) != 0) { printf ("error in ex_inquire for EX_INQ_TITLE\n"); } /* read nodal coordinates values and names from database */ x = (float *) calloc(num_nodes, sizeof(float)); if (num_dim >= 2) y = (float *) calloc(num_nodes, sizeof(float)); else y = 0; 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= 2) { printf ("y coords = \n"); for (i=0; i= 3) { printf ("z coords = \n"); for (i=0; i= 2) free (y); if (num_dim >= 3) free (z); for (i=0; i1) printf ("y coord name = '%s'\n", coord_names[1]); if (num_dim >2) printf ("z coord name = '%s'\n", coord_names[2]); for (i=0; i 0) { for (j=0; j 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 0) { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 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 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 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 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 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 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 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 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 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 0) { var_values = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, time_step, var_index, ids[i], num_elem_in_block[i], var_values); printf ("\nafter ex_get_elem_var, error = %3d\n", error); 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 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 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 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 0) free (num_nodes_per_set); error = ex_close (exoid); printf ("\nafter ex_close, error = %3d\n", error); return 0; } exodusii-6.02.dfsg.1/exodus/cbind/test/testrd.dmp000066400000000000000000000354171225312213100217310ustar00rootroot00000000000000 after ex_open I/O word size 4 after ex_get_init, error = 0 database parameters: title = 'This is a test' num_dim = 3 num_nodes = 33 num_elem = 7 num_elem_blk = 7 num_node_sets = 2 num_side_sets = 5 after ex_inquire, error = 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' z coord name = 'zcoor' after ex_get_attr_param, error = 0 num nodal attributes = 2 after ex_get_attr_names, error = 0 nodal attribute 0 = 'Node_attr_1' after ex_get_one_attr, error = 0 0.0 1.0 1.0 0.0 1.0 2.0 2.0 1.0 0.0 10.0 10.0 1.0 1.0 10.0 10.0 1.0 0.0 1.0 10.0 7.0 3.0 6.0 0.0 3.0 6.0 0.0 2.7 6.0 5.7 3.7 0.0 10.0 10.0 nodal attribute 1 = 'Node_attr_2' after ex_get_one_attr, error = 0 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 10.0 10.0 10.0 10.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 2.0 2.0 2.0 1.7 1.7 1.7 0.0 0.0 0.0 10.0 after ex_get_map, error = 0 elem_map(0) = 1 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( 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 10 11 12 13 14 dist factors for node set 20 1.00 2.00 3.00 4.00 5.00 after ex_get_attr_param, error = 0 num nodeset attributes for nodeset 20 = 1 after ex_get_attr_names, error = 0 nodeset attribute 0 = 'Nodeset_attribute' after ex_get_one_attr, error = 0 0.0 1.0 1.0 0.0 1.0 after ex_get_node_set_param, error = 0 node set 21 parameters: num_nodes = 3 name = 'nset_2' after ex_get_node_set, error = 0 after ex_get_node_set_dist_fact, error = 0 node list for node set 21 20 21 22 dist factors for node set 21 1.10 2.10 3.10 after ex_get_attr_param, error = 0 num nodeset attributes for nodeset 21 = 0 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 = 10 11 12 13 14 20 21 22 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 : 'this_variable_name_is_short' 'this_variable_name_is_just_right' 'this_variable_name_is_tooooo_lon' 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 exodusii-6.02.dfsg.1/exodus/cbind/test/testrd1.c000066400000000000000000001001271225312213100214430ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ #include #include #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 = 0; int elem_list_len = 0; int node_list_len = 0; int df_list_len = 0; 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[10]; char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1]; char *cdum = 0; char *prop_names[3]; char *map_names[3]; 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= 3) { printf ("z coords = \n"); for (i=0; i= 3) free (z); for (i=0; i 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 #include #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 = 0; int elem_list_len = 0; int node_list_len = 0; int df_list_len = 0; 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 = 0; char *prop_names[3]; 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 ("\nafter ex_get_coord (x), error = %3d\n", error); printf ("x coords = \n"); for (i=0; i= 3) { printf ("z coords = \n"); for (i=0; i 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 #include #include #include #include "exodusII_par.h" int main (int argc, char **argv) { MPI_Comm mpi_comm = MPI_COMM_WORLD; MPI_Info mpi_info = MPI_INFO_NULL; 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 = NULL; int *num_elem_per_set = NULL; int *num_df_per_set = NULL; int *node_ind = NULL; int *elem_ind = NULL; int *df_ind = NULL; int 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 = NULL; int *num_nodes_per_elem = NULL; int *num_attr = NULL; 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 title_chk[MAX_LINE_LENGTH+1]; char *cdum = 0; char *prop_names[3]; CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 0; /* use what is stored in file */ ex_opts (EX_VERBOSE | EX_ABORT ); /* Initialize MPI. */ MPI_Init(&argc,&argv); /* open EXODUS II files */ exoid = ex_open_par ("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 */ mpi_comm, mpi_info); 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); ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum); printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum); /* ncopts = NC_VERBOSE; */ /* read database parameters */ 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); /* Check that ex_inquire gives same title */ error = ex_inquire (exoid, EX_INQ_TITLE, &idum, &fdum, title_chk); printf (" after ex_inquire, error = %d\n", error); if (strcmp(title, title_chk) != 0) { printf ("error in ex_inquire for EX_INQ_TITLE\n"); } /* read nodal coordinates values and names from database */ x = (float *) calloc(num_nodes, sizeof(float)); if (num_dim >= 2) y = (float *) calloc(num_nodes, sizeof(float)); else y = 0; 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= 2) { printf ("y coords = \n"); for (i=0; i= 3) { printf ("z coords = \n"); for (i=0; i= 2) free (y); if (num_dim >= 3) free (z); for (i=0; i1) printf ("y coord name = '%s'\n", coord_names[1]); if (num_dim >2) printf ("z coord name = '%s'\n", coord_names[2]); for (i=0; i 0) { for (j=0; j 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 0) { connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), sizeof(int)); error = ex_get_elem_conn (exoid, ids[i], connect); printf ("\nafter ex_get_elem_conn, error = %d\n", error); printf ("connect array for elem block %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 0) { for (j=0; j 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 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 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 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 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 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 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 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 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 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 0) { var_values = (float *) calloc (num_elem_in_block[i], sizeof(float)); error = ex_get_elem_var (exoid, time_step, var_index, ids[i], num_elem_in_block[i], var_values); printf ("\nafter ex_get_elem_var, error = %3d\n", error); 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 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 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 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 0) free (num_nodes_per_set); error = ex_close (exoid); printf ("\nafter ex_close, error = %3d\n", error); MPI_Finalize(); return 0; } exodusii-6.02.dfsg.1/exodus/cbind/test/testrd_ss.c000066400000000000000000000263071225312213100220760ustar00rootroot00000000000000/* * 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 #include #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 = 0; int node_list_len = 0; int df_list_len = 0; 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 = 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 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 #include #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 = 0; int elem_list_len = 0; int node_list_len = 0; int df_list_len = 0; 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 = 0; char *prop_names[3]; 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= 3) { printf ("z coords = \n"); for (i=0; i= 3) free (z); for (i=0; i 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 0) { printf ("dist factors for node set %2d\n", ids[i]); for (j=0; j 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 0) { printf ("dist factors for side set %2d\n", ids[i]); for (j=0; j 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 #include #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 = 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; i0) { /* 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 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 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; i0) { /* 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 #include #include "exodusII.h" int main (int argc, char **argv) { int exoid, rootid, 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[2]; char *title = "This is a test"; int group, num_groups=2; char *group_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 */ rootid = ex_create ("test-groups.exo", /* filename path */ EX_CLOBBER|EX_NETCDF4|EX_NOCLASSIC, /* 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-groups.exo, exoid = %d\n", exoid); printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size); /* ncopts = NC_VERBOSE; */ group_names[0] = "Group_0"; group_names[1] = "Group_1"; for (group = 0; group < num_groups; group++) { /* Now create a group using netdf direct call... */ exoid = ex_create_group(rootid, group_names[group]); printf ("after ex_create_group for group 'Group1' in 'test-groups.exo', exoid = %d\n", exoid); /* 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, 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); if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); exit(-1); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (rootid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x); if (error) { ex_close (rootid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y); if (error) { ex_close (rootid); exit(-1); } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); exit(-1); } error = ex_put_name(exoid, EX_ELEM_BLOCK, ebids[0], block_names[0]); if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); exit(-1); } /* Write element block names */ for (i=0; i < 7; i++) { error = ex_put_name(exoid, EX_ELEM_BLOCK, ebids[i], block_names[i]); printf ("after ex_put_names, error = %d\n", error); } if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); exit(-1); } node_list[0] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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 (rootid); 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 (rootid); 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 (rootid); exit(-1); } node_list[0] = 20; node_list[1] = 21; node_list[2] = 22; 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); exit(-1); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (rootid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (rootid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); exit(-1); } num_ele_vars = 3; /* 0 1 2 3 */ /* 12345678901234567890123456789012 */ var_names[0] = "this_variable_name_is_short"; var_names[1] = "this_variable_name_is_just_right"; var_names[2] = "this_variable_name_is_tooooo_long"; error = ex_put_var_param (exoid, "e", num_ele_vars); printf ("after ex_put_var_param, error = %d\n", error); if (error) { ex_close (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 (rootid); 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 #include /* #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], *variable_names[3]; char *block_names[10], *nset_names[10], *sset_names[10]; char *prop_names[2], *attrib_names[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ 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); ex_set_option(exoid, EX_OPT_MAX_NAME_LENGTH, 127); /* Using long names */ /* 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, 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); 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); } /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ coord_names[0] = "X coordinate name that is padded to be longer than 32 characters"; coord_names[1] = "Y coordinate name that is padded to be longer than 32 characters"; coord_names[2] = "Z coordinate name that is padded to be longer than 32 characters"; 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); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); 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 */ /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ block_names[0] = "Very long name for block_1 that exceeds 32 characters"; block_names[1] = "Very long name for block_2 that exceeds 32 characters"; block_names[2] = "Very long name for block_3 that exceeds 32 characters"; block_names[3] = "Very long name for block_4 that exceeds 32 characters"; block_names[4] = "Very long name for block_5 that exceeds 32 characters"; block_names[5] = "Very long name for block_6 that exceeds 32 characters"; block_names[6] = "Very long name for block_7 that exceeds 32 characters"; 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 */ /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ 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); } /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ attrib_names[0] = "The name for the attribute representing the shell 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write individual side sets */ num_face_in_sset[0] = 2; num_face_in_sset[1] = 2; 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; variable_names[0] = "glo_vars"; error = ex_put_variable_param (exoid, EX_GLOBAL, num_glo_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_GLOBAL, num_glo_vars, variable_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } num_nod_vars = 2; /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ variable_names[0] = "node_variable_a_somewhat_long_name_0"; variable_names[1] = "node_variable_a_much_longer_name_that_is_not_too_long_name"; error = ex_put_variable_param (exoid, EX_NODAL, num_nod_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, variable_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } num_ele_vars = 3; /* 0 1 2 3 4 5 6 */ /* 1234567890123456789012345678901234567890123456789012345678901234 */ variable_names[0] = "the_stress_on_the_elements_in_this_block_that_are_active_now"; variable_names[1] = "ele_var1"; variable_names[2] = "ele_var2"; error = ex_put_variable_param (exoid, EX_ELEM_BLOCK, num_ele_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_ELEM_BLOCK, num_ele_vars, variable_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } { num_nset_vars = 3; variable_names[0] = "ns_var0"; variable_names[1] = "ns_var1"; variable_names[2] = "ns_var2"; error = ex_put_variable_param (exoid, EX_NODE_SET, num_nset_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_NODE_SET, num_nset_vars, variable_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } } { num_sset_vars = 3; variable_names[0] = "ss_var0"; variable_names[1] = "ss_var1"; variable_names[2] = "ss_var2"; error = ex_put_variable_param (exoid, EX_SIDE_SET, num_sset_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_SIDE_SET, num_sset_vars, variable_names); printf ("after ex_put_variable_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 #include #include #include #include "exodusII.h" int main (int argc, char **argv) { int exoid, num_dim, num_nodes, num_elem, num_elem_blk; int num_elem_in_block[10], num_total_nodes_per_blk[10]; int num_face_in_block[10], num_total_faces_per_blk[10]; int num_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 bids[10], ssids[10], nsids[10], nnpe[10]; int num_qa_rec, num_info; int num_glo_vars, num_nod_vars, num_ele_vars, num_sset_vars, num_nset_vars; int *truth_tab; 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 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[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("test-nfaced.exo", /* filename path */ EX_CLOBBER, /* create mode */ &CPU_word_size, /* CPU float word size in bytes */ &IO_word_size); /* I/O float word size in bytes */ printf ("after ex_create for test.exo, exoid = %d\n", exoid); printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size); /* ncopts = NC_VERBOSE; */ /* initialize file with parameters */ { ex_init_params par; num_dim = 3; num_nodes = 14; num_elem = 1; num_elem_blk = 1; num_node_sets = 0; strcpy( par.title, title ); par.num_dim = num_dim; par.num_nodes = num_nodes; par.num_edge = 0; par.num_edge_blk = 0; par.num_face = 5; par.num_face_blk = 1; par.num_elem = num_elem; par.num_elem_blk = num_elem_blk; par.num_node_sets = num_node_sets; par.num_edge_sets = 0; par.num_face_sets = 0; par.num_side_sets = 0; par.num_elem_sets = 0; par.num_node_maps = 0; par.num_edge_maps = 0; par.num_face_maps = 0; par.num_elem_maps = 0; error = ex_put_init_ext (exoid, &par); printf ("after ex_put_init_ext, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } } /* write nodal coordinates values and names to database */ x[ 0] = 0.00000e+00 ; y[ 0] = 0.00000e+00 ; z[ 0] = 0.00000e+00 ; x[ 1] = 2.00000e+00 ; y[ 1] = 0.00000e+00 ; z[ 1] = 0.00000e+00 ; x[ 2] = 0.00000e+00 ; y[ 2] = 2.00000e+00 ; z[ 2] = 0.00000e+00 ; x[ 3] = 2.00000e+00 ; y[ 3] = 2.00000e+00 ; z[ 3] = 0.00000e+00 ; x[ 4] = 0.00000e+00 ; y[ 4] = 0.00000e+00 ; z[ 4] = 2.00000e+00 ; x[ 5] = 2.00000e+00 ; y[ 5] = 0.00000e+00 ; z[ 5] = 2.00000e+00 ; x[ 6] = 0.00000e+00 ; y[ 6] = 2.00000e+00 ; z[ 6] = 2.00000e+00 ; x[ 7] = 2.00000e+00 ; y[ 7] = 2.00000e+00 ; z[ 7] = 2.00000e+00 ; x[ 8] = 0.00000e+00 ; y[ 8] = 3.50000e+00 ; z[ 8] = 1.00000e+00 ; x[ 9] = 2.00000e+00 ; y[ 9] = 3.50000e+00 ; z[ 9] = 1.00000e+00 ; x[10] = 0.00000e+00 ; y[10] = 3.00000e+00 ; z[10] = 1.50000e+00 ; x[11] = 2.00000e+00 ; y[11] = 3.00000e+00 ; z[11] = 1.50000e+00 ; x[12] = 0.00000e+00 ; y[12] = 3.00000e+00 ; z[12] = 0.50000e+00 ; x[13] = 2.00000e+00 ; y[13] = 3.00000e+00 ; z[13] = 0.50000e+00 ; error = ex_put_coord (exoid, x, y, z); printf ("after ex_put_coord, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } coord_names[0] = "x"; coord_names[1] = "y"; coord_names[2] = "z"; error = ex_put_coord_names (exoid, coord_names); printf ("after ex_put_coord_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write the face block parameters */ block_names[0] = "face_block_1"; num_face_in_block[0] = 15; num_total_nodes_per_blk[0] = 54; bids[0] = 10; error = ex_put_block (exoid, EX_FACE_BLOCK, bids[0], "nsided", num_face_in_block[0], num_total_nodes_per_blk[0], 0, 0, 0); printf ("after ex_put_block, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write face connectivity */ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int)); i = 0; j = 0; connect[i++] = 5; connect[i++] = 6; connect[i++] = 8; /* connectivity of face 1 of element 1 */ connect[i++] = 2; connect[i++] = 1; connect[i++] = 4; /* face 2 of element 1 */ connect[i++] = 6; connect[i++] = 2; connect[i++] = 4; connect[i++] = 8; /* face 3 of element 1 */ connect[i++] = 8; connect[i++] = 4; connect[i++] = 1; connect[i++] = 5; /* face 4 of element 1 */ connect[i++] = 1; connect[i++] = 2; connect[i++] = 6; connect[i++] = 5; /* face 5 of element 1 */ connect[i++] = 5; connect[i++] = 8; connect[i++] = 7; /* connectivity of face 1 of element 2 */ connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4; nnpe[j++] = 4; connect[i++] = 5; connect[i++] = 3; connect[i++] = 4; connect[i++] = 6; nnpe[j++] = 4; connect[i++] = 5; connect[i++] = 1; connect[i++] = 2; connect[i++] = 6; nnpe[j++] = 4; connect[i++] = 6; connect[i++] = 2; connect[i++] = 4; nnpe[j++] = 3; connect[i++] = 5; connect[i++] = 3; connect[i++] = 1; nnpe[j++] = 3; assert(i == num_total_nodes_per_blk[0]); assert(j == num_face_in_block[0]); error = ex_put_conn (exoid, EX_FACE_BLOCK, bids[0], connect, NULL, NULL); printf ("after ex_put_conn, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } free (connect); connect = NULL; error = ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, bids[0], nnpe); printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write element block parameters */ block_names[0] = "nfaced_1"; num_elem_in_block[0] = 1; num_total_nodes_per_blk[0] = 6; /* Do we need this; does it make sense... */ num_total_faces_per_blk[0] = 5; bids[0] = 10; error = ex_put_block (exoid, EX_ELEM_BLOCK, bids[0], "nfaced", num_elem_in_block[0], 0, 0, num_total_faces_per_blk[0], 0); printf ("after ex_put_block, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write face block names */ error = ex_put_names(exoid, EX_FACE_BLOCK, block_names); printf ("after ex_put_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write element block names */ error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names); printf ("after ex_put_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write element-face connectivity */ connect = (int *) calloc(num_total_faces_per_blk[0], sizeof(int)); i = 0; j = 0; connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4; connect[i++] = 5; nnpe[j++] = 5; /* Number of faces per element */ assert(i == num_total_faces_per_blk[0]); assert(j == num_elem_in_block[0]); error = ex_put_conn (exoid, EX_ELEM_BLOCK, bids[0], NULL, NULL, connect); printf ("after ex_put_conn, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } free (connect); error = ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, bids[0], nnpe); printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write QA records; test empty and just blank-filled records */ num_qa_rec = 2; qa_record[0][0] = "TESTWT-NFACED"; qa_record[0][1] = "testwt-nfaced"; qa_record[0][2] = "2010/02/15"; qa_record[0][3] = "06:35:15"; qa_record[1][0] = ""; qa_record[1][1] = " "; qa_record[1][2] = ""; qa_record[1][3] = " "; error = ex_put_qa (exoid, num_qa_rec, qa_record); printf ("after ex_put_qa, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write information records; test empty and just blank-filled records */ num_info = 3; info[0] = "This is the first information record."; info[1] = ""; info[2] = " "; error = ex_put_info (exoid, num_info, info); printf ("after ex_put_info, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* 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] = "n"; 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); } /* write element variable truth table */ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int)); k = 0; for (i=0; i #include #include #include #include "exodusII.h" int main (int argc, char **argv) { int exoid, num_dim, num_nodes, num_elem, num_elem_blk; int num_elem_in_block[10], num_total_nodes_per_blk[10]; int num_face_in_block[10], num_total_faces_per_blk[10]; int num_node_sets, error; int i, j, *connect; int bids, nnpe[20]; int num_qa_rec, num_info; int CPU_word_size,IO_word_size; float x[100], y[100], z[100]; char *coord_names[3], *qa_record[2][4], *info[3]; char *block_names[10]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("test-nfaced.exo", /* filename path */ EX_CLOBBER, /* create mode */ &CPU_word_size, /* CPU float word size in bytes */ &IO_word_size); /* I/O float word size in bytes */ printf ("after ex_create for test.exo, exoid = %d\n", exoid); printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size); /* ncopts = NC_VERBOSE; */ /* initialize file with parameters */ { ex_init_params par; num_dim = 3; num_nodes = 14; num_elem = 3; num_elem_blk = 1; num_node_sets = 0; strcpy( par.title, title ); par.num_dim = num_dim; par.num_nodes = num_nodes; par.num_edge = 0; par.num_edge_blk = 0; par.num_face = 15; par.num_face_blk = 1; par.num_elem = num_elem; par.num_elem_blk = num_elem_blk; par.num_node_sets = num_node_sets; par.num_edge_sets = 0; par.num_face_sets = 0; par.num_side_sets = 0; par.num_elem_sets = 0; par.num_node_maps = 0; par.num_edge_maps = 0; par.num_face_maps = 0; par.num_elem_maps = 0; error = ex_put_init_ext (exoid, &par); printf ("after ex_put_init_ext, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } } /* write nodal coordinates values and names to database */ x[ 0] = 0.00000e+00 ; y[ 0] = 0.00000e+00 ; z[ 0] = 0.00000e+00 ; x[ 1] = 2.00000e+00 ; y[ 1] = 0.00000e+00 ; z[ 1] = 0.00000e+00 ; x[ 2] = 0.00000e+00 ; y[ 2] = 2.00000e+00 ; z[ 2] = 0.00000e+00 ; x[ 3] = 2.00000e+00 ; y[ 3] = 2.00000e+00 ; z[ 3] = 0.00000e+00 ; x[ 4] = 0.00000e+00 ; y[ 4] = 0.00000e+00 ; z[ 4] = 2.00000e+00 ; x[ 5] = 2.00000e+00 ; y[ 5] = 0.00000e+00 ; z[ 5] = 2.00000e+00 ; x[ 6] = 0.00000e+00 ; y[ 6] = 2.00000e+00 ; z[ 6] = 2.00000e+00 ; x[ 7] = 2.00000e+00 ; y[ 7] = 2.00000e+00 ; z[ 7] = 2.00000e+00 ; x[ 8] = 0.00000e+00 ; y[ 8] = 3.50000e+00 ; z[ 8] = 1.00000e+00 ; x[ 9] = 2.00000e+00 ; y[ 9] = 3.50000e+00 ; z[ 9] = 1.00000e+00 ; x[10] = 0.00000e+00 ; y[10] = 3.00000e+00 ; z[10] = 1.50000e+00 ; x[11] = 2.00000e+00 ; y[11] = 3.00000e+00 ; z[11] = 1.50000e+00 ; x[12] = 0.00000e+00 ; y[12] = 3.00000e+00 ; z[12] = 0.50000e+00 ; x[13] = 2.00000e+00 ; y[13] = 3.00000e+00 ; z[13] = 0.50000e+00 ; error = ex_put_coord (exoid, x, y, z); printf ("after ex_put_coord, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } coord_names[0] = "x"; coord_names[1] = "y"; coord_names[2] = "z"; error = ex_put_coord_names (exoid, coord_names); printf ("after ex_put_coord_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write the face block parameters */ block_names[0] = "face_block_1"; num_face_in_block[0] = 15; num_total_nodes_per_blk[0] = 58; bids = 10; error = ex_put_block (exoid, EX_FACE_BLOCK, bids, "nsided", num_face_in_block[0], num_total_nodes_per_blk[0], 0, 0, 0); printf ("after ex_put_block, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write face block names */ error = ex_put_names(exoid, EX_FACE_BLOCK, block_names); printf ("after ex_put_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write face connectivity */ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int)); i = 0; j = 0; connect[i++] = 5; connect[i++] = 6; connect[i++] = 8; /* connectivity of face 1 of element 1 */ nnpe[j++] = 3; connect[i++] = 2; connect[i++] = 1; connect[i++] = 4; /* face 2 of element 1 */ nnpe[j++] = 3; connect[i++] = 6; connect[i++] = 2; connect[i++] = 4; connect[i++] = 8; /* face 3 of element 1 */ nnpe[j++] = 4; connect[i++] = 8; connect[i++] = 4; connect[i++] = 1; connect[i++] = 5; /* face 4 of element 1 */ nnpe[j++] = 4; connect[i++] = 1; connect[i++] = 2; connect[i++] = 6; connect[i++] = 5; /* face 5 of element 1 */ nnpe[j++] = 4; connect[i++] = 5; connect[i++] = 8; connect[i++] = 7; /* connectivity of face 1 of element 2 */ nnpe[j++] = 3; connect[i++] = 1; connect[i++] = 3; connect[i++] = 4; /* face 2 of element 2 */ nnpe[j++] = 3; connect[i++] = 7; connect[i++] = 8; connect[i++] = 4; connect[i++] = 3; /* face 3 of element 2 */ nnpe[j++] = 4; connect[i++] = 7; connect[i++] = 3; connect[i++] = 1; connect[i++] = 5; /* face 4 of element 2 */ nnpe[j++] = 4; connect[i++] = 8; connect[i++] = 4; connect[i++] = 14; connect[i++] = 10; connect[i++] = 12; /* connectivity of face 1 of element 3 */ nnpe[j++] = 5; connect[i++] = 7; connect[i++] = 11; connect[i++] = 9; connect[i++] = 13; connect[i++] = 3; /* face 2 of element 3 */ nnpe[j++] = 5; connect[i++] = 7; connect[i++] = 8; connect[i++] = 12; connect[i++] = 11; /* face 3 of element 3 */ nnpe[j++] = 4; connect[i++] = 11; connect[i++] = 12; connect[i++] = 10; connect[i++] = 9; /* face 4 of element 3 */ nnpe[j++] = 4; connect[i++] = 9; connect[i++] = 10; connect[i++] = 14; connect[i++] = 13; /* face 5 of element 3 */ nnpe[j++] = 4; connect[i++] = 13; connect[i++] = 14; connect[i++] = 4; connect[i++] = 3; /* face 6 of element 3 */ nnpe[j++] = 4; assert(i == num_total_nodes_per_blk[0]); assert(j == num_face_in_block[0]); error = ex_put_conn (exoid, EX_FACE_BLOCK, bids, connect, NULL, NULL); printf ("after ex_put_conn, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } free (connect); connect = NULL; error = ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, bids, nnpe); printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write element block parameters */ block_names[0] = "nfaced_1"; num_elem_in_block[0] = 3; num_total_faces_per_blk[0] = 5 + 5 + 7; bids = 10; error = ex_put_block (exoid, EX_ELEM_BLOCK, bids, "nfaced", num_elem_in_block[0], 0, 0, num_total_faces_per_blk[0], 0); printf ("after ex_put_block, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write element block names */ error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names); printf ("after ex_put_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write element-face connectivity */ connect = (int *) calloc(num_total_faces_per_blk[0], sizeof(int)); i = 0; j = 0; connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4; connect[i++] = 5; nnpe[j++] = 5; /* Number of faces per element 1 */ connect[i++] = 4; connect[i++] = 6; connect[i++] = 7; connect[i++] = 8; connect[i++] = 9; nnpe[j++] = 5; /* Number of faces per element 2 */ connect[i++] = 8; connect[i++] = 10; connect[i++] = 11; connect[i++] = 12; connect[i++] = 13; connect[i++] = 14; connect[i++] = 15; nnpe[j++] = 7; /* Number of faces per element 3 */ assert(i == num_total_faces_per_blk[0]); assert(j == num_elem_in_block[0]); error = ex_put_conn (exoid, EX_ELEM_BLOCK, bids, NULL, NULL, connect); printf ("after ex_put_conn, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } free (connect); error = ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, bids, nnpe); printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write QA records; test empty and just blank-filled records */ num_qa_rec = 2; qa_record[0][0] = "TESTWT-NFACED"; qa_record[0][1] = "testwt-nfaced"; qa_record[0][2] = "2010/02/15"; qa_record[0][3] = "06:35:15"; qa_record[1][0] = ""; qa_record[1][1] = " "; qa_record[1][2] = ""; qa_record[1][3] = " "; error = ex_put_qa (exoid, num_qa_rec, qa_record); printf ("after ex_put_qa, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write information records; test empty and just blank-filled records */ num_info = 3; info[0] = "This is the first information record."; info[1] = ""; info[2] = " "; error = ex_put_info (exoid, num_info, info); printf ("after ex_put_info, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* close the EXODUS files */ error = ex_close (exoid); printf ("after ex_close, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } return 0; } exodusii-6.02.dfsg.1/exodus/cbind/test/testwt-nfaced.dmp000066400000000000000000000044561225312213100231730ustar00rootroot00000000000000netcdf test-nfaced { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 14 ; num_elem = 3 ; num_face = 15 ; num_el_blk = 1 ; num_fa_blk = 1 ; num_fa_in_blk1 = 15 ; num_nod_per_fa1 = 58 ; num_el_in_blk1 = 3 ; num_fac_per_el1 = 17 ; num_qa_rec = 2 ; num_info = 3 ; variables: float time_whole(time_step) ; int eb_status(num_el_blk) ; int eb_prop1(num_el_blk) ; eb_prop1:name = "ID" ; int fa_status(num_fa_blk) ; int fa_prop1(num_fa_blk) ; fa_prop1:name = "ID" ; float coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char fa_names(num_fa_blk, len_name) ; char coor_names(num_dim, len_name) ; int fbconn1(num_nod_per_fa1) ; fbconn1:elem_type = "nsided" ; int fbepecnt1(num_fa_in_blk1) ; fbepecnt1:entity_type1 = "NODE" ; fbepecnt1:entity_type2 = "FACE" ; int facconn1(num_fac_per_el1) ; facconn1:elem_type = "nfaced" ; int ebepecnt1(num_el_in_blk1) ; ebepecnt1:entity_type1 = "FACE" ; ebepecnt1:entity_type2 = "ELEM" ; char qa_records(num_qa_rec, four, len_string) ; char info_records(num_info, len_line) ; // global attributes: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; data: eb_status = 1 ; eb_prop1 = 10 ; fa_status = 1 ; fa_prop1 = 10 ; coordx = 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2 ; coordy = 0, 0, 2, 2, 0, 0, 2, 2, 3.5, 3.5, 3, 3, 3, 3 ; coordz = 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 1.5, 1.5, 0.5, 0.5 ; eb_names = "nfaced_1" ; fa_names = "face_block_1" ; coor_names = "x", "y", "z" ; fbconn1 = 5, 6, 8, 2, 1, 4, 6, 2, 4, 8, 8, 4, 1, 5, 1, 2, 6, 5, 5, 8, 7, 1, 3, 4, 7, 8, 4, 3, 7, 3, 1, 5, 8, 4, 14, 10, 12, 7, 11, 9, 13, 3, 7, 8, 12, 11, 11, 12, 10, 9, 9, 10, 14, 13, 13, 14, 4, 3 ; fbepecnt1 = 3, 3, 4, 4, 4, 3, 3, 4, 4, 5, 5, 4, 4, 4, 4 ; facconn1 = 1, 2, 3, 4, 5, 4, 6, 7, 8, 9, 8, 10, 11, 12, 13, 14, 15 ; ebepecnt1 = 5, 5, 7 ; qa_records = "TESTWT-NFACED", "testwt-nfaced", "2010/02/15", "06:35:15", "", " ", "", " " ; info_records = "This is the first information record.", "", " " ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testwt-nsided.c000066400000000000000000000615501225312213100226610ustar00rootroot00000000000000/* * 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 (testwt-nsided.exo) * *****************************************************************************/ #include #include #include #include "exodusII.h" int main (int argc, char **argv) { int exoid, num_dim, num_nodes, num_elem, num_elem_blk; int num_elem_in_block[10], num_total_nodes_per_blk[10]; int num_face_in_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], nnpe[10]; int num_qa_rec, num_info; int num_glo_vars, num_nod_vars, num_ele_vars, num_sset_vars, num_nset_vars; int *truth_tab; 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 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 *attrib_names[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("test-nsided.exo", /* filename path */ EX_CLOBBER, /* create mode */ &CPU_word_size, /* CPU float word size in bytes */ &IO_word_size); /* I/O float word size in bytes */ 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 = 1; num_node_sets = 2; num_side_sets = 5; error = ex_put_init (exoid, title, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets); printf ("after ex_put_init, error = %d\n", error); 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); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); 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] = "nsided_1"; num_elem_in_block[0] = 7; num_total_nodes_per_blk[0] = 37; ebids[0] = 10; #if 0 error = ex_put_nsided_block (exoid, EX_ELEM_BLOCK, ebids[0], num_elem_in_block[0], num_total_nodes_per_blk[0], 0); #else error = ex_put_block (exoid, EX_ELEM_BLOCK, ebids[0], "nsided", num_elem_in_block[0], num_total_nodes_per_blk[0], 0, 0, 0); #endif printf ("after ex_put_block, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* Write element block names */ error = ex_put_names(exoid, EX_ELEM_BLOCK, block_names); printf ("after ex_put_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* write element connectivity */ connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int)); i = 0; j = 0; connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4; nnpe[j++] = 4; connect[i++] = 5; connect[i++] = 6; connect[i++] = 7; connect[i++] = 8; nnpe[j++] = 4; connect[i++] = 9; connect[i++] = 10; connect[i++] = 11; connect[i++] = 12; connect[i++] = 13; connect[i++] = 14; connect[i++] = 15; connect[i++] = 16; nnpe[j++] = 8 ; connect[i++] = 17; connect[i++] = 18; connect[i++] = 19; connect[i++] = 20; nnpe[j++] = 4; connect[i++] = 21; connect[i++] = 22; connect[i++] = 23; connect[i++] = 24; connect[i++] = 25; connect[i++] = 26; nnpe[j++] = 6; connect[i++] = 17; connect[i++] = 18; connect[i++] = 19; connect[i++] = 20; connect[i++] = 27; connect[i++] = 28; connect[i++] = 30; connect[i++] = 29; nnpe[j++] = 8; connect[i++] = 31; connect[i++] = 32; connect[i++] = 33; nnpe[j++] = 3; assert(i == num_total_nodes_per_blk[0]); assert(j == num_elem_in_block[0]); error = ex_put_conn (exoid, EX_ELEM_BLOCK, ebids[0], connect, NULL, NULL); printf ("after ex_put_elem_conn, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } free (connect); error = ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, ebids[0], nnpe); printf ("after ex_put_entity_count_per_polyhedra, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } /* 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write individual side sets */ num_face_in_sset[0] = 2; num_face_in_sset[1] = 2; 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 #include #include #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]; /* Coordinate Frames */ int cf_ids[2] = {20, 13}; float pt_coords[9*2] = {1,0,0, 1,0,1, 2,0,0, 0,0,0, 1,0,0, 0,1,0}; char tags[2]={'r', 'c'}; ex_opts (EX_VERBOSE | EX_ABORT); /* Specify compute and i/o word size */ 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); /* Add a coordinate frame just to give test coverage... */ { error = ex_put_coordinate_frames(exoid, 2, cf_ids, pt_coords, tags); assert(error == 0); } /* close the EXODUS files */ error = ex_close (exoid); 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 #include /* #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[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("test.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, 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); 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; for (i=0; i < num_nodes; i+=11) { error = ex_put_n_coord (exoid, i+1, 11, &x[i], &y[i], &z[i]); printf ("after ex_put_coord, error = %d\n", error); } if (error) { ex_close (exoid); 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); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } for (i=0; i < num_nodes; i+=11) { error = ex_put_n_one_attr(exoid, EX_NODAL, 0, i+1, 11, 1, &x[i]); if (error) { ex_close (exoid); exit(-1); } error = ex_put_n_one_attr(exoid, EX_NODAL, 0, i+1, 11, 2, &y[i]); if (error) { ex_close (exoid); exit(-1); } } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); 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 */ /* 1234567890123456789012345678901234567890 */ 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write individual side sets */ num_face_in_sset[0] = 2; num_face_in_sset[1] = 2; 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_variable_param (exoid, EX_GLOBAL, num_glo_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_GLOBAL, num_glo_vars, var_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } num_nod_vars = 2; /* 12345678901234567890123456789012 */ var_names[0] = "node_variable_a_very_long_name_0"; var_names[1] = "nod_var1"; error = ex_put_variable_param (exoid, EX_NODAL, num_nod_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, var_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } num_ele_vars = 3; var_names[0] = "ele_var0"; var_names[1] = "ele_var1"; var_names[2] = "ele_var2"; error = ex_put_variable_param (exoid, EX_ELEM_BLOCK, num_ele_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_ELEM_BLOCK, num_ele_vars, var_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } { num_nset_vars = 3; var_names[0] = "ns_var0"; var_names[1] = "ns_var1"; var_names[2] = "ns_var2"; error = ex_put_variable_param (exoid, EX_NODE_SET, num_nset_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_NODE_SET, num_nset_vars, var_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } } { num_sset_vars = 3; var_names[0] = "ss_var0"; var_names[1] = "ss_var1"; var_names[2] = "ss_var2"; error = ex_put_variable_param (exoid, EX_SIDE_SET, num_sset_vars); printf ("after ex_put_variable_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_variable_names (exoid, EX_SIDE_SET, num_sset_vars, var_names); printf ("after ex_put_variable_names, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } } /* write element variable truth table */ truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int)); k = 0; for (i=0; i #include /* #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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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 #include /* #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_node_sets, num_side_sets, error; int i, j; 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; float time_value; 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 = 1; num_nodes = 0; num_elem = 0; num_elem_blk = 0; 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); } coord_names[0] = "xcoor"; 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 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); for (i=0; i #include /* #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[2]; char *title = "This is a test"; ex_opts (EX_VERBOSE | EX_ABORT ); /* Specify compute and i/o word size */ CPU_word_size = 0; /* sizeof(float) */ IO_word_size = 4; /* (4 bytes) */ /* create EXODUS II file */ exoid = ex_create ("test.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, 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); 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); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); 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_name(exoid, EX_ELEM_BLOCK, ebids[0], block_names[0]); 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 */ for (i=0; i < 7; i++) { error = ex_put_name(exoid, EX_ELEM_BLOCK, ebids[i], block_names[i]); 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write individual side sets */ num_face_in_sset[0] = 2; num_face_in_sset[1] = 2; 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; /* 0 1 2 3 */ /* 12345678901234567890123456789012 */ var_names[0] = "this_variable_name_is_short"; var_names[1] = "this_variable_name_is_just_right"; var_names[2] = "this_variable_name_is_tooooo_long"; 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 #include #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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; node_list[5] = 20; node_list[6] = 21; node_list[7] = 22; 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; elem_list[0] = 3; node_list[2] = 6; node_list[3] = 7; elem_list[1] = 3; /* side set #2 - quad/hex, spanning 2 element types */ node_list[4] = 2; node_list[5] = 3; elem_list[2] = 1; node_list[6] = 7; node_list[7] = 8; elem_list[3] = 3; /* side set #3 - hex */ node_list[ 8] = 9; node_list[ 9] = 12; node_list[10] = 11; node_list[11] = 10; elem_list[4] = 4; node_list[12] = 11; node_list[13] = 12; node_list[14] = 16; node_list[15] = 15; elem_list[5] = 4; node_list[16] = 16; node_list[17] = 15; node_list[18] = 11; node_list[19] = 12; elem_list[6] = 4; node_list[20] = 10; node_list[21] = 11; node_list[22] = 15; node_list[23] = 14; elem_list[7] = 4; node_list[24] = 13; node_list[25] = 16; node_list[26] = 12; node_list[27] = 9; elem_list[8] = 4; node_list[28] = 14; node_list[29] = 13; node_list[30] = 9; node_list[31] = 10; elem_list[9] = 4; node_list[32] = 16; node_list[33] = 13; node_list[34] = 14; node_list[35] = 15; elem_list[10] = 4; /* side set #4 - tetras */ node_list[36] = 17; node_list[37] = 18; node_list[38] = 20; elem_list[11] = 5; node_list[39] = 18; node_list[40] = 19; node_list[41] = 20; elem_list[12] = 5; node_list[42] = 20; node_list[43] = 19; node_list[44] = 17; elem_list[13] = 5; node_list[45] = 19; node_list[46] = 18; node_list[47] = 17; elem_list[14] = 5; /* side set #5 - circle and sphere */ node_list[48] = 21; elem_list[15] = 6; node_list[49] = 22; elem_list[16] = 7; /* side set #6 - wedges */ node_list[50] = 27; node_list[51] = 26; node_list[52] = 23; node_list[53] = 24; elem_list[17] = 8; node_list[54] = 28; node_list[55] = 27; node_list[56] = 24; node_list[57] = 25; elem_list[18] = 8; node_list[58] = 28; node_list[59] = 25; node_list[60] = 23; node_list[61] = 26; elem_list[19] = 8; node_list[62] = 25; node_list[63] = 24; node_list[64] = 23; elem_list[20] = 8; node_list[65] = 26; node_list[66] = 27; node_list[67] = 28; elem_list[21] = 8; 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; /* 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 #include #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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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] = 10; node_list2[1] = 11; node_list2[2] = 12; node_list2[3] = 13; node_list2[4] = 14; 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] = 20; node_list2[1] = 21; node_list2[2] = 22; 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; node_list[5] = 20; node_list[6] = 21; node_list[7] = 22; 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; prop_array[0] = 1000; prop_array[1] = 2000; 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); error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array); printf ("after ex_put_prop_array, error = %d\n", error); error = ex_put_concat_node_sets (exoid2, 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(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); error = ex_put_prop_array(exoid2, EX_NODE_SET, "VELOCITY", prop_array); 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 #include #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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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 #include /* #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[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 = 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); printf ("after ex_put_coord, error = %d\n", error); error = ex_put_coord (exoid, x, NULL, NULL); printf ("after ex_put_coord, error = %d\n", error); error = ex_put_coord (exoid, NULL, y, NULL); printf ("after ex_put_coord, error = %d\n", error); 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); } /* Add nodal attributes */ error = ex_put_attr_param(exoid, EX_NODAL, 0, 2); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 1, x); if (error) { ex_close (exoid); exit(-1); } error = ex_put_one_attr(exoid, EX_NODAL, 0, 2, y); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Node_attr_1"; attrib_names[1] = "Node_attr_2"; error = ex_put_attr_names (exoid, EX_NODAL, 0, attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write element order map */ elem_map = (int *) calloc(num_elem, sizeof(int)); 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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); } /* Add nodeset attributes */ error = ex_put_attr_param(exoid, EX_NODE_SET, nsids[0], 1); printf ("after ex_put_attr_param, error = %d\n", error); if (error) { ex_close (exoid); exit(-1); } error = ex_put_attr(exoid, EX_NODE_SET, nsids[0], x); if (error) { ex_close (exoid); exit(-1); } { attrib_names[0] = "Nodeset_attribute"; error = ex_put_attr_names (exoid, EX_NODE_SET, nsids[0], attrib_names); if (error) { ex_close (exoid); exit(-1); } } /* write individual side sets */ num_face_in_sset[0] = 2; num_face_in_sset[1] = 2; 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; /* 0 1 2 3 */ /* 12345678901234567890123456789012 */ var_names[0] = "this_variable_name_is_short"; var_names[1] = "this_variable_name_is_just_right"; var_names[2] = "this_variable_name_is_tooooo_long"; 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 #include #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]; 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); /* 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; node_list[5] = 20; node_list[6] = 21; node_list[7] = 22; 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 #include /* #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; } exodusii-6.02.dfsg.1/exodus/cbind/test/testwt_ss.dmp000066400000000000000000000133121225312213100224510ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 = -1, -1 ; ss_status = 0, 0, 1, 1, 1, 1, 1, 1, 1 ; ss_prop1 = 30, 31, 32, 33, 34, 35, 36, 37, 38 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 2.7, 6, 5.7 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 1.7, 1.7, 1.7 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 2.7, 3.3, 1.7 ; eb_names = "", "", "", "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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.", "", " " ; } exodusii-6.02.dfsg.1/exodus/cbind/test/testwtbig.c000066400000000000000000000567631225312213100221110ustar00rootroot00000000000000/* * 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. * * *****************************************************************************/ #define BIG 100000 #include #include #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 #include #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]; 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] = 10; node_list[1] = 11; node_list[2] = 12; node_list[3] = 13; node_list[4] = 14; 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] = 20; node_list[1] = 21; node_list[2] = 22; 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 individual 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); 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 #include #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 #include #include "exodusII.h" int main (int argc, char **argv) { int num_glo_vars = 10; int num_nod_vars = 2; int CPU_word_size = 8; int IO_word_size = 8; const char* title = "This is a 2D mesh example with tri, quad, beam, truss, circle"; int ebids[] = {100, 200, 300, 400, 500}; int num_dim = 2; int num_nodes = 13; int num_elem = 20; int num_elem_blk = 5; int num_node_sets = 2; int num_side_sets = 2; /* create EXODUS II file */ int exoid = ex_create ("twod.e", /* 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 */ ex_opts(EX_VERBOSE); /* initialize file with parameters */ ex_put_init (exoid, title, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets); /* write nodal coordinates values and names to database */ { double x[13], y[13]; x[0] = 0.0; y[0] = 0.0; x[1] = -0.5; y[1] = -0.5; x[2] = 0.5; y[2] = -0.5; x[3] = 0.5; y[3] = 0.5; x[4] = -0.5; y[4] = 0.5; x[5] = -1.0; y[5] = -1.0; x[6] = 1.0; y[6] = -1.0; x[7] = 1.0; y[7] = 1.0; x[8] = -1.0; y[8] = 1.0; x[9] = -2.0; y[9] = 0.0; x[10] = 0.0; y[10] = -2.0; x[11] = 2.0; y[11] = 0.0; x[12] = 0.0; y[12] = 2.0; ex_put_coord (exoid, x, y, 0); } { const char* coord_names[] = {"xcoor", "ycoor"}; ex_put_coord_names (exoid, (char**)coord_names); } { int node_map[] = {10,20,30,40,50,60,70,80,90,100,110,120,130}; ex_put_node_num_map(exoid, node_map); } /* write element order map */ { int elem_map[] = {11,21,31,41, 52, 62, 72, 82, 93,103,113,123,133,143,153,163, 174,184,194,204}; ex_put_elem_num_map (exoid, elem_map); } /* write element block parameters */ { const char* block_names[] = {"Triangles", "Quadrilaterals", "", "Trusses", "Circles"}; int num_elem_in_block[] = {4, 4, 4, 4, 4}; int num_nodes_per_elem[] = {3, 4, 2, 2, 1}; ex_put_elem_block (exoid, ebids[0], "triangle", num_elem_in_block[0], num_nodes_per_elem[0], 0); ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1], num_nodes_per_elem[1], 0); ex_put_elem_block (exoid, ebids[2], "beam", num_elem_in_block[2], num_nodes_per_elem[2], 3); ex_put_elem_block (exoid, ebids[3], "truss", num_elem_in_block[3], num_nodes_per_elem[3], 1); ex_put_elem_block (exoid, ebids[4], "circle", num_elem_in_block[4], num_nodes_per_elem[4], 2); /* Write element block names */ ex_put_names(exoid, EX_ELEM_BLOCK, (char**)block_names); } /* write element connectivity */ { int conn_t[] = {2,3,1, 3,4,1, 4,5,1, 5,2,1}; int conn_q[] = {6,7,3,2, 7,8,4,3, 8,9,5,4, 9,6,2,5}; int conn_B[] = {11,7, 8,13, 13,9, 6,11}; int conn_T[] = {10,6, 9,10, 7,12, 12,8}; int conn_c[] = {6,7,8,9}; ex_put_elem_conn (exoid, ebids[0], conn_t); ex_put_elem_conn (exoid, ebids[1], conn_q); ex_put_elem_conn (exoid, ebids[2], conn_B); ex_put_elem_conn (exoid, ebids[3], conn_T); ex_put_elem_conn (exoid, ebids[4], conn_c); } /* write element block attributes */ { const char* attn_T[] = {"Area"}; double attr_T[] = {1.0, 1.1, 1.2, 1.3}; const char* attn_B[] = {"A", "I", "J"}; double attr_B[] = {1.0, 100.0, 200.0, 1.1, 100.1, 200.1, 1.2, 100.2, 200.2, 1.3, 100.3, 200.3}; const char* attn_c[] = {"Radius", "A"}; double attr_c[] = {1.0, 3.14, 1.1, 4.14, 1.2, 5.14, 1.3, 6.14}; ex_put_elem_attr (exoid, ebids[2], attr_B); ex_put_elem_attr (exoid, ebids[3], attr_T); ex_put_elem_attr (exoid, ebids[4], attr_c); ex_put_elem_attr_names (exoid, ebids[2], (char**)attn_B); ex_put_elem_attr_names (exoid, ebids[3], (char**)attn_T); ex_put_elem_attr_names (exoid, ebids[4], (char**)attn_c); } /* write individual node sets */ { int num_nodes_in_nset[] = {5, 8}; int nsids[] = {20, 22}; int nod1[] = {5,4,3,2,1}; int nod2[] = {6,7,8,9,2,3,4,5}; const char* nset_names[] = {"Triangle_Nodes", "Quadrilateral_Nodes"}; ex_put_set_param (exoid, EX_NODE_SET, nsids[0], num_nodes_in_nset[0], 0); ex_put_set_param (exoid, EX_NODE_SET, nsids[1], num_nodes_in_nset[1], 0); ex_put_set (exoid, EX_NODE_SET, nsids[0], nod1, 0); ex_put_set (exoid, EX_NODE_SET, nsids[1], nod2, 0); ex_put_names(exoid, EX_NODE_SET, (char**)nset_names); } { /* write individual side sets */ int num_face_in_sset[] = {4,4}; int ssids[] = {100,200}; int ss1el[] = {1,2,3,4}; int ss1si[] = {1,1,1,1}; int ss2el[] = {5,7,6,8}; int ss2si[] = {1,1,1,1}; const char* sset_names[] = {"A", "B"}; ex_put_set_param (exoid, EX_SIDE_SET, ssids[0], num_face_in_sset[0], 0); ex_put_set_param (exoid, EX_SIDE_SET, ssids[1], num_face_in_sset[1], 0); ex_put_set (exoid, EX_SIDE_SET, ssids[0], ss1el, ss1si); ex_put_set (exoid, EX_SIDE_SET, ssids[1], ss2el, ss2si); ex_put_names(exoid, EX_SIDE_SET, (char**)sset_names); } /* write results variables parameters and names */ { const char* gvarn[] = {"g_01", "g_02", "g_03", "g_04", "g_05", "g_06", "g_07", "g_08", "g_09", "g_10"}; ex_put_variable_param (exoid, EX_GLOBAL, num_glo_vars); ex_put_variable_names (exoid, EX_GLOBAL, num_glo_vars, (char**)gvarn); } { const char* nvarn[] = {"disp_x", "disp_y"}; ex_put_variable_param (exoid, EX_NODAL, num_nod_vars); ex_put_variable_names (exoid, EX_NODAL, num_nod_vars, (char**)nvarn); } #if 0 num_ele_vars = 3; /* 0 1 2 3 */ /* 12345678901234567890123456789012 */ var_names[0] = "this_variable_name_is_short"; var_names[1] = "this_variable_name_is_just_right"; var_names[2] = "this_variable_name_is_tooooo_long"; ex_put_var_param (exoid, "e", num_ele_vars); printf ("after ex_put_var_param, %d\n", error); if (error) { ex_close (exoid); exit(-1); } ex_put_var_names (exoid, "e", num_ele_vars, var_names); printf ("after ex_put_var_names, %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"; ex_put_var_param (exoid, "m", num_nset_vars); printf ("after ex_put_var_param, %d\n", error); if (error) { ex_close (exoid); exit(-1); } ex_put_var_names (exoid, "m", num_nset_vars, var_names); printf ("after ex_put_var_names, %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"; ex_put_var_param (exoid, "s", num_sset_vars); printf ("after ex_put_var_param, %d\n", error); if (error) { ex_close (exoid); exit(-1); } ex_put_var_names (exoid, "s", num_sset_vars, var_names); printf ("after ex_put_var_names, %d\n", error); if (error) { ex_close (exoid); exit(-1); } } #endif /* 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 */ { int i, j, k; int whole_time_step = 1; int num_time_steps = 10; double gvar[10]; double nvar[20]; for (i=0; i test.output ${PREFIX} ${SRCDIR}/testwt >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/test.dmp echo "testrd - single precision read test..." echo "begin testrd" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd.dmp echo "end testrd" >> test.output echo "testrdv - single precision read test with varid..." echo "begin testrdv" >> test.output ${PREFIX} ${SRCDIR}/testrdv | grep -v version > ${SRCDIR}/testrdv.dmp echo "end testrdv" >> test.output echo "testcp_ss - single-to-single precision copy test..." echo "begin testcp_ss" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version > ${SRCDIR}/testcp_ss.dmp echo "testcp_sd - single-to-double precision copy test..." echo "begin testcp_sd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_sd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version > ${SRCDIR}/testcp_sd.dmp echo "testcp_ln - large model to normal model single precision copy test..." echo "begin testcp_ln" >> test.output ${PREFIX} ${SRCDIR}/testcp_ln >> test.output echo "end testcp_ln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version > ${SRCDIR}/testcp_ln.dmp echo "testcp_nl - normal_model to large_model single precision copy test..." echo "begin testcp_nl" >> test.output ${PREFIX} ${SRCDIR}/testcp_nl >> test.output echo "end testcp_nl" >> test.output ${NCDUMP} -d5,5 testcp_nl.exo | grep -v version > ${SRCDIR}/testcp_nl.dmp echo "testwt_clb - single precision write test using concatenated puts..." echo "begin testwt_clb" >> test.output ${PREFIX} ${SRCDIR}/testwt_clb >> test.output echo "end testwt_clb" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/test_clb.dmp echo "testwtd - double precision write test..." echo "begin testwtd" >> test.output ${PREFIX} ${SRCDIR}/testwtd >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/testd.dmp echo "testrdd - double precision read test..." echo "begin testrdd" >> test.output ${PREFIX} ${SRCDIR}/testrdd | grep -v version >- ${SRCDIR}/testrdd.dmp echo "end testrdd" >> test.output echo "testcp_dd - double-to-double precision copy test..." echo "begin testcp_dd" >> test.output ${PREFIX} ${SRCDIR}/testcpd >> test.output echo "end testcp_dd" >> test.output ${NCDUMP} -d5,5 testcpd.exo | grep -v version > ${SRCDIR}/testcp_dd.dmp echo "testcp_ds - double-to-single precision copy test..." echo "begin testcp_ds" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ds" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version > ${SRCDIR}/testcp_ds.dmp echo "testwt1 - single precision write files with several side sets..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/test1.dmp 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} ${SRCDIR}/testrd1 | grep -v version > ${SRCDIR}/testrd1.dmp 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} ${SRCDIR}/testwt_ss >> test.output echo "end testwt_ss" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/testwt_ss.dmp 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} ${SRCDIR}/testrd_ss | grep -v version > ${SRCDIR}/testrd_ss.dmp echo "end testrd_ss" >> test.output echo "testwt2 - single precision write 2 files (simultaneously open) test..." echo "begin testwt2" >> test.output ${PREFIX} ${SRCDIR}/testwt2 >> test.output echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/test2-1.dmp ${NCDUMP} -d5,5 test2.exo | grep -v version > ${SRCDIR}/test2-2.dmp echo "testrdwt - read from one and write to another (simutaneously open) file..." echo "begin testrdwt" >> test.output ${PREFIX} ${SRCDIR}/testrdwt >> test.output echo "end testrdwt" >> test.output ${NCDUMP} -d5,5 test2.exo | grep -v version > ${SRCDIR}/test2.dmp echo "testwt_nc - write x y z components of coordinates separately..." echo "begin testwt_nc" >> test.output ${PREFIX} ${SRCDIR}/testwt_nc >> test.output echo "end testwt_nc" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/test.dmp echo "testrd_nc - read x y z components of coordinates separately..." echo "begin testrd_nc" >> test.output ${PREFIX} ${SRCDIR}/testrd_nc | grep -v version > ${SRCDIR}/testrd_nc.dmp echo "end testrd" >> test.output echo "testwt-zeron - write file with zero nodes and elements..." echo "begin testwt-zeron" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeron >> test.output echo "end testwt-zeron" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/testwt-zeron.dmp echo "testrd - read test of file with zero nodes and elements..." echo "begin testrd zero nodes" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd_zeron.dmp echo "end testrd zero nodes" >> test.output echo "testwt-zeroe - write file with zero elements..." echo "begin testwt-zeroe" >> test.output ${PREFIX} ${SRCDIR}/testwt-zeroe >> test.output echo "end testwt-zeroe" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/testwt-zeroe.dmp echo "testrd - read test of file with zero elements..." echo "begin testrd zero elements" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd_zeroe.dmp 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} ${SRCDIR}/testwt-one-attrib | tee testrd_zeroe.res echo "end testwt-one-attrib - read attributes one at a time" >> test.output echo "testwt-nsided - write file with nsided elements..." echo "begin testwt-nsided" >> test.output ${PREFIX} ${SRCDIR}/testwt-nsided >> test.output echo "end testwt-nsided" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version > ${SRCDIR}/testwt-nsided.dmp echo "testrd-nsided - read file with nsided elements..." echo "begin testrd-nsided" >> test.output ${PREFIX} ${SRCDIR}/testrd-nsided | grep -v version > ${SRCDIR}/testrd-nsided.dmp echo "end testrd-nsided" >> test.output echo "testwt-nfaced - write file with nfaced elements..." echo "begin testwt-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testwt-nfaced >> test.output echo "end testwt-nfaced" >> test.output ${NCDUMP} -d5,5 test-nfaced.exo | grep -v version > ${SRCDIR}/testwt-nfaced.dmp echo "testrd-nfaced - read file with nfaced elements..." echo "begin testrd-nfaced" >> test.output ${PREFIX} ${SRCDIR}/testrd-nfaced | grep -v version > ${SRCDIR}/testrd-nfaced.dmp echo "end testrd-nfaced" >> test.output echo "testwt-long-name - write file with long (64-character) names..." echo "begin testwt-long-name" >> test.output ${PREFIX} ${SRCDIR}/testwt-long-name >> test.output echo "end testwt-long-name" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version > ${SRCDIR}/testwt-long-name.dmp echo "testrd - read long name file truncating to 32 characters on read..." echo "begin testrd (truncate)" >> test.output ${PREFIX} ${SRCDIR}/testrd | grep -v version > ${SRCDIR}/testrd-nm32.dmp echo "end testrd (truncate)" >> test.output echo "testrd-long-name - read long name file..." echo "begin testrd-long-name" >> test.output ${PREFIX} ${SRCDIR}/testrd-long-name | grep -v version > ${SRCDIR}/testrd-long-name.dmp echo "end testrd-long-name" >> test.output echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/cmake-script000077500000000000000000000006561225312213100201710ustar00rootroot00000000000000EXTRA_ARGS=$@ FC=/opt/local/bin/gfortran-mp-4.8 ACCESS=/Users/gdsjaar/src/SEACAS rm -f CMakeCache.txt cmake \ -DBUILD_SHARED=ON \ -DCMAKE_Fortran_COMPILER:FILEPATH=${FC} \ -DNETCDF_NCDUMP:PATH=${ACCESS}/bin/ncdump \ -DNETCDF_INCLUDE_DIR:PATH=${ACCESS}/include \ -DNETCDF_LIBRARY:PATH=${ACCESS}/lib/libnetcdf.a \ -DHDF5HL_LIBRARY:PATH=${ACCESS}/lib/libhdf5_hl.a \ -DHDF5_LIBRARY:PATH=${ACCESS}/lib/libhdf5.a \ $EXTRA_ARGS exodusii-6.02.dfsg.1/exodus/cmake/000077500000000000000000000000001225312213100167325ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/cmake/Dependencies.cmake000066400000000000000000000004031225312213100223170ustar00rootroot00000000000000SET(LIB_REQUIRED_DEP_PACKAGES) SET(LIB_OPTIONAL_DEP_PACKAGES) SET(TEST_REQUIRED_DEP_PACKAGES) SET(TEST_OPTIONAL_DEP_PACKAGES) SET(LIB_REQUIRED_DEP_TPLS Netcdf) SET(LIB_OPTIONAL_DEP_TPLS HDF5 MPI) SET(TEST_REQUIRED_DEP_TPLS Netcdf) SET(TEST_OPTIONAL_DEP_TPLS) exodusii-6.02.dfsg.1/exodus/customdoxygen.css000066400000000000000000000244741225312213100213070ustar00rootroot00000000000000/* The standard CSS for doxygen */ body, table, div, p, dl { font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; font-size: 12px; } /* @group Heading Levels */ h1 { font-size: 150%; } h2 { font-size: 120%; } h3 { font-size: 100%; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex, div.navtab{ background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; padding: 2px; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a { color: #3D578C; font-weight: normal; text-decoration: none; } .contents a:visited { color: #4665A2; } a:hover { text-decoration: underline; } a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } .contents a.qindexHL:visited { color: #ffffff; } a.el { font-weight: bold; } a.elRef { } a.code { color: #4665A2; } a.codeRef { color: #4665A2; } /* @end */ dl.el { margin-left: -1cm; } .fragment { font-family: monospace, fixed; font-size: 105%; } pre.fragment { border: 1px solid #C4CFE5; background-color: #EEEEFF; padding: 4px 6px; margin: 4px 8px 4px 8px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; } div.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px; padding: 0.2em; border: solid thin #333; border-radius: 0.5em; -webkit-border-radius: .5em; -moz-border-radius: .5em; box-shadow: 2px 2px 3px #999; -webkit-box-shadow: 2px 2px 3px #999; -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background: white; color: black; margin: 0; } div.contents { margin-top: 10px; margin-left: 10px; margin-right: 10px; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } /* @end */ /* .search { color: #003399; font-weight: bold; } form.search { margin-bottom: 0px; margin-top: 0px; } input.search { font-size: 75%; color: #000080; font-weight: normal; background-color: #e8eef2; } */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memItemLeft, .memItemRight, .memTemplParams { border-top: 1px solid #C4CFE5; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memTemplParams { color: #4665A2; white-space: nowrap; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .memitem { padding: 0; margin-bottom: 10px; } .memname { white-space: nowrap; font-weight: bold; margin-left: 6px; } .memproto { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); /* opera specific markup */ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); border-top-right-radius: 8px; border-top-left-radius: 8px; /* firefox specific markup */ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; -moz-border-radius-topright: 8px; -moz-border-radius-topleft: 8px; /* webkit specific markup */ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); -webkit-border-top-right-radius: 8px; -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; } .memdoc { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 2px 5px; background-color: #FBFCFD; border-top-width: 0; /* opera specific markup */ border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ -webkit-border-bottom-left-radius: 8px; -webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .params, .retval, .exception, .tparams { border-spacing: 6px 2px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } /* @end */ /* @group Directory (tree) */ /* for the tree view */ .ftvtree { font-family: sans-serif; margin: 0px; } /* these are for tree view when used as main index */ .directory { font-size: 9pt; font-weight: bold; margin: 5px; } .directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } /* The following two styles can be used to replace the root node title with an image of your choice. Simply uncomment the next two styles, specify the name of your image and be sure to set 'height' to the proper pixel height of your image. */ /* .directory h3.swap { height: 61px; background-repeat: no-repeat; background-image: url("yourimage.gif"); } .directory h3.swap span { display: none; } */ .directory > h3 { margin-top: 0; } .directory p { margin: 0px; white-space: nowrap; } .directory div { display: none; margin: 0px; } .directory img { vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { font-size: 100%; font-weight: bold; } .directory-alt h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } .directory-alt > h3 { margin-top: 0; } .directory-alt p { margin: 0px; white-space: nowrap; } .directory-alt div { display: none; margin: 0px; } .directory-alt img { vertical-align: -30%; } /* @end */ div.dynheader { margin-top: 8px; } address { font-style: normal; color: #2A3D61; } table.doxtable { border-collapse:collapse; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; text-align:left; } .tabsearch { top: 0px; left: 10px; height: 36px; background-image: url('tab_b.png'); z-index: 101; overflow: hidden; font-size: 13px; } .navpath ul { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right: 15px; background-image:url('bc_s.png'); background-repeat:no-repeat; background-position:right; color:#364D7C; } .navpath a { height:32px; display:block; text-decoration: none; outline: none; } .navpath a:hover { color:#6884BD; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; } div.header { background-image:url('nav_h.png'); background-repeat:repeat-x; background-color: #F9FAFC; margin: 0px; border-bottom: 1px solid #C4CFE5; } div.headertitle { padding: 5px 5px 5px 10px; } exodusii-6.02.dfsg.1/exodus/doc/000077500000000000000000000000001225312213100164175ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/doc/doc.poly.txt000066400000000000000000000145171225312213100207170ustar00rootroot00000000000000Storage of 3d arbitrary polyhedra elements in exodusII. The 3d polyhedra elements are represented as elements with a variable number of faces in their connectivity. The faces can either be regular faces such as quadrilateral or triangles; or they can be topologically two-dimensional arbitary polyhedra themselves. An arbitrary polyhedra 3D element block will have an element type of "nfaced" or "NFACED". The faces that are used in the connectivity of this block should be defined in one or more face blocks. If the faces are arbitrary polyhedra, then they will have a face type of "nsided" or "NSIDED". An annotated example of defining an arbitrary polyhedral element block consisting of 3 elements is shown below. The geometry is shown in Figure 1. The three elements have the following geometry: * Element 1: 5 faces. * Face 1: triangle with nodes 5, 6, 8 * Face 2: triangle with nodes 2, 1, 4 * Face 3: quadrilateral with nodes 6, 2, 4, 8 * Face 4: quadrilateral with nodes 8, 4, 1, 5 * Face 5: quadrilateral with nodes 1, 2, 6, 5 * Element 2: 5 faces. * Face 6: triangle with nodes 5, 8, 7 * Face 7: triangle with nodes 1, 3, 4 * Face 8: quadrilateral with nodes 7, 8, 4, 3 * Face 9: quadrilateral with nodes 7, 3, 1, 5 * Face 4: quadrilateral with nodes 8, 4, 1, 5 (shared with element 1) Element 3: 7 faces. * Face 8: quadrilateral with nodes 7, 8, 4, 3 (shared with element 2) * Face 10: pentagonal with nodes 8, 4, 14, 10, 12 * Face 11: pentagonal with nodes 7, 11, 9, 13, 3 * Face 12: quadrilateral with nodes 7, 8, 12, 11 * Face 13: quadrilateral with nodes 11, 12, 10, 9 * Face 14: quadrilateral with nodes 9, 10, 14, 13 * Face 15: quadrilateral with nodes 12, 14, 4, 3 The exodusII model is created via the following calls: * Output the initial information. Since the model contains faces and a face block, the "extended" version of the ex_put_init_ext call must be used: ex_init_params par; strcpy( par.title, "This is the title" ); par.num_dim = 3; par.num_nodes = 14; par.num_edge = 0; par.num_edge_blk = 0; par.num_face = 15; par.num_face_blk = 1; par.num_elem = 3; par.num_elem_blk = 1; par.num_node_sets = 0; par.num_edge_sets = 0; par.num_face_sets = 0; par.num_side_sets = 0; par.num_elem_sets = 0; par.num_node_maps = 0; par.num_edge_maps = 0; par.num_face_maps = 0; par.num_elem_maps = 0; ex_put_init_ext (exoid, &par); * Coordinate output is normal... * Define the face block. block_name = "face_block_1"; num_face_in_block[0] = 15; num_total_nodes_per_blk[0] = 58; block_id = 10; ex_put_block (exoid, EX_FACE_BLOCK, block_id, "nsided", num_face_in_block[0], num_total_nodes_per_blk[0], 0, 0, 0); ex_put_name(exoid, EX_FACE_BLOCK, block_id, block_name); * Output the face connectivity for face_block_1. The data for the face connectivity is listed above; a portion is shown below... connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int)); i = 0 connect[i++] = 5; connect[i++] = 6; connect[i++] = 8; /* connectivity of face 1 of element 1 */ connect[i++] = 2; connect[i++] = 1; connect[i++] = 4; /* face 2 of element 1 */ connect[i++] = 6; connect[i++] = 2; connect[i++] = 4; connect[i++] = 8; /* face 3 of element 1 */ connect[i++] = 8; connect[i++] = 4; connect[i++] = 1; connect[i++] = 5; /* face 4 of element 1 */ connect[i++] = 1; connect[i++] = 2; connect[i++] = 6; connect[i++] = 5; /* face 5 of element 1 */ connect[i++] = 5; connect[i++] = 8; connect[i++] = 7; /* connectivity of face 1 of element 2 */ ... and so on.... assert(i == num_total_nodes_per_blk[0]); ex_put_conn (exoid, EX_FACE_BLOCK, block_id, connect, NULL, NULL); * Output the number of nodes per face count for face_block_1: j = 0; nnpe[ 1] = 3; /* Face 1 */ nnpe[ 2] = 3; nnpe[ 3] = 4; nnpe[ 4] = 4; nnpe[ 5] = 4; nnpe[ 6] = 3; nnpe[ 7] = 3; nnpe[ 8] = 4; nnpe[ 9] = 4; nnpe[10] = 5; nnpe[11] = 5; nnpe[12] = 4; nnpe[13] = 4; nnpe[14] = 4; nnpe[15] = 4; ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, block_id, nnpe); * The face block is now fully defined; now define the nfaced element block which uses these faces. block_name = "nfaced_1"; num_elem_in_block = 3; num_total_faces_per_blk = 5 + 5 + 7; block_id = 10; ex_put_block (exoid, EX_ELEM_BLOCK, block_id, "nfaced", num_elem_in_block, 0, /* nodes */ 0, /* edges */ num_total_faces_per_blk, 0); /* attribute count */ ex_put_name(exoid, EX_ELEM_BLOCK, block_id, block_name); In the "ex_put_block" function, the element type is "nfaced". The connectivity is defined in terms of the faces, so the node and edge arguments are passed zeros. The nodal connectivity can be defined, but it isn't required. The face connectivity argument for an nfaced block is the total number of faces in the connectivity for all elements in the nfaced block. * Write the face connectivity: /* write element-face connectivity */ connect = (int *) calloc(num_total_faces_per_blk, sizeof(int)); i = 0; connect[i++] = 1; connect[i++] = 2; connect[i++] = 3; connect[i++] = 4; connect[i++] = 5; connect[i++] = 4; connect[i++] = 6; connect[i++] = 7; connect[i++] = 8; connect[i++] = 9; connect[i++] = 8; connect[i++] = 10; connect[i++] = 11; connect[i++] = 12; connect[i++] = 13; connect[i++] = 14; connect[i++] = 15; assert(i == num_total_faces_per_blk); ex_put_conn (exoid, EX_ELEM_BLOCK, block_id, NULL, NULL, connect); * Output the number of faces per element count for "nfaced_1": nnpe[1] = 5; /* Number of faces per element 1 */ nnpe[2] = 5; /* Number of faces per element 2 */ nnpe[3] = 7; /* Number of faces per element 3 */ ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, block_id, nnpe); * That's all; the rest of the calls are the same as normal exodusII except: * There is a similar "ex_get_entity_count_per_polyhedra" function for read. * The ex_get_block functions return the total number of nodes or faces for all faces or element for "nfaced" and "nsided" blocks and not the number per element * An example read/write usage is shown in the the cbind/test/testwt-nfaced.c and cbind/test/testrd-nfaced.c files. * These changes are in exodusII version bv4.93 and later. exodusii-6.02.dfsg.1/exodus/exodusii.dsp000066400000000000000000000235261225312213100202230ustar00rootroot00000000000000# 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 exodusii-6.02.dfsg.1/exodus/forbind/000077500000000000000000000000001225312213100172755ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/CMakeLists.txt000066400000000000000000000034651225312213100220450ustar00rootroot00000000000000# Set Mangling by hand # Assume _name mangling see src/exo_jack.c code for how ADDC_ will be used in # Fortran mangling add_definitions (-DADDC_) find_path( NETCDF_INCLUDE_DIR netcdf.h $ENV{ACCESS}/inc $ENV{NETCDF_DIR}/inc $ENV{NETCDF_DIR}/include $ENV{NETCDF_DIR}/libsrc ) find_library( NETCDF_LIBRARY NAMES netcdf PATHS "$ENV{ACCESS}/lib" "$ENV{NETCDF_DIR}/lib" "$ENV{NETCDF_DIR}/libsrc/.libs" ) find_program (NETCDF_NCDUMP ncdump $ENV{ACCESS}/bin $ENV{NETCDF_DIR}/bin $ENV{NETCDF_DIR}/ncdump ) # Hack for HDF5 find_library( HDF5_LIBRARY hdf5 $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) find_library( HDF5HL_LIBRARY hdf5_hl $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../cbind/include" "${CMAKE_CURRENT_BINARY_DIR}/include" "${NETCDF_INCLUDE_DIR}" ) SET(forbind_SRCS src/exo_jack.c ) ADD_LIBRARY(exoIIv2for ${EXODUS_LIBRARY_TYPE} ${forbind_SRCS}) TARGET_LINK_LIBRARIES(exoIIv2for exoIIv2c ${NETCDF_LIBRARY} ${HDF5_LIBRARY} ${HDF5HL_LIBRARY}) IF(EXODUS_LIBRARY_PROPERTIES) SET_TARGET_PROPERTIES(exoIIv2for PROPERTIES ${EXODUS_LIBRARY_PROPERTIES}) ENDIF(EXODUS_LIBRARY_PROPERTIES) IF(NOT EXODUS_INSTALL_NO_LIBRARIES) INSTALL(TARGETS exoIIv2for RUNTIME DESTINATION lib COMPONENT Runtime LIBRARY DESTINATION lib COMPONENT Runtime ARCHIVE DESTINATION lib COMPONENT Development) INSTALL(FILES ${forbind_HEADERS} DESTINATION include COMPONENT Development) ENDIF(NOT EXODUS_INSTALL_NO_LIBRARIES) INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake) IF (BUILD_TESTING) ENABLE_TESTING() SUBDIRS(test) ENDIF (BUILD_TESTING) exodusii-6.02.dfsg.1/exodus/forbind/include/000077500000000000000000000000001225312213100207205ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/include/Imakefile000066400000000000000000000002271225312213100225320ustar00rootroot00000000000000XCOMM $Id: Imakefile,v 1.5 2008/07/24 21:40:41 gdsjaar Exp $ INCLIST=exodusII.inc exodusII_int.inc InstallIncludeList(install,$(INCLIST),$(INCDIR)) exodusii-6.02.dfsg.1/exodus/forbind/include/exodusII.inc000066400000000000000000000245161225312213100231540ustar00rootroot00000000000000 ! -*- 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 ! !***************************************************************************** ! ! Define Exodus functions that return values ! integer excre,exopen,exlgmd, exinqi external excre, exopen, exlgmd, exinqi ! ! Define access modes ! integer EXNOCL,EXCLOB,EXREAD,EXWRIT,EXWRT,EXNORM,EXLARG integer EXNET4, EXNOSH, EXSHAR integer EX_READ,EX_WRITE,EX_NOCLOBBER,EX_CLOBBER,EX_NORMAL_MODEL integer EX_LARGE_MODEL,EX_NETCDF4,EX_NOSHARE,EX_SHARE integer EX_NOCLASSIC,EX_MAPS_INT64_DB,EX_IDS_INT64_DB integer EX_BULK_INT64_DB,EX_ALL_INT64_DB integer EX_MAPS_INT64_API integer EX_IDS_INT64_API,EX_BULK_INT64_API,EX_ALL_INT64_API parameter (EXREAD = 0) ! EXREAD - File open for read parameter (EXWRIT = 1) ! EXWRIT - File open for write parameter (EXWRT = 1) ! EXWRT - File open for write (alternate to EXWRIT) parameter (EXNOCL = 4) ! EXNOCL - File create with no overwrite (no clobber), default parameter (EXCLOB = 8) ! EXCLOB - File create with overwrite (clobber) parameter (EXNORM = 16) ! EXNORM - Disable large model modifications parameter (EXLARG = 32) ! EXLARG - Large model modifications parameter (EXNET4 = 64) ! EXNET4 - use the hdf5-based netcdf4 output parameter (EXNOSH = 128) ! EXNOSH - Do not open netcdf file in "share" mode parameter (EXSHAR = 256) ! EXSHAR - Do open netcdf file in "share" mode ! Some of these are repeated from above, but use the same name as the C/C++ versions... parameter (EX_READ = 0) !ex_open(): open file for reading (default) parameter (EX_WRITE = 1) ! ex_open(): open existing file for appending. parameter (EX_NOCLOBBER = 4) ! Don't overwrite existing database, default parameter (EX_CLOBBER = 8) ! Overwrite existing database if it exists parameter (EX_NORMAL_MODEL = 16) ! disable mods that permit storage of larger models parameter (EX_LARGE_MODEL = 32) ! enable mods that permit storage of larger models parameter (EX_NETCDF4 = 64) ! use the hdf5-based netcdf4 output parameter (EX_NOSHARE = 128) ! Do not open netcdf file in "share" mode parameter (EX_SHARE = 256) ! Do open netcdf file in "share" mode parameter (EX_NOCLASSIC = 512) ! Do not force netcdf to classic mode in netcdf4 mode ! Need to distinguish between storage on database (DB in name) and ! passed through the API functions (API in name). parameter (EX_MAPS_INT64_DB = 1024) ! All maps (id, order, ...) store int64_t values parameter (EX_IDS_INT64_DB = 2048) ! All entity ids (sets, blocks, maps) are int64_t values parameter (EX_BULK_INT64_DB = 4096) ! All integer bulk data (local indices, counts, maps); not ids parameter (EX_ALL_INT64_DB = 1024+2048+4096) ! All of the above... parameter (EX_MAPS_INT64_API= 8192) ! All maps (id, order, ...) store int64_t values parameter (EX_IDS_INT64_API = 16384) ! All entity ids (sets, blocks, maps) are int64_t values parameter (EX_BULK_INT64_API= 32768) ! All integer bulk data (local indices, counts, maps); not ids parameter (EX_ALL_INT64_API = 8192+16384+32768) ! All of the above... ! ! --INQUIRE FLAGS integer EXTYPE, EXVERS, EXDBVR, EXTITL, EXDIM, EXNODE integer EXELEM, EXELBL, EXNODS, EXSIDS, EXQA, EXINFO integer EXTIMS, EXSSNL, EXSSEL, EXNSNL, EXNEBP, EXNNSP integer EXNSSP, EXNSDF, EXSSDF, EXLBVR, EXNEMP, EXNNMP integer EXNEM, EXNNM, EXNEDG, EXNEDB, EXNEDS, EXESL integer EXESDL, EXEDBP, EXEDSP, EXNFAC, EXNFB , EXNFS integer EXFSL , EXFSDL, EXFABP, EXFASP, EXNELS, EXELSL integer EXELSD, EXELSP, EXNEDM, EXNFAM, EXNCF, EXDBMXALNM integer EXDBMXUSNM, EXMXRDNM ! parameter (EXTYPE = 1) ! -- inquire EXODUS II file type parameter (EXVERS = 2) ! -- inquire API version number parameter (EXDBVR = 3) ! -- inquire database version number parameter (EXTITL = 4) ! -- inquire database title parameter (EXDIM = 5) ! -- inquire number of dimensions parameter (EXNODE = 6) ! -- inquire number of nodes parameter (EXELEM = 7) ! -- inquire number of elements parameter (EXELBL = 8) ! -- inquire number of element blocks parameter (EXNODS = 9) ! -- inquire number of node sets parameter (EXNSNL = 10) ! -- inquire length of node set node list parameter (EXSIDS = 11) ! -- inquire number of side sets parameter (EXSSNL = 12) ! -- inquire length of side set node list parameter (EXSSEL = 13) ! -- inquire length of side set element list parameter (EXQA = 14) ! -- inquire number of QA records parameter (EXINFO = 15) ! -- inquire number of info records parameter (EXTIMS = 16) ! -- inquire number of time steps in the database parameter (EXNEBP = 17) ! -- inquire number of element block properties parameter (EXNNSP = 18) ! -- inquire number of node set properties parameter (EXNSSP = 19) ! -- inquire number of side set properties parameter (EXNSDF = 20) ! -- inquire length of node set distribution factor list parameter (EXSSDF = 21) ! -- inquire length of side set distribution factor list parameter (EXLBVR = 22) ! -- inquire API Lib vers number parameter (EXNEMP = 23) ! -- inquire number of element map properties parameter (EXNNMP = 24) ! -- inquire number of node map properties parameter (EXNEM = 25) ! -- inquire number of element maps parameter (EXNNM = 26) ! -- inquire number of node maps parameter (EXNEDG = 27) ! -- inquire number of edges parameter (EXNEDB = 28) ! -- inquire number of edge blocks parameter (EXNEDS = 29) ! -- inquire number of edge sets parameter (EXESL = 30) ! -- inquire length of concat edge set edge list parameter (EXESDL = 31) ! -- inquire length of concat edge set dist factor list parameter (EXEDBP = 32) ! -- inquire number of properties stored per edge block parameter (EXEDSP = 33) ! -- inquire number of properties stored per edge set Parameter (EXNFAC = 34) ! -- inquire number of faces parameter (EXNFB = 35) ! -- inquire number of face blocks parameter (EXNFS = 36) ! -- inquire number of face sets parameter (EXFSL = 37) ! -- inquire length of concat face set face list parameter (EXFSDL = 38) ! -- inquire length of concat face set dist factor list parameter (EXFABP = 39) ! -- inquire number of properties stored per face block parameter (EXFASP = 40) ! -- inquire number of properties stored per face set parameter (EXNELS = 41) ! -- inquire number of element sets parameter (EXELSL = 42) ! -- inquire length of concat element set element list parameter (EXELSD = 43) ! -- inquire length of concat element set dist factor list parameter (EXELSP = 44) ! -- inquire number of properties stored per elem set parameter (EXNEDM = 45) ! -- inquire number of edge maps parameter (EXNFAM = 46) ! -- inquire number of face maps parameter (EXNCF = 47) ! -- inquire number of coordinate frames parameter (EXDBMXALNM = 48)! -- inquire size of MAX_NAME_LENGTH dimension on database parameter (EXDBMXUSNM = 49)! -- inquire max size of any name existing on database parameter (EXMXRDNM = 50) ! -- inquire user-specified max size of names returned; truncated if longer ! ! Define limits ! integer MXSTLN, MXLNLN, MXNAME ! MXSTLN - Maximum string length: used for store strings parameter (MXSTLN = 32) ! MXLNLN - Maximum line string length parameter (MXLNLN = 80) ! MXNAME - Maximum possible length of a name (due to netcdf NC_MAX_NAME) parameter (MXNAME = 256) ! ! properties ! integer EXEBLK, EXNSET, EXSSET, EXEMAP, EXNMAP parameter (EXEBLK = 1) ! EXEBLK - element block property code parameter (EXNSET = 2) ! EXNSPR - node set property code parameter (EXSSET = 3) ! EXSSPR - side set property code parameter (EXEMAP = 4) ! EXEMAP - element map property code parameter (EXNMAP = 5) ! EXNMAP - node map property code ! ! Define options codes ! integer EXVRBS, EXDEBG, EXABRT parameter (EXVRBS = 1) ! EXVRBS - verbose mode message flag parameter (EXDEBG = 2) ! EXDEBG - debug mode message flag parameter (EXABRT = 4) ! EXABRT - abort mode flag ! ! Define coordinate frames ! integer EXCFREC, EXCFCYL, EXCFSPH parameter (EXCFREC = 1) ! Rectangular parameter (EXCFCYL = 2) ! Cylindrical parameter (EXCFSPH = 3) ! Spherical ! ! Define error return codes ! integer EXFATL, EXOK, EXWARN parameter (EXFATL = -1) ! EXFATL - fatal error flag def parameter (EXOK = 0) ! EXOK - no err (success) flag def parameter (EXWARN = 1) ! EXWARN - warning flag def ! ! Define error return codes and flags ! integer EXMEMF, EXBFMD, EXBFID, EXBTID, EXBPRM, EXNULL integer EXPMSG, EXLMSG parameter (EXMEMF = 1000) ! EXMEMF - memory allocation failure flag def parameter (EXBFMD = 1001) ! EXBFMD - wrong file mode parameter (EXBFID = 1002) ! EXBFID - bad file id def parameter (EXBTID = 1004) ! EXBTID - id table lookup failed parameter (EXBPRM = 1005) ! EXBPRM - bad parameter passed parameter (EXNULL = -1006) ! EXNULL - null entity found parameter (EXPMSG = -1000) ! EXPMSG - message print code - no error implied parameter (EXLMSG = -1001) ! EXLMSG - print last error message msg code exodusii-6.02.dfsg.1/exodus/forbind/include/exodusII_int.inc000066400000000000000000000157611225312213100240300ustar00rootroot00000000000000C***************************************************************************** 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.8 2008/07/24 21:40:41 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 exodusii-6.02.dfsg.1/exodus/forbind/src/000077500000000000000000000000001225312213100200645ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/src/Imakefile000066400000000000000000000053621225312213100217030ustar00rootroot00000000000000# 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. # /* Use *.h files in ../../cbind/include/ instead of installed *.h files */ INCLUDES = IncRef-I../../cbind/include F77EXTRAOPTIONS = IncRef-I../include F77CPPFLAGS = F77CppFlags SRCS = exo_jack.c SRCSF = addrwrap.F OBJS = ${SRCS:.c=.o} ${SRCSF:.F=.o} LibraryTargetSubdirsCopy(libexoIIv2for.a,$(OBJS),../../) CleanupCapF(addrwrap.f) #if Build64BitAccess == YES /* Need to compile exo_jack.c without the -DBuild64 option * real* -> float* (actually void* since it handles both float* and double*) */ exo_jack32.o: exo_jack.c $(CC) -o exo_jack32.o -c $(CFLAGS) -DDEFAULT_REAL_INT exo_jack.c all:: libexoIIv2for32.a libexoIIv2for32.a: exo_jack32.o $(AR) $@ $? $(_NULLCMD_) $(_NULLCMD_) $(CP) $@ ../../ #endif /* * 32-bit build: * Compile exo_jack.c and put in libexoIIv2for.a archive. * * 64-bit build: (using 8-byte integer/real) * Compile addrwrap.F (contains main api name 'func'; calls 'func4' name) * Compile exo_jack.c with -DBuild64 (adds 4_ to function names) * -- put above two object files into libexoIIv2for.a * */ DependTarget() exodusii-6.02.dfsg.1/exodus/forbind/src/Makefile.standalone000066400000000000000000000046301225312213100236560ustar00rootroot00000000000000# 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 SRCSF = addrwrap.F COBJS = ${SRCS:.c=.o} FOBJS = ${SRCSF:.F=.o} all:: libexoIIv2for.a libexoIIv2for.a: $(COBJS) $(FOBJS) $(AR) $@ $? $(RANLIB) $@ cp libexoIIv2for.a ../../ all:: libexoIIv2for32.a libexoIIv2for32.a: $(COBJS) $(AR) $@ $? $(RANLIB) $@ cp libexoIIv2for.a ../../ 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 exodusii-6.02.dfsg.1/exodus/forbind/src/addrwrap.F000066400000000000000000003062541225312213100220110ustar00rootroot00000000000000C 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXCN2S4 (IDEXO4, NSESS, NDESS, IXEESS, IXNESS, & LTEESS, LTNESS, LTSESS, IERR4) 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) INTEGER*4 IFLAG4 C ... This is hardwired instead of getting from exodusII.inc due to compiler errors about C exopen/excre already having a type... integer EX_MAPS_INT64_API integer EX_BULK_INT64_API integer EX_IDS_INT64_API integer EX_INQ_INT64_API parameter (EX_MAPS_INT64_API= 8192) ! All maps (id, order, ...) store int64_t values parameter (EX_IDS_INT64_API = 16384) ! All entity ids parameter (EX_BULK_INT64_API= 32768) ! All integer bulk data parameter (EX_INQ_INT64_API = 65536) ! All integer inquire arguments C ... All wrapper routines are passing INTEGER*8, but at this C time, only the maps are supported... ICMODE4 = ICMODE IFLAG4 = EX_MAPS_INT64_API+EX_IDS_INT64_API+EX_BULK_INT64_API+ * EX_INQ_INT64_API ICMODE4 = IOR(ICMODE4, IFLAG4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGCNS4 (IDEXO4, IDNPSS, NNNPS, NDNPS, IXNNPS, & IXDNPS, LTNNPS, FACNPS, IERR4) IERR = IERR4 END SUBROUTINE EXGFRM (IDEXO, NFRAME, IDSCF, COORD, ITAGS, IERR) C C READ COORDINATE FRAMES C implicit none include 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER NFRAME ! (R) INTEGER IDSCF(*) ! (W) INTEGER ITAGS(*) ! (W) INTEGER IERR ! (W) REAL COORD(*) ! (W) INTEGER*4 IDEXO4 ! (R) integer*4 nframe4 ! (R) integer*4 itags4(1) ! (W) INTEGER*4 IERR4 ! (W) POINTER (PITAGS4, ITAGS4) idexo4 = idexo NFRAME = EXINQI (IDEXO, EXNCF) NFRAME4 = NFRAME CALL I4ALLOC (NFRAME, PITAGS4) call exgfrm4(idexo4, nframe4, idscf, coord, itags4, ierr4) CALL I4I8 (NFRAME, PITAGS4, ITAGS) ierr = ierr4 END SUBROUTINE EXPFRM (IDEXO, NFRAME, IDSCF, COORD, ITAGS, IERR) C C DEFINE/WRITE COORDINATE FRAMES C implicit none include 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER NFRAME ! (R) INTEGER IDSCF(*) ! (R) INTEGER ITAGS(*) ! (R) INTEGER IERR ! (W) REAL COORD(*) ! (R) INTEGER*4 IDEXO4 ! (R) integer*4 nframe4 ! (R) integer*4 itags4(1) ! (R) INTEGER*4 IERR4 ! (W) POINTER (PITAGS4, ITAGS4) idexo4 = idexo NFRAME4 = NFRAME CALL I8I4 (NFRAME, ITAGS, PITAGS4) call expfrm4(idexo4, nframe4, idscf, coord, itags4, ierr4) CALL I4FREE (PITAGS4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGCSS4 (IDEXO4, IDESSS, NSESS, NDESS, IXEESS, & IXDESS, LTEESS, LTSESS, FACESS, IERR4) IERR = IERR4 END SUBROUTINE EXGCSSF (IDEXO, IDESSS, NSESS, NDESS, IXEESS, & IXDESS, LTEESS, LTSESS, IERR) C C READ CONCATENATED SIDE SETS C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER IDESSS (*) ! (W) INTEGER NSESS (*) ! (W) INTEGER NDESS (*) ! (W) INTEGER IXEESS (*) ! (W) INTEGER IXDESS (*) ! (W) INTEGER LTEESS (*) ! (W) INTEGER LTSESS (*) ! (W) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGCSSF4 (IDEXO4, IDESSS, NSESS, NDESS, IXEESS, & IXDESS, LTEESS, LTSESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGEAT4 (IDEXO4, IDELB, 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 NATTR4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO NATTR4 = NATTR CALL EXGEAN4 (IDEXO4, IDELB, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGEBI4 (IDEXO4, IDELBS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGELB4 (IDEXO4, IDELB, NAMELB, NUMELB, NUMLNK, & NUMATR, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGELC4 (IDEXO4, IDELB, LINK, IERR4) IERR = IERR4 END SUBROUTINE EXGECPP (IDEXO, ITYPE, IDELB, COUNTS, IERR) C C READ ENTITY_COUNT-PER-POLYHEDRA C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER IDELB ! (R) INTEGER ITYPE ! (R) INTEGER COUNTS (*) ! (NUMELB) ! (W) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 ITYPE4 ! (R) INTEGER*4 COUNTS4 (1) ! (NUMELB) ! (W) POINTER (PCOUNTS4, COUNTS4) INTEGER*4 IERR4 ! (W) CHARACTER* (MXSTLN) NAMELB INTEGER NUMELB INTEGER NUMATR INTEGER NUMLNK IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXGELB4 (IDEXO4, IDELB, NAMELB, NUMELB, NUMLNK, & NUMATR, IERR4) CALL I4ALLOC (NUMELB, PCOUNTS4) CALL EXGECPP4 (IDEXO4, ITYPE4, IDELB, COUNTS4, IERR4) CALL I4I8 (NUMELB, PCOUNTS4, COUNTS) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGENM4 (IDEXO4, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGEM4 (IDEXO4, MAPID, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGPEM4 (IDEXO4, MAPID, ISTART, ICOUNT, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXELEV4 = IXELEV CALL EXGEV4 (IDEXO4, ISTEP4, IXELEV4, IDELB, NUMELB, & 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 ISTPB4 ! (R) INTEGER*4 ISTPE4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO IXELEV4 = IXELEV ISTPB4 = ISTPB ISTPE4 = ISTPE CALL EXGEVT4 (IDEXO4, IXELEV4, IELNUM, 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXV4 = IXV CALL EXGNSV4 (IDEXO4, ISTEP4, IXV4, ID, NUM, 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXV4 = IXV CALL EXGSSV4 (IDEXO4, ISTEP4, IXV4, ID, NUM, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGINI4 (IDEXO4, TITLE, NDIM, NUMNP, NUMEL, NELBLK, & NUMNPS, NUMESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGMAP4 (IDEXO4, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNNM4 (IDEXO4, MAPNOD, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNM4 (IDEXO4, MAPID, MAPNOD, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNP4 (IDEXO4, IDNPS, NNNPS, NDNPS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNS4 (IDEXO4, IDNPS, LTNNPS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNSD4 (IDEXO4, IDNPS, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGNSI4 (IDEXO4, IDNPSS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXNODV4 = IXNODV CALL EXGNV4 (IDEXO4, ISTEP4, IXNODV4, NUMNP, 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 ISTPB4 ! (R) INTEGER*4 ISTPE4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO IXNODV4 = IXNODV ISTPB4 = ISTPB ISTPE4 = ISTPE CALL EXGNVT4 (IDEXO4, IXNODV4, NODNUM, 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 IERR4 ! (W) IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXGP4 (IDEXO4, ITYPE4, ID, NAMEPR, IVAL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXGPA4 (IDEXO4, ITYPE4, NAMEPR, IVAL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSP4 (IDEXO4, IDESS, NSESS, NDESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSNL4 (IDEXO4, IDESS, NNESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSS4 (IDEXO4, IDESS, LTEESS, LTSESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSSD4 (IDEXO4, IDESS, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSSI4 (IDEXO4, IDESSS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXGSSN4 (IDEXO4, IDESS, INCNT, LTNESS, IERR4) IERR = IERR4 END SUBROUTINE EXGSSC (IDEXO, IDESS, INCNT, IERR) C C READ SIDE SET NODE LIST COUNT C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER IDESS ! (R) INTEGER INCNT (*) ! (W) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 INCNT4 (1) ! (W) POINTER (PINCNT4, INCNT4) INTEGER*4 IERR4 ! (W) integer*4 nsess4 integer*4 ndess4 INTEGER NINCNT IDEXO4 = IDEXO CALL EXGSP4 (IDEXO4, IDESS, NSESS4, NDESS4, IERR4) NINCNT = NSESS4 CALL I4ALLOC (NINCNT, PINCNT4) CALL EXGSSC4 (IDEXO4, IDESS, INCNT4, IERR4) CALL I4I8 (NINCNT, PINCNT4, INCNT) IERR = IERR4 END SUBROUTINE EXGCSSC (IDEXO, INCNT, IERR) C C READ CONCATENATED SIDE SET NODE COUNT LIST C (nodes/face for all faces) C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER INCNT (*) ! (W) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 INCNT4 (1) ! (W) POINTER (PINCNT4, INCNT4) INTEGER*4 IERR4 ! (W) INTEGER NINCNT IDEXO4 = IDEXO NINCNT = EXINQI (IDEXO, EXSSEL) CALL I4ALLOC (NINCNT, PINCNT4) CALL EXGCSSC4 (IDEXO4, INCNT4, IERR4) CALL I4I8 (NINCNT, PINCNT4, INCNT) IERR = IERR4 END SUBROUTINE EXGTIM (IDEXO, NSTEP, TIME, IERR) C C READ TIME VALUE FOR A TIME STEP 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 (NVAREL*NELBLK, PISEVOK4) CALL EXGVTT4 (IDEXO4, NELBLK4, NVAREL4, ISEVOK4, IERR4) CALL I4I8 (NVAREL*NELBLK, 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 (NVAR*NBLK, PISVOK4) CALL EXGNSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4) CALL I4I8 (NVAR*NBLK, 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 (NVAR*NBLK, PISVOK4) CALL EXGSSTT4 (IDEXO4, NBLK4, NVAR4, ISVOK4, IERR4) CALL I4I8 (NVAR*NBLK, 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) REAL*4 RELRET4 ! (W) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO INFREQ4 = INFREQ CALL EXINQ4 (IDEXO4, INFREQ4, INTRET, RELRET4, CHRRET, IERR4) RELRET = RELRET4 IERR = IERR4 END INTEGER FUNCTION EXINQI (IDEXO, INFREQ) C C INQUIRE EXODUS PARAMETERS C IMPLICIT NONE INTEGER IDEXO ! (R) INTEGER INFREQ ! (R) INTEGER*4 EXINQI4 EXTERNAL EXINQI4 INTEGER*4 IDEXO4 ! (R) INTEGER*4 INFREQ4 ! (R) IDEXO4 = IDEXO INFREQ4 = INFREQ EXINQI = EXINQI4 (IDEXO4, INFREQ4) 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) INTEGER*4 IFLAG4 C ... This is hardwired instead of getting from exodusII.inc due to compiler errors about C exopen/excre already having a type... integer EX_MAPS_INT64_API integer EX_BULK_INT64_API integer EX_IDS_INT64_API integer EX_INQ_INT64_API parameter (EX_MAPS_INT64_API= 8192) ! All maps (id, order, ...) store int64_t values parameter (EX_IDS_INT64_API = 16384) ! All entity ids parameter (EX_BULK_INT64_API= 32768) ! All integer bulk data parameter (EX_INQ_INT64_API = 65536) ! All integer inquire arguments 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 C ... All wrapper routines are passing INTEGER*8, but at this C time, only the maps are supported... IFLAG4 = EX_MAPS_INT64_API+EX_IDS_INT64_API+EX_BULK_INT64_API+ * EX_INQ_INT64_API IMODE4 = IOR(IMODE4, IFLAG4) 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 EXMXNM (IDEXO, LENGTH, IERR) C C SET MAXIMUM NAME LENGTH C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER LENGTH ! (R) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 LENGTH4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO LENGTH4 = LENGTH CALL EXMXNM4 (IDEXO4, LENGTH4, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPCNS4 (IDEXO4, IDNPSS, NNNPS, NDNPS, IXNNPS, & IXDNPS, LTNNPS, FACNPS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPCSS4 (IDEXO4, IDESSS, NSESS, NDESS, IXEESS, & IXDESS, LTEESS, LTSESS, FACESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPEAT4 (IDEXO4, IDELB, 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 NATTR4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO NATTR4 = NATTR CALL EXPEAN4 (IDEXO4, IDELB, 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 MKMAP4 ! (R) INTEGER*4 IERR4 ! (W) IDEXO4 = IDEXO MKMAP4 = MKMAP CALL EXPCLB4 (IDEXO4, IDELB, NAMELB, NUMELB, NUMLNK, & NUMATR, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPELB4 (IDEXO4, IDELB, NAMELB, NUMELB, NUMLNK, & NUMATR, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPELC4 (IDEXO4, IDELB, LINK, IERR4) IERR = IERR4 END SUBROUTINE EXPECPP (IDEXO, ITYPE, IDELB, COUNTS, IERR) C C WRITE ELEMENT BLOCK ELEMENT COUNT PER POLYHEDRA C IMPLICIT NONE INCLUDE 'exodusII.inc' INTEGER IDEXO ! (R) INTEGER ITYPE ! (R) INTEGER IDELB ! (R) INTEGER COUNTS (*) ! (NUMELB) ! (R) INTEGER IERR ! (W) INTEGER*4 IDEXO4 ! (R) INTEGER*4 ITYPE4 ! (R) INTEGER*4 COUNTS4 (1) ! (NUMELB) ! (R) POINTER (PCOUNTS4, COUNTS4) INTEGER*4 IERR4 ! (W) CHARACTER* (MXSTLN) NAMELB INTEGER NUMELB INTEGER NUMLNK INTEGER NUMATR IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXGELB4 (IDEXO4, IDELB, NAMELB, NUMELB, NUMLNK, & NUMATR, IERR4) CALL I8I4 (NUMELB, COUNTS, PCOUNTS4) CALL EXPECPP4 (IDEXO4, ITYPE4, IDELB, COUNTS4, IERR4) CALL I4FREE (PCOUNTS4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPENM4 (IDEXO4, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPEM4 (IDEXO4, MAPID, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPPEM4 (IDEXO4, MAPID, ISTART, ICOUNT, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXELEV4 = IXELEV CALL EXPEV4 (IDEXO4, ISTEP4, IXELEV4, IDELB, NUMELB, & 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXV4 = IXV CALL EXPNSV4 (IDEXO4, ISTEP4, IXV4, ID, NUM, 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXV4 = IXV CALL EXPSSV4 (IDEXO4, ISTEP4, IXV4, ID, NUM, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPINI4 (IDEXO4, TITLE, NDIM, NUMNP, NUMEL, NELBLK, & NUMNPS, NUMESS, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPMAP4 (IDEXO4, MAPEL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPNNM4 (IDEXO4, MAPNOD, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPNM4 (IDEXO4, MAPID, MAPNOD, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPNP4 (IDEXO4, IDNPS, NNNPS, NDNPS, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPNS4 (IDEXO4, IDNPS, LTNNPS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPNSD4 (IDEXO4, IDNPS, 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 IERR4 ! (W) IDEXO4 = IDEXO ISTEP4 = ISTEP IXNODV4 = IXNODV CALL EXPNV4 (IDEXO4, ISTEP4, IXNODV4, NUMNP, 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 IERR4 ! (W) IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXPP4 (IDEXO4, ITYPE4, ID, NAMEPR, IVAL, 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 IERR4 ! (W) IDEXO4 = IDEXO ITYPE4 = ITYPE CALL EXPPA4 (IDEXO4, ITYPE4, NAMEPR, IVAL, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPSP4 (IDEXO4, IDESS, NSESS, NDESS, 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPSS4 (IDEXO4, IDESS, LTEESS, LTSESS, IERR4) 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 IERR4 ! (W) IDEXO4 = IDEXO CALL EXPSSD4 (IDEXO4, IDESS, 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 (NVAREL*NELBLK, 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 (NVAR*NBLK, 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 (NVAR*NBLK, 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) 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) 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 C----------------------------------------------------------------------- C C Get initial information from nemesis file C subroutine exgii (idexo, nproc, nproc_in_f, ftype, ierr) implicit none integer idexo integer nproc integer nproc_in_f character*(*) ftype integer ierr C integer*4 idexo4 integer*4 nproc4 integer*4 nproc_in_f4 integer*4 ierr4 C idexo4 = idexo call exgii4 (idexo4, nproc4, nproc_in_f4, ftype, ierr4) nproc = nproc4 nproc_in_f = nproc_in_f4 ierr = ierr4 C end C----------------------------------------------------------------------- C C Write initial information from nemesis file C subroutine expii (idexo, nproc, nproc_in_f, ftype, ierr) implicit none integer idexo integer nproc integer nproc_in_f character*(*) ftype integer ierr C integer*4 idexo4 integer*4 nproc4 integer*4 nproc_in_f4 integer*4 ierr4 C idexo4 = idexo nproc4 = nproc nproc_in_f4 = nproc_in_f call expii4 (idexo4, nproc4, nproc_in_f4, ftype, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read initial global information C subroutine exgig (idexo, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr) implicit none integer idexo integer nnodes_g integer nelems_g integer nelem_blks_g integer nnode_sets_g integer nside_sets_g integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgig4 (idexo4, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write initial global information C subroutine expig (idexo, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr) implicit none integer idexo integer nnodes_g integer nelems_g integer nelem_blks_g integer nnode_sets_g integer nside_sets_g integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expig4 (idexo4, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read load balance parameters C subroutine exglbp (idexo, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor, ierr) implicit none integer idexo integer nint_nodes integer nbor_nodes integer next_nodes integer nint_elems integer nbor_elems integer nnode_cmaps integer nelem_cmaps integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exglbp4 (idexo4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write load balance parameters C subroutine explbp (idexo, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor, ierr) implicit none integer idexo integer nint_nodes integer nbor_nodes integer next_nodes integer nint_elems integer nbor_elems integer nnode_cmaps integer nelem_cmaps integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call explbp4 (idexo4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write concatenated load balance parameters C subroutine explbpc (idexo, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, ierr) implicit none integer idexo integer nint_nodes(*) integer nbor_nodes(*) integer next_nodes(*) integer nint_elems(*) integer nbor_elems(*) integer nnode_cmaps(*) integer nelem_cmaps(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call explbpc4 (idexo4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global node set parameters C subroutine exgnspg (idexo, ns_ids_glob, ns_n_cnt_glob, $ ns_df_cnt_glob, ierr) implicit none integer idexo integer ns_ids_glob(*) integer ns_n_cnt_glob(*) integer ns_df_cnt_glob(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnspg4 (idexo4, ns_ids_glob, ns_n_cnt_glob, $ ns_df_cnt_glob, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global node set parameters C subroutine expnspg (idexo, global_ids, global_n_cnts, $ global_df_cnts, ierr) integer idexo integer global_ids(*) integer global_n_cnts(*) integer global_df_cnts(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnspg4 (idexo4, global_ids, global_n_cnts, $ global_df_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global side set parameters C subroutine exgsspg (idexo, ss_ids_glob, ss_n_cnt_glob, $ ss_df_cnt_glob, ierr) implicit none integer idexo integer ss_ids_glob(*) integer ss_n_cnt_glob(*) integer ss_df_cnt_glob(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgsspg4 (idexo4, ss_ids_glob, ss_n_cnt_glob, $ ss_df_cnt_glob, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global side set parameters C subroutine expsspg (idexo, global_ids, global_el_cnts, $ global_df_cnts, ierr) implicit none integer idexo integer global_ids(*) integer global_el_cnts(*) integer global_df_cnts(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expsspg4 (idexo4, global_ids, global_el_cnts, $ global_df_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global element block information C subroutine exgebig (idexo, el_blk_ids, el_blk_cnts, ierr) implicit none integer idexo integer el_blk_ids(*) integer el_blk_cnts(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgebig4 (idexo4, el_blk_ids, el_blk_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global element block information C subroutine expebig (idexo, el_blk_ids, el_blk_cnts, ierr) implicit none integer idexo integer el_blk_ids(*) integer el_blk_cnts(*) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expebig4 (idexo4, el_blk_ids, el_blk_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read side set element list and side set side list C subroutine exgnss (idexo, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr) implicit none integer idexo integer ss_id integer start_side_num integer num_sides integer ss_elem_list(num_sides) integer ss_side_list(num_sides) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnss4 (idexo4, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write side set element list and side set side list C subroutine expnss (idexo, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr) implicit none integer idexo integer ss_id integer start_side_num integer num_sides integer ss_elem_list(num_sides) integer ss_side_list(num_sides) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnss4 (idexo4, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read side set distribution factor C subroutine exgnssd (idexo, ss_id, start_num, num_df_to_get, $ ss_df, ierr) implicit none integer idexo integer ss_id integer start_num integer num_df_to_get real ss_df(num_df_to_get) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnssd4 (idexo4, ss_id, start_num, num_df_to_get, $ ss_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write side set distribution factor C subroutine expnssd (idexo, ss_id, start_num, num_df_to_get, $ ss_df, ierr) implicit none integer idexo integer ss_id integer start_num integer num_df_to_get real ss_df(num_df_to_get) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnssd4 (idexo4, ss_id, start_num, num_df_to_get, $ ss_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read node set list for a single node set C subroutine exgnns (idexo, ns_id, start_node_num, num_node, $ ns_node_list, ierr) implicit none integer idexo integer ns_id integer start_node_num integer num_node integer ns_node_list(num_node) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnns4 (idexo4, ns_id, start_node_num, num_node, $ ns_node_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write node set list for a single node set C subroutine expnns (idexo, ns_id, start_node_num, num_node, $ ns_node_list, ierr) implicit none integer idexo integer ns_id integer start_node_num integer num_node integer ns_node_list(num_node) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnns4 (idexo4, ns_id, start_node_num, num_node, $ ns_node_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read node set distribution factor C subroutine exgnnsd (idexo, ns_id, start_num, num_df_to_get, $ ns_df, ierr) implicit none integer idexo integer ns_id integer start_num integer num_df_to_get real ns_df(num_df_to_get) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnnsd4 (idexo4, ns_id, start_num, num_df_to_get, $ ns_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write node set distribution factor C subroutine expnnsd (idexo, ns_id, start_num, num_df_to_get, $ ns_df, ierr) implicit none integer idexo integer ns_id integer start_num integer num_df_to_get real ns_df(num_df_to_get) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnnsd4 (idexo4, ns_id, start_num, num_df_to_get, $ ns_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read coordinates of the nodes C subroutine exgncor (idexo, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr) implicit none integer idexo integer start_node_num integer num_nodes real x_coor(num_nodes) real y_coor(num_nodes) real z_coor(num_nodes) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgcor4 (idexo4, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write coordinates of the nodes C subroutine expncor (idexo, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr) implicit none integer idexo integer start_node_num integer num_nodes real x_coor(num_nodes) real y_coor(num_nodes) real z_coor(num_nodes) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expcor4 (idexo4, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read an element blocks connectivity list C subroutine exgnec (idexo, elem_blk_id, start_elem_num, $ num_elems, connect, ierr) implicit none integer idexo integer elem_blk_id integer start_elem_num integer num_elems integer connect(num_elems) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnec4 (idexo4, elem_blk_id, start_elem_num, $ num_elems, connect, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write an element blocks connectivity list C subroutine expnec (idexo, elem_blk_id, start_elem_num, $ num_elems, connect, ierr) implicit none integer idexo integer elem_blk_id integer start_elem_num integer num_elems integer connect(num_elems) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnec4 (idexo4, elem_blk_id, start_elem_num, $ num_elems, connect, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read an element blocks attributes C subroutine exgneat (idexo, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr) implicit none integer idexo integer elem_blk_id integer start_elem_num integer num_elems real attrib(num_elems) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgneat4 (idexo4, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write an element blocks attributes C subroutine expneat (idexo, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr) implicit none integer idexo integer elem_blk_id integer start_elem_num integer num_elems real attrib(num_elems) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expneat4 (idexo4, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr4) ierr = ierr4 C end C C----------------------------------------------------------------------- C Read the element type for a specific element block C subroutine exgelt (idexo, elem_blk_id, elem_type, ierr) implicit none integer idexo integer elem_blk_id character*(*) elem_type integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgelt4 (idexo4, elem_blk_id, elem_type, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read a variable for an element block C subroutine exgnev (idexo, time_step, elem_var_index, $ elem_blk_id, num_elem_this_blk, start_elem_num, $ num_elem, elem_var_vals, ierr) implicit none integer idexo integer time_step integer elem_var_index integer elem_blk_id integer num_elem_this_blk integer start_elem_num integer num_elem real elem_var_vals(num_elem) integer ierr C integer*4 idexo4 integer*4 time_step4 integer*4 elem_var_index4 integer*4 ierr4 C idexo4 = idexo time_step4 = time_step elem_var_index4 = elem_var_index call exgnev4 (idexo4, time_step4, elem_var_index4, $ elem_blk_id, num_elem_this_blk, start_elem_num, $ num_elem, elem_var_vals, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write a variable slab for an element block C subroutine expevs (idexo, time_step, elem_var_index, $ elem_blk_id, start_pos, num_vals, elem_var_vals, $ ierr) implicit none integer idexo integer time_step integer elem_var_index integer elem_blk_id integer start_pos integer num_vals real elem_var_vals(num_vals) integer ierr C integer*4 idexo4 integer*4 time_step4 integer*4 elem_var_index4 integer*4 ierr4 C idexo4 = idexo time_step4 = time_step elem_var_index4 = elem_var_index call expevs4 (idexo4, time_step4, elem_var_index4, $ elem_blk_id, start_pos, num_vals, elem_var_vals, $ ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the values of a single nodal variable for a single time step C subroutine exgnnv (idexo, time_step, nodal_var_index, $ start_node_num, num_nodes, nodal_vars, ierr) implicit none integer idexo integer time_step integer nodal_var_index integer start_node_num integer num_nodes real nodal_vars(num_nodes) integer ierr C integer*4 idexo4 integer*4 time_step4 integer*4 nodal_var_index4 integer*4 ierr4 C idexo4 = idexo time_step4 = time_step nodal_var_index4 = nodal_var_index call exgnnv4 (idexo4, time_step4, nodal_var_index4, $ start_node_num, num_nodes, nodal_vars, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write nodal variable slab C subroutine expnvs (idexo, time_step, nodal_var_index, $ start_pos, num_vals, nodal_var_vals, ierr) implicit none integer idexo integer time_step integer nodal_var_index integer start_pos integer num_vals real nodal_var_vals(num_vals) integer ierr C integer*4 idexo4 integer*4 time_step4 integer*4 nodal_var_index4 integer*4 ierr4 C idexo4 = idexo time_step4 = time_step nodal_var_index4 = nodal_var_index call expnvs4 (idexo4, time_step4, nodal_var_index4, $ start_pos, num_vals, nodal_var_vals, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the element numbering map C subroutine exgnenm (idexo, starte, num_ent, elem_map, ierr) implicit none integer idexo integer starte integer num_ent integer elem_map(num_ent) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnenm4 (idexo4, starte, num_ent, elem_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the element numbering map C subroutine expnenm (idexo, starte, num_ent, elem_map, ierr) implicit none integer idexo integer starte integer num_ent integer elem_map(num_ent) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnenm4 (idexo4, starte, num_ent, elem_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the node numbering map C subroutine exgnnnm (idexo, startn, num_ent, node_map, ierr) implicit none integer idexo integer startn integer num_ent integer node_map(num_ent) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call exgnnnm4 (idexo4, startn, num_ent, node_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the node numbering map C subroutine expnnnm (idexo, startn, num_ent, node_map, ierr) implicit none integer idexo integer startn integer num_ent integer node_map(num_ent) integer ierr C integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expnnnm4 (idexo4, startn, num_ent, node_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the node map for a processor C subroutine exgnmp (idexo, node_mapi, node_mapb, node_mape, $ processor, ierr) implicit none integer idexo integer node_mapi(*) integer node_mapb(*) integer node_mape(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exgnmp4 (idexo4, node_mapi, node_mapb, node_mape, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write a node map for a processor C subroutine expnmp (idexo, node_mapi, node_mapb, node_mape, $ processor, ierr) implicit none integer idexo integer node_mapi(*) integer node_mapb(*) integer node_mape(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call expnmp4 (idexo4, node_mapi, node_mapb, node_mape, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the element map for a processor C subroutine exgemp (idexo, elem_mapi, elem_mapb, processor, ierr) implicit none integer idexo integer elem_mapi(*) integer elem_mapb(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exgemp4 (idexo4, elem_mapi, elem_mapb, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the element map for a processor C subroutine expemp (idexo, elem_mapi, elem_mapb, processor, ierr) implicit none integer idexo integer elem_mapi(*) integer elem_mapb(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call expemp4 (idexo4, elem_mapi, elem_mapb, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the communications map parameters for a single processor C subroutine exgcmp (idexo, ncmap_ids, ncmap_node_cnts, $ ecmap_ids, ecmap_elem_cnts, processor, ierr) implicit none integer idexo integer ncmap_ids(*) integer ncmap_node_cnts(*) integer ecmap_ids(*) integer ecmap_elem_cnts(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exgcmp4 (idexo4, ncmap_ids, ncmap_node_cnts, $ ecmap_ids, ecmap_elem_cnts, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the communications map parameters for a single processor C subroutine expcmp (idexo, nmap_ids, nmap_node_cnts, emap_ids, $ emap_elem_cnts, processor, ierr) implicit none integer idexo integer nmap_ids(*) integer nmap_node_cnts(*) integer emap_ids(*) integer emap_elem_cnts(*) integer processor integer ierr integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call expcmp4 (idexo4, nmap_ids, nmap_node_cnts, emap_ids, $ emap_elem_cnts, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the communications map parameters for all processors C subroutine expcmpc (idexo, nmap_ids, nmap_node_cnts, $ nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs, ierr) implicit none integer idexo integer nmap_ids(*) integer nmap_node_cnts(*) integer nproc_ptrs(*) integer emap_ids(*) integer emap_elem_cnts(*) integer eproc_ptrs(*) integer ierr integer*4 idexo4 integer*4 ierr4 C idexo4 = idexo call expcmpc4 (idexo4, nmap_ids, nmap_node_cnts, $ nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs, ierr4) ierr = ierr4 end C----------------------------------------------------------------------- C C Read the nodal communications map for a single processor C subroutine exgncm (idexo, map_id, node_ids, proc_ids, $ processor, ierr) implicit none integer idexo integer map_id integer node_ids(*) integer proc_ids(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exgncm4 (idexo4, map_id, node_ids, proc_ids, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the nodal communications map for a single processor C subroutine expncm (idexo, map_id, node_ids, proc_ids, $ processor, ierr) implicit none integer idexo integer map_id integer node_ids(*) integer proc_ids(*) integer processor integer ierr C integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call expncm4 (idexo4, map_id, node_ids, proc_ids, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the elemental communications map for a single processor C subroutine exgecm (idexo, map_id, elem_ids, side_ids, $ proc_ids, processor, ierr) implicit none integer idexo integer map_id integer elem_ids(*) integer side_ids(*) integer proc_ids(*) integer processor integer ierr integer*4 idexo4 integer*4 processor4 integer*4 ierr4 C idexo4 = idexo processor4 = processor call exgecm4 (idexo4, map_id, elem_ids, side_ids, $ proc_ids, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the elemental communications map for a single processor C subroutine expecm (idexo, map_id, elem_ids, side_ids, $ proc_ids, processor, ierr) implicit none integer idexo integer map_id integer elem_ids(*) integer side_ids(*) integer proc_ids(*) integer processor integer ierr integer*4 idexo4 integer*4 processor4 integer*4 ierr4 idexo4 = idexo processor4 = processor call expecm4 (idexo4, map_id, elem_ids, side_ids, $ proc_ids, processor4, ierr4) ierr = ierr4 end C----------------------------------------------------------------------- SUBROUTINE I8I4 (N, I8, PI4) C C CREATE I4 ARRAY AND COPY I8 ARRAY CONTENTS TO I4 C IMPLICIT NONE INTEGER N INTEGER I8 (*) INTEGER*4 I4 (1) POINTER (PI4, I4) INTEGER 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 N INTEGER*4 I4 (1) POINTER (PI4, I4) INTEGER I8 (*) INTEGER 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 N INTEGER*4 I4 (1) POINTER (PI4, I4) INTEGER MALLOC INTEGER NB PI4 = 0 IF (N .EQ. 0) RETURN NB = N * 4 PI4 = MALLOC (NB) if (PI4 .EQ. 0) then write (*,*) * 'ERROR: Unable to allocate array of size ',N,' in I4ALLOC' stop 'Exodus Memory Allocation Error' end if 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 #ifndef __XLF__ CALL FREE (PI4) #endif PI4 = 0 END #endif exodusii-6.02.dfsg.1/exodus/forbind/src/exo_jack-windows.c000066400000000000000000003337211225312213100235140ustar00rootroot00000000000000/* * 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. * */ /* * OVERVIEW * * This file contains jacket routines written in C for interfacing Fortran * ExodusII function calls to the actual C binding for ExodusII. * 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 #include #include #include #include "netcdf.h" #include "exodusII.h" #include "exodusII_int.h" /* * The Build64 is for the "normal" SEACAS build which uses compiler * options to change reals and integers into 8-byte quantities. The * routines in addrwrap.F are used to down-convert the 8-byte integers * into 4-byte integers which then call through to the routines in * this file which have a '4' or '4_' appended to the routine name. * These routines then call through to the C API routines. * * If DEFAULT_REAL_INT is defined, then the build is to build a * fortran library interface that takes 4-byte ints and either 4-byte * or 8-byte floating point (real/double) variables. In this case, the * addrwrap routines are not built and a fortran client will call the * routines in this file directly. * */ #if defined(Build64) && !defined(DEFAULT_REAL_INT) /* 64-bit */ #define real double #define entity_id ex_entity_id #ifdef ADDC_ #define F2C(name) name##4_ #else #define F2C(name) name##4 #endif #else /* 32-bit */ #define real float #define entity_id int #ifdef ADDC_ #define F2C(name) name##_ #else #define F2C(name) name #endif #endif 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 */ static void ex_fcdcpy(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); if (len > fslen) len = fslen; 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) = ' '; } } /* copy function used to copy strings and strip trailing blanks */ static void ex_fstrncpy(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 ex_nstrncpy(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'; } /* Above are utility functions used below */ /* ======================================================================== */ /* Below are the exodus API functions */ /* * Adding a new function: * + Protect the name with the f2c (uppercase) macro which will add/not add '4' and or '_' * depending on the compilation mode. * * + float/double arguments are declared as 'real' which will be replaced with float or double. * * + If there are any character arguments 'X', then add an int* argument 'Xlen' at end of argument list * This will contain the length of the passed in character argument. * * + Look at existing functions for guidance... */ /* * create an EXODUS II file */ int F2C(EXCRE) (char *path, int *clobmode, int *cpu_word_size, int *io_word_size, int *ierr, int pathlen) { char *name; int idexo; if (!(name = malloc((pathlen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return (EX_FATAL); } (void) ex_nstrncpy(name, path, pathlen); if ((idexo = ex_create(name, *clobmode, cpu_word_size, io_word_size)) != EX_FATAL) { free(name); *ierr = 0; return (idexo); } free(name); *ierr = exerrval; return (EX_FATAL); } /* * open an EXODUS II file */ int F2C(EXOPEN) (char *path, int *mode, int *cpu_word_size, int *io_word_size, float *version, /* This is float always; not real */ int *ierr, int pathlen) { char *name; int idexo; if (!(name = malloc((pathlen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return (EX_FATAL); } (void) ex_nstrncpy(name, path, pathlen); if ((idexo = ex_open(name, *mode, cpu_word_size, io_word_size, version)) != EX_FATAL) { free(name); *ierr = 0; return (idexo); } free(name); *ierr = EX_FATAL; return (EX_FATAL); } /* * close an EXODUS II file */ void F2C(EXCLOS) (int *idexo, int *ierr) { *ierr = ex_close(*idexo); } /* * update an EXODUS II file */ void F2C(EXUPDA) (int *idexo, int *ierr) { *ierr = ex_update(*idexo); } /* * write initialization parameters */ void F2C(EXPINI) (int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen) { int slen; char *name; slen = MAX_LINE_LENGTH; /* max line size */ // AIS printf("%i\n",slen); printf("%i\n",titlelen); if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } name = malloc((slen + 1) * sizeof(char)); (void) ex_fstrncpy(name, title, slen); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t *n_dim = num_dim; int64_t *n_nodes = num_nodes; int64_t *n_elem = num_elem; int64_t *n_elem_blk = num_elem_blk; int64_t *n_node_sets = num_node_sets; int64_t *n_side_sets = num_side_sets; // AIS printf("I am in then"); // AIF *ierr = ex_put_init(*idexo, name, *n_dim, *n_nodes, *n_elem, *n_elem_blk, *n_node_sets, *n_side_sets); // AIS printf("%i\n",*ierr); // AIF } else { int *n_dim = num_dim; int *n_nodes = num_nodes; int *n_elem = num_elem; int *n_elem_blk = num_elem_blk; int *n_node_sets = num_node_sets; int *n_side_sets = num_side_sets; // AIS printf("I am in else"); // AIF *ierr = ex_put_init(*idexo, name, *n_dim, *n_nodes, *n_elem, *n_elem_blk, *n_node_sets, *n_side_sets); } free(name); } /* * read initialization parameters */ void F2C(EXGINI) (int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen) { int slen; char *name; *ierr = 0; slen = MAX_LINE_LENGTH; /* max line size */ if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } name = malloc((slen + 1) * sizeof(char)); memset(name, 0, slen + 1); *ierr = ex_get_init(*idexo, name, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets); ex_fcdcpy(title, slen, name); free(name); } /* * write QA records */ void F2C(EXPQA) (int *idexo, int *num_qa_records, char *qa_record, int *ierr, int qa_recordlen) { 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 */ slen = MAX_STR_LENGTH; /* max str size */ if (qa_recordlen != MAX_STR_LENGTH) { slen = qa_recordlen; } 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; 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 */ ex_fstrncpy(*(sptr + iii), qa_record + iii * qa_recordlen, slen); iii++; /* bump char array pointer */ } } *(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 F2C(EXGQA) (int *idexo, char *qa_record, int *ierr, int qa_recordlen) { int num_qa_records; char **sptr; /* internal string pointer array for malloc * use */ int i, ii, iii, slen, alen; *ierr = 0; /* default no errror */ slen = MAX_STR_LENGTH; /* max str size */ if (qa_recordlen != MAX_STR_LENGTH) { slen = qa_recordlen; } alen = 4; /* qa records are 4 strings deep */ /* do ExodusII C call to find out how many qa records are avail */ num_qa_records = ex_inquire_int(*idexo, EX_INQ_QA); /* Allocate space for the QA string ptr array */ if (!(sptr = malloc((num_qa_records * alen + 1) * sizeof(char *)))) { *ierr = 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; 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; 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 */ ex_fcdcpy(qa_record + iii * qa_recordlen, slen, *(sptr + iii)); 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 F2C(EXPINF) (int *idexo, int *num_info, char *info, int *ierr, int infolen) { 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 */ slen = MAX_LINE_LENGTH; /* max str size */ if (infolen != MAX_LINE_LENGTH) { slen = infolen; } /* Allocate space for the string ptr array */ if (!(aptr = malloc(((*num_info) + 1) * sizeof(char *)))) { *ierr = 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; 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 * infolen, slen); /* copy string into * buffer */ } *(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 */ return; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read information records */ void F2C(EXGINF) (int *idexo, char *info, int *ierr, int infolen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int i, slen, num_info; *ierr = 0; /* default no errror */ /* do exodusII C call to find out how many info records are avail */ num_info = ex_inquire_int(*idexo, EX_INQ_INFO); slen = MAX_LINE_LENGTH; /* max str size */ if (infolen != MAX_LINE_LENGTH) { slen = infolen; } /* * 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; 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; 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); return; } for (i = 0; i < num_info; i++) { /* Copy Fortran info records to * staging space */ ex_fcdcpy(info + i * infolen, 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 F2C(EXPCOR) (int *idexo, real * x_coor, real * y_coor, real * z_coor, int *ierr) { *ierr = ex_put_coord(*idexo, x_coor, y_coor, z_coor); } /* * read nodal coordinates */ void F2C(EXGCOR) (int *idexo, real * x_coor, real * y_coor, real * z_coor, int *ierr) { *ierr = ex_get_coord(*idexo, x_coor, y_coor, z_coor); } /* * write coordinate names */ void F2C(EXPCON) (int *idexo, char *coord_names, int *ierr, int coord_nameslen) { char **aptr; /* internal array of string pointers for * malloc use */ char *sptr; /* internal string pointer for malloc use */ int i, ndim, slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (coord_nameslen < slen) { slen = coord_nameslen; } /* do ExodusII C call to find out how many dimensions */ ndim = ex_inquire_int(*idexo, EX_INQ_DIM); /* Allocate space for the name ptr array */ if (!(aptr = malloc((ndim + 1) * sizeof(char *)))) { *ierr = 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); return; } for (i = 0; i < ndim; i++) { *(aptr + i) = sptr + i * (slen + 1); /* copy fortran string into allocated space */ ex_fstrncpy(*(aptr + i), coord_names + i * coord_nameslen, slen); } *(aptr + i) = 0; /* set last pointer to null */ if (ex_put_coord_names(*idexo, aptr) == EX_FATAL) { *ierr = EX_FATAL; } /* 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 F2C(EXGCON) (int *idexo, char *coord_names, int *ierr, int coord_nameslen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int ndim; int i, slen; *ierr = 0; /* default no error */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (coord_nameslen < slen) { slen = coord_nameslen; } /* do ExodusII C call to find out how many dimensions */ ndim = ex_inquire_int(*idexo, EX_INQ_DIM); /* allocate memory to stage the coordinate name ptrs into */ if (!(aptr = malloc((ndim + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* 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 */ return; } for (i = 0; i < ndim; i++) { /* put pointers to staging space into ptr * array */ *(aptr + i) = sptr + i * (slen + 1); } /* 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 */ return; } /* copy C strings to Fortran arrays */ memset(coord_names, 0, ndim * coord_nameslen); for (i = 0; i < ndim; i++) { ex_fcdcpy(coord_names + i * coord_nameslen, 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 F2C(EXPMAP) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_put_map(*idexo, elem_map); } /* * read element order map */ void F2C(EXGMAP) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_get_map(*idexo, elem_map); } /* * write concatenated element block parameters */ void F2C(EXPCLB) (int *idexo, void_int *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *create_maps, int *ierr, int elem_typelen) { size_t num_elem_blk; char **aptr; /* ptr to temp staging space for string array * ptrs */ char *sptr; /* ptr to temp staging space for strings */ size_t i, slen; *ierr = 0; /* default no error */ num_elem_blk = ex_inquire_int(*idexo, EX_INQ_ELEM_BLK); slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory for pointer array */ if (!(aptr = malloc((num_elem_blk + 1) * sizeof(char *)))) { *ierr = 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; 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 * elem_typelen, 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; } free(sptr); free(aptr); } /* * write element block parameters */ void F2C(EXPELB) (int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; /* default no error */ slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory to stage the element type name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Copy element type names from Fortran array to staging area */ ex_fstrncpy(sptr, elem_type, slen); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t *n_elem_this_blk = num_elem_this_blk; int64_t *n_nodes_per_elem = num_nodes_per_elem; int64_t *n_attr = num_attr; *ierr = ex_put_elem_block(*idexo, *elem_blk_id, sptr, *n_elem_this_blk, *n_nodes_per_elem, *n_attr); } else { int *n_elem_this_blk = num_elem_this_blk; int *n_nodes_per_elem = num_nodes_per_elem; int *n_attr = num_attr; *ierr = ex_put_elem_block(*idexo, *elem_blk_id, sptr, *n_elem_this_blk, *n_nodes_per_elem, *n_attr); } free(sptr); } /* * read element block parameters */ void F2C(EXGELB) (int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory to stage the element type names into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = 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; return; } /* Copy element type name from staging area to Fortran array */ memset(elem_type, 0, elem_typelen); ex_fcdcpy(elem_type, slen, sptr); free(sptr); } /* * read element blocks IDs */ void F2C(EXGEBI) (int *idexo, void_int *elem_blk_ids, int *ierr) { *ierr = ex_get_elem_blk_ids(*idexo, elem_blk_ids); } /* * write element block connectivity */ void F2C(EXPELC) (int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr) { *ierr = ex_put_elem_conn(*idexo, *elem_blk_id, connect); } /* * read element block connectivity */ void F2C(EXGELC) (int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr) { *ierr = ex_get_elem_conn(*idexo, *elem_blk_id, connect); } /* * write entity count-per-polyhedra information for nsided block */ void F2C(EXPECPP) (int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr) { *ierr = ex_put_entity_count_per_polyhedra(*idexo, (ex_entity_type) * obj_type, *elem_blk_id, counts); } /* * read entity count-per-polyhedra information for nsided block */ void F2C(EXGECPP) (int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr) { *ierr = ex_get_entity_count_per_polyhedra(*idexo, (ex_entity_type) * obj_type, *elem_blk_id, counts); } /* * write element block attributes */ void F2C(EXPEAT) (int *idexo, entity_id *elem_blk_id, real * attrib, int *ierr) { *ierr = ex_put_elem_attr(*idexo, *elem_blk_id, attrib); } /* * read element block attributes */ void F2C(EXGEAT) (int *idexo, entity_id *elem_blk_id, real * attrib, int *ierr) { *ierr = ex_get_elem_attr(*idexo, *elem_blk_id, attrib); } /* * read element block attribute names */ void F2C(EXGEAN) (int *idexo, entity_id *elem_blk_id, int *num_attr, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_attr + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_attr * (slen + 1) * sizeof(char)))) { *ierr = 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); } /* Copy Fortran names from staging space */ memset(names, 0, *num_attr * nameslen); for (i = 0; i < *num_attr; i++) { ex_fcdcpy(names + i * nameslen, 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 F2C(EXPEAN) (int *idexo, entity_id *elem_blk_id, int *num_attr, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_attr + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_attr * (slen + 1) * sizeof(char)))) { *ierr = 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 * nameslen, 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; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * write object names */ void F2C(EXPNAMS) (int *idexo, int *type, int *num_obj, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory for pointer array */ if (!(aptr = malloc((*num_obj + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_obj * (slen + 1) * sizeof(char)))) { 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 * nameslen, 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, (ex_entity_type) * type, aptr) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read object names */ void F2C(EXGNAMS) (int *idexo, int *type, int *num_obj, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_obj + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_obj * (slen + 1) * sizeof(char)))) { *ierr = 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, (ex_entity_type) * type, aptr) == EX_FATAL) { *ierr = EX_FATAL; free(sptr); /* free up allocated space */ free(aptr); return; } /* Copy Fortran names from staging space */ memset(names, 0, *num_obj * nameslen); for (i = 0; i < *num_obj; i++) { ex_fcdcpy(names + i * nameslen, 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 F2C(EXPPN) (int *idexo, int *obj_type, int *num_props, char *prop_names, int *ierr, int prop_nameslen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int i, slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_nameslen < slen) { slen = prop_nameslen; } /* Allocate space for the name ptr array */ if (!(aptr = malloc((*num_props + 1) * sizeof(char *)))) { *ierr = 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); return; } for (i = 0; i < *num_props; i++) { *(aptr + i) = sptr + i * (slen + 1); /* copy fortran string into allocated space */ ex_fstrncpy(*(aptr + i), prop_names + i * prop_nameslen, slen); } *(aptr + i) = 0; /* set last pointer to null */ if (ex_put_prop_names(*idexo, (ex_entity_type) * obj_type, *num_props, aptr) == EX_FATAL) { *ierr = EX_FATAL; } /* 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 F2C(EXGPN) (int *idexo, int *obj_type, char *prop_names, int *ierr, int prop_nameslen) { 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; ex_inquiry inq_code; int num_props; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_nameslen < slen) { slen = prop_nameslen; } switch ((ex_entity_type) * 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 */ num_props = ex_inquire_int(*idexo, inq_code); /* Allocate space for the name ptr array */ if (!(aptr = malloc((num_props + 1) * sizeof(char *)))) { *ierr = 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); 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, (ex_entity_type) * obj_type, aptr) == EX_FATAL) { *ierr = EX_FATAL; free(sptr); /* free up string space */ free(aptr); /* free up array ptr space */ return; } /* copy C strings to Fortran arrays */ memset(prop_names, 0, num_props * prop_nameslen); for (i = 0; i < num_props; i++) { ex_fcdcpy(prop_names + i * prop_nameslen, 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 F2C(EXPP) (int *idexo, int *obj_type, entity_id *obj_id, char *prop_name, entity_id *value, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); *ierr = ex_put_prop(*idexo, (ex_entity_type) * obj_type, *obj_id, sptr, *value); free(sptr); } /* * read object property */ void F2C(EXGP) (int *idexo, int *obj_type, entity_id *obj_id, char *prop_name, void_int *value, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* use exodusII C routine to get the property value */ if (ex_get_prop(*idexo, (ex_entity_type) * obj_type, *obj_id, sptr, value) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * read object property array */ void F2C(EXGPA) (int *idexo, int *obj_type, char *prop_name, void_int *values, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } memset(sptr, 0, slen + 1); /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* use exodusII C routine to get the values array */ if (ex_get_prop_array(*idexo, (ex_entity_type) * obj_type, sptr, values) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * write object property array */ void F2C(EXPPA) (int *idexo, int *obj_type, char *prop_name, void_int *values, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* Use exodusII C routine to store the property values */ if (ex_put_prop_array(*idexo, (ex_entity_type) * obj_type, sptr, values) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * write node set parameters */ void F2C(EXPNP) (int *idexo, entity_id *node_set_id, void_int *num_nodes_in_set, void_int *num_dist_in_set, int *ierr) { if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t nnis = *(int64_t*)num_nodes_in_set; int64_t ndis = *(int64_t*)num_dist_in_set; *ierr = ex_put_node_set_param(*idexo, *node_set_id, nnis, ndis); } else { int nnis = *(int*)num_nodes_in_set; int ndis = *(int*)num_dist_in_set; *ierr = ex_put_node_set_param(*idexo, *node_set_id, nnis, ndis); } } /* * read node set parameters */ void F2C(EXGNP) (int *idexo, entity_id *node_set_id, void_int *num_nodes_in_set, void_int *num_dist_in_set, int *ierr) { *ierr = ex_get_node_set_param(*idexo, *node_set_id, num_nodes_in_set, num_dist_in_set); } /* * write node set */ void F2C(EXPNS) (int *idexo, entity_id *node_set_id, void_int *node_set_node_list, int *ierr) { *ierr = ex_put_node_set(*idexo, *node_set_id, node_set_node_list); } /* * write node set dist factors */ void F2C(EXPNSD) (int *idexo, entity_id *node_set_id, real * node_set_dist_fact, int *ierr) { *ierr = ex_put_node_set_dist_fact(*idexo, *node_set_id, node_set_dist_fact); } /* * read node set */ void F2C(EXGNS) (int *idexo, entity_id *node_set_id, void_int *node_set_node_list, int *ierr) { *ierr = ex_get_node_set(*idexo, *node_set_id, node_set_node_list); } /* * read node set dist factors */ void F2C(EXGNSD) (int *idexo, entity_id *node_set_id, real * node_set_dist_fact, int *ierr) { *ierr = ex_get_node_set_dist_fact(*idexo, *node_set_id, node_set_dist_fact); } /* * read node sets IDs */ void F2C(EXGNSI) (int *idexo, void_int *node_set_ids, int *ierr) { *ierr = ex_get_node_set_ids(*idexo, node_set_ids); } /* * write concatenated node sets */ void F2C(EXPCNS) (int *idexo, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_dist_index, void_int *node_sets_node_list, real * node_sets_dist_fact, int *ierr) { size_t num_node_sets, i; int int_size; void_int *node_index_ptr, *dist_index_ptr; *ierr = 0; num_node_sets = ex_inquire_int(*idexo, EX_INQ_NODE_SETS); int_size = sizeof(int); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } /* allocate memory for C node index array */ if (!(node_index_ptr = malloc(num_node_sets * int_size))) { *ierr = EX_MEMFAIL; return; } /* allocate memory for C dist factor index array */ if (!(dist_index_ptr = malloc(num_node_sets * int_size))) { free(node_index_ptr); *ierr = EX_MEMFAIL; return; } if (int_size == sizeof(int64_t)) { for (i = 0; i < num_node_sets; i++) { /* change from 1-based to 0 index */ ((int64_t*)node_index_ptr)[i] = ((int64_t*)node_sets_node_index)[i] - 1; ((int64_t*)dist_index_ptr)[i] = ((int64_t*)node_sets_dist_index)[i] - 1; } } else { for (i = 0; i < num_node_sets; i++) { /* change from 1-based to 0 index */ ((int*)node_index_ptr)[i] = ((int*)node_sets_node_index)[i] - 1; ((int*)dist_index_ptr)[i] = ((int*)node_sets_dist_index)[i] - 1; } } *ierr = 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); free(node_index_ptr); free(dist_index_ptr); } /* * read concatenated node sets */ void F2C(EXGCNS) (int *idexo, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_dist_index, void_int *node_sets_node_list, real * node_sets_dist_fact, int *ierr) { size_t num_node_sets, i; *ierr = ex_get_concat_node_sets(*idexo, node_set_ids, num_nodes_per_set, num_dist_per_set, node_sets_node_index, node_sets_dist_index, node_sets_node_list, node_sets_dist_fact); num_node_sets = ex_inquire_int(*idexo, EX_INQ_NODE_SETS); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_node_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)node_sets_node_index)[i] += 1; ((int64_t*)node_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_node_sets; i++) { /* change from 0-based to 1 index */ ((int*)node_sets_node_index)[i] += 1; ((int*)node_sets_dist_index)[i] += 1; } } } /* * write side set parameters */ void F2C(EXPSP) (int *idexo, entity_id *side_set_id, void_int *num_sides_in_set, void_int *num_df_in_set, int *ierr) { if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t nsis = *(int64_t*)num_sides_in_set; int64_t ndis = *(int64_t*)num_df_in_set; *ierr = ex_put_side_set_param(*idexo, *side_set_id, nsis, ndis); } else { int nsis = *(int*)num_sides_in_set; int ndis = *(int*)num_df_in_set; *ierr = ex_put_side_set_param(*idexo, *side_set_id, nsis, ndis); } } /* * read side set parameters */ void F2C(EXGSP) (int *idexo, entity_id *side_set_id, void_int *num_sides_in_set, void_int *num_df_in_set, int *ierr) { *ierr = ex_get_side_set_param(*idexo, *side_set_id, num_sides_in_set, num_df_in_set); } /* * get side set node list length */ void F2C(EXGSNL) (int *idexo, entity_id *side_set_id, void_int *num_nodes_in_set, int *ierr) { *ierr = ex_get_side_set_node_list_len(*idexo, *side_set_id, num_nodes_in_set); } /* * write side set */ void F2C(EXPSS) (int *idexo, entity_id *side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list, int *ierr) { *ierr = ex_put_side_set(*idexo, *side_set_id, side_set_elem_list, side_set_side_list); } /* * read side set */ void F2C(EXGSS) (int *idexo, entity_id *side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list, int *ierr) { *ierr = ex_get_side_set(*idexo, *side_set_id, side_set_elem_list, side_set_side_list); } /* * write side set distribution factors */ void F2C(EXPSSD) (int *idexo, entity_id *side_set_id, real * side_set_dist_fact, int *ierr) { *ierr = ex_put_side_set_dist_fact(*idexo, *side_set_id, side_set_dist_fact); } /* * read side set distribution factors */ void F2C(EXGSSD) (int *idexo, entity_id *side_set_id, real * side_set_dist_fact, int *ierr) { *ierr = ex_get_side_set_dist_fact(*idexo, *side_set_id, side_set_dist_fact); } /* * read side sets IDs */ void F2C(EXGSSI) (int *idexo, void_int *side_set_ids, int *ierr) { *ierr = ex_get_side_set_ids(*idexo, side_set_ids); } /* * write concatenated side sets */ void F2C(EXPCSS) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, real * side_sets_dist_fact, int *ierr) { size_t num_side_sets, i; void_int *elem_index_ptr, *dist_index_ptr; int int_size; *ierr = 0; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); int_size = sizeof(int); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } /* allocate memory for C element index array */ if (!(elem_index_ptr = malloc(num_side_sets * int_size))) { *ierr = EX_MEMFAIL; return; } /* allocate memory for C dist factor index array */ if (!(dist_index_ptr = malloc(num_side_sets * int_size))) { free(elem_index_ptr); *ierr = EX_MEMFAIL; return; } if (int_size == sizeof(int64_t)) { for (i = 0; i < num_side_sets; i++) { /* change from 1-based to 0 index */ ((int64_t*)elem_index_ptr)[i] = ((int64_t*)side_sets_elem_index)[i] - 1; ((int64_t*)dist_index_ptr)[i] = ((int64_t*)side_sets_dist_index)[i] - 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 1-based to 0 index */ ((int*)elem_index_ptr)[i] = ((int*)side_sets_elem_index)[i] - 1; ((int*)dist_index_ptr)[i] = ((int*)side_sets_dist_index)[i] - 1; } } *ierr = 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); free(elem_index_ptr); free(dist_index_ptr); } /* * read concatenated side sets */ void F2C(EXGCSS) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, real * side_sets_dist_fact, int *ierr) { size_t i, num_side_sets; *ierr = 0; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); *ierr = ex_get_concat_side_sets(*idexo, side_set_ids, num_elem_per_set, num_dist_per_set, side_sets_elem_index, side_sets_dist_index, side_sets_elem_list, side_sets_side_list, side_sets_dist_fact); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)side_sets_elem_index)[i] += 1; ((int64_t*)side_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int*)side_sets_elem_index)[i] += 1; ((int*)side_sets_dist_index)[i] += 1; } } } /* * read concatenated side sets (no dist factors) */ void F2C(EXGCSSF) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, int *ierr) { size_t i, num_side_sets; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); *ierr = ex_get_concat_side_sets(*idexo, side_set_ids, num_elem_per_set, num_dist_per_set, side_sets_elem_index, side_sets_dist_index, side_sets_elem_list, side_sets_side_list, 0); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)side_sets_elem_index)[i] += 1; ((int64_t*)side_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int*)side_sets_elem_index)[i] += 1; ((int*)side_sets_dist_index)[i] += 1; } } } /* * write results variables parameters */ void F2C(EXPVP) (int *idexo, char *var_type, int *num_vars, int *ierr, int var_typelen) { *ierr = ex_put_var_param(*idexo, var_type, *num_vars); } /* * read results variables parameters */ void F2C(EXGVP) (int *idexo, char *var_type, int *num_vars, int *ierr, int var_typelen) { *ierr = ex_get_var_param(*idexo, var_type, num_vars); } /* * write results variables names */ void F2C(EXPVAN) (int *idexo, char *var_type, int *num_vars, char *var_names, int *ierr, int var_typelen, int var_nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (var_nameslen < slen) { slen = var_nameslen; } /* allocate memory for pointer array */ if (!(aptr = malloc((*num_vars + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_vars * (slen + 1) * sizeof(char)))) { 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 */ ex_fstrncpy(*(aptr + i), var_names + i * var_nameslen, slen); /* copy string into * buffer */ } *(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; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read results variables names */ void F2C(EXGVAN) (int *idexo, char *var_type, int *num_vars, char *var_names, int *ierr, int var_typelen, int var_nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (var_nameslen < slen) { slen = var_nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_vars + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_vars * (slen + 1) * sizeof(char)))) { *ierr = 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); return; } /* Copy Fortran variable names to staging space */ memset(var_names, 0, *num_vars * var_nameslen); for (i = 0; i < *num_vars; i++) { ex_fcdcpy(var_names + i * var_nameslen, 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 F2C(EXPVTT) (int *idexo, int *num_elem_blk, int *num_elem_var, int *elem_var_tab, int *ierr) { *ierr = ex_put_elem_var_tab(*idexo, *num_elem_blk, *num_elem_var, elem_var_tab); } /* * write nodeset variable truth table */ void F2C(EXPNSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_put_nset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * write sideset variable truth table */ void F2C(EXPSSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_put_sset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * read element variable truth table */ void F2C(EXGVTT) (int *idexo, int *num_elem_blk, int *num_elem_var, int *elem_var_tab, int *ierr) { *ierr = ex_get_elem_var_tab(*idexo, *num_elem_blk, *num_elem_var, elem_var_tab); } /* * read nodeset variable truth table */ void F2C(EXGNSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_get_nset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * read sideset variable truth table */ void F2C(EXGSSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_get_sset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * write global variable values at time step */ void F2C(EXPGV) (int *idexo, int *time_step, int *num_glob_vars, real * glob_var_vals, int *ierr) { *ierr = ex_put_glob_vars(*idexo, *time_step, *num_glob_vars, glob_var_vals); } /* * read global variable values at a time step */ void F2C(EXGGV) (int *idexo, int *time_step, int *num_glob_vars, real * glob_var_vals, int *ierr) { *ierr = ex_get_glob_vars(*idexo, *time_step, *num_glob_vars, glob_var_vals); } /* * read global variable values through time */ void F2C(EXGGVT) (int *idexo, int *glob_var_index, int *beg_time_step, int *end_time_step, real * glob_var_vals, int *ierr) { *ierr = ex_get_glob_var_time(*idexo, *glob_var_index, *beg_time_step, *end_time_step, glob_var_vals); } /* * write nodal variable values at a time step */ void F2C(EXPNV) (int *idexo, int *time_step, int *nodal_var_index, void_int *num_nodes, real * nodal_var_vals, int *ierr) { int64_t nnodes; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnodes = *(int64_t*)num_nodes; } else { nnodes = *(int*)num_nodes; } *ierr = ex_put_nodal_var(*idexo, *time_step, *nodal_var_index, nnodes, nodal_var_vals); } /* * read nodal variable values at a time step */ void F2C(EXGNV) (int *idexo, int *time_step, int *nodal_var_index, void_int *num_nodes, real * nodal_var_vals, int *ierr) { int64_t nnodes; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnodes = *(int64_t*)num_nodes; } else { nnodes = *(int*)num_nodes; } *ierr = ex_get_nodal_var(*idexo, *time_step, *nodal_var_index, nnodes, nodal_var_vals); } /* * read nodal variable values through time */ void F2C(EXGNVT) (int *idexo, int *nodal_var_index, void_int *node_number, int *beg_time_step, int *end_time_step, real * nodal_var_vals, int *ierr) { int64_t nnode; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnode = *(int64_t*)node_number; } else { nnode = *(int*)node_number; } *ierr = ex_get_nodal_var_time(*idexo, *nodal_var_index, nnode, *beg_time_step, *end_time_step, nodal_var_vals); } /* * write element variable values at a time step */ void F2C(EXPEV) (int *idexo, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, real * elem_var_vals, int *ierr) { int64_t neblk; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { neblk = *(int64_t*)num_elem_this_blk; } else { neblk = *(int*)num_elem_this_blk; } *ierr = ex_put_elem_var(*idexo, *time_step, *elem_var_index, *elem_blk_id, neblk, elem_var_vals); } /* * read element variable values at a time step */ void F2C(EXGEV) (int *idexo, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, real * elem_var_vals, int *ierr) { int64_t neblk; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { neblk = *(int64_t*)num_elem_this_blk; } else { neblk = *(int*)num_elem_this_blk; } *ierr = ex_get_elem_var(*idexo, *time_step, *elem_var_index, *elem_blk_id, neblk, elem_var_vals); } /* * read element variable values through time */ void F2C(EXGEVT) (int *idexo, int *elem_var_index, void_int *elem_number, int *beg_time_step, int *end_time_step, real * elem_var_vals, int *ierr) { int64_t el_num; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { el_num = *(int64_t*)elem_number; } else { el_num = *(int*)elem_number; } *ierr = ex_get_elem_var_time(*idexo, *elem_var_index, el_num, *beg_time_step, *end_time_step, elem_var_vals); } /* * write nodeset variable values at a time step */ void F2C(EXPNSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_put_nset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * read nodeset variable values at a time step */ void F2C(EXGNSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_get_nset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * write sideset variable values at a time step */ void F2C(EXPSSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_put_sset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * read sideset variable values at a time step */ void F2C(EXGSSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_get_sset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * write time value for a time step */ void F2C(EXPTIM) (int *idexo, int *time_step, real * time_value, int *ierr) { *ierr = ex_put_time(*idexo, *time_step, time_value); } /* * read time value for a time step */ void F2C(EXGTIM) (int *idexo, int *time_step, real * time_value, int *ierr) { *ierr = ex_get_time(*idexo, *time_step, time_value); } /* * read all time values */ void F2C(EXGATM) (int *idexo, real * time_values, int *ierr) { *ierr = ex_get_all_times(*idexo, time_values); } /* * inquire EXODUS parameters */ void F2C(EXINQ) (int *idexo, int *req_info, void_int *ret_int, float *ret_float, char *ret_char, int *ierr, int ret_charlen) { *ierr = ex_inquire(*idexo, (ex_inquiry) * req_info, ret_int, ret_float, ret_char); } /* * inquire integer EXODUS parameters */ int64_t F2C(EXINQI) (int *idexo, int *req_info) { return ex_inquire_int(*idexo, (ex_inquiry) *req_info); } /* * convert side set node lists to side set side lists */ void F2C(EXCN2S) (int *idexo, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, void_int *side_sets_node_index, void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list, int *ierr) { *ierr = ex_cvt_nodes_to_sides(*idexo, num_elem_per_set, num_nodes_per_set, NULL, /* unused */ NULL, /* unused */ side_sets_elem_list, side_sets_node_list, side_sets_side_list); } /* * read side set node list */ void F2C(EXGSSN) (int *idexo, entity_id *side_set_id, int *side_set_node_cnt_list, void_int *side_set_node_list, int *ierr) { *ierr = ex_get_side_set_node_list(*idexo, *side_set_id, side_set_node_cnt_list, side_set_node_list); } /* * read side set node count */ void F2C(EXGSSC) (int *idexo, entity_id *side_set_id, int *side_set_node_cnt_list, int *ierr) { *ierr = ex_get_side_set_node_count(*idexo, *side_set_id, side_set_node_cnt_list); } /* * read concatenated side set node count */ void F2C(EXGCSSC) (int *idexo, int *side_set_node_cnt_list, int *ierr) { *ierr = ex_get_concat_side_set_node_count(*idexo, side_set_node_cnt_list); } /* ex_get_coordinate_frames -- read coordinate frames */ void F2C(EXGFRM) (int *idexo, int *nframeo, void_int *cfids, real * coord, int *tags, int *ierr) { int i; char *ctags = NULL; /* Determine number of coordinate frames stored in file */ int nframe = ex_inquire_int(*idexo, EX_INQ_COORD_FRAMES); if (nframe != *nframeo) { *ierr = EX_FATAL; return; } /* Create array of characters to store tags... */ if (nframe > 0) { if (!(ctags = calloc(nframe, sizeof(char)))) { *ierr = EX_MEMFAIL; return; } *ierr = 0; if (ex_get_coordinate_frames(*idexo, &nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; return; } /* Convert character tags back to integer tags for fortran */ for (i = 0; i < nframe; i++) { if (ctags[i] == 'R' || ctags[i] == 'r') tags[i] = EX_CF_RECTANGULAR; else if (ctags[i] == 'C' || ctags[i] == 'c') tags[i] = EX_CF_CYLINDRICAL; else if (ctags[i] == 'S' || ctags[i] == 's') tags[i] = EX_CF_SPHERICAL; } free(ctags); } } /* ex_put_coordinate_frames -- define/write coordinate frames */ void F2C(EXPFRM) (int *idexo, int *nframe, void_int *cfids, real * coord, int *tags, int *ierr) { int i; char *ctags = NULL; /* Create array of characters to store tags... */ if (*nframe > 0) { if (!(ctags = calloc(*nframe, sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Convert fortran integer tags to C API character tags */ for (i = 0; i < *nframe; i++) { if (tags[i] == EX_CF_RECTANGULAR) ctags[i] = 'R'; else if (tags[i] == EX_CF_CYLINDRICAL) ctags[i] = 'C'; else if (tags[i] == EX_CF_SPHERICAL) ctags[i] = 'S'; } *ierr = 0; if (ex_put_coordinate_frames(*idexo, *nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; return; } free(ctags); } } /* Routine to return floating point word size */ int F2C(EXCPWS) () { return (ex_get_cpu_ws()); } /* Routine to return large model setting */ int F2C(EXLGMD) (int *idexo) { return (ex_large_model(*idexo)); } /* Generalized error handling function */ void F2C(EXERR) (char *pname, char *err_string, int *errcode, int pnamelen, int err_stringlen) { 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; } 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 F2C(EXOPTS) (int *option_val, int *ierr) { *ierr = 0; ex_opts((ex_options) * option_val); if (exerrval != 0) { *ierr = EX_FATAL; } } void F2C(EXMXNM) (int *idexo, int *length, int *ierr) { *ierr = ex_set_max_name_length(*idexo, *length); } /* * copy EXODUS file */ void F2C(EXCOPY) (int *idexo_in, int *idexo_out, int *ierr) { *ierr = ex_copy(*idexo_in, *idexo_out); } /* * get element map */ void F2C(EXGEM) (int *idexo, entity_id *map_id, void_int *elem_map, int *ierr) { *ierr = ex_get_num_map(*idexo, EX_ELEM_MAP, *map_id, elem_map); } /* * get partial_element map */ void F2C(EXGPEM) (int *idexo, entity_id *map_id, void_int *start, void_int *count, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } *ierr = ex_get_partial_num_map(*idexo, EX_ELEM_MAP, *map_id, st, cnt, elem_map); } /* * get element number map */ void F2C(EXGENM) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_get_id_map(*idexo, EX_ELEM_MAP, elem_map); } /* * get map parameters */ void F2C(EXGMP) (int *idexo, int *num_node_maps, int *num_elem_maps, int *ierr) { *ierr = ex_get_map_param(*idexo, num_node_maps, num_elem_maps); } /* * get node map */ void F2C(EXGNM) (int *idexo, entity_id *map_id, void_int *node_map, int *ierr) { *ierr = ex_get_num_map(*idexo, EX_NODE_MAP, *map_id, node_map); } /* * get node number map */ void F2C(EXGNNM) (int *idexo, void_int *node_map, int *ierr) { *ierr = ex_get_id_map(*idexo, EX_NODE_MAP, node_map); } /* * read results variables names */ void F2C(EXGVNM) (int *idexo, char *var_type, int *var_index, char *var_name, int *ierr, int var_typelen, int var_namelen) { char *sptr; /* ptr to temp staging space for string */ int slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (var_namelen < slen) { slen = var_namelen; } /* Allocate staging space for the variable name */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = 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 */ return; } /* Copy Fortran variable names to staging space */ /** printf("[exgvnm] var_name(%d): %s\n",*var_index,sptr)); **/ memset(var_name, 0, var_namelen); ex_fcdcpy(var_name, slen, sptr); /* copy string into Fortran buffer */ free(sptr); /* Free up string staging area */ } /* * put element map */ void F2C(EXPEM) (int *idexo, entity_id *map_id, void_int *elem_map, int *ierr) { *ierr = ex_put_num_map(*idexo, EX_ELEM_MAP, *map_id, elem_map); } /* * put partial element map */ void F2C(EXPPEM) (int *idexo, entity_id *map_id, void_int *start, void_int *count, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } *ierr = ex_put_partial_num_map(*idexo, EX_ELEM_MAP, *map_id, st, cnt, elem_map); } /* * put element number map */ void F2C(EXPENM) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_put_id_map(*idexo, EX_ELEM_MAP, elem_map); } /* * put map parameters */ void F2C(EXPMP) (int *idexo, int *num_node_maps, int *num_elem_maps, int *ierr) { *ierr = ex_put_map_param(*idexo, *num_node_maps, *num_elem_maps); } /* * put node map */ void F2C(EXPNM) (int *idexo, entity_id *map_id, void_int *node_map, int *ierr) { *ierr = ex_put_num_map(*idexo, EX_NODE_MAP, *map_id, node_map); } /* * put node number map */ void F2C(EXPNNM) (int *idexo, void_int *node_map, int *ierr) { *ierr = ex_put_id_map(*idexo, EX_NODE_MAP, node_map); } /* * write results variable name */ void F2C(EXPVNM) (int *idexo, char *var_type, int *var_index, char *var_name, int *ierr, int var_typelen, int var_namelen) { char *sptr; /* ptr to temp staging space for string */ int slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (var_namelen < slen) { slen = var_namelen; } /* Allocate staging space for the variable name */ if (!(sptr = (char *) malloc((slen + 1) * sizeof(char)))) { *ierr = 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 */ return; } free(sptr); /* Free up string staging area */ } /* * Get initial information from nemesis file */ void F2C(EXGII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("negii",errmsg,EX_MSG); #endif slen = ftypelen; } file_type = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to get initial information from file id %d", *idne); ex_err("negii",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (ftype, slen, file_type); free(file_type); } /* * Write initial information from nemesis file */ void F2C(EXPII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { char errmsg[MAX_ERR_LENGTH]; size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { slen = ftypelen; #if defined(EXODUS_STRING_LENGTH_WARNING) sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("nepii",errmsg,EX_MSG); #endif } file_type = (char *) malloc((slen+1)*sizeof(char)); ex_fstrncpy (file_type, ftype, slen); if ((*ierr = ex_put_init_info(*idne, *nproc, *nproc_in_f, file_type)) != 0) { sprintf(errmsg, "Error: failed to put initial information in file id %d", *idne); ex_err("nepii",errmsg,EX_MSG); } free(file_type); } /* * Read initial global information */ void F2C(EXGIG)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if ((*ierr = ex_get_init_global(*idne, nnodes_g, nelems_g, nelem_blks_g, nnode_sets_g, nside_sets_g)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read initial global information from file id %d", *idne); ex_err("negig",errmsg,EX_MSG); } } /* * Write initial global information */ void F2C(EXPIG)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nnodes_g = (int64_t*)nnodes_g; int64_t *n_nelems_g = (int64_t*)nelems_g; int64_t *n_nelem_blks_g = (int64_t*)nelem_blks_g; int64_t *n_nnode_sets_g = (int64_t*)nnode_sets_g; int64_t *n_nside_sets_g = (int64_t*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } else { int *n_nnodes_g = (int*)nnodes_g; int *n_nelems_g = (int*)nelems_g; int *n_nelem_blks_g = (int*)nelem_blks_g; int *n_nnode_sets_g = (int*)nnode_sets_g; int *n_nside_sets_g = (int*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store initial global information in file id %d", *idne); ex_err("nepig",errmsg,EX_MSG); } } /* * Read load balance parameters */ void F2C(EXGLBP)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if ((*ierr = ex_get_loadbal_param(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read load balance parameters from file id %d", *idne); ex_err("neglbp",errmsg,EX_MSG); } } /* * Write load balance parameters */ void F2C(EXPLBP)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nint_nodes = (int64_t*)nint_nodes; int64_t *n_nbor_nodes = (int64_t*)nbor_nodes; int64_t *n_next_nodes = (int64_t*)next_nodes; int64_t *n_nint_elems = (int64_t*)nint_elems; int64_t *n_nbor_elems = (int64_t*)nbor_elems; int64_t *n_nnode_cmaps = (int64_t*)nnode_cmaps; int64_t *n_nelem_cmaps = (int64_t*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } else { int *n_nint_nodes = (int*)nint_nodes; int *n_nbor_nodes = (int*)nbor_nodes; int *n_next_nodes = (int*)next_nodes; int *n_nint_elems = (int*)nint_elems; int *n_nbor_elems = (int*)nbor_elems; int *n_nnode_cmaps = (int*)nnode_cmaps; int *n_nelem_cmaps = (int*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbp",errmsg,EX_MSG); } } /* * Write concatenated load balance parameters */ void F2C(EXPLBPC)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *ierr) { if ((*ierr = ex_put_loadbal_param_cc(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbpc",errmsg,EX_MSG); } } /* * Read global node set parameters */ void F2C(EXGNSPG)(int *idne, void_int *ns_ids_glob, void_int *ns_n_cnt_glob, void_int *ns_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ns_param_global(*idne, ns_ids_glob, ns_n_cnt_glob, ns_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global node set parameters from file id %d", *idne); ex_err("negnspg",errmsg,EX_MSG); } } /* * Write global node set parameters */ void F2C(EXPNSPG)(int *idne, void_int *global_ids, void_int *global_n_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ns_param_global(*idne, global_ids, global_n_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global node set parameters in file id %d", *idne); ex_err("nepnspg",errmsg,EX_MSG); } } /* * Read global side set parameters */ void F2C(EXGSSPG)(int *idne, void_int *ss_ids_glob, void_int *ss_n_cnt_glob, void_int *ss_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ss_param_global(*idne, ss_ids_glob, ss_n_cnt_glob, ss_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global side set parameters from file id %d", *idne); ex_err("negsspg",errmsg,EX_MSG); } } /* * Write global side set parameters */ void F2C(EXPSSPG)(int *idne, void_int *global_ids, void_int *global_el_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ss_param_global(*idne, global_ids, global_el_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global side set parameters in file id %d", *idne); ex_err("nepsspg",errmsg,EX_MSG); } } /* * Read global element block information */ void F2C(EXGEBIG)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_get_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global element block info from file id %d", *idne); ex_err("negebig",errmsg,EX_MSG); } } /* * Write global element block information */ void F2C(EXPEBIG)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_put_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global element block info in file id %d", *idne); ex_err("nepebig",errmsg,EX_MSG); } } /* * Read side set element list and side set side list */ void F2C(EXGNSS)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set element list from file id %d", *idne); ex_err("negnss",errmsg,EX_MSG); } } /* * Write side set element list and side set side list */ void F2C(EXPNSS)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set element list to file id %d", *idne); ex_err("nepnss",errmsg,EX_MSG); } } /* * Read side set distribution factor */ void F2C(EXGNSSD)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set dist factor from file id %d", *idne); ex_err("negnssd",errmsg,EX_MSG); } } /* * Write side set distribution factor */ void F2C(EXPNSSD)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set dist factor to file id %d", *idne); ex_err("nepnssd",errmsg,EX_MSG); } } /* * Read node set list for a single node set */ void F2C(EXGNNS)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set(*idne, *ns_id, st, cnt,ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set node list from file id %d", *idne); ex_err("negnns",errmsg,EX_MSG); } } /* * Write node set list for a single node set */ void F2C(EXPNNS)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set(*idne, *ns_id, st, cnt, ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set node list to file id %d", *idne); ex_err("nepnns",errmsg,EX_MSG); } } /* * Read node set distribution factor */ void F2C(EXGNNSD)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set dist factor from file id %d", *idne); ex_err("negnnsd",errmsg,EX_MSG); } } /* * Write node set distribution factor */ void F2C(EXPNNSD)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set dist factor to file id %d", *idne); ex_err("nepnnsd",errmsg,EX_MSG); } } /* * Read coordinates of the nodes */ void F2C(EXGNCOR)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node coordinates from file id %d", *idne); ex_err("negcor",errmsg,EX_MSG); } } /* * Write coordinates of the nodes */ void F2C(EXPNCOR)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node coordinates to file id %d", *idne); ex_err("nepcor",errmsg,EX_MSG); } } /* * Read an element block's connectivity list */ void F2C(EXGNEC)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block connectivity from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write an element block's connectivity list */ void F2C(EXPNEC)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block connectivity to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read an element block's attributes */ void F2C(EXGNEAT)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block attribute from file id %d", *idne); ex_err("negneat",errmsg,EX_MSG); } } /* * Write an element block's attributes */ void F2C(EXPNEAT)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block attribute to file id %d", *idne); ex_err("nepneat",errmsg,EX_MSG); } } /* * Read the element type for a specific element block */ void F2C(EXGELT)(int *idne, entity_id *elem_blk_id, char *elem_type, int *ierr, size_t elem_typelen) { size_t slen = MAX_STR_LENGTH; char *etype; /* WARNING: ftypelen 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 NEMESIS spec. */ if (elem_typelen != MAX_STR_LENGTH) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: element type string length is %d in file id %d\n", elem_typelen, *idne); ex_err("negelt",errmsg,EX_MSG); #endif slen = elem_typelen; } etype = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_elem_type(*idne, *elem_blk_id, etype)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block type from file id %d", *idne); ex_err("negelt",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (elem_type, slen, etype); free(etype); } /* * Read a variable for an element block */ void F2C(EXGNEV)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_var(*idne, *time_step, EX_ELEM_BLOCK, *elem_var_index, *elem_blk_id, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block variable from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write a variable slab for an element block */ void F2C(EXPEVS)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_elem_var_slab(*idne, *time_step, *elem_var_index, *elem_blk_id, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elem block variable slab to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read the values of a single nodal variable for a single time step */ void F2C(EXGNNV)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_vars, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_var(*idne, *time_step, EX_NODAL, *nodal_var_index, 1, st, cnt, nodal_vars)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal variable from file id %d", *idne); ex_err("negnnv",errmsg,EX_MSG); } } /* * Write nodal variable slab */ void F2C(EXPNVS)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_nodal_var_slab(*idne, *time_step, *nodal_var_index, st, cnt, nodal_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal variable slab to file id %d", *idne); ex_err("nepnvs",errmsg,EX_MSG); } } /* * Read the element numbering map */ void F2C(EXGNENM)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element numbering map from file id %d", *idne); ex_err("negnenm",errmsg,EX_MSG); } } /* * Write the element numbering map */ void F2C(EXPNENM)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_put_partial_id_map(*idne, EX_ELEM_MAP, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element numbering map to file id %d", *idne); ex_err("nepnenm",errmsg,EX_MSG); } } /* * Read the node numbering map */ void F2C(EXGNNNM)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_node_num_map(*idne, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node numbering map from file id %d", *idne); ex_err("negnnnm",errmsg,EX_MSG); } } /* * Write the node numbering map */ void F2C(EXPNNNM)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_put_partial_id_map(*idne, EX_NODE_MAP, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node numbering map to file id %d", *idne); ex_err("nepnnnm",errmsg,EX_MSG); } } /* * Read the node map for a processor */ void F2C(EXGNMP)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_get_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor node map from file id %d", *idne); ex_err("negnm",errmsg,EX_MSG); } } /* * Write a node map for a processor */ void F2C(EXPNMP)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_put_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor node map to file id %d", *idne); ex_err("nepnm",errmsg,EX_MSG); } } /* * Read the element map for a processor */ void F2C(EXGEMP)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_get_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor element map from file id %d", *idne); ex_err("negem",errmsg,EX_MSG); } } /* * Write the element map for a processor */ void F2C(EXPEMP)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_put_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor element map to file id %d", *idne); ex_err("nepem",errmsg,EX_MSG); } } /* * Read the communications map parameters for a single processor */ void F2C(EXGCMP)(int *idne, void_int *ncmap_ids, void_int *ncmap_node_cnts, void_int *ecmap_ids, void_int *ecmap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_get_cmap_params(*idne, ncmap_ids, ncmap_node_cnts, ecmap_ids, ecmap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read comm map parameters from file id %d", *idne); ex_err("negcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for a single processor */ void F2C(EXPCMP)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *emap_ids, void_int *emap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_put_cmap_params(*idne, nmap_ids, nmap_node_cnts, emap_ids, emap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for all processors */ void F2C(EXPCMPC)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *nproc_ptrs, void_int *emap_ids, void_int *emap_elem_cnts, void_int *eproc_ptrs, int *ierr) { if ((*ierr = ex_put_cmap_params_cc(*idne, nmap_ids, nmap_node_cnts, nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmpc",errmsg,EX_MSG); } } /* * Read the nodal communications map for a single processor */ void F2C(EXGNCM)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal communications map from file id %d", *idne); ex_err("negncm",errmsg,EX_MSG); } } /* * Write the nodal communications map for a single processor */ void F2C(EXPNCM)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal communications map to file id %d", *idne); ex_err("nepncm",errmsg,EX_MSG); } } /* * Read the elemental communications map for a single processor */ void F2C(EXGECM)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read elemental comm map from file id %d", *idne); ex_err("negecm",errmsg,EX_MSG); } } /* * Write the elemental communications map for a single processor */ void F2C(EXPECM)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elemental comm map to file id %d", *idne); ex_err("nepecm",errmsg,EX_MSG); } } exodusii-6.02.dfsg.1/exodus/forbind/src/exo_jack.c000066400000000000000000003257311225312213100220260ustar00rootroot00000000000000/* * 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. * */ /* * OVERVIEW * * This file contains jacket routines written in C for interfacing Fortran * ExodusII function calls to the actual C binding for ExodusII. * 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 #include #include #include #include "netcdf.h" #include "exodusII.h" #include "exodusII_int.h" /* * The Build64 is for the "normal" SEACAS build which uses compiler * options to change reals and integers into 8-byte quantities. The * routines in addrwrap.F are used to down-convert the 8-byte integers * into 4-byte integers which then call through to the routines in * this file which have a '4' or '4_' appended to the routine name. * These routines then call through to the C API routines. * * If DEFAULT_REAL_INT is defined, then the build is to build a * fortran library interface that takes 4-byte ints and either 4-byte * or 8-byte floating point (real/double) variables. In this case, the * addrwrap routines are not built and a fortran client will call the * routines in this file directly. * */ #if defined(Build64) && !defined(DEFAULT_REAL_INT) /* 64-bit */ #define real double #define entity_id ex_entity_id #ifdef ADDC_ #define F2C(name,NAME) name##4_ #else #ifdef _MSC_VER #define F2C(name,NAME) NAME##4 #else #define F2C(name,NAME) name##4 #endif #endif #else /* 32-bit */ #define real float #define entity_id int #ifdef ADDC_ #define F2C(name,NAME) name##_ #else #ifdef _MSC_VER #define F2C(name,NAME) NAME #else #define F2C(name,NAME) name #endif #endif #endif /* 64 vs 32 bit build */ 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 */ static void ex_fcdcpy(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); if (len > fslen) len = fslen; 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) = ' '; } } /* copy function used to copy strings and strip trailing blanks */ static void ex_fstrncpy(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 ex_nstrncpy(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'; } /* Above are utility functions used below */ /* ======================================================================== */ /* Below are the exodus API functions */ /* * Adding a new function: * + Protect the name with the f2c (uppercase) macro which will add/not add '4' and or '_' * depending on the compilation mode. * * + float/double arguments are declared as 'real' which will be replaced with float or double. * * + If there are any character arguments 'X', then add an int* argument 'Xlen' at end of argument list * This will contain the length of the passed in character argument. * * + Look at existing functions for guidance... */ /* * create an EXODUS II file */ int F2C(excre,EXCRE) (char *path, int *clobmode, int *cpu_word_size, int *io_word_size, int *ierr, int pathlen) { char *name; int idexo; if (!(name = malloc((pathlen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return (EX_FATAL); } (void) ex_nstrncpy(name, path, pathlen); if ((idexo = ex_create(name, *clobmode, cpu_word_size, io_word_size)) != EX_FATAL) { free(name); *ierr = 0; return (idexo); } free(name); *ierr = exerrval; return (EX_FATAL); } /* * open an EXODUS II file */ int F2C(exopen,EXOPEN) (char *path, int *mode, int *cpu_word_size, int *io_word_size, float *version, /* This is float always; not real */ int *ierr, int pathlen) { char *name; int idexo; if (!(name = malloc((pathlen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return (EX_FATAL); } (void) ex_nstrncpy(name, path, pathlen); if ((idexo = ex_open(name, *mode, cpu_word_size, io_word_size, version)) != EX_FATAL) { free(name); *ierr = 0; return (idexo); } free(name); *ierr = EX_FATAL; return (EX_FATAL); } /* * close an EXODUS II file */ void F2C(exclos,EXCLOS) (int *idexo, int *ierr) { *ierr = ex_close(*idexo); } /* * update an EXODUS II file */ void F2C(exupda,EXUPDA) (int *idexo, int *ierr) { *ierr = ex_update(*idexo); } /* * write initialization parameters */ void F2C(expini,EXPINI) (int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen) { int slen; char *name; slen = MAX_LINE_LENGTH; /* max line size */ if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } name = malloc((slen + 1) * sizeof(char)); (void) ex_fstrncpy(name, title, slen); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t *n_dim = num_dim; int64_t *n_nodes = num_nodes; int64_t *n_elem = num_elem; int64_t *n_elem_blk = num_elem_blk; int64_t *n_node_sets = num_node_sets; int64_t *n_side_sets = num_side_sets; *ierr = ex_put_init(*idexo, name, *n_dim, *n_nodes, *n_elem, *n_elem_blk, *n_node_sets, *n_side_sets); } else { int *n_dim = num_dim; int *n_nodes = num_nodes; int *n_elem = num_elem; int *n_elem_blk = num_elem_blk; int *n_node_sets = num_node_sets; int *n_side_sets = num_side_sets; *ierr = ex_put_init(*idexo, name, *n_dim, *n_nodes, *n_elem, *n_elem_blk, *n_node_sets, *n_side_sets); } free(name); } /* * read initialization parameters */ void F2C(exgini,EXGINI) (int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen) { int slen; char *name; *ierr = 0; slen = MAX_LINE_LENGTH; /* max line size */ if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } name = malloc((slen + 1) * sizeof(char)); memset(name, 0, slen + 1); *ierr = ex_get_init(*idexo, name, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets); ex_fcdcpy(title, slen, name); free(name); } /* * write QA records */ void F2C(expqa,EXPQA) (int *idexo, int *num_qa_records, char *qa_record, int *ierr, int qa_recordlen) { 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 */ slen = MAX_STR_LENGTH; /* max str size */ if (qa_recordlen != MAX_STR_LENGTH) { slen = qa_recordlen; } 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; 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 */ ex_fstrncpy(*(sptr + iii), qa_record + iii * qa_recordlen, slen); iii++; /* bump char array pointer */ } } *(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 F2C(exgqa,EXGQA) (int *idexo, char *qa_record, int *ierr, int qa_recordlen) { int num_qa_records; char **sptr; /* internal string pointer array for malloc * use */ int i, ii, iii, slen, alen; *ierr = 0; /* default no errror */ slen = MAX_STR_LENGTH; /* max str size */ if (qa_recordlen != MAX_STR_LENGTH) { slen = qa_recordlen; } alen = 4; /* qa records are 4 strings deep */ /* do ExodusII C call to find out how many qa records are avail */ num_qa_records = ex_inquire_int(*idexo, EX_INQ_QA); /* Allocate space for the QA string ptr array */ if (!(sptr = malloc((num_qa_records * alen + 1) * sizeof(char *)))) { *ierr = 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) { free(sptr); *ierr = 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; 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 */ ex_fcdcpy(qa_record + iii * qa_recordlen, slen, *(sptr + iii)); 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 F2C(expinf,EXPINF) (int *idexo, int *num_info, char *info, int *ierr, int infolen) { 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 */ slen = MAX_LINE_LENGTH; /* max str size */ if (infolen != MAX_LINE_LENGTH) { slen = infolen; } /* Allocate space for the string ptr array */ if (!(aptr = malloc(((*num_info) + 1) * sizeof(char *)))) { *ierr = 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; 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 * infolen, slen); /* copy string into * buffer */ } *(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 */ return; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read information records */ void F2C(exginf,EXGINF) (int *idexo, char *info, int *ierr, int infolen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int i, slen, num_info; *ierr = 0; /* default no errror */ /* do exodusII C call to find out how many info records are avail */ num_info = ex_inquire_int(*idexo, EX_INQ_INFO); slen = MAX_LINE_LENGTH; /* max str size */ if (infolen != MAX_LINE_LENGTH) { slen = infolen; } /* * 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; 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; 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); return; } for (i = 0; i < num_info; i++) { /* Copy Fortran info records to * staging space */ ex_fcdcpy(info + i * infolen, 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 F2C(expcor,EXPCOR) (int *idexo, real * x_coor, real * y_coor, real * z_coor, int *ierr) { *ierr = ex_put_coord(*idexo, x_coor, y_coor, z_coor); } /* * read nodal coordinates */ void F2C(exgcor,EXGCOR) (int *idexo, real * x_coor, real * y_coor, real * z_coor, int *ierr) { *ierr = ex_get_coord(*idexo, x_coor, y_coor, z_coor); } /* * write coordinate names */ void F2C(expcon,EXPCON) (int *idexo, char *coord_names, int *ierr, int coord_nameslen) { char **aptr; /* internal array of string pointers for * malloc use */ char *sptr; /* internal string pointer for malloc use */ int i, ndim, slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (coord_nameslen < slen) { slen = coord_nameslen; } /* do ExodusII C call to find out how many dimensions */ ndim = ex_inquire_int(*idexo, EX_INQ_DIM); /* Allocate space for the name ptr array */ if (!(aptr = malloc((ndim + 1) * sizeof(char *)))) { *ierr = 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); return; } for (i = 0; i < ndim; i++) { *(aptr + i) = sptr + i * (slen + 1); /* copy fortran string into allocated space */ ex_fstrncpy(*(aptr + i), coord_names + i * coord_nameslen, slen); } *(aptr + i) = 0; /* set last pointer to null */ if (ex_put_coord_names(*idexo, aptr) == EX_FATAL) { *ierr = EX_FATAL; } /* 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 F2C(exgcon,EXGCON) (int *idexo, char *coord_names, int *ierr, int coord_nameslen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int ndim; int i, slen; *ierr = 0; /* default no error */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (coord_nameslen < slen) { slen = coord_nameslen; } /* do ExodusII C call to find out how many dimensions */ ndim = ex_inquire_int(*idexo, EX_INQ_DIM); /* allocate memory to stage the coordinate name ptrs into */ if (!(aptr = malloc((ndim + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* 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 */ return; } for (i = 0; i < ndim; i++) { /* put pointers to staging space into ptr * array */ *(aptr + i) = sptr + i * (slen + 1); } /* 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 */ return; } /* copy C strings to Fortran arrays */ memset(coord_names, 0, ndim * coord_nameslen); for (i = 0; i < ndim; i++) { ex_fcdcpy(coord_names + i * coord_nameslen, 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 F2C(expmap,EXPMAP) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_put_map(*idexo, elem_map); } /* * read element order map */ void F2C(exgmap,EXGMAP) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_get_map(*idexo, elem_map); } /* * write concatenated element block parameters */ void F2C(expclb,EXPCLB) (int *idexo, void_int *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *create_maps, int *ierr, int elem_typelen) { size_t num_elem_blk; char **aptr; /* ptr to temp staging space for string array * ptrs */ char *sptr; /* ptr to temp staging space for strings */ size_t i, slen; *ierr = 0; /* default no error */ num_elem_blk = ex_inquire_int(*idexo, EX_INQ_ELEM_BLK); slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory for pointer array */ if (!(aptr = malloc((num_elem_blk + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* allocate memory to stage the element type name into */ if (!(sptr = malloc(num_elem_blk * (slen + 1) * sizeof(char)))) { free(aptr); *ierr = 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 * elem_typelen, 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; } free(sptr); free(aptr); } /* * write element block parameters */ void F2C(expelb,EXPELB) (int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; /* default no error */ slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory to stage the element type name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Copy element type names from Fortran array to staging area */ ex_fstrncpy(sptr, elem_type, slen); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t *n_elem_this_blk = num_elem_this_blk; int64_t *n_nodes_per_elem = num_nodes_per_elem; int64_t *n_attr = num_attr; *ierr = ex_put_elem_block(*idexo, *elem_blk_id, sptr, *n_elem_this_blk, *n_nodes_per_elem, *n_attr); } else { int *n_elem_this_blk = num_elem_this_blk; int *n_nodes_per_elem = num_nodes_per_elem; int *n_attr = num_attr; *ierr = ex_put_elem_block(*idexo, *elem_blk_id, sptr, *n_elem_this_blk, *n_nodes_per_elem, *n_attr); } free(sptr); } /* * read element block parameters */ void F2C(exgelb,EXGELB) (int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = MAX_STR_LENGTH; /* max str size */ if (elem_typelen != MAX_STR_LENGTH) { slen = elem_typelen; } /* allocate memory to stage the element type names into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = 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; return; } /* Copy element type name from staging area to Fortran array */ memset(elem_type, 0, elem_typelen); ex_fcdcpy(elem_type, slen, sptr); free(sptr); } /* * read element blocks IDs */ void F2C(exgebi,EXGEBI) (int *idexo, void_int *elem_blk_ids, int *ierr) { *ierr = ex_get_elem_blk_ids(*idexo, elem_blk_ids); } /* * write element block connectivity */ void F2C(expelc,EXPELC) (int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr) { *ierr = ex_put_elem_conn(*idexo, *elem_blk_id, connect); } /* * read element block connectivity */ void F2C(exgelc,EXGELC) (int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr) { *ierr = ex_get_elem_conn(*idexo, *elem_blk_id, connect); } /* * write entity count-per-polyhedra information for nsided block */ void F2C(expecpp,EXPECPP) (int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr) { *ierr = ex_put_entity_count_per_polyhedra(*idexo, (ex_entity_type) * obj_type, *elem_blk_id, counts); } /* * read entity count-per-polyhedra information for nsided block */ void F2C(exgecpp,EXGECPP) (int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr) { *ierr = ex_get_entity_count_per_polyhedra(*idexo, (ex_entity_type) * obj_type, *elem_blk_id, counts); } /* * write element block attributes */ void F2C(expeat,EXPEAT) (int *idexo, entity_id *elem_blk_id, real * attrib, int *ierr) { *ierr = ex_put_elem_attr(*idexo, *elem_blk_id, attrib); } /* * read element block attributes */ void F2C(exgeat,EXGEAT) (int *idexo, entity_id *elem_blk_id, real * attrib, int *ierr) { *ierr = ex_get_elem_attr(*idexo, *elem_blk_id, attrib); } /* * read element block attribute names */ void F2C(exgean,EXGEAN) (int *idexo, entity_id *elem_blk_id, int *num_attr, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_attr + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_attr * (slen + 1) * sizeof(char)))) { *ierr = 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); return; } /* Copy Fortran names from staging space */ memset(names, 0, *num_attr * nameslen); for (i = 0; i < *num_attr; i++) { ex_fcdcpy(names + i * nameslen, 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 F2C(expean,EXPEAN) (int *idexo, entity_id *elem_blk_id, int *num_attr, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_attr + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_attr * (slen + 1) * sizeof(char)))) { *ierr = 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 * nameslen, 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; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * write object names */ void F2C(expnams,EXPNAMS) (int *idexo, int *type, int *num_obj, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory for pointer array */ if (!(aptr = malloc((*num_obj + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_obj * (slen + 1) * sizeof(char)))) { 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 * nameslen, 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, (ex_entity_type) * type, aptr) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read object names */ void F2C(exgnams,EXGNAMS) (int *idexo, int *type, int *num_obj, char *names, int *ierr, int nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (nameslen < slen) { slen = nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_obj + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_obj * (slen + 1) * sizeof(char)))) { *ierr = 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, (ex_entity_type) * type, aptr) == EX_FATAL) { *ierr = EX_FATAL; free(sptr); /* free up allocated space */ free(aptr); return; } /* Copy Fortran names from staging space */ memset(names, 0, *num_obj * nameslen); for (i = 0; i < *num_obj; i++) { ex_fcdcpy(names + i * nameslen, 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 F2C(exppn,EXPPN) (int *idexo, int *obj_type, int *num_props, char *prop_names, int *ierr, int prop_nameslen) { char **aptr; /* internal string array pointer for malloc * use */ char *sptr; /* internal string pointer for malloc use */ int i, slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_nameslen < slen) { slen = prop_nameslen; } /* Allocate space for the name ptr array */ if (!(aptr = malloc((*num_props + 1) * sizeof(char *)))) { *ierr = 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); return; } for (i = 0; i < *num_props; i++) { *(aptr + i) = sptr + i * (slen + 1); /* copy fortran string into allocated space */ ex_fstrncpy(*(aptr + i), prop_names + i * prop_nameslen, slen); } *(aptr + i) = 0; /* set last pointer to null */ if (ex_put_prop_names(*idexo, (ex_entity_type) * obj_type, *num_props, aptr) == EX_FATAL) { *ierr = EX_FATAL; } /* 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 F2C(exgpn,EXGPN) (int *idexo, int *obj_type, char *prop_names, int *ierr, int prop_nameslen) { 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; ex_inquiry inq_code; int num_props; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_nameslen < slen) { slen = prop_nameslen; } switch ((ex_entity_type) * 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 */ num_props = ex_inquire_int(*idexo, inq_code); /* Allocate space for the name ptr array */ if (!(aptr = malloc((num_props + 1) * sizeof(char *)))) { *ierr = 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); 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, (ex_entity_type) * obj_type, aptr) == EX_FATAL) { *ierr = EX_FATAL; free(sptr); /* free up string space */ free(aptr); /* free up array ptr space */ return; } /* copy C strings to Fortran arrays */ memset(prop_names, 0, num_props * prop_nameslen); for (i = 0; i < num_props; i++) { ex_fcdcpy(prop_names + i * prop_nameslen, 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 F2C(expp,EXPP) (int *idexo, int *obj_type, entity_id *obj_id, char *prop_name, entity_id *value, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); *ierr = ex_put_prop(*idexo, (ex_entity_type) * obj_type, *obj_id, sptr, *value); free(sptr); } /* * read object property */ void F2C(exgp,EXGP) (int *idexo, int *obj_type, entity_id *obj_id, char *prop_name, void_int *value, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* use exodusII C routine to get the property value */ if (ex_get_prop(*idexo, (ex_entity_type) * obj_type, *obj_id, sptr, value) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * read object property array */ void F2C(exgpa,EXGPA) (int *idexo, int *obj_type, char *prop_name, void_int *values, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } memset(sptr, 0, slen + 1); /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* use exodusII C routine to get the values array */ if (ex_get_prop_array(*idexo, (ex_entity_type) * obj_type, sptr, values) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * write object property array */ void F2C(exppa,EXPPA) (int *idexo, int *obj_type, char *prop_name, void_int *values, int *ierr, int prop_namelen) { char *sptr; /* internal string pointer for malloc use */ int slen; *ierr = 0; slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (prop_namelen < slen) { slen = prop_namelen; } /* allocate memory to stage the property name into */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = EX_MEMFAIL; } /* Copy property name from Fortran string to staging area */ ex_fstrncpy(sptr, prop_name, slen); /* Use exodusII C routine to store the property values */ if (ex_put_prop_array(*idexo, (ex_entity_type) * obj_type, sptr, values) == EX_FATAL) { *ierr = EX_FATAL; } free(sptr); } /* * write node set parameters */ void F2C(expnp,EXPNP) (int *idexo, entity_id *node_set_id, void_int *num_nodes_in_set, void_int *num_dist_in_set, int *ierr) { if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t nnis = *(int64_t*)num_nodes_in_set; int64_t ndis = *(int64_t*)num_dist_in_set; *ierr = ex_put_node_set_param(*idexo, *node_set_id, nnis, ndis); } else { int nnis = *(int*)num_nodes_in_set; int ndis = *(int*)num_dist_in_set; *ierr = ex_put_node_set_param(*idexo, *node_set_id, nnis, ndis); } } /* * read node set parameters */ void F2C(exgnp,EXGNP) (int *idexo, entity_id *node_set_id, void_int *num_nodes_in_set, void_int *num_dist_in_set, int *ierr) { *ierr = ex_get_node_set_param(*idexo, *node_set_id, num_nodes_in_set, num_dist_in_set); } /* * write node set */ void F2C(expns,EXPNS) (int *idexo, entity_id *node_set_id, void_int *node_set_node_list, int *ierr) { *ierr = ex_put_node_set(*idexo, *node_set_id, node_set_node_list); } /* * write node set dist factors */ void F2C(expnsd,EXPNSD) (int *idexo, entity_id *node_set_id, real * node_set_dist_fact, int *ierr) { *ierr = ex_put_node_set_dist_fact(*idexo, *node_set_id, node_set_dist_fact); } /* * read node set */ void F2C(exgns,EXGNS) (int *idexo, entity_id *node_set_id, void_int *node_set_node_list, int *ierr) { *ierr = ex_get_node_set(*idexo, *node_set_id, node_set_node_list); } /* * read node set dist factors */ void F2C(exgnsd,EXGNSD) (int *idexo, entity_id *node_set_id, real * node_set_dist_fact, int *ierr) { *ierr = ex_get_node_set_dist_fact(*idexo, *node_set_id, node_set_dist_fact); } /* * read node sets IDs */ void F2C(exgnsi,EXGNSI) (int *idexo, void_int *node_set_ids, int *ierr) { *ierr = ex_get_node_set_ids(*idexo, node_set_ids); } /* * write concatenated node sets */ void F2C(expcns,EXPCNS) (int *idexo, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_dist_index, void_int *node_sets_node_list, real * node_sets_dist_fact, int *ierr) { size_t num_node_sets, i; int int_size; void_int *node_index_ptr, *dist_index_ptr; *ierr = 0; num_node_sets = ex_inquire_int(*idexo, EX_INQ_NODE_SETS); int_size = sizeof(int); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } /* allocate memory for C node index array */ if (!(node_index_ptr = malloc(num_node_sets * int_size))) { *ierr = EX_MEMFAIL; return; } /* allocate memory for C dist factor index array */ if (!(dist_index_ptr = malloc(num_node_sets * int_size))) { free(node_index_ptr); *ierr = EX_MEMFAIL; return; } if (int_size == sizeof(int64_t)) { for (i = 0; i < num_node_sets; i++) { /* change from 1-based to 0 index */ ((int64_t*)node_index_ptr)[i] = ((int64_t*)node_sets_node_index)[i] - 1; ((int64_t*)dist_index_ptr)[i] = ((int64_t*)node_sets_dist_index)[i] - 1; } } else { for (i = 0; i < num_node_sets; i++) { /* change from 1-based to 0 index */ ((int*)node_index_ptr)[i] = ((int*)node_sets_node_index)[i] - 1; ((int*)dist_index_ptr)[i] = ((int*)node_sets_dist_index)[i] - 1; } } *ierr = 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); free(node_index_ptr); free(dist_index_ptr); } /* * read concatenated node sets */ void F2C(exgcns,EXGCNS) (int *idexo, void_int *node_set_ids, void_int *num_nodes_per_set, void_int *num_dist_per_set, void_int *node_sets_node_index, void_int *node_sets_dist_index, void_int *node_sets_node_list, real * node_sets_dist_fact, int *ierr) { size_t num_node_sets, i; *ierr = ex_get_concat_node_sets(*idexo, node_set_ids, num_nodes_per_set, num_dist_per_set, node_sets_node_index, node_sets_dist_index, node_sets_node_list, node_sets_dist_fact); num_node_sets = ex_inquire_int(*idexo, EX_INQ_NODE_SETS); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_node_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)node_sets_node_index)[i] += 1; ((int64_t*)node_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_node_sets; i++) { /* change from 0-based to 1 index */ ((int*)node_sets_node_index)[i] += 1; ((int*)node_sets_dist_index)[i] += 1; } } } /* * write side set parameters */ void F2C(expsp,EXPSP) (int *idexo, entity_id *side_set_id, void_int *num_sides_in_set, void_int *num_df_in_set, int *ierr) { if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int64_t nsis = *(int64_t*)num_sides_in_set; int64_t ndis = *(int64_t*)num_df_in_set; *ierr = ex_put_side_set_param(*idexo, *side_set_id, nsis, ndis); } else { int nsis = *(int*)num_sides_in_set; int ndis = *(int*)num_df_in_set; *ierr = ex_put_side_set_param(*idexo, *side_set_id, nsis, ndis); } } /* * read side set parameters */ void F2C(exgsp,EXGSP) (int *idexo, entity_id *side_set_id, void_int *num_sides_in_set, void_int *num_df_in_set, int *ierr) { *ierr = ex_get_side_set_param(*idexo, *side_set_id, num_sides_in_set, num_df_in_set); } /* * get side set node list length */ void F2C(exgsnl,EXGSNL) (int *idexo, entity_id *side_set_id, void_int *num_nodes_in_set, int *ierr) { *ierr = ex_get_side_set_node_list_len(*idexo, *side_set_id, num_nodes_in_set); } /* * write side set */ void F2C(expss,EXPSS) (int *idexo, entity_id *side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list, int *ierr) { *ierr = ex_put_side_set(*idexo, *side_set_id, side_set_elem_list, side_set_side_list); } /* * read side set */ void F2C(exgss,EXGSS) (int *idexo, entity_id *side_set_id, void_int *side_set_elem_list, void_int *side_set_side_list, int *ierr) { *ierr = ex_get_side_set(*idexo, *side_set_id, side_set_elem_list, side_set_side_list); } /* * write side set distribution factors */ void F2C(expssd,EXPSSD) (int *idexo, entity_id *side_set_id, real * side_set_dist_fact, int *ierr) { *ierr = ex_put_side_set_dist_fact(*idexo, *side_set_id, side_set_dist_fact); } /* * read side set distribution factors */ void F2C(exgssd,EXGSSD) (int *idexo, entity_id *side_set_id, real * side_set_dist_fact, int *ierr) { *ierr = ex_get_side_set_dist_fact(*idexo, *side_set_id, side_set_dist_fact); } /* * read side sets IDs */ void F2C(exgssi,EXGSSI) (int *idexo, void_int *side_set_ids, int *ierr) { *ierr = ex_get_side_set_ids(*idexo, side_set_ids); } /* * write concatenated side sets */ void F2C(expcss,EXPCSS) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, real * side_sets_dist_fact, int *ierr) { size_t num_side_sets, i; void_int *elem_index_ptr, *dist_index_ptr; int int_size; *ierr = 0; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); int_size = sizeof(int); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { int_size = sizeof(int64_t); } /* allocate memory for C element index array */ if (!(elem_index_ptr = malloc(num_side_sets * int_size))) { *ierr = EX_MEMFAIL; return; } /* allocate memory for C dist factor index array */ if (!(dist_index_ptr = malloc(num_side_sets * int_size))) { free(elem_index_ptr); *ierr = EX_MEMFAIL; return; } if (int_size == sizeof(int64_t)) { for (i = 0; i < num_side_sets; i++) { /* change from 1-based to 0 index */ ((int64_t*)elem_index_ptr)[i] = ((int64_t*)side_sets_elem_index)[i] - 1; ((int64_t*)dist_index_ptr)[i] = ((int64_t*)side_sets_dist_index)[i] - 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 1-based to 0 index */ ((int*)elem_index_ptr)[i] = ((int*)side_sets_elem_index)[i] - 1; ((int*)dist_index_ptr)[i] = ((int*)side_sets_dist_index)[i] - 1; } } *ierr = 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); free(elem_index_ptr); free(dist_index_ptr); } /* * read concatenated side sets */ void F2C(exgcss,EXGCSS) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, real * side_sets_dist_fact, int *ierr) { size_t i, num_side_sets; *ierr = 0; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); *ierr = ex_get_concat_side_sets(*idexo, side_set_ids, num_elem_per_set, num_dist_per_set, side_sets_elem_index, side_sets_dist_index, side_sets_elem_list, side_sets_side_list, side_sets_dist_fact); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)side_sets_elem_index)[i] += 1; ((int64_t*)side_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int*)side_sets_elem_index)[i] += 1; ((int*)side_sets_dist_index)[i] += 1; } } } /* * read concatenated side sets (no dist factors) */ void F2C(exgcssf,EXGCSSF) (int *idexo, void_int *side_set_ids, void_int *num_elem_per_set, void_int *num_dist_per_set, void_int *side_sets_elem_index, void_int *side_sets_dist_index, void_int *side_sets_elem_list, void_int *side_sets_side_list, int *ierr) { size_t i, num_side_sets; num_side_sets = ex_inquire_int(*idexo, EX_INQ_SIDE_SETS); *ierr = ex_get_concat_side_sets(*idexo, side_set_ids, num_elem_per_set, num_dist_per_set, side_sets_elem_index, side_sets_dist_index, side_sets_elem_list, side_sets_side_list, 0); if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int64_t*)side_sets_elem_index)[i] += 1; ((int64_t*)side_sets_dist_index)[i] += 1; } } else { for (i = 0; i < num_side_sets; i++) { /* change from 0-based to 1 index */ ((int*)side_sets_elem_index)[i] += 1; ((int*)side_sets_dist_index)[i] += 1; } } } /* * write results variables parameters */ void F2C(expvp,EXPVP) (int *idexo, char *var_type, int *num_vars, int *ierr, int var_typelen) { *ierr = ex_put_var_param(*idexo, var_type, *num_vars); } /* * read results variables parameters */ void F2C(exgvp,EXGVP) (int *idexo, char *var_type, int *num_vars, int *ierr, int var_typelen) { *ierr = ex_get_var_param(*idexo, var_type, num_vars); } /* * write results variables names */ void F2C(expvan,EXPVAN) (int *idexo, char *var_type, int *num_vars, char *var_names, int *ierr, int var_typelen, int var_nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (var_nameslen < slen) { slen = var_nameslen; } /* allocate memory for pointer array */ if (!(aptr = malloc((*num_vars + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_vars * (slen + 1) * sizeof(char)))) { 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 */ ex_fstrncpy(*(aptr + i), var_names + i * var_nameslen, slen); /* copy string into * buffer */ } *(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; } free(sptr); /* Free up string staging area */ free(aptr); /* Free up string ptr array */ } /* * read results variables names */ void F2C(exgvan,EXGVAN) (int *idexo, char *var_type, int *num_vars, char *var_names, int *ierr, int var_typelen, int var_nameslen) { 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 */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (var_nameslen < slen) { slen = var_nameslen; } /* allocate memory to for pointer array */ if (!(aptr = malloc((*num_vars + 1) * sizeof(char *)))) { *ierr = EX_MEMFAIL; return; } /* Allocate staging space for the variable names */ if (!(sptr = malloc(*num_vars * (slen + 1) * sizeof(char)))) { *ierr = 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); return; } /* Copy Fortran variable names to staging space */ memset(var_names, 0, *num_vars * var_nameslen); for (i = 0; i < *num_vars; i++) { ex_fcdcpy(var_names + i * var_nameslen, 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 F2C(expvtt,EXPVTT) (int *idexo, int *num_elem_blk, int *num_elem_var, int *elem_var_tab, int *ierr) { *ierr = ex_put_elem_var_tab(*idexo, *num_elem_blk, *num_elem_var, elem_var_tab); } /* * write nodeset variable truth table */ void F2C(expnstt,EXPNSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_put_nset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * write sideset variable truth table */ void F2C(expsstt,EXPSSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_put_sset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * read element variable truth table */ void F2C(exgvtt,EXGVTT) (int *idexo, int *num_elem_blk, int *num_elem_var, int *elem_var_tab, int *ierr) { *ierr = ex_get_elem_var_tab(*idexo, *num_elem_blk, *num_elem_var, elem_var_tab); } /* * read nodeset variable truth table */ void F2C(exgnstt,EXGNSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_get_nset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * read sideset variable truth table */ void F2C(exgsstt,EXGSSTT) (int *idexo, int *num_entity, int *num_var, int *var_tab, int *ierr) { *ierr = ex_get_sset_var_tab(*idexo, *num_entity, *num_var, var_tab); } /* * write global variable values at time step */ void F2C(expgv,EXPGV) (int *idexo, int *time_step, int *num_glob_vars, real * glob_var_vals, int *ierr) { *ierr = ex_put_glob_vars(*idexo, *time_step, *num_glob_vars, glob_var_vals); } /* * read global variable values at a time step */ void F2C(exggv,EXGGV) (int *idexo, int *time_step, int *num_glob_vars, real * glob_var_vals, int *ierr) { *ierr = ex_get_glob_vars(*idexo, *time_step, *num_glob_vars, glob_var_vals); } /* * read global variable values through time */ void F2C(exggvt,EXGGVT) (int *idexo, int *glob_var_index, int *beg_time_step, int *end_time_step, real * glob_var_vals, int *ierr) { *ierr = ex_get_glob_var_time(*idexo, *glob_var_index, *beg_time_step, *end_time_step, glob_var_vals); } /* * write nodal variable values at a time step */ void F2C(expnv,EXPNV) (int *idexo, int *time_step, int *nodal_var_index, void_int *num_nodes, real * nodal_var_vals, int *ierr) { int64_t nnodes; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnodes = *(int64_t*)num_nodes; } else { nnodes = *(int*)num_nodes; } *ierr = ex_put_nodal_var(*idexo, *time_step, *nodal_var_index, nnodes, nodal_var_vals); } /* * read nodal variable values at a time step */ void F2C(exgnv,EXGNV) (int *idexo, int *time_step, int *nodal_var_index, void_int *num_nodes, real * nodal_var_vals, int *ierr) { int64_t nnodes; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnodes = *(int64_t*)num_nodes; } else { nnodes = *(int*)num_nodes; } *ierr = ex_get_nodal_var(*idexo, *time_step, *nodal_var_index, nnodes, nodal_var_vals); } /* * read nodal variable values through time */ void F2C(exgnvt,EXGNVT) (int *idexo, int *nodal_var_index, void_int *node_number, int *beg_time_step, int *end_time_step, real * nodal_var_vals, int *ierr) { int64_t nnode; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { nnode = *(int64_t*)node_number; } else { nnode = *(int*)node_number; } *ierr = ex_get_nodal_var_time(*idexo, *nodal_var_index, nnode, *beg_time_step, *end_time_step, nodal_var_vals); } /* * write element variable values at a time step */ void F2C(expev,EXPEV) (int *idexo, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, real * elem_var_vals, int *ierr) { int64_t neblk; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { neblk = *(int64_t*)num_elem_this_blk; } else { neblk = *(int*)num_elem_this_blk; } *ierr = ex_put_elem_var(*idexo, *time_step, *elem_var_index, *elem_blk_id, neblk, elem_var_vals); } /* * read element variable values at a time step */ void F2C(exgev,EXGEV) (int *idexo, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, real * elem_var_vals, int *ierr) { int64_t neblk; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { neblk = *(int64_t*)num_elem_this_blk; } else { neblk = *(int*)num_elem_this_blk; } *ierr = ex_get_elem_var(*idexo, *time_step, *elem_var_index, *elem_blk_id, neblk, elem_var_vals); } /* * read element variable values through time */ void F2C(exgevt,EXGEVT) (int *idexo, int *elem_var_index, void_int *elem_number, int *beg_time_step, int *end_time_step, real * elem_var_vals, int *ierr) { int64_t el_num; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { el_num = *(int64_t*)elem_number; } else { el_num = *(int*)elem_number; } *ierr = ex_get_elem_var_time(*idexo, *elem_var_index, el_num, *beg_time_step, *end_time_step, elem_var_vals); } /* * write nodeset variable values at a time step */ void F2C(expnsv,EXPNSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_put_nset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * read nodeset variable values at a time step */ void F2C(exgnsv,EXGNSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_get_nset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * write sideset variable values at a time step */ void F2C(expssv,EXPSSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_put_sset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * read sideset variable values at a time step */ void F2C(exgssv,EXGSSV) (int *idexo, int *time_step, int *var_index, entity_id *id, void_int *num_entity, real * var_vals, int *ierr) { int64_t n_entity; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { n_entity = *(int64_t*)num_entity; } else { n_entity = *(int*)num_entity; } *ierr = ex_get_sset_var(*idexo, *time_step, *var_index, *id, n_entity, var_vals); } /* * write time value for a time step */ void F2C(exptim,EXPTIM) (int *idexo, int *time_step, real * time_value, int *ierr) { *ierr = ex_put_time(*idexo, *time_step, time_value); } /* * read time value for a time step */ void F2C(exgtim,EXGTIM) (int *idexo, int *time_step, real * time_value, int *ierr) { *ierr = ex_get_time(*idexo, *time_step, time_value); } /* * read all time values */ void F2C(exgatm,EXGATM) (int *idexo, real * time_values, int *ierr) { *ierr = ex_get_all_times(*idexo, time_values); } /* * inquire EXODUS parameters */ void F2C(exinq,EXINQ) (int *idexo, int *req_info, void_int *ret_int, float *ret_float, char *ret_char, int *ierr, int ret_charlen) { *ierr = ex_inquire(*idexo, (ex_inquiry) * req_info, ret_int, ret_float, ret_char); } /* * inquire integer EXODUS parameters */ int64_t F2C(exinqi,EXINQI) (int *idexo, int *req_info) { return ex_inquire_int(*idexo, (ex_inquiry) *req_info); } /* * convert side set node lists to side set side lists */ void F2C(excn2s,EXCN2S) (int *idexo, void_int *num_elem_per_set, void_int *num_nodes_per_set, void_int *side_sets_elem_index, void_int *side_sets_node_index, void_int *side_sets_elem_list, void_int *side_sets_node_list, void_int *side_sets_side_list, int *ierr) { *ierr = ex_cvt_nodes_to_sides(*idexo, num_elem_per_set, num_nodes_per_set, NULL, /* unused */ NULL, /* unused */ side_sets_elem_list, side_sets_node_list, side_sets_side_list); } /* * read side set node list */ void F2C(exgssn,EXGSSN) (int *idexo, entity_id *side_set_id, int *side_set_node_cnt_list, void_int *side_set_node_list, int *ierr) { *ierr = ex_get_side_set_node_list(*idexo, *side_set_id, side_set_node_cnt_list, side_set_node_list); } /* * read side set node count */ void F2C(exgssc,EXGSSC) (int *idexo, entity_id *side_set_id, int *side_set_node_cnt_list, int *ierr) { *ierr = ex_get_side_set_node_count(*idexo, *side_set_id, side_set_node_cnt_list); } /* * read concatenated side set node count */ void F2C(exgcssc,EXGCSSC) (int *idexo, int *side_set_node_cnt_list, int *ierr) { *ierr = ex_get_concat_side_set_node_count(*idexo, side_set_node_cnt_list); } /* ex_get_coordinate_frames -- read coordinate frames */ void F2C(exgfrm,EXGFRM) (int *idexo, int *nframeo, void_int *cfids, real * coord, int *tags, int *ierr) { int i; char *ctags = NULL; /* Determine number of coordinate frames stored in file */ int nframe = ex_inquire_int(*idexo, EX_INQ_COORD_FRAMES); if (nframe != *nframeo) { *ierr = EX_FATAL; return; } /* Create array of characters to store tags... */ if (nframe > 0) { if (!(ctags = calloc(nframe, sizeof(char)))) { *ierr = EX_MEMFAIL; return; } *ierr = 0; if (ex_get_coordinate_frames(*idexo, &nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; return; } /* Convert character tags back to integer tags for fortran */ for (i = 0; i < nframe; i++) { if (ctags[i] == 'R' || ctags[i] == 'r') tags[i] = EX_CF_RECTANGULAR; else if (ctags[i] == 'C' || ctags[i] == 'c') tags[i] = EX_CF_CYLINDRICAL; else if (ctags[i] == 'S' || ctags[i] == 's') tags[i] = EX_CF_SPHERICAL; } free(ctags); } } /* ex_put_coordinate_frames -- define/write coordinate frames */ void F2C(expfrm,EXPFRM) (int *idexo, int *nframe, void_int *cfids, real * coord, int *tags, int *ierr) { int i; char *ctags = NULL; /* Create array of characters to store tags... */ if (*nframe > 0) { if (!(ctags = calloc(*nframe, sizeof(char)))) { *ierr = EX_MEMFAIL; return; } /* Convert fortran integer tags to C API character tags */ for (i = 0; i < *nframe; i++) { if (tags[i] == EX_CF_RECTANGULAR) ctags[i] = 'R'; else if (tags[i] == EX_CF_CYLINDRICAL) ctags[i] = 'C'; else if (tags[i] == EX_CF_SPHERICAL) ctags[i] = 'S'; } *ierr = 0; if (ex_put_coordinate_frames(*idexo, *nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; } free(ctags); } } /* Routine to return floating point word size */ int F2C(excpws,EXCPWS) () { return (ex_get_cpu_ws()); } /* Routine to return large model setting */ int F2C(exlgmd,EXLGMD) (int *idexo) { return (ex_large_model(*idexo)); } /* Generalized error handling function */ void F2C(exerr,EXERR) (char *pname, char *err_string, int *errcode, int pnamelen, int err_stringlen) { 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; } 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 F2C(exopts,EXOPTS) (int *option_val, int *ierr) { *ierr = 0; ex_opts((ex_options) * option_val); if (exerrval != 0) { *ierr = EX_FATAL; } } void F2C(exmxnm,EXMXNM) (int *idexo, int *length, int *ierr) { *ierr = ex_set_max_name_length(*idexo, *length); } /* * copy EXODUS file */ void F2C(excopy,EXCOPY) (int *idexo_in, int *idexo_out, int *ierr) { *ierr = ex_copy(*idexo_in, *idexo_out); } /* * get element map */ void F2C(exgem,EXGEM) (int *idexo, entity_id *map_id, void_int *elem_map, int *ierr) { *ierr = ex_get_num_map(*idexo, EX_ELEM_MAP, *map_id, elem_map); } /* * get partial_element map */ void F2C(exgpem,EXGPEM) (int *idexo, entity_id *map_id, void_int *start, void_int *count, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } *ierr = ex_get_partial_num_map(*idexo, EX_ELEM_MAP, *map_id, st, cnt, elem_map); } /* * get element number map */ void F2C(exgenm,EXGENM) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_get_id_map(*idexo, EX_ELEM_MAP, elem_map); } /* * get map parameters */ void F2C(exgmp,EXGMP) (int *idexo, int *num_node_maps, int *num_elem_maps, int *ierr) { *ierr = ex_get_map_param(*idexo, num_node_maps, num_elem_maps); } /* * get node map */ void F2C(exgnm,EXGNM) (int *idexo, entity_id *map_id, void_int *node_map, int *ierr) { *ierr = ex_get_num_map(*idexo, EX_NODE_MAP, *map_id, node_map); } /* * get node number map */ void F2C(exgnnm,EXGNNM) (int *idexo, void_int *node_map, int *ierr) { *ierr = ex_get_id_map(*idexo, EX_NODE_MAP, node_map); } /* * read results variables names */ void F2C(exgvnm,EXGVNM) (int *idexo, char *var_type, int *var_index, char *var_name, int *ierr, int var_typelen, int var_namelen) { char *sptr; /* ptr to temp staging space for string */ int slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_MAX_READ_NAME_LENGTH); /* max string size */ if (var_namelen < slen) { slen = var_namelen; } /* Allocate staging space for the variable name */ if (!(sptr = malloc((slen + 1) * sizeof(char)))) { *ierr = 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 */ return; } /* Copy Fortran variable names to staging space */ /** printf("[exgvnm] var_name(%d): %s\n",*var_index,sptr)); **/ memset(var_name, 0, var_namelen); ex_fcdcpy(var_name, slen, sptr); /* copy string into Fortran buffer */ free(sptr); /* Free up string staging area */ } /* * put element map */ void F2C(expem,EXPEM) (int *idexo, entity_id *map_id, void_int *elem_map, int *ierr) { *ierr = ex_put_num_map(*idexo, EX_ELEM_MAP, *map_id, elem_map); } /* * put partial element map */ void F2C(exppem,EXPPEM) (int *idexo, entity_id *map_id, void_int *start, void_int *count, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idexo) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } *ierr = ex_put_partial_num_map(*idexo, EX_ELEM_MAP, *map_id, st, cnt, elem_map); } /* * put element number map */ void F2C(expenm,EXPENM) (int *idexo, void_int *elem_map, int *ierr) { *ierr = ex_put_id_map(*idexo, EX_ELEM_MAP, elem_map); } /* * put map parameters */ void F2C(expmp,EXPMP) (int *idexo, int *num_node_maps, int *num_elem_maps, int *ierr) { *ierr = ex_put_map_param(*idexo, *num_node_maps, *num_elem_maps); } /* * put node map */ void F2C(expnm,EXPNM) (int *idexo, entity_id *map_id, void_int *node_map, int *ierr) { *ierr = ex_put_num_map(*idexo, EX_NODE_MAP, *map_id, node_map); } /* * put node number map */ void F2C(expnnm,EXPNNM) (int *idexo, void_int *node_map, int *ierr) { *ierr = ex_put_id_map(*idexo, EX_NODE_MAP, node_map); } /* * write results variable name */ void F2C(expvnm,EXPVNM) (int *idexo, char *var_type, int *var_index, char *var_name, int *ierr, int var_typelen, int var_namelen) { char *sptr; /* ptr to temp staging space for string */ int slen; *ierr = 0; /* default no errror */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (var_namelen < slen) { slen = var_namelen; } /* Allocate staging space for the variable name */ if (!(sptr = (char *) malloc((slen + 1) * sizeof(char)))) { *ierr = 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 */ return; } free(sptr); /* Free up string staging area */ } /* * Get initial information from nemesis file */ void F2C(exgii,EXGII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("negii",errmsg,EX_MSG); #endif slen = ftypelen; } file_type = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to get initial information from file id %d", *idne); ex_err("negii",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (ftype, slen, file_type); free(file_type); } /* * Write initial information from nemesis file */ void F2C(expii,EXPII)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { char errmsg[MAX_ERR_LENGTH]; size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { slen = ftypelen; #if defined(EXODUS_STRING_LENGTH_WARNING) sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("nepii",errmsg,EX_MSG); #endif } file_type = (char *) malloc((slen+1)*sizeof(char)); ex_fstrncpy (file_type, ftype, slen); if ((*ierr = ex_put_init_info(*idne, *nproc, *nproc_in_f, file_type)) != 0) { sprintf(errmsg, "Error: failed to put initial information in file id %d", *idne); ex_err("nepii",errmsg,EX_MSG); } free(file_type); } /* * Read initial global information */ void F2C(exgig,EXGIG)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if ((*ierr = ex_get_init_global(*idne, nnodes_g, nelems_g, nelem_blks_g, nnode_sets_g, nside_sets_g)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read initial global information from file id %d", *idne); ex_err("negig",errmsg,EX_MSG); } } /* * Write initial global information */ void F2C(expig,EXPIG)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nnodes_g = (int64_t*)nnodes_g; int64_t *n_nelems_g = (int64_t*)nelems_g; int64_t *n_nelem_blks_g = (int64_t*)nelem_blks_g; int64_t *n_nnode_sets_g = (int64_t*)nnode_sets_g; int64_t *n_nside_sets_g = (int64_t*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } else { int *n_nnodes_g = (int*)nnodes_g; int *n_nelems_g = (int*)nelems_g; int *n_nelem_blks_g = (int*)nelem_blks_g; int *n_nnode_sets_g = (int*)nnode_sets_g; int *n_nside_sets_g = (int*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store initial global information in file id %d", *idne); ex_err("nepig",errmsg,EX_MSG); } } /* * Read load balance parameters */ void F2C(exglbp,EXGLBP)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if ((*ierr = ex_get_loadbal_param(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read load balance parameters from file id %d", *idne); ex_err("neglbp",errmsg,EX_MSG); } } /* * Write load balance parameters */ void F2C(explbp,EXPLBP)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nint_nodes = (int64_t*)nint_nodes; int64_t *n_nbor_nodes = (int64_t*)nbor_nodes; int64_t *n_next_nodes = (int64_t*)next_nodes; int64_t *n_nint_elems = (int64_t*)nint_elems; int64_t *n_nbor_elems = (int64_t*)nbor_elems; int64_t *n_nnode_cmaps = (int64_t*)nnode_cmaps; int64_t *n_nelem_cmaps = (int64_t*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } else { int *n_nint_nodes = (int*)nint_nodes; int *n_nbor_nodes = (int*)nbor_nodes; int *n_next_nodes = (int*)next_nodes; int *n_nint_elems = (int*)nint_elems; int *n_nbor_elems = (int*)nbor_elems; int *n_nnode_cmaps = (int*)nnode_cmaps; int *n_nelem_cmaps = (int*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbp",errmsg,EX_MSG); } } /* * Write concatenated load balance parameters */ void F2C(explbpc,EXPLBPC)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *ierr) { if ((*ierr = ex_put_loadbal_param_cc(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbpc",errmsg,EX_MSG); } } /* * Read global node set parameters */ void F2C(exgnspg,EXGNSPG)(int *idne, void_int *ns_ids_glob, void_int *ns_n_cnt_glob, void_int *ns_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ns_param_global(*idne, ns_ids_glob, ns_n_cnt_glob, ns_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global node set parameters from file id %d", *idne); ex_err("negnspg",errmsg,EX_MSG); } } /* * Write global node set parameters */ void F2C(expnspg,EXPNSPG)(int *idne, void_int *global_ids, void_int *global_n_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ns_param_global(*idne, global_ids, global_n_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global node set parameters in file id %d", *idne); ex_err("nepnspg",errmsg,EX_MSG); } } /* * Read global side set parameters */ void F2C(exgsspg,EXGSSPG)(int *idne, void_int *ss_ids_glob, void_int *ss_n_cnt_glob, void_int *ss_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ss_param_global(*idne, ss_ids_glob, ss_n_cnt_glob, ss_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global side set parameters from file id %d", *idne); ex_err("negsspg",errmsg,EX_MSG); } } /* * Write global side set parameters */ void F2C(expsspg,EXPSSPG)(int *idne, void_int *global_ids, void_int *global_el_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ss_param_global(*idne, global_ids, global_el_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global side set parameters in file id %d", *idne); ex_err("nepsspg",errmsg,EX_MSG); } } /* * Read global element block information */ void F2C(exgebig,EXGEBIG)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_get_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global element block info from file id %d", *idne); ex_err("negebig",errmsg,EX_MSG); } } /* * Write global element block information */ void F2C(expebig,EXPEBIG)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_put_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global element block info in file id %d", *idne); ex_err("nepebig",errmsg,EX_MSG); } } /* * Read side set element list and side set side list */ void F2C(exgnss,EXGNSS)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set element list from file id %d", *idne); ex_err("negnss",errmsg,EX_MSG); } } /* * Write side set element list and side set side list */ void F2C(expnss,EXPNSS)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set element list to file id %d", *idne); ex_err("nepnss",errmsg,EX_MSG); } } /* * Read side set distribution factor */ void F2C(exgnssd,EXGNSSD)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set dist factor from file id %d", *idne); ex_err("negnssd",errmsg,EX_MSG); } } /* * Write side set distribution factor */ void F2C(expnssd,EXPNSSD)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set dist factor to file id %d", *idne); ex_err("nepnssd",errmsg,EX_MSG); } } /* * Read node set list for a single node set */ void F2C(exgnns,EXGNNS)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set(*idne, *ns_id, st, cnt,ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set node list from file id %d", *idne); ex_err("negnns",errmsg,EX_MSG); } } /* * Write node set list for a single node set */ void F2C(expnns,EXPNNS)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set(*idne, *ns_id, st, cnt, ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set node list to file id %d", *idne); ex_err("nepnns",errmsg,EX_MSG); } } /* * Read node set distribution factor */ void F2C(exgnnsd,EXGNNSD)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set dist factor from file id %d", *idne); ex_err("negnnsd",errmsg,EX_MSG); } } /* * Write node set distribution factor */ void F2C(expnnsd,EXPNNSD)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set dist factor to file id %d", *idne); ex_err("nepnnsd",errmsg,EX_MSG); } } /* * Read coordinates of the nodes */ void F2C(exgncor,EXGNCOR)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node coordinates from file id %d", *idne); ex_err("negcor",errmsg,EX_MSG); } } /* * Write coordinates of the nodes */ void F2C(expncor,EXPNCOR)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node coordinates to file id %d", *idne); ex_err("nepcor",errmsg,EX_MSG); } } /* * Read an element block's connectivity list */ void F2C(exgnec,EXGNEC)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block connectivity from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write an element block's connectivity list */ void F2C(expnec,EXPNEC)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block connectivity to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read an element block's attributes */ void F2C(exgneat,EXGNEAT)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block attribute from file id %d", *idne); ex_err("negneat",errmsg,EX_MSG); } } /* * Write an element block's attributes */ void F2C(expneat,EXPNEAT)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block attribute to file id %d", *idne); ex_err("nepneat",errmsg,EX_MSG); } } /* * Read the element type for a specific element block */ void F2C(exgelt,EXGELT)(int *idne, entity_id *elem_blk_id, char *elem_type, int *ierr, size_t elem_typelen) { size_t slen = MAX_STR_LENGTH; char *etype; /* WARNING: ftypelen 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 NEMESIS spec. */ if (elem_typelen != MAX_STR_LENGTH) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: element type string length is %d in file id %d\n", elem_typelen, *idne); ex_err("negelt",errmsg,EX_MSG); #endif slen = elem_typelen; } etype = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_elem_type(*idne, *elem_blk_id, etype)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block type from file id %d", *idne); ex_err("negelt",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (elem_type, slen, etype); free(etype); } /* * Read a variable for an element block */ void F2C(exgnev,EXGNEV)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_var(*idne, *time_step, EX_ELEM_BLOCK, *elem_var_index, *elem_blk_id, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block variable from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write a variable slab for an element block */ void F2C(expevs,EXPEVS)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_elem_var_slab(*idne, *time_step, *elem_var_index, *elem_blk_id, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elem block variable slab to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read the values of a single nodal variable for a single time step */ void F2C(exgnnv,EXGNNV)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_vars, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_var(*idne, *time_step, EX_NODAL, *nodal_var_index, 1, st, cnt, nodal_vars)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal variable from file id %d", *idne); ex_err("negnnv",errmsg,EX_MSG); } } /* * Write nodal variable slab */ void F2C(expnvs,EXPNVS)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_nodal_var_slab(*idne, *time_step, *nodal_var_index, st, cnt, nodal_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal variable slab to file id %d", *idne); ex_err("nepnvs",errmsg,EX_MSG); } } /* * Read the element numbering map */ void F2C(exgnenm,EXGNENM)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element numbering map from file id %d", *idne); ex_err("negnenm",errmsg,EX_MSG); } } /* * Write the element numbering map */ void F2C(expnenm,EXPNENM)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_put_partial_id_map(*idne, EX_ELEM_MAP, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element numbering map to file id %d", *idne); ex_err("nepnenm",errmsg,EX_MSG); } } /* * Read the node numbering map */ void F2C(exgnnnm,EXGNNNM)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_node_num_map(*idne, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node numbering map from file id %d", *idne); ex_err("negnnnm",errmsg,EX_MSG); } } /* * Write the node numbering map */ void F2C(expnnnm,EXPNNNM)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_put_partial_id_map(*idne, EX_NODE_MAP, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node numbering map to file id %d", *idne); ex_err("nepnnnm",errmsg,EX_MSG); } } /* * Read the node map for a processor */ void F2C(exgnmp,EXGNMP)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_get_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor node map from file id %d", *idne); ex_err("negnm",errmsg,EX_MSG); } } /* * Write a node map for a processor */ void F2C(expnmp,EXPNMP)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_put_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor node map to file id %d", *idne); ex_err("nepnm",errmsg,EX_MSG); } } /* * Read the element map for a processor */ void F2C(exgemp,EXGEMP)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_get_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor element map from file id %d", *idne); ex_err("negem",errmsg,EX_MSG); } } /* * Write the element map for a processor */ void F2C(expemp,EXPEMP)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_put_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor element map to file id %d", *idne); ex_err("nepem",errmsg,EX_MSG); } } /* * Read the communications map parameters for a single processor */ void F2C(exgcmp,EXGCMP)(int *idne, void_int *ncmap_ids, void_int *ncmap_node_cnts, void_int *ecmap_ids, void_int *ecmap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_get_cmap_params(*idne, ncmap_ids, ncmap_node_cnts, ecmap_ids, ecmap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read comm map parameters from file id %d", *idne); ex_err("negcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for a single processor */ void F2C(expcmp,EXPCMP)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *emap_ids, void_int *emap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_put_cmap_params(*idne, nmap_ids, nmap_node_cnts, emap_ids, emap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for all processors */ void F2C(expcmpc,EXPCMPC)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *nproc_ptrs, void_int *emap_ids, void_int *emap_elem_cnts, void_int *eproc_ptrs, int *ierr) { if ((*ierr = ex_put_cmap_params_cc(*idne, nmap_ids, nmap_node_cnts, nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmpc",errmsg,EX_MSG); } } /* * Read the nodal communications map for a single processor */ void F2C(exgncm,EXGNCM)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal communications map from file id %d", *idne); ex_err("negncm",errmsg,EX_MSG); } } /* * Write the nodal communications map for a single processor */ void F2C(expncm,EXPNCM)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal communications map to file id %d", *idne); ex_err("nepncm",errmsg,EX_MSG); } } /* * Read the elemental communications map for a single processor */ void F2C(exgecm,EXGECM)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read elemental comm map from file id %d", *idne); ex_err("negecm",errmsg,EX_MSG); } } /* * Write the elemental communications map for a single processor */ void F2C(expecm,EXPECM)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elemental comm map to file id %d", *idne); ex_err("nepecm",errmsg,EX_MSG); } } exodusii-6.02.dfsg.1/exodus/forbind/src/exo_jack.src000066400000000000000000004301251225312213100223650ustar00rootroot00000000000000/* * 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 - * * *****************************************************************************/ %* %* 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 #include #include #include #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); if (len > fslen) len = fslen; 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 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 = exerrval; 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 */ % ) % { int slen; char* name; *ierr = 0; slen = MAX_LINE_LENGTH; /* max line size */ if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } 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 */ % ) % { int slen; char* name; *ierr = 0; slen = MAX_LINE_LENGTH; /* max line size */ if (titlelen != MAX_LINE_LENGTH) { slen = titlelen; } 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 */ slen = MAX_STR_LENGTH; /* max str size */ if (qa_recordlen != MAX_STR_LENGTH) { slen = qa_recordlen; } 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 0) { if (!(ctags = calloc(nframe, sizeof(char)))) { *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("exgfrm",errmsg,EX_MEMFAIL); } return; } *ierr = 0; if (ex_get_coordinate_frames (*idexo, &nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; if (exoptval & EX_DEBUG) { sprintf(errmsg, "Error: failed to get coordinate frames from file id %d", *idexo); ex_err("exgfrm",errmsg,EX_MSG); } return; } /* Convert character tags back to integer tags for fortran */ for (i = 0; i < nframe; i++) { if (ctags[i] == 'R' || ctags[i] == 'r') tags[i] = EX_CF_RECTANGULAR; else if (ctags[i] == 'C' || ctags[i] == 'c') tags[i] = EX_CF_CYLINDRICAL; else if (ctags[i] == 'S' || ctags[i] == 's') tags[i] = EX_CF_SPHERICAL; } free(ctags); } } /* ex_put_coordinate_frames -- define/write coordinate frames */ % void % expfrm ( % int *idexo, % int *nframe, % int *cfids, % real *coord, % int *tags, % int *ierr % ) % { int i; char *ctags = NULL; char errmsg[MAX_ERR_LENGTH]; /* Create array of characters to store tags... */ if (*nframe > 0) { if (!(ctags = calloc(*nframe, sizeof(char)))) { *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("exgfrm",errmsg,EX_MEMFAIL); } return; } /* Convert fortran integer tags to C API character tags */ for (i = 0; i < *nframe; i++) { if (tags[i] == EX_CF_RECTANGULAR) ctags[i] = 'R'; else if (tags[i] == EX_CF_CYLINDRICAL) ctags[i] = 'C'; else if (tags[i] == EX_CF_SPHERICAL) ctags[i] = 'S'; } *ierr = 0; if (ex_put_coordinate_frames (*idexo, *nframe, cfids, coord, ctags) == EX_FATAL) { *ierr = EX_FATAL; if (exoptval & EX_DEBUG) { sprintf(errmsg, "Error: failed to define/write coordinate frames in file id %d", *idexo); ex_err("expfrm",errmsg,EX_MSG); } return; } free(ctags); } } /* 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; } 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((ex_options)*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); } } } % void % exmxnm ( % int *idexo, /* EXODUS file ID */ % int *length, /* max length of names */ % int *ierr /* error return code */ % ) % { char errmsg[MAX_ERR_LENGTH]; *ierr = ex_set_max_name_length(*idexo, *length); if (*ierr != 0) { *ierr = EX_FATAL; if (exoptval & EX_DEBUG) { sprintf(errmsg, "Error: failed to set maximum name length to %d", *length); ex_err("exmxnm",errmsg,EX_MSG); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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 */ slen = ex_max_name_length; /* max str size */ if (var_namelen < slen) { slen = var_namelen; } /* 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)); **/ memset(var_name, 0, var_namelen); ex_fcdcpy(var_name,slen,sptr);/* copy string into Fortran buffer */ free(sptr); /* Free up string staging area */ } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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); } } } /* * 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 */ slen = ex_inquire_int(*idexo, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH); /* max str size */ if (var_namelen < slen) { slen = var_namelen; } /* 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 */ } exodusii-6.02.dfsg.1/exodus/forbind/test/000077500000000000000000000000001225312213100202545ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/test/CMakeLists.txt000066400000000000000000000017461225312213100230240ustar00rootroot00000000000000ADD_DEFINITIONS(-DUSING_CMAKE) SET( forbind_OLDTESTS testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln testwt_nsid testrd_nsid test_nem ) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/testall.in ${CMAKE_CURRENT_BINARY_DIR}/testall @ONLY ) # NOTE: The "LINKER_LANGUAGE CXX" is used to workaround an issue with # the trilinos cmake adding the pamgen and pamgen_extras libraries as # a dependency. These are C++ libraries and result in unresolved depedencies # when built with shareable libraries on some platforms.... FOREACH ( testName ${forbind_OLDTESTS} ) ADD_EXECUTABLE( f_${testName} ${testName}.f ) TARGET_LINK_LIBRARIES( f_${testName} exoIIv2for ) SET_TARGET_PROPERTIES(f_${testName} PROPERTIES LINKER_LANGUAGE Fortran) ENDFOREACH ( testName ) ADD_CUSTOM_TARGET( f_check COMMAND /bin/csh ${CMAKE_CURRENT_BINARY_DIR}/testall WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) exodusii-6.02.dfsg.1/exodus/forbind/test/Imakefile000066400000000000000000000067271225312213100221010ustar00rootroot00000000000000### 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 -lexodus LOCALEXO = ../../libexoIIv2for32.a ../../libexodus.a #else EXOIITEST = -L../.. -lexoIIv2for -lexodus LOCALEXO = ../../libexoIIv2for.a ../../libexodus.a #endif LIBS = $(LOCALEXO) -L$(USRLIBDIR) $(NETCDF) PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln testwt_nsid testrd_nsid test_nem 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)) NormalFortranTarget(testwt_nsid, testwt_nsid.o, $(LOCALEXO), /**/, $(LIBS)) NormalFortranTarget(testrd_nsid, testrd_nsid.o, $(LOCALEXO), /**/, $(LIBS)) NormalFortranTarget(test_nem, test_nem.o, $(LOCALEXO), /**/, $(LIBS)) testall: testall.in1 $(CONFIGDIR)/$(MACROFILE) rm -f testall $(ETCDIR)/MsubCmd +R"@<" -R">@" testall.in1 >testall test: check check: $(PROGS) testall csh -f ./testall ExtraStuffToClean(*.res) ExtraStuffToClean(*.exo) ExtraStuffToClean(test.output) ExtraStuffToClean(testall) exodusii-6.02.dfsg.1/exodus/forbind/test/Makefile.standalone000066400000000000000000000074731225312213100240560ustar00rootroot00000000000000# 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 -lexodus LOCALEXO = ../../libexoIIv2for.a ../../libexodus.a LIBS = $(LOCALEXO) $(NETCDF_LIB) PROGS = testwt testwtd testrd testrd1 testrdd testwt1 testwt2 testwtm testcp testcpnl testcpln testwt_nsid testrd_nsid test_nem all:: check testwt:: testwt.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwt.o $(LDFLAGS) $(LIBS) testwtd:: testwtd.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwtd.o $(LDFLAGS) $(LIBS) testrd:: testrd.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testrd.o $(LDFLAGS) $(LIBS) testrd1:: testrd1.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testrd1.o $(LDFLAGS) $(LIBS) testrdd:: testrdd.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testrdd.o $(LDFLAGS) $(LIBS) testwt1:: testwt1.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwt1.o $(LDFLAGS) $(LIBS) testwt2:: testwt2.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwt2.o $(LDFLAGS) $(LIBS) testwtm:: testwtm.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwtm.o $(LDFLAGS) $(LIBS) testcp:: testcp.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testcp.o $(LDFLAGS) $(LIBS) testcpnl:: testcpnl.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testcpnl.o $(LDFLAGS) $(LIBS) testcpln:: testcpln.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testcpln.o $(LDFLAGS) $(LIBS) testwt_nsid:: testwt_nsid.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testwt_nsid.o $(LDFLAGS) $(LIBS) testrd_nsid:: testrd_nsid.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) testrd_nsid.o $(LDFLAGS) $(LIBS) test_nem:: test_nem.o $(LOCALEXO) $(FC) -o $@ $(FFLAGS) test_nem.o $(LDFLAGS) $(LIBS) test: check check: $(PROGS) csh ./testall.standalone ${NCDUMP} 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 exodusii-6.02.dfsg.1/exodus/forbind/test/exodus_unit_tests.gold000066400000000000000000000011761225312213100247200ustar00rootroot00000000000000************************************************************************ ************************************************************************ testwt ... testrd ... testrd ... [Expect ex_create NOCLOBBER error from this test] testcp_ss ... testcpln ... testcpnl ... testwt1 ... testwt1 ... [Expect WEDGE6 warning from this test] testrd1 ... testrd1 ... [Expect failure locating elem var 1 for elem block 12] testwtd ... testrdd ... testwt2 ... testwt_nsid ... testrd_nsid ... test_nem ... ************************************************************************ ************************************************************************ exodusii-6.02.dfsg.1/exodus/forbind/test/test-nsided.dmp000066400000000000000000000044731225312213100232110ustar00rootroot00000000000000netcdf test-nsided { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; num_dim = 3 ; num_nodes = 33 ; num_elem = 7 ; num_el_blk = 1 ; num_el_in_blk1 = 7 ; num_nod_per_el1 = 37 ; num_qa_rec = 2 ; num_info = 3 ; num_cframes = 3 ; num_cframes_9 = 27 ; variables: float time_whole(time_step) ; int eb_status(num_el_blk) ; int eb_prop1(num_el_blk) ; eb_prop1:name = "ID" ; float coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; int connect1(num_nod_per_el1) ; connect1:elem_type = "nsided" ; int ebepecnt1(num_el_in_blk1) ; ebepecnt1:entity_type1 = "NODE" ; ebepecnt1:entity_type2 = "ELEM" ; char qa_records(num_qa_rec, four, len_string) ; char info_records(num_info, len_line) ; float frame_coordinates(num_cframes_9) ; int frame_ids(num_cframes) ; char frame_tags(num_cframes) ; // global attributes: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; data: eb_status = 1 ; eb_prop1 = 10 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 3, 6, 0, 3, 6, 0, 2.7, 6, 5.7, 3.7, 0, 10, 10 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 0, 0, 0, 2, 2, 2, 1.7, 1.7, 1.7, 0, 0, 0, 10 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 6, 0, 0, 6, 2, 0, 2.7, 3.3, 1.7, 2.3, 0, 0, 10 ; eb_names = "" ; coor_names = "xcoor", "ycoor", "zcoor" ; elem_map = 1, 2, 3, 4, 5, 6, 7 ; connect1 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 17, 18, 19, 20, 27, 28, 30, 29, 31, 32, 33 ; ebepecnt1 = 4, 4, 8, 4, 6, 8, 3 ; qa_records = "testwt", "07/07/93", "15:41:33", "FASTQ", "fastq", "07/07/93", "16:41:33" ; info_records = "This is the first information record.", "This is the second information record.", "This is the third information record." ; frame_coordinates = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9 ; frame_ids = 1, 11, 111 ; frame_tags = "RCS" ; } exodusii-6.02.dfsg.1/exodus/forbind/test/test.dmp000066400000000000000000000266641225312213100217530ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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", "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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/forbind/test/test1.dmp000066400000000000000000000347111225312213100220240ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int nm_prop1(num_node_maps) ; nm_prop1:name = "ID" ; char nmap_names(num_node_maps, len_name) ; int node_map1(num_nodes) ; int em_prop1(num_elem_maps) ; em_prop1:name = "ID" ; char emap_names(num_elem_maps, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is testwt1" ; :maximum_name_length = 32 ; 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 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1, 0, 10, 10, 1, 1, 10, 10, 1, 0, 1, 10, 7, 100, 50, 3, 6, 0, 3, 6, 0 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 5, 100, 50, 0, 0, 0, 2, 2, 2 ; coordz = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -10, -10, 0, 0, -10, -10, 0, 5, 2, 3, 0, 20, 6, 0, 0, 6, 2, 0 ; eb_names = "", "", "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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", "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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.27, 1.28, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 3.43, 3.52, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.27, 2.28, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.54, 2.56, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.81, 2.84, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 3.08, 3.12, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 3.35, 3.4, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 3.62, 3.68, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 3.89, 3.96, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 4.16, 4.24, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 4.43, 4.52, 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 ; } exodusii-6.02.dfsg.1/exodus/forbind/test/test2-1.dmp000066400000000000000000000266101225312213100221620ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is test 2" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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", "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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/forbind/test/test2-2.dmp000066400000000000000000000265651225312213100221740ustar00rootroot00000000000000netcdf test2 { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; float coordy(num_nodes) ; float coordz(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; float vals_glo_var(time_step, num_glo_var) ; float vals_nod_var1(time_step, num_nodes) ; float vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is test 2" ; :maximum_name_length = 32 ; 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 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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", "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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 1.1, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.2, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.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.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.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, 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, 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, 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, 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, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.81, 1.9, 1.99, 2.08, 2.17, 2.26, 2.35, 2.44, 2.53, 2.62, 2.71, 2.8, 2.89, 2.98, 3.07, 3.16, 3.25, 3.34, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.09, 2.1, 2.11, 2.12, 2.13, 2.14, 2.15, 2.16, 2.17, 2.18, 2.19, 2.2, 2.21, 2.22, 2.23, 2.24, 2.25, 2.26, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.18, 2.2, 2.22, 2.24, 2.26, 2.28, 2.3, 2.32, 2.34, 2.36, 2.38, 2.4, 2.42, 2.44, 2.46, 2.48, 2.5, 2.52, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.27, 2.3, 2.33, 2.36, 2.39, 2.42, 2.45, 2.48, 2.51, 2.54, 2.57, 2.6, 2.63, 2.66, 2.69, 2.72, 2.75, 2.78, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.36, 2.4, 2.44, 2.48, 2.52, 2.56, 2.6, 2.64, 2.68, 2.72, 2.76, 2.8, 2.84, 2.88, 2.92, 2.96, 3, 3.04, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.45, 2.5, 2.55, 2.6, 2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.05, 3.1, 3.15, 3.2, 3.25, 3.3, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.54, 2.6, 2.66, 2.72, 2.78, 2.84, 2.9, 2.96, 3.02, 3.08, 3.14, 3.2, 3.26, 3.32, 3.38, 3.44, 3.5, 3.56, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.63, 2.7, 2.77, 2.84, 2.91, 2.98, 3.05, 3.12, 3.19, 3.26, 3.33, 3.4, 3.47, 3.54, 3.61, 3.68, 3.75, 3.82, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.72, 2.8, 2.88, 2.96, 3.04, 3.12, 3.2, 3.28, 3.36, 3.44, 3.52, 3.6, 3.68, 3.76, 3.84, 3.92, 4, 4.08, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 2.81, 2.9, 2.99, 3.08, 3.17, 3.26, 3.35, 3.44, 3.53, 3.62, 3.71, 3.8, 3.89, 3.98, 4.07, 4.16, 4.25, 4.34, 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 ; } exodusii-6.02.dfsg.1/exodus/forbind/test/test_nem.dmp000066400000000000000000000027011225312213100225740ustar00rootroot00000000000000 ******************Output Tests***************** creating ExodusII file... ...successful testing init info output... ...successful testing global init info output... ...successful testing global element block ID output... ...successful testing global node-set params output... ...successful testing global side-set params output... ...successful testing concatenated load balance info output... ...successful testing node map output... ...successful testing element map output... ...successful testing concatenated communication map params output... ...successful testing nodal communication map output... ...successful testing elemental communication map output... ...successful closing ExodusII file... ...successful ******************Input Tests****************** reopening ExodusII file... ...successful testing init info input... ...successful testing global init info input... ...successful testing global element block IDs input... ...successful testing global node-set params input... ...successful testing global side-set params input... ...successful testing load-balance params input... ...successful testing node map input... ...successful testing element map input... ...successful testing nodal communication map input... ...successful testing elemental communication map input... ...successful closing ExodusII file... ...successful Tests Passed: 25 Tests Failed: 0 exodusii-6.02.dfsg.1/exodus/forbind/test/test_nem.f000066400000000000000000000600361225312213100222460ustar00rootroot00000000000000C Copyright (c) 1998 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 C================================================================= C C This is just a simple test program to test the fortran interface C for the NEMESIS I library. C C This file was created by translating ne_test.c into fortran. C C================================================================= C================================================================= PROGRAM NETEST C================================================================= INCLUDE 'exodusII.inc' INCLUDE 'test_nem.inc' C local variables INTEGER NEID, IO_WS, CPU_WS, T_PASS, T_FAIL, DBG_FLAG, IERR CHARACTER FNAME*256, YO*6 REAL VERSION YO = 'NETEST' IO_WS = 0 CPU_WS = 0 T_PASS = 0 T_FAIL = 0 DBG_FLAG = 0 C now let's get going... C I don't care about input arguments, so the file name will be ne_test.nemI FNAME = 'test_nem.exo' C and set the debug flag to 0 DBG_FLAG = 0 PRINT*, '******************Output Tests*****************' C create the exodus II file PRINT*, 'creating ExodusII file...' NEID = EXCRE(FNAME, EXCLOB, CPU_WS, IO_WS, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to create test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of initial information PRINT*, 'testing init info output...' CALL EXPII(NEID, NPROC, NPROCF, 'S', IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of initial global information PRINT*, 'testing global init info output...' CALL EXPIG(NEID, NNG, NEG, NEBG, NNSG, NSSG, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global element block IDs PRINT*, 'testing global element block ID output...' CALL EXTPEBI(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global node-set info PRINT*, 'testing global node-set params output...' CALL EXTPNSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global side-set info PRINT*, 'testing global side-set params output...' CALL EXTPSSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the concatenated load-balance parameters PRINT*, 'testing concatenated load balance info output...' CALL EXTPLBPC(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the node map PRINT*, 'testing node map output...' CALL EXTPNM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the element map PRINT*, 'testing element map output...' CALL EXTPEM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the concatenated communication map params PRINT*, 'testing concatenated communication map params output...' CALL EXTPCMPC(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test nodal communication map output PRINT*, 'testing nodal communication map output...' CALL EXTPNCM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test elemental communication map output PRINT*, 'testing elemental communication map output...' CALL EXTPECM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Close the ExodusII/Nemesis test file PRINT*, 'closing ExodusII file...' CALL EXCLOS(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to close test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C================================================================= C INPUT TEST SECTION C================================================================= PRINT*, '******************Input Tests******************' C Re-open the ExodusII/NemesisI file PRINT*, 'reopening ExodusII file...' NEID = EXOPEN(FNAME, EXREAD, CPU_WS, IO_WS, VERSION, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to open test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of of the initial information PRINT*, 'testing init info input...' CALL EXTGII(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of initial global information PRINT*, 'testing global init info input...' CALL EXTGIG(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global element block IDs PRINT*, 'testing global element block IDs input...' CALL EXTGEBI(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global node-set params PRINT*, 'testing global node-set params input...' CALL EXTGNSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global side-set params PRINT*, 'testing global side-set params input...' CALL EXTGSSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of load-balance params PRINT*, 'testing load-balance params input...' CALL EXTGLBP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of the node map PRINT*, 'testing node map input...' CALL EXTGNM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of the element map PRINT*, 'testing element map input...' CALL EXTGEM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of nodal communication maps PRINT*, 'testing nodal communication map input...' CALL EXTGNCM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of elemental communication maps PRINT*, 'testing elemental communication map input...' CALL EXTGECM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Close the ExodusII/Nemesis test file PRINT*, 'closing ExodusII file...' CALL EXCLOS(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to close test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF PRINT*, 'Tests Passed: ', T_PASS PRINT*, 'Tests Failed: ', T_FAIL 100 CONTINUE END C================================================================= SUBROUTINE EXTPEBI(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, EBLK_IDS(NEBG) INTEGER EBLK_CNTS(NEBG) DO 110 I=1,NEBG EBLK_IDS(I) = I EBLK_CNTS(I) = 10 110 CONTINUE CALL EXPEBIG(NEID, EBLK_IDS, EBLK_CNTS, IERR) END C================================================================= SUBROUTINE EXTPNSP(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, GLBL_IDS(NNSG), GLBL_NC(NNSG), GLBL_DFC(NNSG) DO 120 I = 1,NNSG GLBL_IDS(I) = 2 * I GLBL_NC(I) = 3 * I GLBL_DFC(I) = 1 120 CONTINUE CALL EXPNSPG(NEID, GLBL_IDS, GLBL_NC, GLBL_DFC, IERR) END C================================================================= SUBROUTINE EXTPSSP(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, GLBL_IDS(NSSG), GLBL_ELC(NSSG), GLBL_DFC(NSSG) DO 130 I = 1,NSSG GLBL_IDS(I) = 3 * I GLBL_ELC(I) = 2 * I GLBL_DFC(I) = 1 130 CONTINUE CALL EXPSSPG(NEID, GLBL_IDS, GLBL_ELC, GLBL_DFC, IERR) END C================================================================= SUBROUTINE EXTPLBPC(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, NUM_IN(NPROCF), NUM_BN(NPROCF), NUM_EN(NPROCF), 1 NUM_IE(NPROCF), NUM_BE(NPROCF), NUM_NCM(NPROCF), NUM_ECM(NPROCF) DO 140 IPROC = 1,NPROCF NUM_IN(IPROC) = NINTN NUM_BN(IPROC) = NBORN NUM_EN(IPROC) = NEXTN NUM_IE(IPROC) = NINTE NUM_BE(IPROC) = NBORE NUM_NCM(IPROC) = NNCMAP NUM_ECM(IPROC) = NECMAP 140 CONTINUE CALL EXPLBPC(NEID, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, 1 NUM_NCM, NUM_ECM, IERR) END C================================================================= SUBROUTINE EXTPNM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, J, NMAPI(NINTN), NMAPB(NBORN), NMAPE(NEXTN) I = 0 DO 200 IPROC = 0,(NPROCF-1) DO 150 J = 1,NINTN NMAPI(J) = I I = I + 1 150 CONTINUE DO 160 J = 1,NBORN NMAPB(J) = I I = I + 1 160 CONTINUE DO 170 J = 1,NEXTN NMAPE(J) = I I = I + 1 170 CONTINUE I = 0 CALL EXPNMP(NEID, NMAPI, NMAPB, NMAPE, IPROC, IERR) IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTPEM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, J, EMAPI(NINTE), EMAPB(NBORE) I = 0 DO 200 IPROC = 0,(NPROCF-1) DO 150 J = 1,NINTE EMAPI(J) = I I = I + 1 150 CONTINUE DO 160 J = 1,NBORE EMAPB(J) = I I = I + 1 160 CONTINUE I = 0 CALL EXPEMP(NEID, EMAPI, EMAPB, IPROC, IERR) IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTPCMPC(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, NCNTR, ECNTR, NMAPIDS(NNCXNPF), 1 NMAPCNT(NNCXNPF), NMAPPROC(NPROCF+1), EMAPIDS(NECXNPF), 1 EMAPCNT(NECXNPF), EMAPPROC(NPROCF+1) NMAPPROC(1) = 0 EMAPPROC(1) = 0 NCNTR = 1 ECNTR = 1 DO 200 IPROC = 1,NPROCF DO 150 I = 1,NNCMAP NMAPIDS(NCNTR) = I NMAPCNT(NCNTR) = NCNTCM NCNTR = NCNTR + 1 150 CONTINUE DO 160 I = 1,NECMAP EMAPIDS(ECNTR) = 2*I EMAPCNT(ECNTR) = ECNTCM ECNTR = ECNTR + 1 160 CONTINUE NMAPPROC(IPROC+1) = NMAPPROC(IPROC) + NNCMAP EMAPPROC(IPROC+1) = EMAPPROC(IPROC) + NECMAP 200 CONTINUE CALL EXPCMPC(NEID, NMAPIDS, NMAPCNT, NMAPPROC, EMAPIDS, EMAPCNT, 1 EMAPPROC, IERR) END C================================================================= SUBROUTINE EXTPNCM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, NMAPIDS(NNCMAP), NIDS(NCNTCM), PIDS(NCNTCM) DO 200 IPROC = 0,(NPROCF-1) DO 150 I = 1,NNCMAP NMAPIDS(I) = I 150 CONTINUE DO 160 I = 1,NCNTCM NIDS(I) = 2*I PIDS(I) = 3*I 160 CONTINUE DO 170 I=1,NNCMAP CALL EXPNCM(NEID, NMAPIDS(I), NIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTPECM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, EMAPIDS(NECMAP), EIDS(ECNTCM), PIDS(ECNTCM), 1 SIDS(ECNTCM) DO 200 IPROC = 0,(NPROCF-1) DO 150 I = 1,NECMAP EMAPIDS(I) = 2*I 150 CONTINUE DO 160 I = 1,ECNTCM EIDS(I) = 2*I SIDS(I) = 3*I PIDS(I) = 4*I 160 CONTINUE DO 170 I=1,NECMAP CALL EXPECM(NEID, EMAPIDS(I), EIDS, SIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGII(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER NP, NPF CHARACTER FTYPE*2 CALL EXGII(NEID, NP, NPF, FTYPE, IERR) IF (IERR.NE.0) GOTO 210 IF (NP.NE.NPROC) IERR = -1 IF (NPF.NE.NPROCF) IERR = -1 IF (NP.NE.NPROC) IERR = -1 210 CONTINUE END C================================================================= SUBROUTINE EXTGIG(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER NUMNG, NUMEG, NUMEBG, NUMNSG, NUMSSG CALL EXGIG(NEID, NUMNG, NUMEG, NUMEBG, NUMNSG, NUMSSG, IERR) IF (IERR.NE.0) GOTO 210 IF (NUMNG.NE.NNG) IERR = -1 IF (NUMEG.NE.NEG) IERR = -1 IF (NUMEBG.NE.NEBG) IERR = -1 IF (NUMNSG.NE.NNSG) IERR = -1 IF (NUMSSG.NE.NSSG) IERR = -1 210 CONTINUE END C================================================================= SUBROUTINE EXTGEBI(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, EBLK_IDS(NEBG) INTEGER EBLK_CNTS(NEBG) CALL EXGEBIG(NEID, EBLK_IDS, EBLK_CNTS, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NEBG IF (EBLK_IDS(I).NE.I) IERR = -1 IF (EBLK_CNTS(I) .NE. 10) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGNSP(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, GLBL_IDS(NNSG), GLBL_NC(NNSG), GLBL_DFC(NNSG) CALL EXGNSPG(NEID, GLBL_IDS, GLBL_NC, GLBL_DFC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NNSG IF (GLBL_IDS(I).NE.(2*I)) IERR = -1 IF (GLBL_NC(I).NE.(3*I)) IERR = -1 IF (GLBL_DFC(I).NE.1) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGSSP(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER I, GLBL_IDS(NSSG), GLBL_EC(NSSG), GLBL_DFC(NSSG) CALL EXGSSPG(NEID, GLBL_IDS, GLBL_EC, GLBL_DFC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NNSG IF (GLBL_IDS(I).NE.(3*I)) IERR = -1 IF (GLBL_EC(I).NE.(2*I)) IERR = -1 IF (GLBL_DFC(I).NE.1) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGLBP(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, * NUM_NCM, NUM_ECM DO 150 IPROC = 0,(NPROCF-1) CALL EXGLBP(NEID, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, 1 NUM_NCM, NUM_ECM, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF(NUM_IN.NE.NINTN) IERR = -1 IF(NUM_BN.NE.NBORN) IERR = -1 IF(NUM_EN.NE.NEXTN) IERR = -1 IF(NUM_IE.NE.NINTE) IERR = -1 IF(NUM_BE.NE.NBORE) IERR = -1 IF(NUM_NCM.NE.NNCMAP) IERR = -1 IF(NUM_ECM.NE.NECMAP) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGNM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, J, NMAPI(NINTN), NMAPB(NBORN), NMAPE(NEXTN) I = 0 DO 200 IPROC = 0,(NPROCF-1) CALL EXGNMP(NEID, NMAPI, NMAPB, NMAPE, IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 J = 1,NINTN IF (NMAPI(J).NE.I) ERR = -1 I = I + 1 150 CONTINUE DO 160 J = 1,NBORN IF (NMAPB(J).NE.I) ERR = -1 I = I + 1 160 CONTINUE DO 170 J = 1,NEXTN IF (NMAPE(J).NE.I) ERR = -1 I = I + 1 170 CONTINUE I = 0 IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGEM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, J, EMAPI(NINTE), EMAPB(NBORE) I = 0 DO 200 IPROC = 0,(NPROCF-1) CALL EXGEMP(NEID, EMAPI, EMAPB, IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 J = 1,NINTE IF (EMAPI(J).NE.I) ERR = -1 I = I + 1 150 CONTINUE DO 160 J = 1,NBORE IF (EMAPB(J).NE.I) ERR = -1 I = I + 1 160 CONTINUE I = 0 IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGNCM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, J, NMAPIDS(NNCMAP), NMAPCNT(NNCMAP), 1 NIDS(NCNTCM), PIDS(NCNTCM), EMAPIDS(NECMAP), EMAPCNT(NECMAP) DO 200 IPROC = 0,(NPROCF-1) CALL EXGCMP(NEID, NMAPIDS, NMAPCNT, EMAPIDS, EMAPCNT, 1 IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 170 I = 1,NNCMAP CALL EXGNCM(NEID, NMAPIDS(I), NIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF (NMAPIDS(I).NE.I) IERR = -1 DO 160 J = 1,NCNTCM IF (NIDS(J).NE.2*J) IERR = -1 IF (PIDS(J).NE.3*J) IERR = -1 160 CONTINUE IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE EXTGECM(NEID, IERR) C================================================================= INCLUDE 'test_nem.inc' INTEGER IPROC, I, EMAPIDS(NECMAP), EMAPCNT(NECMAP), EIDS(ECNTCM), 1 PIDS(ECNTCM), SIDS(ECNTCM), NMAPIDS(NNCMAP), NMAPCNT(NNCMAP) DO 200 IPROC = 0,(NPROCF-1) CALL EXGCMP(NEID, NMAPIDS, NMAPCNT, EMAPIDS, EMAPCNT, 1 IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 170 I = 1,NECMAP CALL EXGECM(NEID, EMAPIDS(I), EIDS, SIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF (EMAPIDS(I).NE.(2*I)) IERR = -1 DO 160 J = 1,ECNTCM IF (EIDS(J).NE.2*J) IERR = -1 IF (SIDS(J).NE.3*J) IERR = -1 IF (PIDS(J).NE.4*J) IERR = -1 160 CONTINUE IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END exodusii-6.02.dfsg.1/exodus/forbind/test/test_nem.inc000066400000000000000000000051061225312213100225670ustar00rootroot00000000000000C Copyright (c) 1998 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 C================================================== C Parameters for the NE_TEST fortran interface test C program C================================================== C Constants for init_global functions PARAMETER (NNG = 100) PARAMETER (NEG = 50) PARAMETER (NEBG = 5) PARAMETER (NNSG = 2) PARAMETER (NSSG = 3) C Constants for load-balance functions PARAMETER (NPROC = 10) PARAMETER (NPROCF = NPROC) PARAMETER (NINTN = 200) PARAMETER (NBORN = 10) PARAMETER (NEXTN = 5) PARAMETER (NINTE = 100) PARAMETER (NBORE = 20) INTEGER NNCMAP, NECMAP PARAMETER (NNCMAP = 4) PARAMETER (NECMAP = 2) C Constants for communication map PARAMETER (NCNTCM = 20) INTEGER ECNTCM PARAMETER (ECNTCM = 17) C Some multiplied values C NNCMAP * NPROCF PARAMETER (NNCXNPF = 40) C NECMAP * NPROCF PARAMETER (NECXNPF = 20) exodusii-6.02.dfsg.1/exodus/forbind/test/testall.in000066400000000000000000000134301225312213100222550ustar00rootroot00000000000000# 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 SUFFIX = "" set BINDIR = @CMAKE_CURRENT_BINARY_DIR@ set SRCDIR = @CMAKE_CURRENT_SOURCE_DIR@ set NCDUMP = @NETCDF_NCDUMP@ # testwt - single precision write test echo "************************************************************************" echo "************************************************************************" echo "testwt ..." echo "begin testwt" > test.output ${PREFIX} ${BINDIR}/f_testwt${SUFFIX} >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test.dmp | tee testwt.res # testrd - single precision read test echo "testrd ..." echo "testrd ... [Expect ex_create NOCLOBBER error from this test]" ${PREFIX} ${BINDIR}/f_testrd${SUFFIX} | grep -v version | diff - ${SRCDIR}/testrd.dmp | tee testrd.res # testcp_ss - single-to-single precision copy test echo "testcp_ss ..." echo "begin testcp_ss" >> test.output ${PREFIX} ${BINDIR}/f_testcp${SUFFIX} >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcp_ss.dmp | tee testcp_ss.res # testcpln - single-to-single, large to normal copy test echo "testcpln ..." echo "begin testcpln" >> test.output ${PREFIX} ${BINDIR}/f_testcpln${SUFFIX} >> test.output echo "end testcpln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - ${SRCDIR}/testcpln.dmp | tee testcpln.res # testcpnl - single-to-single, normal to large copy test echo "testcpnl ..." echo "begin testcpnl" >> test.output ${PREFIX} ${BINDIR}/f_testcpnl${SUFFIX} >> test.output echo "end testcpnl" >> test.output ${NCDUMP} -d5,5 testcpnl.exo | grep -v version | diff - ${SRCDIR}/testcpnl.dmp | tee testcpnl.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} ${BINDIR}/f_testwt1${SUFFIX} >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/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} ${BINDIR}/f_testrd1${SUFFIX} | grep -v version | diff - ${SRCDIR}/testrd1.dmp | tee testrd1.res # testwtd - double precision write test echo "testwtd ..." echo "begin testwtd" >> test.output ${PREFIX} ${BINDIR}/f_testwtd${SUFFIX} >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/testd.dmp | tee testwtd.res # testrdd - double precision read test echo "testrdd ..." ${PREFIX} ${BINDIR}/f_testrdd${SUFFIX} | grep -v version | diff - ${SRCDIR}/testrdd.dmp | tee testrdd.res # testwt2 - single precision write 2 files (simultaneously open) test echo "testwt2 ..." echo "begin testwt2" >> test.output ${PREFIX} ${BINDIR}/f_testwt2${SUFFIX} >> test.output |&grep -v "property name string" echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - ${SRCDIR}/test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | diff - ${SRCDIR}/test2-2.dmp | tee testwt2-2.res echo "testwt_nsid ..." echo "begin testwt_nsid" > test.output ${PREFIX} ${BINDIR}/f_testwt_nsid${SUFFIX} >> test.output echo "end testwt_nsid" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | diff - ${SRCDIR}/test-nsided.dmp | tee testwt_nsid.res # testrd_nsid - single precision read test echo "testrd_nsid ..." ${PREFIX} ${BINDIR}/f_testrd_nsid${SUFFIX} | grep -v version | diff - ${SRCDIR}/testrd_nsid.dmp | tee testrd_nsid.res # test_nem - nemesis routines echo "test_nem ..." ${PREFIX} ${BINDIR}/f_test_nem${SUFFIX} | diff -w - ${SRCDIR}/test_nem.dmp | tee test_nem.res echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/forbind/test/testall.in1000066400000000000000000000126531225312213100223440ustar00rootroot00000000000000# 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 SRCDIR = . set NCDUMP = @@/ncdump # testwt - single precision write test echo "************************************************************************" echo "************************************************************************" echo "testwt ..." echo "begin testwt" > test.output ${PREFIX} ${SRCDIR}/testwt >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test.dmp | tee testwt.res # testrd - single precision read test echo "testrd ..." echo "testrd ... [Expect ex_create NOCLOBBER error from this test]" ${PREFIX} ${SRCDIR}/testrd | grep -v version | diff - testrd.dmp | tee testrd.res # testcp_ss - single-to-single precision copy test echo "testcp_ss ..." echo "begin testcp_ss" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - testcp_ss.dmp | tee testcp_ss.res # testcpln - single-to-single, large to normal copy test echo "testcpln ..." echo "begin testcpln" >> test.output ${PREFIX} ${SRCDIR}/testcpln >> test.output echo "end testcpln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - testcpln.dmp | tee testcpln.res # testcpnl - single-to-single, normal to large copy test echo "testcpnl ..." echo "begin testcpnl" >> test.output ${PREFIX} ${SRCDIR}/testcpnl >> test.output echo "end testcpnl" >> test.output ${NCDUMP} -d5,5 testcpnl.exo | grep -v version | diff - testcpnl.dmp | tee testcpnl.res # testwt1 - single precision write test with multiple side sets echo "testwt1 ..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test1.dmp | tee testwt1.res # testrd1 - single precision read test with multiple side sets echo "testrd1 ..." echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" ${PREFIX} ${SRCDIR}/testrd1 | grep -v version | diff - testrd1.dmp | tee testrd1.res # testwtd - double precision write test echo "testwtd ..." echo "begin testwtd" >> test.output ${PREFIX} ${SRCDIR}/testwtd >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - testd.dmp | tee testwtd.res # testrdd - double precision read test echo "testrdd ..." ${PREFIX} ${SRCDIR}/testrdd | grep -v version | diff - testrdd.dmp | tee testrdd.res # testwt2 - single precision write 2 files (simultaneously open) test echo "testwt2 ..." echo "begin testwt2" >> test.output ${PREFIX} ${SRCDIR}/testwt2 >> test.output |&grep -v "property name string" echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | diff - test2-2.dmp | tee testwt2-2.res echo "testwt_nsid ..." echo "begin testwt_nsid" > test.output ${PREFIX} ${SRCDIR}/testwt_nsid >> test.output echo "end testwt_nsid" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | diff - test-nsided.dmp | tee testwt_nsid.res # testrd_nsid - single precision read test echo "testrd_nsid ..." ${PREFIX} ${SRCDIR}/testrd_nsid | grep -v version | diff - testrd_nsid.dmp | tee testrd_nsid.res # test_nem - nemesis routines echo "test_nem ..." ${PREFIX} ${SRCDIR}/test_nem | diff - test_nem.dmp | tee test_nem.res echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/forbind/test/testall.standalone000077500000000000000000000127361225312213100240120ustar00rootroot00000000000000# 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. if ($#argv == 0) then set NCDUMP = `which ncdump` else set NCDUMP = $1 endif #set PREFIX = "valgrind --tool=memcheck" set PREFIX = "" set SRCDIR = . # testwt - single precision write test echo "************************************************************************" echo "************************************************************************" echo "testwt ..." echo "begin testwt" > test.output ${PREFIX} ${SRCDIR}/testwt >> test.output echo "end testwt" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test.dmp | tee testwt.res # testrd - single precision read test echo "testrd ..." echo "testrd ... [Expect ex_create NOCLOBBER error from this test]" ${PREFIX} ${SRCDIR}/testrd | grep -v version | diff - testrd.dmp | tee testrd.res # testcp_ss - single-to-single precision copy test echo "testcp_ss ..." echo "begin testcp_ss" >> test.output ${PREFIX} ${SRCDIR}/testcp >> test.output echo "end testcp_ss" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - testcp_ss.dmp | tee testcp_ss.res # testcpln - single-to-single, large to normal copy test echo "testcpln ..." echo "begin testcpln" >> test.output ${PREFIX} ${SRCDIR}/testcpln >> test.output echo "end testcpln" >> test.output ${NCDUMP} -d5,5 testcp.exo | grep -v version | diff - testcpln.dmp | tee testcpln.res # testcpnl - single-to-single, normal to large copy test echo "testcpnl ..." echo "begin testcpnl" >> test.output ${PREFIX} ${SRCDIR}/testcpnl >> test.output echo "end testcpnl" >> test.output ${NCDUMP} -d5,5 testcpnl.exo | grep -v version | diff - testcpnl.dmp | tee testcpnl.res # testwt1 - single precision write test with multiple side sets echo "testwt1 ..." echo "testwt1 ... [Expect WEDGE6 warning from this test]" echo "begin testwt1" >> test.output ${PREFIX} ${SRCDIR}/testwt1 >> test.output echo "end testwt1" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test1.dmp | tee testwt1.res # testrd1 - single precision read test with multiple side sets echo "testrd1 ..." echo "testrd1 ... [Expect failure locating elem var 1 for elem block 12]" ${PREFIX} ${SRCDIR}/testrd1 | grep -v version | diff - testrd1.dmp | tee testrd1.res # testwtd - double precision write test echo "testwtd ..." echo "begin testwtd" >> test.output ${PREFIX} ${SRCDIR}/testwtd >> test.output echo "end testwtd" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - testd.dmp | tee testwtd.res # testrdd - double precision read test echo "testrdd ..." ${PREFIX} ${SRCDIR}/testrdd | grep -v version | diff - testrdd.dmp | tee testrdd.res # testwt2 - single precision write 2 files (simultaneously open) test echo "testwt2 ..." echo "begin testwt2" >> test.output ${PREFIX} ${SRCDIR}/testwt2 >> test.output |&grep -v "property name string" echo "end testwt2" >> test.output ${NCDUMP} -d5,5 test.exo | grep -v version | diff - test2-1.dmp | tee testwt2-1.res ${NCDUMP} -d5,5 test2.exo | grep -v version | diff - test2-2.dmp | tee testwt2-2.res echo "testwt_nsid ..." echo "begin testwt_nsid" > test.output ${PREFIX} ${SRCDIR}/testwt_nsid >> test.output echo "end testwt_nsid" >> test.output ${NCDUMP} -d5,5 test-nsided.exo | grep -v version | diff - test-nsided.dmp | tee testwt_nsid.res # testrd_nsid - single precision read test echo "testrd_nsid ..." ${PREFIX} ${SRCDIR}/testrd_nsid | grep -v version | diff - testrd_nsid.dmp | tee testrd_nsid.res # test_nem - nemesis routines echo "test_nem ..." ${PREFIX} ${SRCDIR}/test_nem | diff - test_nem.dmp | tee test_nem.res echo "************************************************************************" echo "************************************************************************" exodusii-6.02.dfsg.1/exodus/forbind/test/testcp.f000066400000000000000000000027551225312213100217360ustar00rootroot00000000000000 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 = ", i6, ", error = ",i4)') 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testcp_dd.dmp000066400000000000000000000000001225312213100227150ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/test/testcp_ds.dmp000066400000000000000000000113121225312213100227440ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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 = 5.15f ; :version = 5.15f ; :floating_point_word_size = 4 ; :file_size = 0 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; data: eb_status = 0, 0, 0, 0, 0 ; eb_prop1 = 0, 0, 0, 0, 0 ; ns_status = 0, 0 ; ns_prop1 = 0, 0 ; ss_status = 0, 0, 0, 0, 0 ; ss_prop1 = 0, 0, 0, 0, 0 ; coord = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "", "", "" ; elem_map = 0, 0, 0, 0, 0 ; attrib1 = 0 ; attrib_name1 = "" ; connect1 = 0, 0, 0, 0 ; attrib2 = 0 ; attrib_name2 = "" ; connect2 = 0, 0, 0, 0 ; attrib3 = 0 ; attrib_name3 = "" ; connect3 = 0, 0, 0, 0, 0, 0, 0, 0 ; attrib4 = 0 ; attrib_name4 = "" ; connect4 = 0, 0, 0, 0 ; attrib5 = 0 ; attrib_name5 = "" ; connect5 = 0, 0, 0, 0, 0, 0 ; eb_prop2 = _, _, _, _, _ ; eb_prop3 = _, _, _, _, _ ; node_ns1 = 0, 0, 0, 0, 0 ; dist_fact_ns1 = 0, 0, 0, 0, 0 ; node_ns2 = 0, 0, 0 ; dist_fact_ns2 = 0, 0, 0 ; ns_prop2 = _, _ ; ns_prop3 = 0, 0 ; elem_ss1 = 0, 0 ; side_ss1 = 0, 0 ; dist_fact_ss1 = 0, 0, 0, 0 ; elem_ss2 = 0, 0 ; side_ss2 = 0, 0 ; dist_fact_ss2 = 0, 0, 0, 0 ; elem_ss3 = 0, 0, 0, 0, 0, 0, 0 ; side_ss3 = 0, 0, 0, 0, 0, 0, 0 ; elem_ss4 = 0, 0, 0, 0 ; side_ss4 = 0, 0, 0, 0 ; elem_ss5 = 0, 0, 0, 0, 0 ; side_ss5 = 0, 0, 0, 0, 0 ; ss_prop2 = _, _, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/forbind/test/testcp_sd.dmp000066400000000000000000000000001225312213100227340ustar00rootroot00000000000000exodusii-6.02.dfsg.1/exodus/forbind/test/testcp_ss.dmp000066400000000000000000000116501225312213100227700ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/forbind/test/testcpd.f000066400000000000000000000027461225312213100221020ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testcpln.dmp000066400000000000000000000115471225312213100226220ustar00rootroot00000000000000netcdf testcp { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 0 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/forbind/test/testcpln.f000066400000000000000000000032311225312213100222560ustar00rootroot00000000000000 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 ("testcp.exo", 1 EXCLOB+EXNORM, cpu_ws, io_ws, ierr) write (iout,'("after excre, id = ", i6, ", error = ",i4)') 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testcpnl.dmp000066400000000000000000000116521225312213100226170ustar00rootroot00000000000000netcdf testcpnl { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (0 currently) len_name = 33 ; 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 eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; float attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; 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_name) ; 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_name) ; 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: :floating_point_word_size = 4 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; eb_names = "", "", "", "", "" ; ns_names = "", "" ; ss_names = "", "", "", "", "" ; coor_names = "xcoor", "ycoor", "zcoor" ; 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, _, _, _ ; } exodusii-6.02.dfsg.1/exodus/forbind/test/testcpnl.f000066400000000000000000000032331225312213100222600ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testd.dmp000066400000000000000000000141451225312213100221060ustar00rootroot00000000000000netcdf test { dimensions: len_string = 33 ; len_line = 81 ; four = 4 ; time_step = UNLIMITED ; // (10 currently) len_name = 33 ; 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 coordx(num_nodes) ; double coordy(num_nodes) ; char eb_names(num_el_blk, len_name) ; char ns_names(num_node_sets, len_name) ; char ss_names(num_side_sets, len_name) ; char coor_names(num_dim, len_name) ; int elem_map(num_elem) ; double attrib1(num_el_in_blk1, num_att_in_blk1) ; char attrib_name1(num_att_in_blk1, len_name) ; 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_name) ; 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_name) ; double vals_glo_var(time_step, num_glo_var) ; double vals_nod_var1(time_step, num_nodes) ; double vals_nod_var2(time_step, num_nodes) ; char name_nod_var(num_nod_var, len_name) ; char name_elem_var(num_elem_var, len_name) ; 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: :floating_point_word_size = 8 ; :file_size = 1 ; :int64_status = 0 ; :title = "This is a test" ; :maximum_name_length = 32 ; 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 ; coordx = 0, 1, 1, 0, 1, 2, 2, 1 ; coordy = 0, 0, 1, 1, 0, 0, 1, 1 ; eb_names = "", "" ; ns_names = "", "" ; ss_names = "", "" ; coor_names = "xcoor", "ycoor" ; 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", "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_var1 = 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.02, 1.04, 1.06, 1.08, 1.1, 1.12, 1.14, 1.16, 1.03, 1.06, 1.09, 1.12, 1.15, 1.18, 1.21, 1.24, 1.04, 1.08, 1.12, 1.16, 1.2, 1.24, 1.28, 1.32, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.07, 1.14, 1.21, 1.28, 1.35, 1.42, 1.49, 1.56, 1.08, 1.16, 1.24, 1.32, 1.4, 1.48, 1.56, 1.64, 1.09, 1.18, 1.27, 1.36, 1.45, 1.54, 1.63, 1.72, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 ; vals_nod_var2 = 2.01, 2.02, 2.03, 2.04, 2.05, 2.06, 2.07, 2.08, 2.02, 2.04, 2.06, 2.08, 2.1, 2.12, 2.14, 2.16, 2.03, 2.06, 2.09, 2.12, 2.15, 2.18, 2.21, 2.24, 2.04, 2.08, 2.12, 2.16, 2.2, 2.24, 2.28, 2.32, 2.05, 2.1, 2.15, 2.2, 2.25, 2.3, 2.35, 2.4, 2.06, 2.12, 2.18, 2.24, 2.3, 2.36, 2.42, 2.48, 2.07, 2.14, 2.21, 2.28, 2.35, 2.42, 2.49, 2.56, 2.08, 2.16, 2.24, 2.32, 2.4, 2.48, 2.56, 2.64, 2.09, 2.18, 2.27, 2.36, 2.45, 2.54, 2.63, 2.72, 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 ; } exodusii-6.02.dfsg.1/exodus/forbind/test/testrd.dmp000066400000000000000000000256041225312213100222720ustar00rootroot00000000000000 after exopen, error = 0 I/O word size 4 Model Size 1 Maximum Allowed/Used DB Name Size 3232 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testrd.f000066400000000000000000000531261225312213100217370ustar00rootroot00000000000000 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 integer mxalnmlen, mxusnmlen 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 call exinq (exoid, EXNEBP, num_props, fdum, cdum, ierr) call exinq (exoid, EXDBMXALNM, mxalnmlen, fdum, cdum, ierr) call exinq (exoid, EXDBMXUSNM, mxusnmlen, fdum, cdum, ierr) write (iout, '(" Maximum Allowed/Used DB Name Size ",i2,i2)') * mxalnmlen, mxusnmlen 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testrd1.dmp000066400000000000000000000344401225312213100223510ustar00rootroot00000000000000 after exopen, error = 0 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testrd1.f000066400000000000000000000576151225312213100220270ustar00rootroot00000000000000 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 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testrd_nsid.dmp000066400000000000000000000044021225312213100233000ustar00rootroot00000000000000 after exopen, error = 0 I/O word size 4 Model Size 1 after exgini, error = 0 database parameters: title = This is a test num_dim = 3 num_nodes = 33 num_elem = 7 num_elem_blk = 1 num_node_sets = 0 num_side_sets = 0 after exgcor, error = 0 x coords = 0.0 1.0 1.0 0.0 1.0 2.0 2.0 1.0 0.0 10.0 10.0 1.0 1.0 10.0 10.0 1.0 0.0 1.0 10.0 7.0 3.0 6.0 0.0 3.0 6.0 0.0 2.7 6.0 5.7 3.7 0.0 10.0 10.0 y coords = 0.0 0.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 10.0 10.0 10.0 10.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 2.0 2.0 2.0 1.7 1.7 1.7 0.0 0.0 0.0 10.0 z coords = 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -10.0 -10.0 0.0 0.0 -10.0 -10.0 0.0 5.0 2.0 3.0 6.0 0.0 0.0 6.0 2.0 0.0 2.7 3.3 1.7 2.3 0.0 0.0 10.0 after exgcon, error = 0 x coord name = xcoor y coord name = ycoor after exgmap, error = 0 elem_map(1) = 1 elem_map(2) = 2 elem_map(3) = 3 elem_map(4) = 4 elem_map(5) = 5 elem_map(6) = 6 elem_map(7) = 7 after exgebi, error = 0 after exgelb, error = 0 element block id = 10 element type = nsided num_elem_in_block = 7 num_nodes_per_elem = 37 num_attr = 0 after exgelc, error = 0 after exgecpp, error = 0 connect array for elem block 10 Element 1, Nodes/Element = 4 -- 1 2 3 4 Element 2, Nodes/Element = 4 -- 5 6 7 8 Element 3, Nodes/Element = 8 -- 9 10 11 12 13 14 15 16 Element 4, Nodes/Element = 4 -- 17 18 19 20 Element 5, Nodes/Element = 6 -- 21 22 23 24 25 26 Element 6, Nodes/Element = 8 -- 17 18 19 20 27 28 30 29 Element 7, Nodes/Element = 3 -- 31 32 33 after exinq, error = 0 There are 3 coordinate frames after exgfrm, error = 0 1 RECTANGULAR 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 11 CYLINDRICAL 1.10 1.20 1.30 1.40 1.50 1.60 1.70 1.80 1.90 111 SPHERICAL 2.10 2.20 2.30 2.40 2.50 2.60 2.70 2.80 2.90 after exclos, error = 0 exodusii-6.02.dfsg.1/exodus/forbind/test/testrd_nsid.f000066400000000000000000000132001225312213100227410ustar00rootroot00000000000000 program testrd c c This is a test program for the Fortran binding of the EXODUS II c database read routines c c 09/07/93 V.R. Yarberry - Modified for API 2.00 implicit none include 'exodusII.inc' integer iin, iout, ierr, ioff integer exoid, num_dim, num_nodes, num_elem, num_elem_blk integer num_node_sets integer num_side_sets integer i, j, k, elem_map(100), connect(100), nnpe(10) integer ids(10) integer num_elem_in_block(10), num_nodes_per_elem(10) integer num_attr(10) integer cpu_ws,io_ws, mod_sz real x(100), y(100), z(100) real vers character*(MXSTLN) coord_names(3) character*(MXLNLN) titl character*(MXSTLN) eltype(10) data iin /5/, iout /6/ c c open EXODUS II files c cpu_ws = 0 io_ws = 0 exoid = exopen ("test-nsided.exo", EXREAD, cpu_ws, io_ws, * vers, ierr) write (iout, '(/"after exopen, error = ",i3)') 1 ierr write (iout, '("test-nsided.exo is an EXODUSII file; version ", 1 f4.2)') vers write (iout, '(" I/O word size",i2)') io_ws mod_sz = exlgmd(exoid) write (iout, '(" Model Size",i2)') mod_sz c c read database parameters c call exgini (exoid, titl, num_dim, num_nodes, num_elem, 1 num_elem_blk, num_node_sets, num_side_sets, ierr) write (iout, '(/"after exgini, error = ", i3)' ) ierr write (iout, '("database parameters:"/ 1 "title = ", a81 / 2 "num_dim = ", i3 / 3 "num_nodes = ", i3 / 4 "num_elem = ", i3 / 5 "num_elem_blk = ", i3 / 6 "num_node_sets = ", i3 / 7 "num_side_sets = ", i3)') 8 titl,num_dim, num_nodes, num_elem, 9 num_elem_blk,num_node_sets, num_side_sets c c read nodal coordinates values and names from database c call exgcor (exoid, x, y, z, ierr) write (iout, '(/"after exgcor, error = ", i3)' ) ierr write (iout, '("x coords = ")') do 10 i = 1, num_nodes write (iout, '(f5.1)') x(i) 10 continue write (iout, '("y coords = ")') do 20 i = 1, num_nodes write (iout, '(f5.1)') y(i) 20 continue if (num_dim .gt. 2) then write (iout, '("z coords = ")') do 22 i = 1, num_nodes write (iout, '(f5.1)') z(i) 22 continue endif call exgcon (exoid, coord_names, ierr) write (iout, '(/"after exgcon, error = ", i3)' ) ierr write (iout, '("x coord name = ", a9)') coord_names(1) write (iout, '("y coord name = ", a9)') coord_names(2) c c read element order map c call exgmap (exoid, elem_map, ierr) write (iout, '(/"after exgmap, error = ", i3)' ) ierr do 30 i = 1, num_elem write (iout, '("elem_map(",i1,") = ", i1)') i, elem_map(i) 30 continue c c read element block parameters c c call exgebi (exoid, ids, ierr) write (iout, '(/"after exgebi, error = ", i3)' ) ierr do 40 i = 1, num_elem_blk call exgelb (exoid, ids(i), eltype(i), num_elem_in_block(i), 1 num_nodes_per_elem(i), num_attr(i), ierr) write (iout, '(/"after exgelb, error = ", i3)' ) ierr write (iout, '("element block id = ", i2,/ 1 "element type = ", a9,/ 2 "num_elem_in_block = ", i2,/ 3 "num_nodes_per_elem = ", i2,/ 4 "num_attr = ", i2)') 5 ids(i), eltype(i), num_elem_in_block(i), 6 num_nodes_per_elem(i), num_attr(i) 40 continue c c read element connectivity c do 60 i = 1, num_elem_blk call exgelc (exoid, ids(i), connect, ierr) write (iout, '(/"after exgelc, error = ", i3)' ) ierr if (eltype(i) .eq. 'nsided' .or. eltype(i) .eq. 'NSIDED') then call exgecpp(exoid, EXEBLK, ids(i), nnpe, ierr) write (iout, '(/"after exgecpp, error = ", i3)' ) ierr write (iout, '("connect array for elem block ", i2)') ids(i) ioff = 0 do j = 1, num_elem_in_block(i) write (iout, 100) j, nnpe(j), (connect(ioff+k),k=1,nnpe(j)) ioff = ioff + nnpe(j) end do end if 60 continue C ... Test coordinate frames call getfrm(exoid) call exclos (exoid, ierr) write (iout, '(/"after exclos, error = ", i3)' ) ierr 100 format(' Element ',I3,', Nodes/Element = ',I3,' -- ',20I3) stop end subroutine getfrm(exoid) implicit none include 'exodusII.inc' real fdum character*1 cdum integer iout integer exoid, ierr, i, j integer numfrm; ! Assumed to be 3 for remaining dimensions integer cfids(3), tags(3) character*32 ctag real coord(27) data iout /6/ call exinq(exoid, EXNCF, numfrm, fdum, cdum, ierr) write (iout, '(/"after exinq, error = ", i3)' ) ierr write (iout, 1 '(/"There are ",i2," coordinate frames")') 2 numfrm call exgfrm(exoid, numfrm, cfids, coord, tags, ierr); write (6,'("after exgfrm, error = ", i4)') ierr ! NOTE: These values may not be sensical; just used for testing. do i=0,2 if (tags(i+1) .eq. EXCFREC) then ctag = 'RECTANGULAR' else if (tags(i+1) .eq. EXCFCYL) then ctag = 'CYLINDRICAL' else if (tags(i+1) .eq. EXCFSPH) then ctag = 'SPHERICAL' end if write (iout, 100) cfids(i+1), ctag, (COORD(9*i+j),j=1,9) end do 100 format(i5, 3x, A, 9F10.2) return end exodusii-6.02.dfsg.1/exodus/forbind/test/testrdd.dmp000066400000000000000000000144361225312213100224370ustar00rootroot00000000000000 after exopen, error = 0 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testrdd.f000066400000000000000000000475131225312213100221060ustar00rootroot00000000000000 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 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwt.f000066400000000000000000000672611225312213100217710ustar00rootroot00000000000000 program testwt c c This is a test program for the Fortran binding of the EXODUS II c database write routines. c include 'exodusII.inc' integer iin, iout integer exoid, num_dim,num_nodes,elem_map(5),num_elem,num_elem_blk integer num_elem_in_block(10), num_nodes_per_elem(10),numattr(10) integer num_node_sets, num_side_sets integer i, j, k, m, connect(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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwt1.f000066400000000000000000000612741225312213100220500ustar00rootroot00000000000000 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) = 5 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwt2.f000066400000000000000000001107341225312213100220450ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwt3.f000066400000000000000000000364011225312213100220440ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwt_nsid.f000066400000000000000000000205201225312213100227710ustar00rootroot00000000000000 program testwt c c This is a test program for the Fortran binding of the EXODUS II c database write routines. c include 'exodusII.inc' integer iin, iout integer exoid, num_dim,num_nodes,elem_map(5),num_elem,num_elem_blk integer num_elem_in_block(10), num_nodes_per_elem(10),numattr(10) integer num_node_sets, num_side_sets integer i, connect(37), nnpe(10) integer ebids(10) integer num_qa_rec, num_info integer cpu_word_size, io_word_size real x(100), y(100), z(100) character*(MXSTLN) coord_names(3) character*(MXSTLN) cname character*(MXSTLN) qa_record(4,2) character*(MXLNLN) inform(3) data iin /5/, iout /6/ call exopts (EXABRT, ierr) write (iout,'("after exopts, error = ", i4)') ierr cpu_word_size = 0 io_word_size = 0 c c create EXODUS II files c exoid = excre ("test-nsided.exo", 1 EXCLOB, cpu_word_size, io_word_size, ierr) write (iout,'("after excre for test-nsided.exo, id: ", i4)') exoid write (iout,'(" cpu word size: ",i4," io word size: ",i4)') 1 cpu_word_size, io_word_size write (iout,'("after excre, error = ", i4)') ierr c c initialize file with parameters c num_dim = 3 num_nodes = 33 num_elem = 7 num_elem_blk = 1 num_node_sets = 0 num_side_sets = 0 call expini (exoid, "This is a test", num_dim, num_nodes, 1 num_elem, num_elem_blk, num_node_sets, 2 num_side_sets, ierr) write (iout, '("after expini, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c write nodal coordinates values and names to database c c Quad #1 x(1) = 0.0 x(2) = 1.0 x(3) = 1.0 x(4) = 0.0 y(1) = 0.0 y(2) = 0.0 y(3) = 1.0 y(4) = 1.0 z(1) = 0.0 z(2) = 0.0 z(3) = 0.0 z(4) = 0.0 c Quad #2 x(5) = 1.0 x(6) = 2.0 x(7) = 2.0 x(8) = 1.0 y(5) = 0.0 y(6) = 0.0 y(7) = 1.0 y(8) = 1.0 z(5) = 0.0 z(6) = 0.0 z(7) = 0.0 z(8) = 0.0 c Hex #1 x(9) = 0.0 x(10) = 10.0 x(11) = 10.0 x(12) = 1.0 x(13) = 1.0 x(14) = 10.0 x(15) = 10.0 x(16) = 1.0 y(9) = 0.0 y(10) = 0.0 y(11) = 0.0 y(12) = 0.0 y(13) = 10.0 y(14) = 10.0 y(15) = 10.0 y(16) = 10.0 z(9) = 0.0 z(10) = 0.0 z(11) =-10.0 z(12) =-10.0 z(13) = 0.0 z(14) = 0.0 z(15) =-10.0 z(16) =-10.0 c Tetra #1 x(17) = 0.0 x(18) = 1.0 x(19) = 10.0 x(20) = 7.0 y(17) = 0.0 y(18) = 0.0 y(19) = 0.0 y(20) = 5.0 z(17) = 0.0 z(18) = 5.0 z(19) = 2.0 z(20) = 3.0 c Wedge #1 x(21) = 3.0 x(22) = 6.0 x(23) = 0.0 x(24) = 3.0 x(25) = 6.0 x(26) = 0.0 y(21) = 0.0 y(22) = 0.0 y(23) = 0.0 y(24) = 2.0 y(25) = 2.0 y(26) = 2.0 z(21) = 6.0 z(22) = 0.0 z(23) = 0.0 z(24) = 6.0 z(25) = 2.0 z(26) = 0.0 C Tetra #2 x(27) = 2.7 x(28) = 6.0 x(29) = 5.7 x(30) = 3.7 y(27) = 1.7 y(28) = 1.7 y(29) = 1.7 y(30) = 0.0 z(27) = 2.7 z(28) = 3.3 z(29) = 1.7 z(30) = 2.3 C 3d Tri x(31) = 0.0 x(32) = 10.0 x(33) = 10.0 y(31) = 0.0 y(32) = 0.0 y(33) = 10.0 z(31) = 0.0 z(32) = 0.0 z(33) = 10.0 call expcor (exoid, x, y, z, ierr) write (iout, '("after expcor, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif coord_names(1) = "xcoor" coord_names(2) = "ycoor" coord_names(3) = "zcoor" call expcon (exoid, coord_names, ierr) write (iout, '("after expcon, error = ", i4)' ) ierr call exupda(exoid,ierr) if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c write element order map c do 10 i = 1, num_elem elem_map(i) = i 10 continue call expmap (exoid, elem_map, ierr) write (iout, '("after expmap, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c write element block parameters c num_elem_in_block(1) = 7 num_nodes_per_elem(1) = 37 ! This is total nodes per block ebids(1) = 10 numattr(1) = 0 cname = "nsided" call expelb (exoid,ebids(1),cname,num_elem_in_block(1), 1 num_nodes_per_elem(1),numattr(1),ierr) write (iout, '("after expelb, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c write element connectivity c connect( 1) = 1 connect( 2) = 2 connect( 3) = 3 connect( 4) = 4 nnpe(1) = 4 connect( 5) = 5 connect( 6) = 6 connect( 7) = 7 connect( 8) = 8 nnpe(2) = 4 connect( 9) = 9 connect(10) = 10 connect(11) = 11 connect(12) = 12 connect(13) = 13 connect(14) = 14 connect(15) = 15 connect(16) = 16 nnpe(3) = 8 connect(17) = 17 connect(18) = 18 connect(19) = 19 connect(20) = 20 nnpe(4) = 4 connect(21) = 21 connect(22) = 22 connect(23) = 23 connect(24) = 24 connect(25) = 25 connect(26) = 26 nnpe(5) = 6 connect(27) = 17 connect(28) = 18 connect(29) = 19 connect(30) = 20 connect(31) = 27 connect(32) = 28 connect(33) = 30 connect(34) = 29 nnpe(6) = 8 connect(35) = 31 connect(36) = 32 connect(37) = 33; nnpe(7) = 3 call expelc (exoid, ebids(1), connect, ierr) write (iout, '("after expelc, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif call expecpp(exoid, EXEBLK, ebids(1), nnpe, ierr) write (iout, '("after expecpp, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c c write QA records c num_qa_rec = 2 qa_record(1,1) = "TESTWT fortran version" qa_record(2,1) = "testwt" qa_record(3,1) = "07/07/93" qa_record(4,1) = "15:41:33" qa_record(1,2) = "FASTQ" qa_record(2,2) = "fastq" qa_record(3,2) = "07/07/93" qa_record(4,2) = "16:41:33" call expqa (exoid, num_qa_rec, qa_record, ierr) write (iout, '("after expqa, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c c write information records c num_info = 3 inform(1) = "This is the first information record." inform(2) = "This is the second information record." inform(3) = "This is the third information record." call expinf (exoid, num_info, inform, ierr) write (iout, '("after expinf, error = ", i4)' ) ierr if (ierr .ne. 0) then call exclos(exoid,ierr) call exit (0) endif c ... Define and write some coordinate frames call putfrm(exoid) c c close the EXODUS files c call exclos (exoid, ierr) write (iout, '("after exclos, error = ", i4)' ) ierr stop end subroutine putfrm(exoid) implicit none include 'exodusII.inc' integer exoid, ierr, i integer numfrm; ! Assumed to be 3 for remaining dimensions integer cfids(3), tags(3) real coord(27) numfrm = 3 cfids(1) = 1 cfids(2) = 11 cfids(3) = 111 tags(1) = EXCFREC tags(2) = EXCFCYL tags(3) = EXCFSPH ! NOTE: These values may not be sensical; just used for testing. do i=0,2 COORD(9*i+1) = i+0.1 COORD(9*i+2) = i+0.2 COORD(9*i+3) = i+0.3 COORD(9*i+4) = i+0.4 COORD(9*i+5) = i+0.5 COORD(9*i+6) = i+0.6 COORD(9*i+7) = i+0.7 COORD(9*i+8) = i+0.8 COORD(9*i+9) = i+0.9 end do call expfrm(exoid, numfrm, cfids, coord, tags, ierr); write (6,'("after expfrm, error = ", i4)') ierr return end exodusii-6.02.dfsg.1/exodus/forbind/test/testwtd.f000066400000000000000000000333011225312213100221210ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/exodus/forbind/test/testwtm.f000066400000000000000000000625631225312213100221460ustar00rootroot00000000000000 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 exodusii-6.02.dfsg.1/nemesis/000077500000000000000000000000001225312213100160065ustar00rootroot00000000000000exodusii-6.02.dfsg.1/nemesis/CMakeLists.txt000066400000000000000000000042101225312213100205430ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) SET(NEMESIS_VERSION_MAJOR "5") SET(NEMESIS_VERSION_MINOR "15") SET(NEMESIS_VERSION_PATCH "0") SET(NEMESIS_VERSION "${NEMESIS_VERSION_MAJOR}.${NEMESIS_VERSION_MINOR}") SET(NEMESIS_VERSION_FULL "${NEMESIS_VERSION}.${NEMESIS_VERSION_PATCH}") SET(NEMESIS_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}") SET(HEADERS "ne_nemesisI.h") find_path( NETCDF_INCLUDE_DIR netcdf.h $ENV{ACCESS}/inc $ENV{NETCDF_DIR}/inc $ENV{NETCDF_DIR}/include $ENV{NETCDF_DIR}/libsrc ) find_library( NETCDF_LIBRARY netcdf $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs ) find_program (NETCDF_NCDUMP ncdump $ENV{ACCESS}/bin $ENV{NETCDF_DIR}/bin $ENV{NETCDF_DIR}/ncdump ) find_library( EXODUS_LIBRARY exodus $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib ) # Hack for HDF5 find_library( HDF5_LIBRARY hdf5 $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) find_library( HDF5HL_LIBRARY hdf5_hl $ENV{ACCESS}/lib/shared $ENV{ACCESS}/lib $ENV{NETCDF_DIR}/lib $ENV{NETCDF_DIR}/libsrc/.libs /usr/local/hdf5/lib ) find_library(Z_LIBRARY z /usr/local/zlib/lib ) find_library(MATH_LIBRARY NAMES m PATHS /usr/lib64 /usr/lib ) INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../exodusii/cbind/include/" "${CMAKE_CURRENT_BINARY_DIR}/../exodusii/cbind/include/" "${NETCDF_INCLUDE_DIR}") SET(SOURCES nemesis_wrapper.c ) ADD_LIBRARY(nemesis ${SOURCES}) TARGET_LINK_LIBRARIES(nemesis ${EXODUS_LIBRARY} ${NETCDF_LIBRARY} ${HDF5HL_LIBRARY} ${HDF5_LIBRARY} ${Z_LIBRARY} ${MATH_LIBRARY}) ADD_EXECUTABLE(ne_test ne_ctest_wrap.c) TARGET_LINK_LIBRARIES( ne_test nemesis ${EXODUS_LIBRARY} ${NETCDF_LIBRARY} ${HDF5HL_LIBRARY} ${HDF5_LIBRARY} ${Z_LIBRARY} ${MATH_LIBRARY}) INSTALL(TARGETS nemesis RUNTIME DESTINATION lib COMPONENT Runtime LIBRARY DESTINATION lib COMPONENT Runtime ARCHIVE DESTINATION lib COMPONENT Development) INSTALL(FILES ${HEADERS} DESTINATION include COMPONENT Development) exodusii-6.02.dfsg.1/nemesis/COPYRIGHT000066400000000000000000000031561225312213100173060ustar00rootroot00000000000000Copyright (c) 1998 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-6.02.dfsg.1/nemesis/Imakefile000066400000000000000000000104741225312213100176250ustar00rootroot00000000000000/* * Copyright (c) 1998 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.15 2008/01/24 19:43:41 gdsjaar Exp $ XCOMM Imakefile for Nemesis libraries /* Building Nemesis libraries for installation * % accmkmf * % make Makefiles * % make all * % make install * * Building Nemesis libraries for debugging * % accmkmf * % make Makefiles * % make DEBUG=-g * */ #define IHaveSubdirs #define PassDebugFlags "DEBUG=$(DEBUG)" \ "CDEBUGFLAGS=$(CDEBUGFLAGS)" \ "CXXDEBUGFLAGS=$(CXXDEBUGFLAGS)" \ "F90DEBUGFLAGS=$(F90DEBUGFLAGS)" \ "F77DEBUGFLAGS=$(F77DEBUGFLAGS)" #define ExtraOptions "CCOPTIONS=$(CCOPTIONS)" #ifndef BuildSharedExodusLibrary #define BuildSharedExodusLibrary NO #endif #define DoNormalLib YES #define DoSharedLib BuildSharedExodusLibrary #define LibName nemesis SOREV = 4 #define SoRev SOREV #ifdef PARALLEL CCOPTIONS = ParallelCCOptions F77OPTIONS = ParallelF77Options LIBDIR = $(PLIBDIR) #endif DEFINES = $(PICFLAGS) SUBDIRS = forbind INCLIST = ne_nemesisI.h ne_nemesisI_int.h SRCS = nemesis_wrapper.c OBJS = ${SRCS:.c=.o} REQUIREDLIBS = -L$(SHLIBDIR) $(EXOIIV2C) $(NETCDF) LIBS = $(NETCDF) $(EXOIIV2C) #include #if Build64BitAccess == YES AllTarget(libnemesis.a libnemIf.a libnemIf32.a) #else AllTarget(libnemesis.a libnemIf.a) #endif InstallIncludeList(makeincludes,$(INCLIST),$(INCDIR)) InstallIncludeList(install,$(INCLIST),$(INCDIR)) /* Directory for nemesis c library */ NormalLibraryTarget(nemesis,$(OBJS)) /* Directory for nemesis fortran wrappers */ NamedTargetSubdirs(libnemIf.a,forbind,"making nemIf ",PassDebugFlags ExtraOptions,libnemIf.a) #if Build64BitAccess == YES NamedTargetSubdirs(libnemIf32.a,forbind,"making nemIf32 ",PassDebugFlags ExtraOptions,libnemIf32.a) #endif InstallLibrary(nemesis,$(LIBDIR)) InstallLibraryAlias(nemesis,nemIc,$(LIBDIR)) InstallLibrary(nemIf,$(LIBDIR)) #if Build64BitAccess == YES InstallLibrary(nemIf32,$(LIBDIR)) #endif #if Parallel InstallParallelLibrary(nemesis,$(PLIBDIR)) InstallParallelLibrary(nemIf,$(PLIBDIR)) #if Build64BitAccess == YES InstallParallelLibrary(nemIf32,$(PLIBDIR)) #endif #endif CTESTLIBS = $(EXOIIV2C) $(NETCDF) -lm FTESTLIBS = $(EXOIIV2FOR) $(EXOIIV2C) $(NETCDF) -lm test: libnemesis.a libnemIf.a ne_ctest_wrap.c forbind/ne_ftest.F $(CC) -c $(CFLAGS) ne_ctest_wrap.c $(CC) $(LDOPTIONS) -o ne_ctest_wrap ne_ctest_wrap.o libnemesis.a $(LIBPATH) $(CTESTLIBS) $(FC) -c $(FFLAGS) $(STD_DEFINES) -I./forbind forbind/ne_ftest.F $(FC) $(LDOPTIONS) -o ne_ftest ne_ftest.o libnemIf.a $(LIBPATH) $(FTESTLIBS) ExtraStuffToClean(ne_ctest_wrap ne_ftest ne_test.exoII ne_test.nemI) $(OBJS): ne_nemesisI.h DependTarget() LibraryObjectRule() exodusii-6.02.dfsg.1/nemesis/Makefile.standalone000066400000000000000000000155121225312213100216010ustar00rootroot00000000000000# Copyright (c) 1998 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) 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) DO32=FALSE RANLIB = true OS_TYPE = irix AR = ar -rcv CC = cc FC = f77 ifeq ($(DO32),TRUE) BITS = 32 CCOPTIONS = -n32 -LANG:std F77OPTIONS = -n32 F77PREC = else BITS = 64 CCOPTIONS = -64 -LANG:std F77OPTIONS = -64 F77PREC = -DBuild64 -r8 -i8 endif 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 SYSLIB = -lm 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 strict_ansi -ptr $(shell pwd)/OSF1/cxx_repository -noimplicit_include -ttimestamp endif #======================================================================== OPTIMIZE_FLAG = -O STD_DEFINES = -DVERBOSE CFLAGS = $(OPTIMIZE_FLAG) $(CCOPTIONS) $(STD_DEFINES) $(EXODUS_INC) $(NETCDF_INC) FFLAGS = $(OPTIMIZE_FLAG) $(F77OPTIONS) $(F77PREC) $(EXODUS_INC) NETCDF_INC = -I$(ACCESS)/inc EXODUS_INC = -I$(ACCESS)/inc NETCDF_LIB_DIR = ${ACCESS}/lib NETCDF_LIB = -L$(NETCDF_LIB_DIR) -lnetcdf EXODUS_LIB_DIR = ${ACCESS}/lib EXODUS_LIB = -L$(EXODUS_LIB_DIR) -lexodus EXODUS_FLIB = -L$(EXODUS_LIB_DIR) -lexoIIv2for EXT_LIBS = $(EXODUS_LIB) $(NETCDF_LIB) EXT_FLIBS = $(EXODUS_FLIB) SUBDIRS = forbind SRCS = nemesis_wrapper.c OBJS = ${SRCS:.c=.o} all:: libnemesis.a libnemIf.a libnemesis.a: $(OBJS) $(AR) $@ $? $(RANLIB) $@ libnemIf.a: (cd forbind && $(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)" libnemIf.a) cp forbind/libnemIf.a . check: test test:: ne_test.c libnemesis.a $(CC) -c $(CFLAGS) ne_test.c $(CC) $(CFLAGS) -o ne_ctest ne_test.o libnemesis.a $(EXT_LIBS) -lm ./ne_ctest test:: forbind/ne_test.f libnemIf.a $(FC) -c $(FFLAGS) -I./forbind forbind/ne_test.f $(FC) $(FFLAGS) -o ne_ftest ne_test.o libnemIf.a libnemesis.a $(EXT_FLIBS) $(EXT_LIBS) -lm ./ne_ftest clean:: rm -f *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* clean:: rm -f ne_ctest ne_ftest ne_test.exoII ne_test.nemI 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 .SUFFIXES: .c .c.o: $(CC) -c -I. $(CFLAGS) $*.c exodusii-6.02.dfsg.1/nemesis/README000066400000000000000000000023441225312213100166710ustar00rootroot00000000000000The Nemesis 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 text. We appreciate feedback from users of this package. Please send comments, suggestions, and bug reports to Greg Sjaardema . Please identify the version of the package. ======================================================================== NEMESIS is an enhancement to the EXODUSII finite element database model used to store and retrieve data for unstructured parallel finite element analyses. NEMESIS adds data structures which facilitate the partitioning of a scalar (standard serial) EXODUSII file onto parallel disk systems found on many parallel computers. Since the NEMESIS application programming interface (API) can be used to append information to an existing EXODUSII database, any existing software that reads EXODUSII files can be used on files which contain NEMESIS information. The NEMESIS information is written and read via C or C++ callable functions which compromise the NEMESIS I API. The exodusII package is available at http://sourceforge.net/projects/exodusii exodusii-6.02.dfsg.1/nemesis/forbind/000077500000000000000000000000001225312213100174315ustar00rootroot00000000000000exodusii-6.02.dfsg.1/nemesis/forbind/Imakefile000066400000000000000000000052171225312213100212470ustar00rootroot00000000000000# Copyright (c) 1998 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. # /* Use local include/XXX.h files instead of installed *.h files */ ALTINC = IncRef-I../ F77CPPFLAGS = F77CppFlags SRCS = ne_jack.c SRCSF = addrwrpn.F OBJS = ${SRCS:.c=.o} ${SRCSF:.F=.o} LibraryTargetSubdirsCopy(libnemIf.a,$(OBJS),../) CleanupCapF(addrwrpn.f) #if Build64BitAccess == YES /* Need to compile ne_jack.c without the -DBuild64 option * real* -> float* (actually void* since it handles both float* and double*) */ ne_jack32.o: ne_jack.c $(CC) -o ne_jack32.o -c $(CFLAGS) -DDEFAULT_REAL_INT ne_jack.c all:: libnemIf32.a libnemIf32.a: ne_jack32.o $(AR) $@ $? $(_NULLCMD_) $(_NULLCMD_) $(CP) $@ ../ #endif /* * 32-bit build: * Compile ne_jack.c and put in libexoIIv2for.a archive. * * 64-bit build: (using 8-byte integer/real) * Compile addrwrap.F (contains main api name 'func'; calls 'func4' name) * Compile ne_jack.c with -DBuild64 (adds 4_ to function names) * -- put above two object files into libnemIf.a * */ DependTarget() exodusii-6.02.dfsg.1/nemesis/forbind/Makefile000066400000000000000000000431761225312213100211040ustar00rootroot00000000000000# Makefile generated by imake - do not edit! # $XConsortium: imake.c /main/90 1996/11/13 14:43:23 lehors $ # ---------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $XConsortium: Imake.tmpl /main/243 1996/11/13 14:42:56 lehors $ # all:: .SUFFIXES: .i # $XConsortium: Imake.cf /main/26 1996/09/28 16:05:09 rws $ # ----------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site.def file for SNL ACCESS System # ---------------------------------------------------------------------- # platform-specific configuration parameters - edit darwin.cf to change # # NOTE: This was copied from the X11 distribution and modified. # It includes several symbols that are not used in ACCESS. # # NOTE: The default flags do not do very aggressive optimization; # You can change this if you want (possibly) faster execution. # # Contact seacas@sandia.gov if you have any questions # # operating system: Darwin (10.8.0) # $XFree86: xc/config/cf/darwinLib.rules,v 1.8 2003/10/09 22:43:18 herrb Exp $ # ---------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site.def file for SNL ACCESS Darwin # --------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $XConsortium: Imake.rules /main/217 1996/12/05 09:48:26 kaleb $ _NULLCMD_ = @ echo -n PATHSEP = / SHELL = /bin/sh SYSTEM = Darwin LSYSTEM = `echo $(SYSTEM) | tr "[A-Z]" "[a-z]"` TOP = ../../.. CURRENT_DIR = libraries/nemesis/forbind DESTDIR = SERIALDEBUGCMD = "dbx" PARDEBUGCMDSNGL = "mpirun -dbx" PARDEBUGCMDMULT = "mpirun -dbx" IMAKE = $(ETCDIR)/imake DEPEND = $(ETCDIR)/makedepend MKDIRHIER = mkdir -p EXPORTLISTGEN = CONFIGSRC = $(TOP)/config IMAKESRC = $(CONFIGSRC)/imake DEPENDSRC = $(CONFIGSRC)/makedepend INCROOT = /Users/gdsjaar/src/SEACAS-SF-INSTALL/inc USRLIBDIR = /Users/gdsjaar/src/SEACAS-SF-INSTALL/lib SHLIBDIR = /Users/gdsjaar/src/SEACAS-SF-INSTALL/lib/shared LINTLIBDIR = $(USRLIBDIR)/lint MANPATH = /Users/gdsjaar/src/SEACAS-SF-INSTALL/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)$(MANSUFFIX) LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX) FILEMANDIR = $(MANSOURCEPATH)$(FILEMANSUFFIX) AR = ar cr ARFLAGS = cru BOOTSTRAPCFLAGS = CC = /opt/local/bin/clang-mp-3.1 FC = /opt/local/bin/gfortran-mp-4.8 F90C = /opt/local/bin/gfortran-mp-4.8 CCPAR = /opt/local/bin/clang-mp-3.1 FCPAR = /opt/local/bin/gfortran-mp-4.8 F90CPAR = /opt/local/bin/gfortran-mp-4.8 AS = as TEST = /bin/test M2C = /bin/true .SUFFIXES: .cxx CXX = /opt/local/bin/clang++-mp-3.1 CXXFILT = c++filt CXXLIB = CXXDEBUGFLAGS = CXXDEPENDINCLUDES = CXXEXTRA_DEFINES = CXXEXTRA_INCLUDES = CXXSTD_DEFINES = -DBuild64 -DADDC_ $(CXXPROJECT_DEFINES) CXXOPTIONS = CXXINCLUDES = $(CXXEXTRA_INCLUDES) $(INCLUDES) $(TOP_INCLUDES) CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) $(DEFINES) CXXFLAGS = $(CXXDEBUGFLAGS) $(DEBUG) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) $(PROJECT_INCLUDES) COMPRESS = compress CPP = /usr/bin/cpp $(STD_CPP_DEFINES) PREPROCESSCMD = /usr/bin/cpp -P $(STD_CPP_DEFINES) INSTALL = install INSTALLFLAGS = -c LD = ld LEX = lex LEXLIB = -ll YACC = yacc CCYACC = yacc LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f MANSUFFIX = n LIBMANSUFFIX = 3 FILEMANSUFFIX = 5 TROFF = psroff NROFF = nroff MSMACROS = -ms MANMACROS = -man TBL = tbl EQN = eqn NEQN = neqn COL = col PICFLAGS = -fPIC SHAREDCODEDEF = SHLIBDEF = SHLIBLDFLAGS = -dynamiclib -headerpad_max_install_names PICFLAGS = -fPIC CXXPICFLAGS = -fPIC INSTPGMFLAGS = INSTETCFLAGS = -m 775 -o gdsjaar -g _developer INSTBINFLAGS = -m 775 -o gdsjaar -g _developer INSTUIDFLAGS = -m InstAccUid -o gdsjaar -g _developer INSTLIBFLAGS = -m 775 -o gdsjaar -g _developer INSTINCFLAGS = -m 775 -o gdsjaar -g _developer INSTMANFLAGS = -m 765 -o gdsjaar -g _developer INSTDATFLAGS = -m 765 -o gdsjaar -g _developer INSTKMEMFLAGS = -m InstAccUid -o gdsjaar -g _developer PROJECTROOT = /Users/gdsjaar/src/SEACAS-SF-INSTALL STD_INCLUDES = STD_CPP_DEFINES = -DBuild64 -DADDC_ $(PROJECT_DEFINES) STD_DEFINES = -DBuild64 -DADDC_ $(PROJECT_DEFINES) EXTRA_LOAD_FLAGS = EXTRA_LDOPTIONS = EXTRA_LIBRARIES = F90EXTRALIBRARIES = TAGS = ctags ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(THREADS_DEFINES) $(DEFINES) DEBUG = -O CDEBUGFLAGS = CCOPTIONS = PARCCOPTIONS = CCEXTRAOPTIONS = CFLAGS = $(CDEBUGFLAGS) $(DEBUG) $(CCOPTIONS) $(CCEXTRAOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) $(PROJECT_INCLUDES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) F77DEBUGFLAGS = F77OPTIONS = -fno-range-check -fcray-pointer -fdefault-real-8 -fdefault-integer-8 F77EXTRAOPTIONS = F77PRECOPTIONS = PARF77OPTIONS = -fno-range-check -fcray-pointer -fdefault-real-8 -fdefault-integer-8 F77STATICFLAGS = F77CPPFLAGS = -D$(SYSTEM) FFLAGS = $(F77DEBUGFLAGS) $(DEBUG) $(F77OPTIONS) $(F77PRECOPTIONS) $(F77EXTRAOPTIONS) $(PROJECT_INCLUDES) F90DEBUGFLAGS = F90OPTIONS = -fno-range-check F90EXTRAOPTIONS = PARF90OPTIONS = -fno-range-check F90STATICFLAGS = F90CPPFLAGS = -D$(SYSTEM) $(STD_CPP_DEFINES) F90PRECOPTIONS = F90EXTRALDOPTIONS = F90FLAGS = $(F90DEBUGFLAGS) $(DEBUG) $(F90OPTIONS) $(F90EXTRAOPTIONS) $(F90PRECOPTIONS) $(PROJECT_INCLUDES) LDPRELIB = -L$(USRLIBDIR) LDPOSTLIB = LDOPTIONS = $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) PARLDOPTIONS = LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) CXXLDOPTIONS = $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) CCLINK = $(CC) NATIVECC = /opt/local/bin/clang-mp-3.1 NATIVEF77 = /opt/local/bin/gfortran-mp-4.8 CROSSCC = /opt/local/bin/clang-mp-3.1 CROSSACCESSROOT = /Net/projects/seacas/janus/current CROSSACCESSSRC = $(CROSSACCESSROOT)/ACCESS CROSSALLDEFINES = -I$(CROSSACCESSROOT)/inc -Dcouar -DADDC_ -Usun CROSSLIBPATH = -L./ -L$(CROSSACCESSROOT)/lib CROSSPLIBPATH = -L./ -L$(CROSSACCESSROOT)/plib CROSSLIBDIR = $(CROSSACCESSROOT)/lib CROSSPLIBDIR = $(CROSSACCESSROOT)/plib CROSSPROJECTINCS = -I./ -I$(CROSSACCESSROOT)/inc CXXLINK = $(CXX) LDSTRIPFLAGS = -x LDCOMBINEFLAGS = -r DEPENDFLAGS = MACROFILE = darwin.cf RM_CMD = $(RM) IMAKE_DEFINES = ITOOLS_DEFINES = -DUseSfmakedepend=0 IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) # ---------------------------------------------------------------------- # ACCESS Darwin Build Parameters and Rules # ACCESS.tmpl TEMPDIR = /tmp # PROJECTNAME : name of project # PROJECTRELEASE : release number of ACCESS distribution # ACCESSSRC : location of ACCESS source code # ACCESSDIR : location of ACCESS installation directories # Set in site.def : "SNLA ACCESS", "1.0", /Users/gdsjaar/src/SEACAS-SF, /Users/gdsjaar/src/SEACAS-SF-INSTALL PROJECTNAME = "SNLA ACCESS" PROJECTRELEASE = "1.0" ACCESSSRC = /Users/gdsjaar/src/SEACAS-SF/ACCESS ACCESSDIR = /Users/gdsjaar/src/SEACAS-SF-INSTALL TFLOPROOT = TflopAccessRoot CPLANTROOT = CplantAccessRoot # Used to specify location of hdf5 libraries for use with netcdf-4 HDF5ROOT = /Users/gdsjaar/src/SEACAS-SF # Source code for the ACCESS Darwin ITOOLSSRC = itools GRAPHICSSRC = graphics SVDISRC = svdi LIBRARIESSRC = libraries NETCDFSRC = netcdf HDF5SRC = hdf5 SERIALMPISRC = serial_mpi APPLICATIONSRC = applications SCRIPTSSRC = scripts TESTPROBS = test PARLIBRARIESSRC = parallellibraries PARNETCDFSRC = parallelnetcdf # Translator Subdirectories ALGEBRASRC = algebra ALGEBRA2SRC = algebra2 CONCATSRC = concat CONEXSRC = conex CONEX2SRC = conex2 CONJOINSRC = conjoin EJOINSRC = ejoin EMERGESRC = emerge EXOCTHSRC = exocth EXOEXOSRC = exoexo EXOPATSRC = exopat EXOSYMSRC = exosym EXOTRCSRC = exotrc EXOTEC2SRC = exotec2 EXOTXTSRC = exotxt EXOTXT2SRC = exotxt2 PATEXOSRC = patexo SEAEXOSRC = seaexo SPHGEN2DSRC = sphgen2d SPHGEN3DSRC = sphgen3d SPHGEN3D2SRC = sphgen3d2 TXTEXOSRC = txtexo TXTEXO2SRC = txtexo2 EXO2VISSRC = exo2vis EXOMATLABSRC = exomatlab EXOMATSRC = exomat EXO2MATSRC = exo2mat EX1EX2V2SRC = ex1ex2v2 EX2EX1V2SRC = ex2ex1v2 EXODIFFSRC = exodiff EPUSRC = epu ABAEXOSRC = abaexo NEM_JOINSRC = nem_join NEM_SLICESRC = nem_slice NEM_SPREADSRC = nem_spread WTO3DSRC = wto3d # Graphics Subdirectories BLOTSRC = blot BLOTII2SRC = blotII2 FASTQSRC = fastq FONTSSRC = fonts GRAPHSRC = graph # Library Subdirectories SUPESSRC = supes SUPESDPSRC = supesdp SUPLIBSRC = suplib LEGACYSRC = legacy MAPVARLIBSRC = mapvarlib EXODUSSRC = exodus PLTSRC = plt VDI_DRIVERSSRC = vdi_drivers IOSSSRC = ioss ZOLTANSRC = zoltan CHACOSRC = chaco NEMESISSRC = nemesis APREPROLIBSRC = aprepro XHELPSRC = xhelp # Library Subdirectories for svdi CGISRC = cgi CDRSRC = cdr POSTSRC = post TESTSRC = test # Pre- and Post-processing Subdirectories APREPROSRC = aprepro FAILPROBSRC = failprob GEN3DSRC = gen3d GEN3D2SRC = gen3d2 GENSHELLSRC = genshell GENSHELL2SRC = genshell2 GENHXSHLSRC = genhxshl GJOINSRC = gjoin GJOIN1SRC = gjoin1 GJOIN2SRC = gjoin2 GREPOSSRC = grepos GREPOS2SRC = grepos2 GROPESRC = grope MAPVARSRC = mapvar MAPVARKDSRC = mapvar-kd NUMBERSSRC = numbers NUMBERS2SRC = numbers2 EX_JOINSRC = ex_join SPIFFSRC = spiff # ACCESS installation directories BINDIR = $(ACCESSDIR)/bin CONFIGDIR = $(ACCESSDIR)/config ETCDIR = $(ACCESSDIR)/etc INCDIR = $(ACCESSDIR)/inc LIBDIR = $(ACCESSDIR)/lib PLIBDIR = $(ACCESSDIR)/plib MATLABDIR = $(ACCESSDIR)/matlab SVDIDIR = $(ACCESSDIR)/svdi SVDITESTDIR = $(ACCESSDIR)/svdi/test BUILDINCDIR = $(ACCESSDIR)/inc BUILDINCTOP = .. BUILDLIBDIR = $(TOP)/usrlib # Override Include directories INCREF = ALTINC = INCLUDESRC = ./ PROJECT_INCLUDES = -I$(INCLUDESRC) $(ALTINC) -I$(INCDIR) # Override Library directories LIBREF = ALTLIBPATH = LIBPATH = -L$(INCLUDESRC) $(ALTLIBPATH) -L$(LIBDIR) PLIBPATH = -L$(INCLUDESRC) $(ALTLIBPATH) -L$(PLIBDIR) # Libraries IOSS = -lIonit -lIoex -lIogn -lIotr -lIohb -lIoss HDF5 = -lhdf5 HDF5_HL = -lhdf5_hl SUPES = -lsupes SUPESDP = -lsupesdp SUPLIB = -lsuplib LEGACY = -llegacy MAPVARLIB = -lmapvarlib PLT = -lplt RPCLIB = EXTRANETCDFLIB = -L$(HDF5ROOT)/lib -lhdf5_hl -lhdf5 -lm -lz LCLIB = -lLegacyContact NETCDF = -lnetcdf $(EXTRANETCDFLIB) EXOIIV2C = -lexodus EXODUS = -lexodus EXOIIV2FOR = -lexoIIv2for EXOIIV2FOR32 = -lexoIIv2for32 ABALIB = CGI = -lcgi CDR = -lcdr NEMESIS = -lnemesis NEMESISC = -lnemesis NEMESISF = -lnemIf NEMESISF32 = -lnemIf32 CHACO = -lchaco ZOLTAN = -lzoltan MATIO = -lmatio -lz # Libraries and include path used for building parallel executables PARFLIBS = -lmpi PARCLIBS = -lmpi PARINCPATH = # Perl command and includes needed for sfmakedepend PERLCMD = /usr/bin/perl DEPENDINC = -I /usr/include -I $(INCDIR) # X11 includes and libraries X11INCLUDES = -I/usr/X11R6/include X11 = -L/usr/X11R6/lib -lX11 # Definitions used for running parallel executables PARALLEL = Parallel NUM_PROCS = 1 PARRUNCMD = mpirun NPCMD = -np HFCMD = -p4pg # Imake flag used in the parallel directories PARALLELIMAKEFLAG = ParallelImakeFlag ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/ACCESS.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES) CONFIGDIR = $(ACCESSDIR)/config USRLIBDIRPATH = /Users/gdsjaar/src/SEACAS-SF-INSTALL/lib LDPRELIBS = LDPOSTLIBS = TOP_INCLUDES = -I$(INCROOT) PROJECT_DEFINES = CXXPROJECT_DEFINES = # ---------------------------------------------------------------------- # start of Imakefile # Copyright (c) 1998 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 0 EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ALTINC = -I../ F77CPPFLAGS = -D$(SYSTEM) SRCS = ne_jack.c SRCSF = addrwrpn.F OBJS = ${SRCS:.c=.o} ${SRCSF:.F=.o} all:: libnemIf.a libnemIf.a: $(OBJS) $(AR) $@ $? $(RANLIB) $@ $(_NULLCMD_) $(CP) libnemIf.a ../ ne_jack32.o: ne_jack.c $(CC) -o ne_jack32.o -c $(CFLAGS) -DDEFAULT_REAL_INT ne_jack.c all:: libnemIf32.a libnemIf32.a: ne_jack32.o $(AR) $@ $? $(_NULLCMD_) $(_NULLCMD_) $(CP) $@ ../ depend:: $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) # ---------------------------------------------------------------------- # common rules for all Makefiles - do not edit .c.i: $(RM) $@ $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ emptyrule:: clean:: $(RM) *.CKP *.ln *.BAK *.bak *.o *.M *.mod core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS man_keywords:: # ---------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" install.linkkit:: @echo "install.linkkit in $(CURRENT_DIR) done" Makefiles:: includes:: depend:: # ---------------------------------------------------------------------- .SUFFIXES: .F .f .f90 .c .C .cpp .c.o: $(CC) -c $(CFLAGS) $*.c .C.o: $(CXX) -c $(CXXFLAGS) $*.C .cpp.o: $(CXX) -c $(CXXFLAGS) $*.cpp .f.o: $(FC) -c $(STATICFLAGS) $(FFLAGS) $*.f .f90.o: $(F90C) -c $(STATICFLAGS) $(F90FLAGS) $*.f90 .f90.mod: $(F90C) -c $(STATICFLAGS) $(F90FLAGS) $*.f90 .mod.o: .F.o: $(FC) -c $(STD_CPP_DEFINES) $(F77CPPFLAGS) $(DEFINES) $(STATICFLAGS) $(FFLAGS) $*.F # ---------------------------------------------------------------------- # dependencies generated by makedepend or sfmakedepend exodusii-6.02.dfsg.1/nemesis/forbind/Makefile.standalone000066400000000000000000000046211225312213100232230ustar00rootroot00000000000000# Copyright (c) 1998 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.. F77EXTRAOPTIONS = -I.. SRCS = ne_jack.c SRCSF = addrwrpn.F OBJS = ${SRCS:.c=.o} ${SRCSF:.F=.o} ne_jack.c: ne_jack.src fortc1.sed fortc2.sed common.m4 $(OS_TYPE).m4 ./fortc -P $(BITS) -L . -O $(OS_TYPE) ne_jack.src > $@ all:: libnemIf.a libnemIf.a: $(OBJS) $(AR) $@ $? $(RANLIB) $@ cp libnemIf.a .. clean:: rm -f *.c addrwrpn.f 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 -I.. $(CFLAGS) $*.c .f.o: $(FC) -c $(FFLAGS) $*.f .F.o: $(FC) -c -I.. $(DEFINES) $(FFLAGS) $*.F # ---------------------------------------------------------------------- # dependencies generated by makedepend or sfmakedepend exodusii-6.02.dfsg.1/nemesis/forbind/addrwrpn.F000066400000000000000000000743351225312213100213750ustar00rootroot00000000000000C Copyright (c) 1998 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 adrdumn end #ifdef Build64 C----------------------------------------------------------------------- C C Get initial information from nemesis file C subroutine negii (idne, nproc, nproc_in_f, ftype, ierr) implicit none integer idne integer nproc integer nproc_in_f character*(*) ftype integer ierr C integer*4 idne4 integer*4 nproc4 integer*4 nproc_in_f4 integer*4 ierr4 C idne4 = idne call negii4 (idne4, nproc4, nproc_in_f4, ftype, ierr4) nproc = nproc4 nproc_in_f = nproc_in_f4 ierr = ierr4 C end C----------------------------------------------------------------------- C C Write initial information from nemesis file C subroutine nepii (idne, nproc, nproc_in_f, ftype, ierr) implicit none integer idne integer nproc integer nproc_in_f character*(*) ftype integer ierr C integer*4 idne4 integer*4 nproc4 integer*4 nproc_in_f4 integer*4 ierr4 C idne4 = idne nproc4 = nproc nproc_in_f4 = nproc_in_f call nepii4 (idne4, nproc4, nproc_in_f4, ftype, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read initial global information C subroutine negig (idne, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr) implicit none integer idne integer nnodes_g integer nelems_g integer nelem_blks_g integer nnode_sets_g integer nside_sets_g integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negig4 (idne4, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write initial global information C subroutine nepig (idne, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr) implicit none integer idne integer nnodes_g integer nelems_g integer nelem_blks_g integer nnode_sets_g integer nside_sets_g integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepig4 (idne4, nnodes_g, nelems_g, nelem_blks_g, $ nnode_sets_g, nside_sets_g, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read load balance parameters C subroutine neglbp (idne, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor, ierr) implicit none integer idne integer nint_nodes integer nbor_nodes integer next_nodes integer nint_elems integer nbor_elems integer nnode_cmaps integer nelem_cmaps integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call neglbp4 (idne4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write load balance parameters C subroutine neplbp (idne, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor, ierr) implicit none integer idne integer nint_nodes integer nbor_nodes integer next_nodes integer nint_elems integer nbor_elems integer nnode_cmaps integer nelem_cmaps integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call neplbp4 (idne4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write concatenated load balance parameters C subroutine neplbpc (idne, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, ierr) implicit none integer idne integer nint_nodes(*) integer nbor_nodes(*) integer next_nodes(*) integer nint_elems(*) integer nbor_elems(*) integer nnode_cmaps(*) integer nelem_cmaps(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call neplbpc4 (idne4, nint_nodes, nbor_nodes, next_nodes, $ nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, $ ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global node set parameters C subroutine negnspg (idne, ns_ids_glob, ns_n_cnt_glob, $ ns_df_cnt_glob, ierr) implicit none integer idne integer ns_ids_glob(*) integer ns_n_cnt_glob(*) integer ns_df_cnt_glob(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnspg4 (idne4, ns_ids_glob, ns_n_cnt_glob, $ ns_df_cnt_glob, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global node set parameters C subroutine nepnspg (idne, global_ids, global_n_cnts, $ global_df_cnts, ierr) integer idne integer global_ids(*) integer global_n_cnts(*) integer global_df_cnts(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnspg4 (idne4, global_ids, global_n_cnts, $ global_df_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global side set parameters C subroutine negsspg (idne, ss_ids_glob, ss_n_cnt_glob, $ ss_df_cnt_glob, ierr) implicit none integer idne integer ss_ids_glob(*) integer ss_n_cnt_glob(*) integer ss_df_cnt_glob(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negsspg4 (idne4, ss_ids_glob, ss_n_cnt_glob, $ ss_df_cnt_glob, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global side set parameters C subroutine nepsspg (idne, global_ids, global_el_cnts, $ global_df_cnts, ierr) implicit none integer idne integer global_ids(*) integer global_el_cnts(*) integer global_df_cnts(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepsspg4 (idne4, global_ids, global_el_cnts, $ global_df_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read global element block information C subroutine negebig (idne, el_blk_ids, el_blk_cnts, ierr) implicit none integer idne integer el_blk_ids(*) integer el_blk_cnts(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negebig4 (idne4, el_blk_ids, el_blk_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write global element block information C subroutine nepebig (idne, el_blk_ids, el_blk_cnts, ierr) implicit none integer idne integer el_blk_ids(*) integer el_blk_cnts(*) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepebig4 (idne4, el_blk_ids, el_blk_cnts, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read side set element list and side set side list C subroutine negnss (idne, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr) implicit none integer idne integer ss_id integer start_side_num integer num_sides integer ss_elem_list(num_sides) integer ss_side_list(num_sides) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnss4 (idne4, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write side set element list and side set side list C subroutine nepnss (idne, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr) implicit none integer idne integer ss_id integer start_side_num integer num_sides integer ss_elem_list(num_sides) integer ss_side_list(num_sides) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnss4 (idne4, ss_id, start_side_num, num_sides, $ ss_elem_list, ss_side_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read side set distribution factor C subroutine negnssd (idne, ss_id, start_num, num_df_to_get, $ ss_df, ierr) implicit none integer idne integer ss_id integer start_num integer num_df_to_get real ss_df(num_df_to_get) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnssd4 (idne4, ss_id, start_num, num_df_to_get, $ ss_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write side set distribution factor C subroutine nepnssd (idne, ss_id, start_num, num_df_to_get, $ ss_df, ierr) implicit none integer idne integer ss_id integer start_num integer num_df_to_get real ss_df(num_df_to_get) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnssd4 (idne4, ss_id, start_num, num_df_to_get, $ ss_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read node set list for a single node set C subroutine negnns (idne, ns_id, start_node_num, num_node, $ ns_node_list, ierr) implicit none integer idne integer ns_id integer start_node_num integer num_node integer ns_node_list(num_node) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnns4 (idne4, ns_id, start_node_num, num_node, $ ns_node_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write node set list for a single node set C subroutine nepnns (idne, ns_id, start_node_num, num_node, $ ns_node_list, ierr) implicit none integer idne integer ns_id integer start_node_num integer num_node integer ns_node_list(num_node) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnns4 (idne4, ns_id, start_node_num, num_node, $ ns_node_list, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read node set distribution factor C subroutine negnnsd (idne, ns_id, start_num, num_df_to_get, $ ns_df, ierr) implicit none integer idne integer ns_id integer start_num integer num_df_to_get real ns_df(num_df_to_get) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnnsd4 (idne4, ns_id, start_num, num_df_to_get, $ ns_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write node set distribution factor C subroutine nepnnsd (idne, ns_id, start_num, num_df_to_get, $ ns_df, ierr) implicit none integer idne integer ns_id integer start_num integer num_df_to_get real ns_df(num_df_to_get) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnnsd4 (idne4, ns_id, start_num, num_df_to_get, $ ns_df, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read coordinates of the nodes C subroutine negcor (idne, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr) implicit none integer idne integer start_node_num integer num_nodes real x_coor(num_nodes) real y_coor(num_nodes) real z_coor(num_nodes) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negcor4 (idne4, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write coordinates of the nodes C subroutine nepcor (idne, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr) implicit none integer idne integer start_node_num integer num_nodes real x_coor(num_nodes) real y_coor(num_nodes) real z_coor(num_nodes) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepcor4 (idne4, start_node_num, num_nodes, x_coor, $ y_coor, z_coor, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read an element blocks connectivity list C subroutine negnec (idne, elem_blk_id, start_elem_num, $ num_elems, connect, ierr) implicit none integer idne integer elem_blk_id integer start_elem_num integer num_elems integer connect(num_elems) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnec4 (idne4, elem_blk_id, start_elem_num, $ num_elems, connect, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write an element blocks connectivity list C subroutine nepnec (idne, elem_blk_id, start_elem_num, $ num_elems, connect, ierr) implicit none integer idne integer elem_blk_id integer start_elem_num integer num_elems integer connect(num_elems) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnec4 (idne4, elem_blk_id, start_elem_num, $ num_elems, connect, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read an element blocks attributes C subroutine negneat (idne, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr) implicit none integer idne integer elem_blk_id integer start_elem_num integer num_elems real attrib(num_elems) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negneat4 (idne4, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write an element blocks attributes C subroutine nepneat (idne, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr) implicit none integer idne integer elem_blk_id integer start_elem_num integer num_elems real attrib(num_elems) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepneat4 (idne4, elem_blk_id, start_elem_num, $ num_elems, attrib, ierr4) ierr = ierr4 C end C C----------------------------------------------------------------------- C Read the element type for a specific element block C subroutine negelt (idne, elem_blk_id, elem_type, ierr) implicit none integer idne integer elem_blk_id character*(*) elem_type integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negelt4 (idne4, elem_blk_id, elem_type, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read a variable for an element block C subroutine negnev (idne, time_step, elem_var_index, $ elem_blk_id, num_elem_this_blk, start_elem_num, $ num_elem, elem_var_vals, ierr) implicit none integer idne integer time_step integer elem_var_index integer elem_blk_id integer num_elem_this_blk integer start_elem_num integer num_elem real elem_var_vals(num_elem) integer ierr C integer*4 idne4 integer*4 time_step4 integer*4 elem_var_index4 integer*4 ierr4 C idne4 = idne time_step4 = time_step elem_var_index4 = elem_var_index call negnev4 (idne4, time_step4, elem_var_index4, $ elem_blk_id, num_elem_this_blk, start_elem_num, $ num_elem, elem_var_vals, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write a variable slab for an element block C subroutine nepevs (idne, time_step, elem_var_index, $ elem_blk_id, start_pos, num_vals, elem_var_vals, $ ierr) implicit none integer idne integer time_step integer elem_var_index integer elem_blk_id integer start_pos integer num_vals real elem_var_vals(num_vals) integer ierr C integer*4 idne4 integer*4 time_step4 integer*4 elem_var_index4 integer*4 ierr4 C idne4 = idne time_step4 = time_step elem_var_index4 = elem_var_index call nepevs4 (idne4, time_step4, elem_var_index4, $ elem_blk_id, start_pos, num_vals, elem_var_vals, $ ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the values of a single nodal variable for a single time step C subroutine negnnv (idne, time_step, nodal_var_index, $ start_node_num, num_nodes, nodal_vars, ierr) implicit none integer idne integer time_step integer nodal_var_index integer start_node_num integer num_nodes real nodal_vars(num_nodes) integer ierr C integer*4 idne4 integer*4 time_step4 integer*4 nodal_var_index4 integer*4 ierr4 C idne4 = idne time_step4 = time_step nodal_var_index4 = nodal_var_index call negnnv4 (idne4, time_step4, nodal_var_index4, $ start_node_num, num_nodes, nodal_vars, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write nodal variable slab C subroutine nepnvs (idne, time_step, nodal_var_index, $ start_pos, num_vals, nodal_var_vals, ierr) implicit none integer idne integer time_step integer nodal_var_index integer start_pos integer num_vals real nodal_var_vals(num_vals) integer ierr C integer*4 idne4 integer*4 time_step4 integer*4 nodal_var_index4 integer*4 ierr4 C idne4 = idne time_step4 = time_step nodal_var_index4 = nodal_var_index call nepnvs4 (idne4, time_step4, nodal_var_index4, $ start_pos, num_vals, nodal_var_vals, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the element numbering map C subroutine negnenm (idne, starte, num_ent, elem_map, ierr) implicit none integer idne integer starte integer num_ent integer elem_map(num_ent) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnenm4 (idne4, starte, num_ent, elem_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the element numbering map C subroutine nepnenm (idne, starte, num_ent, elem_map, ierr) implicit none integer idne integer starte integer num_ent integer elem_map(num_ent) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnenm4 (idne4, starte, num_ent, elem_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the node numbering map C subroutine negnnnm (idne, startn, num_ent, node_map, ierr) implicit none integer idne integer startn integer num_ent integer node_map(num_ent) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call negnnnm4 (idne4, startn, num_ent, node_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the node numbering map C subroutine nepnnnm (idne, startn, num_ent, node_map, ierr) implicit none integer idne integer startn integer num_ent integer node_map(num_ent) integer ierr C integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepnnnm4 (idne4, startn, num_ent, node_map, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the node map for a processor C subroutine negnm (idne, node_mapi, node_mapb, node_mape, $ processor, ierr) implicit none integer idne integer node_mapi(*) integer node_mapb(*) integer node_mape(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call negnm4 (idne4, node_mapi, node_mapb, node_mape, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write a node map for a processor C subroutine nepnm (idne, node_mapi, node_mapb, node_mape, $ processor, ierr) implicit none integer idne integer node_mapi(*) integer node_mapb(*) integer node_mape(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call nepnm4 (idne4, node_mapi, node_mapb, node_mape, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the element map for a processor C subroutine negem (idne, elem_mapi, elem_mapb, processor, ierr) implicit none integer idne integer elem_mapi(*) integer elem_mapb(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call negem4 (idne4, elem_mapi, elem_mapb, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the element map for a processor C subroutine nepem (idne, elem_mapi, elem_mapb, processor, ierr) implicit none integer idne integer elem_mapi(*) integer elem_mapb(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call nepem4 (idne4, elem_mapi, elem_mapb, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the communications map parameters for a single processor C subroutine negcmp (idne, ncmap_ids, ncmap_node_cnts, $ ecmap_ids, ecmap_elem_cnts, processor, ierr) implicit none integer idne integer ncmap_ids(*) integer ncmap_node_cnts(*) integer ecmap_ids(*) integer ecmap_elem_cnts(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call negcmp4 (idne4, ncmap_ids, ncmap_node_cnts, $ ecmap_ids, ecmap_elem_cnts, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the communications map parameters for a single processor C subroutine nepcmp (idne, nmap_ids, nmap_node_cnts, emap_ids, $ emap_elem_cnts, processor, ierr) implicit none integer idne integer nmap_ids(*) integer nmap_node_cnts(*) integer emap_ids(*) integer emap_elem_cnts(*) integer processor integer ierr integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call nepcmp4 (idne4, nmap_ids, nmap_node_cnts, emap_ids, $ emap_elem_cnts, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the communications map parameters for all processors C subroutine nepcmpc (idne, nmap_ids, nmap_node_cnts, $ nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs, ierr) implicit none integer idne integer nmap_ids(*) integer nmap_node_cnts(*) integer nproc_ptrs(*) integer emap_ids(*) integer emap_elem_cnts(*) integer eproc_ptrs(*) integer ierr integer*4 idne4 integer*4 ierr4 C idne4 = idne call nepcmpc4 (idne4, nmap_ids, nmap_node_cnts, $ nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs, ierr4) ierr = ierr4 end C----------------------------------------------------------------------- C C Read the nodal communications map for a single processor C subroutine negncm (idne, map_id, node_ids, proc_ids, $ processor, ierr) implicit none integer idne integer map_id integer node_ids(*) integer proc_ids(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call negncm4 (idne4, map_id, node_ids, proc_ids, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the nodal communications map for a single processor C subroutine nepncm (idne, map_id, node_ids, proc_ids, $ processor, ierr) implicit none integer idne integer map_id integer node_ids(*) integer proc_ids(*) integer processor integer ierr C integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call nepncm4 (idne4, map_id, node_ids, proc_ids, $ processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Read the elemental communications map for a single processor C subroutine negecm (idne, map_id, elem_ids, side_ids, $ proc_ids, processor, ierr) implicit none integer idne integer map_id integer elem_ids(*) integer side_ids(*) integer proc_ids(*) integer processor integer ierr integer*4 idne4 integer*4 processor4 integer*4 ierr4 C idne4 = idne processor4 = processor call negecm4 (idne4, map_id, elem_ids, side_ids, $ proc_ids, processor4, ierr4) ierr = ierr4 C end C----------------------------------------------------------------------- C C Write the elemental communications map for a single processor C subroutine nepecm (idne, map_id, elem_ids, side_ids, $ proc_ids, processor, ierr) implicit none integer idne integer map_id integer elem_ids(*) integer side_ids(*) integer proc_ids(*) integer processor integer ierr integer*4 idne4 integer*4 processor4 integer*4 ierr4 idne4 = idne processor4 = processor call nepecm4 (idne4, map_id, elem_ids, side_ids, $ proc_ids, processor4, ierr4) ierr = ierr4 end C----------------------------------------------------------------------- #endif exodusii-6.02.dfsg.1/nemesis/forbind/ne_ftest.F000066400000000000000000000600071225312213100213520ustar00rootroot00000000000000C Copyright (c) 1998 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 C================================================================= C C This is just a simple test program to test the fortran interface C for the NEMESIS I library. C C This file was created by translating ne_test.c into fortran. C C================================================================= C================================================================= PROGRAM NETEST C================================================================= INCLUDE 'exodusII.inc' INCLUDE 'ne_test.inc' C local variables INTEGER NEID, IO_WS, CPU_WS, T_PASS, T_FAIL, DBG_FLAG, IERR CHARACTER FNAME*256, YO*6 REAL VERSION YO = 'NETEST' IO_WS = 0 CPU_WS = 0 T_PASS = 0 T_FAIL = 0 DBG_FLAG = 0 C now let's get going... C I don't care about input arguements, so the file name will be ne_test.nemI FNAME = 'ne_test.nemI' C and set the debug flag to 0 DBG_FLAG = 0 PRINT*, '******************Output Tests*****************' C create the exodus II file PRINT*, 'creating ExodusII file...' NEID = EXCRE(FNAME, EXCLOB, CPU_WS, IO_WS, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to create test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of initial information PRINT*, 'testing init info output...' CALL NEPII(NEID, NPROC, NPROCF, 'S', IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of initial global information PRINT*, 'testing global init info output...' CALL NEPIG(NEID, NNG, NEG, NEBG, NNSG, NSSG, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global element block IDs PRINT*, 'testing global element block ID output...' CALL NETPEBI(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global node-set info PRINT*, 'testing global node-set params output...' CALL NETPNSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the global side-set info PRINT*, 'testing global side-set params output...' CALL NETPSSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the concatenated load-balance parameters PRINT*, 'testing concatenated load balance info output...' CALL NETPLBPC(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the node map PRINT*, 'testing node map output...' CALL NETPNM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the element map PRINT*, 'testing element map output...' CALL NETPEM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test the output of the concatenated communication map params PRINT*, 'testing concatenated communication map params output...' CALL NETPCMPC(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test nodal communication map output PRINT*, 'testing nodal communication map output...' CALL NETPNCM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test elemental communication map output PRINT*, 'testing elemental communication map output...' CALL NETPECM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Close the ExodusII/Nemesis test file PRINT*, 'closing ExodusII file...' CALL EXCLOS(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to close test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C================================================================= C INPUT TEST SECTION C================================================================= PRINT*, '******************Input Tests******************' C Re-open the ExodusII/NemesisI file PRINT*, 'reopening ExodusII file...' NEID = EXOPEN(FNAME, EXREAD, CPU_WS, IO_WS, VERSION, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to open test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of of the initial information PRINT*, 'testing init info input...' CALL NETGII(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of initial global information PRINT*, 'testing global init info input...' CALL NETGIG(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global element block IDs PRINT*, 'testing global element block IDs input...' CALL NETGEBI(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global node-set params PRINT*, 'testing global node-set params input...' CALL NETGNSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of global side-set params PRINT*, 'testing global side-set params input...' CALL NETGSSP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of load-balance params PRINT*, 'testing load-balance params input...' CALL NETGLBP(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of the node map PRINT*, 'testing node map input...' CALL NETGNM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of the element map PRINT*, 'testing element map input...' CALL NETGEM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of nodal communication maps PRINT*, 'testing nodal communication map input...' CALL NETGNCM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Test read of elemental communication maps PRINT*, 'testing elemental communication map input...' CALL NETGECM(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 IF (DBG_FLAG.EQ.1) THEN GOTO 100 END IF ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF C Close the ExodusII/Nemesis test file PRINT*, 'closing ExodusII file...' CALL EXCLOS(NEID, IERR) IF (IERR.NE.0) THEN PRINT*, '...FAILED' T_FAIL = T_FAIL + 1 PRINT*, YO, ': ERROR, unable to close test file', FNAME, '!' GOTO 100 ELSE PRINT*, '...successful' T_PASS = T_PASS + 1 END IF PRINT*, 'Tests Passed: ', T_PASS PRINT*, 'Tests Failed: ', T_FAIL 100 CONTINUE END C================================================================= SUBROUTINE NETPEBI(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, EBLK_IDS(NEBG) INTEGER EBLK_CNTS(NEBG) DO 110 I=1,NEBG EBLK_IDS(I) = I EBLK_CNTS(I) = 10 110 CONTINUE CALL NEPEBIG(NEID, EBLK_IDS, EBLK_CNTS, IERR) END C================================================================= SUBROUTINE NETPNSP(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, GLBL_IDS(NNSG), GLBL_NC(NNSG), GLBL_DFC(NNSG) DO 120 I = 1,NNSG GLBL_IDS(I) = 2 * I GLBL_NC(I) = 3 * I GLBL_DFC(I) = 1 120 CONTINUE CALL NEPNSPG(NEID, GLBL_IDS, GLBL_NC, GLBL_DFC, IERR) END C================================================================= SUBROUTINE NETPSSP(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, GLBL_IDS(NSSG), GLBL_ELC(NSSG), GLBL_DFC(NSSG) DO 130 I = 1,NSSG GLBL_IDS(I) = 3 * I GLBL_ELC(I) = 2 * I GLBL_DFC(I) = 1 130 CONTINUE CALL NEPSSPG(NEID, GLBL_IDS, GLBL_ELC, GLBL_DFC, IERR) END C================================================================= SUBROUTINE NETPLBPC(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, NUM_IN(NPROCF), NUM_BN(NPROCF), NUM_EN(NPROCF), 1 NUM_IE(NPROCF), NUM_BE(NPROCF), NUM_NCM(NPROCF), NUM_ECM(NPROCF) DO 140 IPROC = 1,NPROCF NUM_IN(IPROC) = NINTN NUM_BN(IPROC) = NBORN NUM_EN(IPROC) = NEXTN NUM_IE(IPROC) = NINTE NUM_BE(IPROC) = NBORE NUM_NCM(IPROC) = NNCMAP NUM_ECM(IPROC) = NECMAP 140 CONTINUE CALL NEPLBPC(NEID, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, 1 NUM_NCM, NUM_ECM, IERR) END C================================================================= SUBROUTINE NETPNM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, J, NMAPI(NINTN), NMAPB(NBORN), NMAPE(NEXTN) I = 0 DO 200 IPROC = 0,(NPROCF-1) DO 150 J = 1,NINTN NMAPI(J) = I I = I + 1 150 CONTINUE DO 160 J = 1,NBORN NMAPB(J) = I I = I + 1 160 CONTINUE DO 170 J = 1,NEXTN NMAPE(J) = I I = I + 1 170 CONTINUE I = 0 CALL NEPNM(NEID, NMAPI, NMAPB, NMAPE, IPROC, IERR) IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETPEM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, J, EMAPI(NINTE), EMAPB(NBORE) I = 0 DO 200 IPROC = 0,(NPROCF-1) DO 150 J = 1,NINTE EMAPI(J) = I I = I + 1 150 CONTINUE DO 160 J = 1,NBORE EMAPB(J) = I I = I + 1 160 CONTINUE I = 0 CALL NEPEM(NEID, EMAPI, EMAPB, IPROC, IERR) IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETPCMPC(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, NCNTR, ECNTR, NMAPIDS(NNCXNPF), 1 NMAPCNT(NNCXNPF), NMAPPROC(NPROCF+1), EMAPIDS(NECXNPF), 1 EMAPCNT(NECXNPF), EMAPPROC(NPROCF+1) NMAPPROC(1) = 0 EMAPPROC(1) = 0 NCNTR = 1 ECNTR = 1 DO 200 IPROC = 1,NPROCF DO 150 I = 1,NNCMAP NMAPIDS(NCNTR) = I NMAPCNT(NCNTR) = NCNTCM NCNTR = NCNTR + 1 150 CONTINUE DO 160 I = 1,NECMAP EMAPIDS(ECNTR) = 2*I EMAPCNT(ECNTR) = ECNTCM ECNTR = ECNTR + 1 160 CONTINUE NMAPPROC(IPROC+1) = NMAPPROC(IPROC) + NNCMAP EMAPPROC(IPROC+1) = EMAPPROC(IPROC) + NECMAP 200 CONTINUE CALL NEPCMPC(NEID, NMAPIDS, NMAPCNT, NMAPPROC, EMAPIDS, EMAPCNT, 1 EMAPPROC, IERR) END C================================================================= SUBROUTINE NETPNCM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, NMAPIDS(NNCMAP), NIDS(NCNTCM), PIDS(NCNTCM) DO 200 IPROC = 0,(NPROCF-1) DO 150 I = 1,NNCMAP NMAPIDS(I) = I 150 CONTINUE DO 160 I = 1,NCNTCM NIDS(I) = 2*I PIDS(I) = 3*I 160 CONTINUE DO 170 I=1,NNCMAP CALL NEPNCM(NEID, NMAPIDS(I), NIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETPECM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, EMAPIDS(NECMAP), EIDS(ECNTCM), PIDS(ECNTCM), 1 SIDS(ECNTCM) DO 200 IPROC = 0,(NPROCF-1) DO 150 I = 1,NECMAP EMAPIDS(I) = 2*I 150 CONTINUE DO 160 I = 1,ECNTCM EIDS(I) = 2*I SIDS(I) = 3*I PIDS(I) = 4*I 160 CONTINUE DO 170 I=1,NECMAP CALL NEPECM(NEID, EMAPIDS(I), EIDS, SIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGII(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER NP, NPF CHARACTER FTYPE*2 CALL NEGII(NEID, NP, NPF, FTYPE, IERR) IF (IERR.NE.0) GOTO 210 IF (NP.NE.NPROC) IERR = -1 IF (NPF.NE.NPROCF) IERR = -1 IF (NP.NE.NPROC) IERR = -1 210 CONTINUE END C================================================================= SUBROUTINE NETGIG(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER NUMNG, NUMEG, NUMEBG, NUMNSG, NUMSSG CALL NEGIG(NEID, NUMNG, NUMEG, NUMEBG, NUMNSG, NUMSSG, IERR) IF (IERR.NE.0) GOTO 210 IF (NUMNG.NE.NNG) IERR = -1 IF (NUMEG.NE.NEG) IERR = -1 IF (NUMEBG.NE.NEBG) IERR = -1 IF (NUMNSG.NE.NNSG) IERR = -1 IF (NUMSSG.NE.NSSG) IERR = -1 210 CONTINUE END C================================================================= SUBROUTINE NETGEBI(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, EBLK_IDS(NEBG) INTEGER EBLK_CNTS(NEBG) CALL NEGEBIG(NEID, EBLK_IDS, EBLK_CNTS, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NEBG IF (EBLK_IDS(I).NE.I) IERR = -1 IF (EBLK_CNTS(I) .NE. 10) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGNSP(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, GLBL_IDS(NNSG), GLBL_NC(NNSG), GLBL_DFC(NNSG) CALL NEGNSPG(NEID, GLBL_IDS, GLBL_NC, GLBL_DFC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NNSG IF (GLBL_IDS(I).NE.(2*I)) IERR = -1 IF (GLBL_NC(I).NE.(3*I)) IERR = -1 IF (GLBL_DFC(I).NE.1) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGSSP(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER I, GLBL_IDS(NSSG), GLBL_EC(NSSG), GLBL_DFC(NSSG) CALL NEGSSPG(NEID, GLBL_IDS, GLBL_EC, GLBL_DFC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 I=1,NNSG IF (GLBL_IDS(I).NE.(3*I)) IERR = -1 IF (GLBL_EC(I).NE.(2*I)) IERR = -1 IF (GLBL_DFC(I).NE.1) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGLBP(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, * NUM_NCM, NUM_ECM DO 150 IPROC = 0,(NPROCF-1) CALL NEGLBP(NEID, NUM_IN, NUM_BN, NUM_EN, NUM_IE, NUM_BE, 1 NUM_NCM, NUM_ECM, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF(NUM_IN.NE.NINTN) IERR = -1 IF(NUM_BN.NE.NBORN) IERR = -1 IF(NUM_EN.NE.NEXTN) IERR = -1 IF(NUM_IE.NE.NINTE) IERR = -1 IF(NUM_BE.NE.NBORE) IERR = -1 IF(NUM_NCM.NE.NNCMAP) IERR = -1 IF(NUM_ECM.NE.NECMAP) IERR = -1 150 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGNM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, J, NMAPI(NINTN), NMAPB(NBORN), NMAPE(NEXTN) I = 0 DO 200 IPROC = 0,(NPROCF-1) CALL NEGNM(NEID, NMAPI, NMAPB, NMAPE, IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 J = 1,NINTN IF (NMAPI(J).NE.I) ERR = -1 I = I + 1 150 CONTINUE DO 160 J = 1,NBORN IF (NMAPB(J).NE.I) ERR = -1 I = I + 1 160 CONTINUE DO 170 J = 1,NEXTN IF (NMAPE(J).NE.I) ERR = -1 I = I + 1 170 CONTINUE I = 0 IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGEM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, J, EMAPI(NINTE), EMAPB(NBORE) I = 0 DO 200 IPROC = 0,(NPROCF-1) CALL NEGEM(NEID, EMAPI, EMAPB, IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 150 J = 1,NINTE IF (EMAPI(J).NE.I) ERR = -1 I = I + 1 150 CONTINUE DO 160 J = 1,NBORE IF (EMAPB(J).NE.I) ERR = -1 I = I + 1 160 CONTINUE I = 0 IF (IERR.NE.0) GOTO 210 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGNCM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, J, NMAPIDS(NNCMAP), NMAPCNT(NNCMAP), 1 NIDS(NCNTCM), PIDS(NCNTCM), EMAPIDS(NECMAP), EMAPCNT(NECMAP) DO 200 IPROC = 0,(NPROCF-1) CALL NEGCMP(NEID, NMAPIDS, NMAPCNT, EMAPIDS, EMAPCNT, 1 IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 170 I = 1,NNCMAP CALL NEGNCM(NEID, NMAPIDS(I), NIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF (NMAPIDS(I).NE.I) IERR = -1 DO 160 J = 1,NCNTCM IF (NIDS(J).NE.2*J) IERR = -1 IF (PIDS(J).NE.3*J) IERR = -1 160 CONTINUE IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END C================================================================= SUBROUTINE NETGECM(NEID, IERR) C================================================================= INCLUDE 'ne_test.inc' INTEGER IPROC, I, EMAPIDS(NECMAP), EMAPCNT(NECMAP), EIDS(ECNTCM), 1 PIDS(ECNTCM), SIDS(ECNTCM), NMAPIDS(NNCMAP), NMAPCNT(NNCMAP) DO 200 IPROC = 0,(NPROCF-1) CALL NEGCMP(NEID, NMAPIDS, NMAPCNT, EMAPIDS, EMAPCNT, 1 IPROC, IERR) IF (IERR.NE.0) GOTO 210 DO 170 I = 1,NECMAP CALL NEGECM(NEID, EMAPIDS(I), EIDS, SIDS, PIDS, IPROC, IERR) IF (IERR.NE.0) GOTO 210 IF (EMAPIDS(I).NE.(2*I)) IERR = -1 DO 160 J = 1,ECNTCM IF (EIDS(J).NE.2*J) IERR = -1 IF (SIDS(J).NE.3*J) IERR = -1 IF (PIDS(J).NE.4*J) IERR = -1 160 CONTINUE IF (IERR.NE.0) GOTO 210 170 CONTINUE 200 CONTINUE 210 CONTINUE END exodusii-6.02.dfsg.1/nemesis/forbind/ne_jack.c000066400000000000000000001067031225312213100211760ustar00rootroot00000000000000/* * Copyright (c) 1998 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. * */ /*==================================================================== * ------------------------ * | CVS File Information | * ------------------------ * * $RCSfile: ne_jack.src,v $ * * $Author: gdsjaar $ * * $Date: 2007/10/31 21:39:17 $ * * $Revision: 1.14 $ * *====================================================================*/ /* * OVERVIEW * * This file contains jacket routines written in C for interfacing Fortran * NemesisI function calls to the actual C binding for NemsisI. This code * is written explicitly for DARWIN. 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 #include #include #include #include "netcdf.h" #include "exodusII.h" #include "exodusII_int.h" /* * The Build64 is for the "normal" SEACAS build which uses compiler * options to change reals and integers into 8-byte quantities. The * routines in addrwrap.F are used to down-convert the 8-byte integers * into 4-byte integers which then call through to the routines in * this file which have a '4' or '4_' appended to the routine name. * These routines then call through to the C API routines. * * If DEFAULT_REAL_INT is defined, then the build is to build a * fortran library interface that takes 4-byte ints and either 4-byte * or 8-byte floating point (real/double) variables. In this case, the * addrwrap routines are not built and a fortran client will call the * routines in this file directly. * */ #if defined(Build64) && !defined(DEFAULT_REAL_INT) /* 64-bit */ typedef double real; typedef ex_entity_id entity_id; #ifdef ADDC_ #define F2C(name) name##4_ #else #define F2C(name) name##4 #endif #else /* 32-bit */ typedef float real; typedef int entity_id; #ifdef ADDC_ #define F2C(name) name##_ #else #define F2C(name) name #endif #endif extern int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */ extern int exerrval; /* global int that contains a Exodus-specific error code */ /* blank fill C string to make FORTRAN string */ static void ex_fcdcpy (char *fstring, size_t fslen, char *sstring) /* output string to be blank-filled */ /* length of output string */ /* input string, null-terminated */ { size_t i, len = strlen(sstring); for (i = 0; i < len; i++) *(fstring + i) = *(sstring + i); for (i = len; i < fslen; i++) *(fstring + i) = ' '; } /* copy function used to copy strings and strip trailing blanks */ static void ex_fstrncpy (char *target, char *source, size_t maxlen) /* space to be copied into */ /* string to be copied */ /* maximum length of *source */ { while (maxlen-- && *source != '\0') *target++ = *source++; while (*(--target) == ' '); /* strip blanks */ *(++target) = '\0'; /* insert new EOS marker */ } /* Above are utility functions used below */ /* ======================================================================== */ /* Below are the nemesis API functions */ /* * Adding a new function: * + Protect the name with the f2c (uppercase) macro which will add/not add '4' and or '_' * depending on the compilation mode. * * + float/double arguments are declared as 'real' which will be replaced with float or double. * * + If there are any character arguments 'X', then add an int* argument 'Xlen' at end of argument list * This will contain the length of the passed in character argument. * * + Look at existing functions for guidance... */ /* * Get initial information from nemesis file */ void F2C(negii)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("negii",errmsg,EX_MSG); #endif slen = ftypelen; } file_type = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to get initial information from file id %d", *idne); ex_err("negii",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (ftype, slen, file_type); free(file_type); } /* * Write initial information from nemesis file */ void F2C(nepii)(int *idne, int *nproc, int *nproc_in_f, char *ftype, int *ierr, size_t ftypelen) { char errmsg[MAX_ERR_LENGTH]; size_t slen = 1; char *file_type; /* WARNING: ftypelen SHOULD be 1, but may not be depending on how the Fortran programmer passed it. It is best at this time to hard code it per NEPII spec. */ if (ftypelen != 1) { slen = ftypelen; #if defined(EXODUS_STRING_LENGTH_WARNING) sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", ftypelen, *idne); ex_err("nepii",errmsg,EX_MSG); #endif } file_type = (char *) malloc((slen+1)*sizeof(char)); ex_fstrncpy (file_type, ftype, slen); if ((*ierr = ex_put_init_info(*idne, *nproc, *nproc_in_f, file_type)) != 0) { sprintf(errmsg, "Error: failed to put initial information in file id %d", *idne); ex_err("nepii",errmsg,EX_MSG); } free(file_type); } /* * Read initial global information */ void F2C(negig)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if ((*ierr = ex_get_init_global(*idne, nnodes_g, nelems_g, nelem_blks_g, nnode_sets_g, nside_sets_g)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read initial global information from file id %d", *idne); ex_err("negig",errmsg,EX_MSG); } } /* * Write initial global information */ void F2C(nepig)(int *idne, void_int *nnodes_g, void_int *nelems_g, void_int *nelem_blks_g, void_int *nnode_sets_g, void_int *nside_sets_g, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nnodes_g = (int64_t*)nnodes_g; int64_t *n_nelems_g = (int64_t*)nelems_g; int64_t *n_nelem_blks_g = (int64_t*)nelem_blks_g; int64_t *n_nnode_sets_g = (int64_t*)nnode_sets_g; int64_t *n_nside_sets_g = (int64_t*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } else { int *n_nnodes_g = (int*)nnodes_g; int *n_nelems_g = (int*)nelems_g; int *n_nelem_blks_g = (int*)nelem_blks_g; int *n_nnode_sets_g = (int*)nnode_sets_g; int *n_nside_sets_g = (int*)nside_sets_g; *ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, *n_nnode_sets_g, *n_nside_sets_g); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store initial global information in file id %d", *idne); ex_err("nepig",errmsg,EX_MSG); } } /* * Read load balance parameters */ void F2C(neglbp)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if ((*ierr = ex_get_loadbal_param(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read load balance parameters from file id %d", *idne); ex_err("neglbp",errmsg,EX_MSG); } } /* * Write load balance parameters */ void F2C(neplbp)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *processor, int *ierr) { if (ex_int64_status(*idne) & EX_BULK_INT64_API) { int64_t *n_nint_nodes = (int64_t*)nint_nodes; int64_t *n_nbor_nodes = (int64_t*)nbor_nodes; int64_t *n_next_nodes = (int64_t*)next_nodes; int64_t *n_nint_elems = (int64_t*)nint_elems; int64_t *n_nbor_elems = (int64_t*)nbor_elems; int64_t *n_nnode_cmaps = (int64_t*)nnode_cmaps; int64_t *n_nelem_cmaps = (int64_t*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } else { int *n_nint_nodes = (int*)nint_nodes; int *n_nbor_nodes = (int*)nbor_nodes; int *n_next_nodes = (int*)next_nodes; int *n_nint_elems = (int*)nint_elems; int *n_nbor_elems = (int*)nbor_elems; int *n_nnode_cmaps = (int*)nnode_cmaps; int *n_nelem_cmaps = (int*)nelem_cmaps; *ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, *n_next_nodes, *n_nint_elems, *n_nbor_elems, *n_nnode_cmaps, *n_nelem_cmaps, *processor); } if (*ierr != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbp",errmsg,EX_MSG); } } /* * Write concatenated load balance parameters */ void F2C(neplbpc)(int *idne, void_int *nint_nodes, void_int *nbor_nodes, void_int *next_nodes, void_int *nint_elems, void_int *nbor_elems, void_int *nnode_cmaps, void_int *nelem_cmaps, int *ierr) { if ((*ierr = ex_put_loadbal_param_cc(*idne, nint_nodes, nbor_nodes, next_nodes, nint_elems, nbor_elems, nnode_cmaps, nelem_cmaps)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store load balance parameters in file id %d", *idne); ex_err("neplbpc",errmsg,EX_MSG); } } /* * Read global node set parameters */ void F2C(negnspg)(int *idne, void_int *ns_ids_glob, void_int *ns_n_cnt_glob, void_int *ns_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ns_param_global(*idne, ns_ids_glob, ns_n_cnt_glob, ns_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global node set parameters from file id %d", *idne); ex_err("negnspg",errmsg,EX_MSG); } } /* * Write global node set parameters */ void F2C(nepnspg)(int *idne, void_int *global_ids, void_int *global_n_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ns_param_global(*idne, global_ids, global_n_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global node set parameters in file id %d", *idne); ex_err("nepnspg",errmsg,EX_MSG); } } /* * Read global side set parameters */ void F2C(negsspg)(int *idne, void_int *ss_ids_glob, void_int *ss_n_cnt_glob, void_int *ss_df_cnt_glob, int *ierr) { if ((*ierr = ex_get_ss_param_global(*idne, ss_ids_glob, ss_n_cnt_glob, ss_df_cnt_glob)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global side set parameters from file id %d", *idne); ex_err("negsspg",errmsg,EX_MSG); } } /* * Write global side set parameters */ void F2C(nepsspg)(int *idne, void_int *global_ids, void_int *global_el_cnts, void_int *global_df_cnts, int *ierr) { if ((*ierr = ex_put_ss_param_global(*idne, global_ids, global_el_cnts, global_df_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global side set parameters in file id %d", *idne); ex_err("nepsspg",errmsg,EX_MSG); } } /* * Read global element block information */ void F2C(negebig)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_get_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read global element block info from file id %d", *idne); ex_err("negebig",errmsg,EX_MSG); } } /* * Write global element block information */ void F2C(nepebig)(int *idne, void_int *el_blk_ids, void_int *el_blk_cnts, int *ierr) { if ((*ierr = ex_put_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to store global element block info in file id %d", *idne); ex_err("nepebig",errmsg,EX_MSG); } } /* * Read side set element list and side set side list */ void F2C(negnss)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set element list from file id %d", *idne); ex_err("negnss",errmsg,EX_MSG); } } /* * Write side set element list and side set side list */ void F2C(nepnss)(int *idne, entity_id *ss_id, void_int *start, void_int *count, void_int *ss_elem_list, void_int *ss_side_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set element list to file id %d", *idne); ex_err("nepnss",errmsg,EX_MSG); } } /* * Read side set distribution factor */ void F2C(negnssd)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read side set dist factor from file id %d", *idne); ex_err("negnssd",errmsg,EX_MSG); } } /* * Write side set distribution factor */ void F2C(nepnssd)(int *idne, entity_id *ss_id, void_int *start, void_int *count, real *ss_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write side set dist factor to file id %d", *idne); ex_err("nepnssd",errmsg,EX_MSG); } } /* * Read node set list for a single node set */ void F2C(negnns)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set(*idne, *ns_id, st, cnt,ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set node list from file id %d", *idne); ex_err("negnns",errmsg,EX_MSG); } } /* * Write node set list for a single node set */ void F2C(nepnns)(int *idne, entity_id *ns_id, void_int *start, void_int *count, void_int *ns_node_list, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set(*idne, *ns_id, st, cnt, ns_node_list)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set node list to file id %d", *idne); ex_err("nepnns",errmsg,EX_MSG); } } /* * Read node set distribution factor */ void F2C(negnnsd)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node set dist factor from file id %d", *idne); ex_err("negnnsd",errmsg,EX_MSG); } } /* * Write node set distribution factor */ void F2C(nepnnsd)(int *idne, entity_id *ns_id, void_int *start, void_int *count, real *ns_df, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node set dist factor to file id %d", *idne); ex_err("nepnnsd",errmsg,EX_MSG); } } /* * Read coordinates of the nodes */ void F2C(negcor)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node coordinates from file id %d", *idne); ex_err("negcor",errmsg,EX_MSG); } } /* * Write coordinates of the nodes */ void F2C(nepcor)(int *idne, void_int *start, void_int *count, real *x_coor, real *y_coor, real *z_coor, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node coordinates to file id %d", *idne); ex_err("nepcor",errmsg,EX_MSG); } } /* * Read an element block's connectivity list */ void F2C(negnec)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block connectivity from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write an element block's connectivity list */ void F2C(nepnec)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, void_int *connect, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block connectivity to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read an element block's attributes */ void F2C(negneat)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block attribute from file id %d", *idne); ex_err("negneat",errmsg,EX_MSG); } } /* * Write an element block's attributes */ void F2C(nepneat)(int *idne, entity_id *elem_blk_id, void_int *start, void_int *count, real *attrib, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element block attribute to file id %d", *idne); ex_err("nepneat",errmsg,EX_MSG); } } /* * Read the element type for a specific element block */ void F2C(negelt)(int *idne, entity_id *elem_blk_id, char *elem_type, int *ierr, size_t elem_typelen) { size_t slen = MAX_STR_LENGTH; char *etype; /* WARNING: ftypelen 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 NEMESIS spec. */ if (elem_typelen != MAX_STR_LENGTH) { #if defined(EXODUS_STRING_LENGTH_WARNING) char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg,"Warning: element type string length is %d in file id %d\n", elem_typelen, *idne); ex_err("negelt",errmsg,EX_MSG); #endif slen = elem_typelen; } etype = (char *) malloc((slen+1)*sizeof(char)); if ((*ierr = ex_get_elem_type(*idne, *elem_blk_id, etype)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block type from file id %d", *idne); ex_err("negelt",errmsg,EX_MSG); } if (*ierr == 0) ex_fcdcpy (elem_type, slen, etype); free(etype); } /* * Read a variable for an element block */ void F2C(negnev)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *num_elem_this_blk, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt, ne; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; ne = *(int64_t*)num_elem_this_blk; } else { st = *(int*)start; cnt = *(int*)count; ne = *(int*)num_elem_this_blk; } if ((*ierr = ex_get_n_elem_var(*idne, *time_step, *elem_var_index, *elem_blk_id, ne, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element block variable from file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Write a variable slab for an element block */ void F2C(nepevs)(int *idne, int *time_step, int *elem_var_index, entity_id *elem_blk_id, void_int *start, void_int *count, real *elem_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_elem_var_slab(*idne, *time_step, *elem_var_index, *elem_blk_id, st, cnt, elem_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elem block variable slab to file id %d", *idne); ex_err("negnec",errmsg,EX_MSG); } } /* * Read the values of a single nodal variable for a single time step */ void F2C(negnnv)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_vars, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_get_n_nodal_var(*idne, *time_step, *nodal_var_index, st, cnt, nodal_vars)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal variable from file id %d", *idne); ex_err("negnnv",errmsg,EX_MSG); } } /* * Write nodal variable slab */ void F2C(nepnvs)(int *idne, int *time_step, int *nodal_var_index, void_int *start, void_int *count, real *nodal_var_vals, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)start; cnt = *(int64_t*)count; } else { st = *(int*)start; cnt = *(int*)count; } if ((*ierr = ex_put_nodal_var_slab(*idne, *time_step, *nodal_var_index, st, cnt, nodal_var_vals)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal variable slab to file id %d", *idne); ex_err("nepnvs",errmsg,EX_MSG); } } /* * Read the element numbering map */ void F2C(negnenm)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read element numbering map from file id %d", *idne); ex_err("negnenm",errmsg,EX_MSG); } } /* * Write the element numbering map */ void F2C(nepnenm)(int *idne, void_int *starte, void_int *num_ent, void_int *elem_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)starte; cnt = *(int64_t*)num_ent; } else { st = *(int*)starte; cnt = *(int*)num_ent; } if ((*ierr = ex_put_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write element numbering map to file id %d", *idne); ex_err("nepnenm",errmsg,EX_MSG); } } /* * Read the node numbering map */ void F2C(negnnnm)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_get_n_node_num_map(*idne, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read node numbering map from file id %d", *idne); ex_err("negnnnm",errmsg,EX_MSG); } } /* * Write the node numbering map */ void F2C(nepnnnm)(int *idne, void_int *startn, void_int *num_ent, void_int *node_map, int *ierr) { int64_t st, cnt; if (ex_int64_status(*idne) & EX_BULK_INT64_API) { st = *(int64_t*)startn; cnt = *(int64_t*)num_ent; } else { st = *(int*)startn; cnt = *(int*)num_ent; } if ((*ierr = ex_put_n_node_num_map(*idne, st, cnt, node_map)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write node numbering map to file id %d", *idne); ex_err("nepnnnm",errmsg,EX_MSG); } } /* * Read the node map for a processor */ void F2C(negnm)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_get_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor node map from file id %d", *idne); ex_err("negnm",errmsg,EX_MSG); } } /* * Write a node map for a processor */ void F2C(nepnm)(int *idne, void_int *node_mapi, void_int *node_mapb, void_int *node_mape, int *processor, int *ierr) { if ((*ierr = ex_put_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor node map to file id %d", *idne); ex_err("nepnm",errmsg,EX_MSG); } } /* * Read the element map for a processor */ void F2C(negem)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_get_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read processor element map from file id %d", *idne); ex_err("negem",errmsg,EX_MSG); } } /* * Write the element map for a processor */ void F2C(nepem)(int *idne, void_int *elem_mapi, void_int *elem_mapb, int *processor, int *ierr) { if ((*ierr = ex_put_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write processor element map to file id %d", *idne); ex_err("nepem",errmsg,EX_MSG); } } /* * Read the communications map parameters for a single processor */ void F2C(negcmp)(int *idne, void_int *ncmap_ids, void_int *ncmap_node_cnts, void_int *ecmap_ids, void_int *ecmap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_get_cmap_params(*idne, ncmap_ids, ncmap_node_cnts, ecmap_ids, ecmap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read comm map parameters from file id %d", *idne); ex_err("negcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for a single processor */ void F2C(nepcmp)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *emap_ids, void_int *emap_elem_cnts, int *processor, int *ierr) { if ((*ierr = ex_put_cmap_params(*idne, nmap_ids, nmap_node_cnts, emap_ids, emap_elem_cnts, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmp",errmsg,EX_MSG); } } /* * Write the communications map parameters for all processors */ void F2C(nepcmpc)(int *idne, void_int *nmap_ids, void_int *nmap_node_cnts, void_int *nproc_ptrs, void_int *emap_ids, void_int *emap_elem_cnts, void_int *eproc_ptrs, int *ierr) { if ((*ierr = ex_put_cmap_params_cc(*idne, nmap_ids, nmap_node_cnts, nproc_ptrs, emap_ids, emap_elem_cnts, eproc_ptrs)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write comm map parameters to file id %d", *idne); ex_err("nepcmpc",errmsg,EX_MSG); } } /* * Read the nodal communications map for a single processor */ void F2C(negncm)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read nodal communications map from file id %d", *idne); ex_err("negncm",errmsg,EX_MSG); } } /* * Write the nodal communications map for a single processor */ void F2C(nepncm)(int *idne, entity_id *map_id, void_int *node_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write nodal communications map to file id %d", *idne); ex_err("nepncm",errmsg,EX_MSG); } } /* * Read the elemental communications map for a single processor */ void F2C(negecm)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_get_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to read elemental comm map from file id %d", *idne); ex_err("negecm",errmsg,EX_MSG); } } /* * Write the elemental communications map for a single processor */ void F2C(nepecm)(int *idne, entity_id *map_id, void_int *elem_ids, void_int *side_ids, void_int *proc_ids, int *processor, int *ierr) { if ((*ierr = ex_put_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { char errmsg[MAX_ERR_LENGTH]; sprintf(errmsg, "Error: failed to write elemental comm map to file id %d", *idne); ex_err("nepecm",errmsg,EX_MSG); } } exodusii-6.02.dfsg.1/nemesis/forbind/ne_test.inc000066400000000000000000000051061225312213100215670ustar00rootroot00000000000000C Copyright (c) 1998 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 C================================================== C Parameters for the NE_TEST fortran interface test C program C================================================== C Constants for init_global functions PARAMETER (NNG = 100) PARAMETER (NEG = 50) PARAMETER (NEBG = 5) PARAMETER (NNSG = 2) PARAMETER (NSSG = 3) C Constants for load-balance functions PARAMETER (NPROC = 10) PARAMETER (NPROCF = NPROC) PARAMETER (NINTN = 200) PARAMETER (NBORN = 10) PARAMETER (NEXTN = 5) PARAMETER (NINTE = 100) PARAMETER (NBORE = 20) INTEGER NNCMAP, NECMAP PARAMETER (NNCMAP = 4) PARAMETER (NECMAP = 2) C Constants for communication map PARAMETER (NCNTCM = 20) INTEGER ECNTCM PARAMETER (ECNTCM = 17) C Some multiplied values C NNCMAP * NPROCF PARAMETER (NNCXNPF = 40) C NECMAP * NPROCF PARAMETER (NECXNPF = 20) exodusii-6.02.dfsg.1/nemesis/ne_ctest_wrap.c000066400000000000000000000705711225312213100210210ustar00rootroot00000000000000/* * Copyright (c) 1998 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 the source code for the program used to test the * Nemesis distribution. ***************************************************************************** * Written By: Gary L. Hennigan (SNL, 1421) ***************************************************************************** * Functions contained in this file: * main() - Entry point and main calling program. */ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ #include #include #include #include #include "ne_nemesisI.h" /* Constants for init_global functions */ #define NNG 100 #define NEG 50 #define NEBG 5 #define NEBCG 10 #define NNSG 2 #define NSSG 3 /* Constants for load-balance functions */ #define NPROC 10 #define NPROCF NPROC #define NINTN 200 #define NBORN 10 #define NEXTN 5 #define NINTE 100 #define NBORE 20 #define NNCMAP 4 #define NECMAP 2 /* Constants for communication map */ #define NCNTCM 20 #define ECNTCM 17 int main(int argc, char *argv[]) { /* Local function calls */ int ne_test_glbp(int); int ne_test_piinf(int); int ne_test_pinig(int); int ne_test_pelbid(int); int ne_test_pnsp(int); int ne_test_pssp(int); int ne_test_pnm(int); int ne_test_pem(int); int ne_test_pcmp(int); int ne_test_pncm(int); int ne_test_pecm(int); int ne_test_giinf(int); int ne_test_ginig(int); int ne_test_gelbid(int); int ne_test_gnsp(int); int ne_test_gssp(int); int ne_test_gnm(int); int ne_test_gem(int); int ne_test_gncm(int); int ne_test_gecm(int); int ne_test_plbpc(int); int ne_test_pcmpc(int); /* Unitialized local variables */ int ne_file_id; char test_direc[256], file_name[256]; float version; /* Initialized local variables */ int mode3 = EX_CLOBBER; int mode4 = EX_CLOBBER|EX_NETCDF4|EX_NOCLASSIC; char *yo="main"; int io_ws=0, cpu_ws=0, t_pass=0, t_fail=0; int debug_flag=0; /*-----------------------------Execution Begins-----------------------------*/ /* Get the location of the temporary file to use for the test */ if (argc <= 1) { /* Nothing specified. Use defaults. */ strcpy(file_name, "./ne_test.exoII"); } else if (argc == 2) { /* Test for the help flag */ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "-?") == 0) { /* Output the help line */ printf("Usage:\n\tne_test \n"); exit(0); } /* Test for the debug flag */ else if (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "-d") == 0) { printf("****DEBUG MODE****\n"); ex_opts(EX_VERBOSE | EX_DEBUG); strcpy(file_name, "./ne_test.exoII"); debug_flag = 1; } /* Else get the directory name and assign default name */ else { strcpy(test_direc, argv[1]); if (test_direc[strlen(test_direc)-1] != '/') { strcpy(file_name, test_direc); strcat(file_name, "/ne_test.exoII"); } else { strcpy(file_name, test_direc); strcat(file_name, "ne_test.exoII"); } } } else if (argc == 3) { /* Both directory and file name specified */ strcpy(test_direc, argv[1]); if (test_direc[strlen(test_direc)-1] == '/') { strcpy(file_name, test_direc); strcat(file_name, "/"); strcat(file_name, argv[2]); } else { strcpy(file_name, test_direc); strcat(file_name, argv[2]); } } /*---------------------------------------------------------------------------*/ /* OUTPUT TEST SECTION */ /*---------------------------------------------------------------------------*/ printf("*********************Output Tests***********************\n"); /* Create the ExodusII/Nemesis file */ printf("creating ExodusII file..."); fflush(stdout); /* Attempt to create a netcdf4-format file; if it fails, then assume that the netcdf library does not support that mode and fall back to classic netcdf3 format. If that fails, issue an error and die. */ if ((ne_file_id=ex_create(file_name, mode4, &cpu_ws, &io_ws)) < 0) { /* netcdf4 create failed, try netcdf3 */ if ((ne_file_id=ex_create(file_name, mode3, &cpu_ws, &io_ws)) < 0) { printf("FAILED\n"); t_fail++; fprintf(stderr, "[%s]: ERROR, unable to create test file \"%s\"!\n", yo, file_name); exit(-1); } else { printf(" (netcdf3 format) "); } } else { printf(" (netcdf4 format) "); } printf("successful\n"); fflush(stdout); t_pass++; /* Test the output of initial information */ printf("testing init info output..."); fflush(stdout); if (ne_test_piinf(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of initial global information */ printf("testing global init info output..."); fflush(stdout); if (ne_test_pinig(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global element block IDs */ printf("testing global element block ID output..."); fflush(stdout); if (ne_test_pelbid(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global node-set info */ printf("testing global node-set params output..."); fflush(stdout); if (ne_test_pnsp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the global side-set info */ printf("testing global side-set params output..."); fflush(stdout); if (ne_test_pssp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the concatenated load-balance parameters */ printf("testing concatenated load balance info output..."); fflush(stdout); if (ne_test_plbpc(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); } else { printf("succesful\n"); fflush(stdout); } /* Test the output of the node map */ printf("testing node map output..."); fflush(stdout); if (ne_test_pnm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the element map */ printf("testing element map output..."); fflush(stdout); if (ne_test_pem(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test the output of the concatenated communication map params */ printf("testing concatenated communication map params output..."); fflush(stdout); if (ne_test_pcmpc(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test nodal communication map output */ printf("testing nodal communication map output..."); fflush(stdout); if (ne_test_pncm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test elemental communication map output */ printf("testing elemental communication map output..."); fflush(stdout); if (ne_test_pecm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Close the ExodusII/Nemesis test file */ printf("closing ExodusII file..."); fflush(stdout); if (ex_close(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name); exit(-1); } printf("successful\n"); fflush(stdout); t_pass++; /*---------------------------------------------------------------------------*/ /* INPUT TEST SECTION */ /*---------------------------------------------------------------------------*/ printf("**********************Input Tests***********************\n"); /* Re-open the ExodusII/NemesisI file */ printf("reopening ExodusII file..."); fflush(stdout); if (ex_open(file_name, EX_READ, &cpu_ws, &io_ws, &version) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of of the initial information */ printf("testing init info input..."); fflush(stdout); if (ne_test_giinf(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of initial global information */ printf("testing global init info input..."); fflush(stdout); if (ne_test_ginig(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global element block IDs */ printf("testing global element block IDs input..."); fflush(stdout); if (ne_test_gelbid(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global node-set params */ printf("testing global node-set params input..."); fflush(stdout); if (ne_test_gnsp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of global side-set params */ printf("testing global side-set params input..."); fflush(stdout); if (ne_test_gssp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of load-balance params */ printf("testing load-balance params input..."); fflush(stdout); if (ne_test_glbp(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of the node map */ printf("testing node map input..."); fflush(stdout); if (ne_test_gnm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of element map */ printf("testing element map input..."); fflush(stdout); if (ne_test_gem(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of nodal communication maps */ printf("testing nodal communication map input..."); fflush(stdout); if (ne_test_gncm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Test read of elemental communication maps */ printf("testing elemental communication map input..."); fflush(stdout); if (ne_test_gecm(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; if (debug_flag == 1) return 1; } else { printf("successful\n"); fflush(stdout); t_pass++; } /* Close the ExodusII/Nemesis test file */ printf("closing ExodusII file..."); fflush(stdout); if (ex_close(ne_file_id) < 0) { printf("FAILED\n"); fflush(stdout); t_fail++; fprintf(stderr, "[%s]: ERROR, unable to close test file \"%s\"!\n", yo, file_name); exit(-1); } printf("successful\n"); fflush(stdout); t_pass++; /* Output a test summary */ printf("\n"); printf("Tests Passed: %d\n", t_pass); printf("Tests Failed: %d\n", t_fail); return 0; } /*****************************************************************************/ int ne_test_piinf(int fileid) { char ftype[3]; strcpy(ftype, "s"); return (ne_put_init_info(fileid, NPROC, NPROCF, ftype)); } /*****************************************************************************/ int ne_test_pinig(int fileid) { int nng=NNG, neg=NEG, nebg=NEBG, nnsg=NNSG, nssg=NSSG; /*-----------------------------Execution Begins-----------------------------*/ return (ne_put_init_global(fileid, nng, neg, nebg, nnsg, nssg)); } /*****************************************************************************/ int ne_test_pelbid(int fileid) { int i, elblk_ids[NEBG], elblk_cnt[NEBG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NEBG; i++) { elblk_ids[i]=(i+1); elblk_cnt[i]=NEBCG; } return (ne_put_eb_info_global(fileid, elblk_ids, elblk_cnt)); } /*****************************************************************************/ int ne_test_pnsp(int fileid) { int i, global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NNSG; i++) { global_ids[i]=2*(i+1); global_n_cnts[i]=3*(i+1); global_df_cnts[i]=1; } return (ne_put_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts)); } /*****************************************************************************/ int ne_test_pssp(int fileid) { int i, global_ids[NSSG], global_el_cnts[NSSG], global_df_cnts[NSSG]; /*-----------------------------Execution Begins-----------------------------*/ for(i=0; i < NSSG; i++) { global_ids[i]=3*(i+1); global_el_cnts[i]=2*(i+1); global_df_cnts[i]=1; } return (ne_put_ss_param_global(fileid, global_ids, global_el_cnts, global_df_cnts)); } /*****************************************************************************/ int ne_test_pnm(int fileid) { int iproc, j, error, j1=0; int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NINTN; node_mapi[j++]=j1++); for(j=0; j < NBORN; node_mapb[j++]=j1++); for(j=0; j < NEXTN; node_mape[j++]=j1++); j1 = 0; error = ne_put_node_map(fileid, node_mapi, node_mapb, node_mape, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pem(int fileid) { int iproc, j, error, j1=0; int elem_mapi[NINTE], elem_mapb[NBORE]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NINTE; elem_mapi[j++]=j1++); for(j=0; j < NBORE; elem_mapb[j++]=j1++); j1 = 0; error = ne_put_elem_map(fileid, elem_mapi, elem_mapb, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pcmp(int fileid) { int i, iproc, error; int node_map_ids[NNCMAP], node_map_node_cnts[NNCMAP]; int elem_map_ids[NECMAP], elem_map_elem_cnts[NECMAP]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NNCMAP; i++) { node_map_ids[i]=(i+1); node_map_node_cnts[i]=NCNTCM; } for(i=0; i < NECMAP; i++) { elem_map_ids[i]=2*(i+1); elem_map_elem_cnts[i]=ECNTCM; } error = ne_put_cmap_params(fileid, node_map_node_cnts, node_map_ids, elem_map_elem_cnts, elem_map_ids, iproc); if (error < 0) return error; } return 0; } /*****************************************************************************/ int ne_test_pncm(int fileid) { int i, iproc, error; int node_map_ids[NNCMAP], node_ids[NCNTCM], proc_ids[NCNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NNCMAP; i++) { node_map_ids[i]=(i+1); } for(i=0; i < NCNTCM; i++) { node_ids[i] = 2*(i+1); proc_ids[i] = 3*(i+1); } for(i=0; i < NNCMAP; i++) { error = ne_put_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc); if (error < 0) return error; } } return 0; } /*****************************************************************************/ int ne_test_pecm(int fileid) { int i, iproc, error; int elem_map_ids[NECMAP], elem_ids[ECNTCM], side_ids[ECNTCM]; int proc_ids[ECNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { for(i=0; i < NECMAP; i++) { elem_map_ids[i]=2*(i+1); } for(i=0; i < ECNTCM; i++) { elem_ids[i] = 2*(i+1); side_ids[i] = 3*(i+1); proc_ids[i] = 4*(i+1); } for(i=0; i < NECMAP; i++) { error = ne_put_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc); if (error < 0) return error; } } return 0; } /*****************************************************************************/ int ne_test_giinf(int fileid) { int error, nproc, nprocf; char ftype[2]; /*-----------------------------Execution Begins-----------------------------*/ error = ne_get_init_info(fileid, &nproc, &nprocf, ftype); if (error < 0) return error; if (nproc != NPROC) return -1; if (nprocf != NPROCF) return -1; if (strcmp(ftype, "s") != 0) return -1; return 0; } /*****************************************************************************/ int ne_test_ginig(int fileid) { int error; int num_nodes_g, num_elems_g, num_elem_blks_g, num_ns_g, num_ss_g; /*-----------------------------Execution Begins-----------------------------*/ error = ne_get_init_global(fileid, &num_nodes_g, &num_elems_g, &num_elem_blks_g, &num_ns_g, &num_ss_g); if (error < 0) return error; if (num_nodes_g != NNG) return -1; if (num_elems_g != NEG) return -1; if (num_elem_blks_g != NEBG) return -1; if (num_ns_g != NNSG) return -1; if (num_ss_g != NSSG) return -1; return 0; } /*****************************************************************************/ int ne_test_gelbid(int fileid) { int i, error; int el_blk_ids[NEBG], el_blk_cnt[NEBG]; /*-----------------------------Execution Begins-----------------------------*/ error = ne_get_eb_info_global(fileid, el_blk_ids, el_blk_cnt); if (error < 0) return error; for(i=0; i < NEBG; i++) { if (el_blk_ids[i] != (i+1)) return -1; if (el_blk_cnt[i] != NEBCG) return -1; } return 0; } /*****************************************************************************/ int ne_test_gnsp(int fileid) { int i, error; int global_ids[NNSG], global_n_cnts[NNSG], global_df_cnts[NNSG]; /*-----------------------------Execution Begins-----------------------------*/ error = ne_get_ns_param_global(fileid, global_ids, global_n_cnts, global_df_cnts); if (error < 0) return error; for(i=0; i < NNSG; i++) { if (global_ids[i] != 2*(i+1)) return -1; if (global_n_cnts[i] != 3*(i+1)) return -1; if (global_df_cnts[i] != 1 ) return -1; } return 0; } /*****************************************************************************/ int ne_test_gssp(int fileid) { int i, error; int global_ids[NSSG], global_e_cnts[NSSG], global_df_cnts[NSSG]; /*-----------------------------Execution Begins-----------------------------*/ error = ne_get_ss_param_global(fileid, global_ids, global_e_cnts, global_df_cnts); if (error < 0) return error; for(i=0; i < NSSG; i++) { if (global_ids[i] != 3*(i+1)) return -1; if (global_e_cnts[i] != 2*(i+1)) return -1; if (global_df_cnts[i] != 1 ) return -1; } return 0; } /*****************************************************************************/ int ne_test_glbp(int fileid) { int iproc, error; int nintn, nborn, nextn, ninte, nbore, nncmap, necmap; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ne_get_loadbal_param(fileid, &nintn, &nborn, &nextn, &ninte, &nbore, &nncmap, &necmap, iproc); if (error < 0) return error; if (nintn != NINTN ) return -1; if (nborn != NBORN ) return -1; if (nextn != NEXTN ) return -1; if (ninte != NINTE ) return -1; if (nbore != NBORE ) return -1; if (nncmap != NNCMAP) return -1; if (necmap != NECMAP) return -1; } return 0; } /*****************************************************************************/ int ne_test_gnm(int fileid) { int iproc, j, error, j1=0; int node_mapi[NINTN], node_mapb[NBORN], node_mape[NEXTN]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ne_get_node_map(fileid, node_mapi, node_mapb, node_mape, iproc); if (error < 0) return error; for(j=0; j < NINTN; j++) { if (node_mapi[j] != j1++) return -1; } for(j=0; j < NBORN; j++) { if (node_mapb[j] != j1++) return -1; } for(j=0; j < NEXTN; j++) { if (node_mape[j] != j1++) return -1; } j1 = 0; } return 0; } /*****************************************************************************/ int ne_test_gem(int fileid) { int iproc, j, error, j1=0; int elem_mapi[NINTE], elem_mapb[NBORE]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ne_get_elem_map(fileid, elem_mapi, elem_mapb, iproc); if (error < 0) return error; for(j=0; j < NINTE; j++) { if (elem_mapi[j] != j1++) return -1; } for(j=0; j < NBORE; j++) { if (elem_mapb[j] != j1++) return -1; } j1 = 0; } return 0; } /*****************************************************************************/ int ne_test_gncm(int fileid) { int i, j, iproc, error; int node_map_ids[NNCMAP], node_map_cnts[NNCMAP]; int node_ids[NCNTCM], proc_ids[NCNTCM]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ne_get_cmap_params(fileid, node_map_ids, node_map_cnts, NULL, NULL, iproc); if (error < 0) return error; for(i=0; i < NNCMAP; i++) { error = ne_get_node_cmap(fileid, node_map_ids[i], node_ids, proc_ids, iproc); if (error < 0) return error; for(j=0; j < NCNTCM; j++) { if (node_ids[j] != 2*(j+1)) return -1; if (proc_ids[j] != 3*(j+1)) return -1; } } } return 0; } /*****************************************************************************/ int ne_test_gecm(int fileid) { int i, j, iproc, error; int elem_ids[ECNTCM], elem_map_cnts[NECMAP], proc_ids[ECNTCM]; int side_ids[ECNTCM], elem_map_ids[NECMAP]; /*-----------------------------Execution Begins-----------------------------*/ for(iproc=0; iproc < NPROCF; iproc++) { error = ne_get_cmap_params(fileid, NULL, NULL, elem_map_ids, elem_map_cnts, iproc); if (error < 0) return error; for(i=0; i < NECMAP; i++) { error = ne_get_elem_cmap(fileid, elem_map_ids[i], elem_ids, side_ids, proc_ids, iproc); if (error < 0) return error; for(j=0; j < ECNTCM; j++) { if (elem_ids[j] != 2*(j+1)) return -1; if (side_ids[j] != 3*(j+1)) return -1; if (proc_ids[j] != 4*(j+1)) return -1; } } } return 0; } /*****************************************************************************/ int ne_test_plbpc(int fileid) { int iproc; int num_int_nodes[NPROCF], num_bor_nodes[NPROCF], num_ext_nodes[NPROCF]; int num_int_elems[NPROCF], num_bor_elems[NPROCF]; int num_node_cmaps[NPROCF], num_elem_cmaps[NPROCF]; /*-----------------------------Execution Begins-----------------------------*/ /* Set up the vectors */ for(iproc=0; iproc < NPROCF; iproc++) { num_int_nodes[iproc] = NINTN; num_bor_nodes[iproc] = NBORN; num_ext_nodes[iproc] = NEXTN; num_int_elems[iproc] = NINTE; num_bor_elems[iproc] = NBORE; num_node_cmaps[iproc] = NNCMAP; num_elem_cmaps[iproc] = NECMAP; } return (ne_put_loadbal_param_cc(fileid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps)); } /*****************************************************************************/ int ne_test_pcmpc(int fileid) { int iproc, j, n_cntr, e_cntr; int nmap_ids[NNCMAP*NPROCF], nmap_n_cnts[NNCMAP*NPROCF]; int nmap_proc_ptr[NPROCF+1]; int emap_ids[NECMAP*NPROCF], emap_e_cnts[NECMAP*NPROCF]; int emap_proc_ptr[NPROCF+1]; /*-----------------------------Execution Begins-----------------------------*/ nmap_proc_ptr[0] = 0; emap_proc_ptr[0] = 0; n_cntr = 0; e_cntr = 0; for(iproc=0; iproc < NPROCF; iproc++) { for(j=0; j < NNCMAP; j++) { nmap_ids[n_cntr] = (j+1); nmap_n_cnts[n_cntr++] = NCNTCM; } for(j=0; j < NECMAP; j++) { emap_ids[e_cntr] = 2*(j+1); emap_e_cnts[e_cntr++] = ECNTCM; } nmap_proc_ptr[iproc+1] = nmap_proc_ptr[iproc] + NNCMAP; emap_proc_ptr[iproc+1] = emap_proc_ptr[iproc] + NECMAP; } return (ne_put_cmap_params_cc(fileid, nmap_ids, nmap_n_cnts, nmap_proc_ptr, emap_ids, emap_e_cnts, emap_proc_ptr)); } exodusii-6.02.dfsg.1/nemesis/ne_nemesisI.h000066400000000000000000000563361225312213100204320ustar00rootroot00000000000000/* * Copyright (c) 1998 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 prototypes for the functions found in the NEMESIS * library. ****************************************************************************/ #ifndef _NE_NEMESIS_H #define _NE_NEMESIS_H #ifdef __cplusplus extern "C" { #endif #ifndef EXODUS_II_HDR #include /** Specifies that this argument is the id of an entity: element block, nodeset, sideset, ... */ typedef int64_t ex_entity_id; /** The mechanism for passing double/float and int/int64_t both use a void*; to avoid some confusion as to whether a function takes an integer or a float/double, the following typedef is used for the integer argument */ typedef void void_int; #endif /*============================================================================= * Initial Information Routines *===========================================================================*/ extern int ne_get_init_info(int neid, /* NemesisI file ID */ int *num_proc, /* Number of processors */ int *num_proc_in_f, /* Number of procs in this file */ char *ftype ); extern int ne_put_init_info(int neid, /* NemesisI file ID */ int num_proc, /* Number of processors */ int num_proc_in_f, /* Number of procs in this file */ char *ftype ); extern int ne_get_init_global(int neid, /* NemesisI file ID */ void_int *num_nodes_g, /* Number of global FEM nodes */ void_int *num_elems_g, /* Number of global FEM elements */ void_int *num_elem_blks_g, /* Number of global elem blocks */ void_int *num_node_sets_g, /* Number of global node sets */ void_int *num_side_sets_g /* Number of global side sets */ ); extern int ne_put_init_global(int neid, /* NemesisI file ID */ int64_t num_nodes_g, /* Number of global FEM nodes */ int64_t num_elems_g, /* Number of global FEM elements */ int64_t num_elem_blks_g, /* Number of global elem blocks */ int64_t num_node_sets_g, /* Number of global node sets */ int64_t num_side_sets_g /* Number of global side sets */ ); extern int ne_put_version(int neid); /*============================================================================= * Loadbalance Parameter Routines *===========================================================================*/ extern int ne_get_loadbal_param(int neid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal FEM nodes */ void_int *num_bor_nodes, /* Number of border FEM nodes */ void_int *num_ext_nodes, /* Number of external FEM nodes */ void_int *num_int_elems, /* Number of internal FEM elems */ void_int *num_bor_elems, /* Number of border FEM elems */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps, /* Number of elemental comm maps */ int processor /* Processor ID */ ); extern int ne_put_loadbal_param(int neid, /* NemesisI file ID */ int64_t num_int_nodes, /* Number of internal FEM nodes */ int64_t num_bor_nodes, /* Number of border FEM nodes */ int64_t num_ext_nodes, /* Number of external FEM nodes */ int64_t num_int_elems, /* Number of internal FEM elems */ int64_t num_bor_elems, /* Number of border FEM elems */ int64_t num_node_cmaps,/* Number of nodal comm maps */ int64_t num_elem_cmaps,/* Number of elemental comm maps */ int processor /* Processor ID */ ); extern int ne_put_loadbal_param_cc(int neid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal node IDs */ void_int *num_bor_nodes, /* Number of border node IDs */ void_int *num_ext_nodes, /* Number of external node IDs */ void_int *num_int_elems, /* Number of internal elem IDs */ void_int *num_bor_elems, /* Number of border elem IDs */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps /* Number of elem comm maps */ ); /*============================================================================= * NS, SS & EB Global Parameter Routines *===========================================================================*/ extern int ne_get_ns_param_global(int neid, /* NetCDF/Exodus file ID */ void_int *ns_ids_glob, /* Global IDs of node sets */ void_int *ns_n_cnt_glob, /* Count of nodes in node sets */ void_int *ns_df_cnt_glob /* Count of dist. factors in ns */ ); extern int ne_put_ns_param_global(int neid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global node-set IDs */ void_int *global_n_cnts, /* Vector of node counts in node-sets */ void_int *global_df_cnts /* Vector of dist factor counts in node-sets */ ); extern int ne_get_ss_param_global(int neid, /* NetCDF/Exodus file ID */ void_int *ss_ids_glob, /* Global side-set IDs */ void_int *ss_s_cnt_glob, /* Global side count */ void_int *ss_df_cnt_glob /* Global dist. factor count */ ); extern int ne_put_ss_param_global(int neid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global side-set IDs */ void_int *global_el_cnts, /* Vector of element/side */ /* counts in each side set */ void_int *global_df_cnts /* Vector of dist. factor */ /* counts in each side set */ ); extern int ne_get_eb_info_global(int neid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ); extern int ne_put_eb_info_global(int neid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ); /*============================================================================= * NS, SS & EB Subset Routines *===========================================================================*/ extern int ne_get_n_side_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to read */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to read */ void_int *side_set_elem_list, /* List of element IDs */ void_int *side_set_side_list /* List of side IDs */ ); extern int ne_put_n_side_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to write */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to write */ const void_int *side_set_elem_list, /* List of element IDs */ const void_int *side_set_side_list /* List of side IDs */ ); extern int ne_get_n_side_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *side_set_df /* Distribution factors */ ); extern int ne_put_n_side_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *side_set_df /* Distribution factors */ ); extern int ne_get_n_node_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start reading at */ int64_t num_node, /* Number of nodes to read */ void_int *node_set_node_list /* List of nodes in node set */ ); extern int ne_put_n_node_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start writing at */ int64_t num_node, /* Number of nodes to write */ const void_int *node_set_node_list /* List of nodes in node set */ ); extern int ne_get_n_node_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *node_set_df /* Distribution factors */ ); extern int ne_put_n_node_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *node_set_df /* Distribution factors */ ); extern int ne_get_n_coord(int neid, /* NetCDF/Exodus file ID */ int64_t start_node_num, /* Starting position to read from */ int64_t num_nodes, /* Number of coords to read */ void *x_coor, /* Vector of X coordinates */ void *y_coor, /* Vector of Y coordinates */ void *z_coor /* Vector of Z coordinates */ ); extern int ne_put_n_coord(int neid, /* NetCDF/Exodus file ID */ int64_t start_node_num, /* Starting position to write to */ int64_t num_nodes, /* Number of coords to write */ void *x_coor, /* Vector of X coordinates */ void *y_coor, /* Vector of Y coordinates */ void *z_coor /* Vector of Z coordinates */ ); extern int ne_get_n_elem_conn (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void_int *connect /* Connectivity vector */ ); extern int ne_put_n_elem_conn (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ const void_int *connect /* Connectivity vector */ ); extern int ne_get_n_elem_attr (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void *attrib /* Attribute */ ); extern int ne_put_n_elem_attr (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ void *attrib /* Attribute */ ); extern int ne_get_elem_type(int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ char *elem_type /* The name of the element type */ ); /*============================================================================= * Variable Routines *===========================================================================*/ extern int ne_get_n_elem_var (int neid, /* NetCDF/Exodus file ID */ int time_step, /* time index */ int elem_var_index, /* elemental variable index */ ex_entity_id elem_blk_id, /* elemental block id */ int64_t num_elem_this_blk, /* number of elements in block */ int64_t start_elem_num, /* Starting position for read */ int64_t num_elem, /* Number of elements to read */ void *elem_var_vals /* variable values */ ); extern int ne_put_elem_var_slab (int neid, /* NetCDF/Exodus file ID */ int time_step, /* time index */ int elem_var_index, /* elemental variable index */ ex_entity_id elem_blk_id, /* elemental block id */ int64_t start_pos, /* Starting position to write to */ int64_t num_vals, /* Number of elements to write */ void *elem_var_vals /* variable values */ ); extern int ne_get_n_nodal_var(int neid, /* NetCDF/Exodus file ID */ int time_step, /* whole time step number */ int nodal_var_index, /* index of desired nodal var */ int64_t start_node_num, /* starting node number */ int64_t num_nodes, /* number of nodes to read */ void *nodal_vars /* array of nodal var values */ ); extern int ne_put_nodal_var_slab(int neid, /* NetCDF/Exodus file ID */ int time_step, /* The time step index */ int nodal_var_index, /* Nodal variable index */ int64_t start_pos, /* Start position for write */ int64_t num_vals, /* Number of nodal variables */ void *nodal_var_vals /* Nodal variable values */ ); /*============================================================================= * Number Map Routines *===========================================================================*/ extern int ne_get_n_elem_num_map (int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ void_int *elem_map /* element map numbers */ ); extern int ne_put_n_elem_num_map (int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ const void_int *elem_map /* element map numbers */ ); extern int ne_get_n_node_num_map(int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ void_int *node_map /* vector for node map */ ); extern int ne_put_n_node_num_map(int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ const void_int *node_map /* vector for node map */ ); extern int ne_get_node_map(int neid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* Processor IDs */ ); extern int ne_put_node_map(int neid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* This processor ID */ ); extern int ne_get_elem_map(int neid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal element IDs */ void_int *elem_mapb, /* Border element IDs */ int processor /* Processor ID */ ); extern int ne_put_elem_map(int neid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal FEM element IDs */ void_int *elem_mapb, /* Border FEM element IDs */ int processor /* This processor ID */ ); /*============================================================================= * Communications Maps Routines *===========================================================================*/ extern int ne_get_cmap_params(int neid, /* NetCDF/Exodus file ID */ void_int *node_cmap_ids, /* Nodal comm. map IDs */ void_int *node_cmap_node_cnts, /* Number of nodes in each map */ void_int *elem_cmap_ids, /* Elemental comm. map IDs */ void_int *elem_cmap_elem_cnts, /* Number of elems in each map */ int processor /* This processor ID */ ); extern int ne_put_cmap_params(int neid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts,/* Nodes in nodal comm */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts,/* Elems in elemental comm */ int64_t processor /* This processor ID */ ); extern int ne_put_cmap_params_cc(int neid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts, /* Nodes in nodal comm */ void_int *node_proc_ptrs, /* Pointer into array for */ /* node maps */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts, /* Elems in elemental comm */ void_int *elem_proc_ptrs /* Pointer into array for */ /* elem maps */ ); extern int ne_get_node_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); extern int ne_put_node_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Nodal comm map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); extern int ne_get_elem_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Element IDs */ void_int *side_ids, /* Element side IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ); extern int ne_put_elem_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Vector of element IDs */ void_int *side_ids, /* Vector of side IDs */ void_int *proc_ids, /* Vector of processor IDs */ int processor /* This processor ID */ ); /* Should be internal use only, but was in external include file for nemesis and some codes are using the function */ int ne_get_idx(int neid, /* NetCDF/Exodus file ID */ const char *ne_var_name, /* Nemesis index variable name */ int64_t *index, /* array of length 2 to hold results */ int pos /* position of this proc/cmap in index */ ); #ifdef __cplusplus } #endif #endif /* _NE_NEMESIS_H */ exodusii-6.02.dfsg.1/nemesis/ne_nemesisI_int.h000066400000000000000000000002401225312213100212630ustar00rootroot00000000000000/* Dummy file -- Not needed after integration of nemesis library into exodus. */ /* Provided in case an application used to include this file in the past. */ exodusii-6.02.dfsg.1/nemesis/nemesis_cfg.h.in000077500000000000000000000012531225312213100210520ustar00rootroot00000000000000#ifndef __nemesis_cfg_h #define __nemesis_cfg_h #define NEMESIS_VERSION_MAJOR @NEMESIS_VERSION_MAJOR@ #define NEMESIS_VERSION_MINOR @NEMESIS_VERSION_MINOR@ #define NEMESIS_VERSION_PATCH @NEMESIS_VERSION_PATCH@ #define NEMESIS_VERSION "@NEMESIS_VERSION_MAJOR@.@NEMESIS_VERSION_MINOR@.@NEMESIS_VERSION_PATCH@" #if defined(_WIN32) && !defined(WIN32) # define WIN32 #endif #cmakedefine NEMESIS_BUILD_SHARED_LIBS #if defined(WIN32) && defined(NEMESIS_BUILD_SHARED_LIBS) # if defined(nemc_EXPORTS) # define NEMESIS_EXPORT __declspec( dllexport ) extern # else # define NEMESIS_EXPORT __declspec( dllimport ) extern # endif #else # define NEMESIS_EXPORT extern #endif #endif exodusii-6.02.dfsg.1/nemesis/nemesis_wrapper.c000066400000000000000000000620031225312213100213560ustar00rootroot00000000000000#include #include #include /*============================================================================= * Initial Information Routines *===========================================================================*/ int ne_get_init_info(int neid, /* NemesisI file ID */ int *num_proc, /* Number of processors */ int *num_proc_in_f, /* Number of procs in this file */ char *ftype) { return ex_get_init_info(neid, num_proc, num_proc_in_f, ftype); } int ne_put_init_info(int neid, /* NemesisI file ID */ int num_proc, /* Number of processors */ int num_proc_in_f, /* Number of procs in this file */ char *ftype) { return ex_put_init_info(neid, num_proc, num_proc_in_f, ftype); } int ne_get_init_global(int neid, /* NemesisI file ID */ void_int *num_nodes_g, /* Number of global FEM nodes */ void_int *num_elems_g, /* Number of global FEM elements */ void_int *num_elem_blks_g, /* Number of global elem blocks */ void_int *num_node_sets_g, /* Number of global node sets */ void_int *num_side_sets_g /* Number of global side sets */ ) { return ex_get_init_global(neid, num_nodes_g, num_elems_g, num_elem_blks_g, num_node_sets_g, num_side_sets_g); } int ne_put_init_global(int neid, /* NemesisI file ID */ int64_t num_nodes_g, /* Number of global FEM nodes */ int64_t num_elems_g, /* Number of global FEM elements */ int64_t num_elem_blks_g, /* Number of global elem blocks */ int64_t num_node_sets_g, /* Number of global node sets */ int64_t num_side_sets_g /* Number of global side sets */ ) { return ex_put_init_global(neid, num_nodes_g, num_elems_g, num_elem_blks_g, num_node_sets_g, num_side_sets_g); } int ne_put_version(int neid) { return ex_put_nemesis_version(neid); } /*============================================================================= * Loadbalance Parameter Routines *===========================================================================*/ int ne_get_loadbal_param(int neid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal FEM nodes */ void_int *num_bor_nodes, /* Number of border FEM nodes */ void_int *num_ext_nodes, /* Number of external FEM nodes */ void_int *num_int_elems, /* Number of internal FEM elems */ void_int *num_bor_elems, /* Number of border FEM elems */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps, /* Number of elemental comm maps */ int processor /* Processor ID */ ) { return ex_get_loadbal_param(neid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps, processor); } int ne_put_loadbal_param(int neid, /* NemesisI file ID */ int64_t num_int_nodes, /* Number of internal FEM nodes */ int64_t num_bor_nodes, /* Number of border FEM nodes */ int64_t num_ext_nodes, /* Number of external FEM nodes */ int64_t num_int_elems, /* Number of internal FEM elems */ int64_t num_bor_elems, /* Number of border FEM elems */ int64_t num_node_cmaps,/* Number of nodal comm maps */ int64_t num_elem_cmaps,/* Number of elemental comm maps */ int processor /* Processor ID */ ) { return ex_put_loadbal_param(neid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps, processor); } int ne_put_loadbal_param_cc(int neid, /* NetCDF/Exodus file ID */ void_int *num_int_nodes, /* Number of internal node IDs */ void_int *num_bor_nodes, /* Number of border node IDs */ void_int *num_ext_nodes, /* Number of external node IDs */ void_int *num_int_elems, /* Number of internal elem IDs */ void_int *num_bor_elems, /* Number of border elem IDs */ void_int *num_node_cmaps, /* Number of nodal comm maps */ void_int *num_elem_cmaps /* Number of elem comm maps */ ) { return ex_put_loadbal_param_cc(neid, num_int_nodes, num_bor_nodes, num_ext_nodes, num_int_elems, num_bor_elems, num_node_cmaps, num_elem_cmaps); } /*============================================================================= * NS, SS & EB Global Parameter Routines *===========================================================================*/ int ne_get_ns_param_global(int neid, /* NetCDF/Exodus file ID */ void_int *ns_ids_glob, /* Global IDs of node sets */ void_int *ns_n_cnt_glob, /* Count of nodes in node sets */ void_int *ns_df_cnt_glob /* Count of dist. factors in ns */ ) { return ex_get_ns_param_global(neid, ns_ids_glob, ns_n_cnt_glob, ns_df_cnt_glob); } int ne_put_ns_param_global(int neid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global node-set IDs */ void_int *global_n_cnts, /* Vector of node counts in node-sets */ void_int *global_df_cnts /* Vector of dist factor counts in node-sets */ ) { return ex_put_ns_param_global(neid, global_ids, global_n_cnts, global_df_cnts); } int ne_get_ss_param_global(int neid, /* NetCDF/Exodus file ID */ void_int *ss_ids_glob, /* Global side-set IDs */ void_int *ss_s_cnt_glob, /* Global side count */ void_int *ss_df_cnt_glob /* Global dist. factor count */ ) { return ex_get_ss_param_global(neid, ss_ids_glob, ss_s_cnt_glob, ss_df_cnt_glob); } int ne_put_ss_param_global(int neid, /* NemesisI file ID */ void_int *global_ids, /* Vector of global side-set IDs */ void_int *global_el_cnts, /* Vector of element/side */ /* counts in each side set */ void_int *global_df_cnts /* Vector of dist. factor */ /* counts in each side set */ ) { return ex_put_ss_param_global(neid, global_ids, global_el_cnts, global_df_cnts); } int ne_get_eb_info_global(int neid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ) { return ex_get_eb_info_global(neid, el_blk_ids, el_blk_cnts); } int ne_put_eb_info_global(int neid, /* NemesisI file ID */ void_int *el_blk_ids, /* Vector of global element IDs */ void_int *el_blk_cnts /* Vector of global element counts */ ) { return ex_put_eb_info_global(neid, el_blk_ids, el_blk_cnts); } /*============================================================================= * NS, SS & EB Subset Routines *===========================================================================*/ int ne_get_n_side_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to read */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to read */ void_int *side_set_elem_list, /* List of element IDs */ void_int *side_set_side_list /* List of side IDs */ ) { return ex_get_n_side_set(neid, side_set_id, start_side_num, num_sides, side_set_elem_list, side_set_side_list); } int ne_put_n_side_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID to write */ int64_t start_side_num, /* Starting element number */ int64_t num_sides, /* Number of sides to write */ const void_int *side_set_elem_list, /* List of element IDs */ const void_int *side_set_side_list /* List of side IDs */ ) { return ex_put_n_side_set(neid, side_set_id, start_side_num, num_sides, side_set_elem_list, side_set_side_list); } int ne_get_n_side_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *side_set_df /* Distribution factors */ ) { return ex_get_n_side_set_df(neid, side_set_id, start_num, num_df_to_get, side_set_df); } int ne_put_n_side_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id side_set_id, /* Side-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *side_set_df /* Distribution factors */ ) { return ex_put_n_side_set_df(neid, side_set_id, start_num, num_df_to_get, side_set_df); } int ne_get_n_node_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start reading at */ int64_t num_node, /* Number of nodes to read */ void_int *node_set_node_list /* List of nodes in node set */ ) { return ex_get_n_node_set(neid, node_set_id, start_node_num, num_node, node_set_node_list); } int ne_put_n_node_set(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node set ID */ int64_t start_node_num, /* Node index to start writing at */ int64_t num_node, /* Number of nodes to write */ const void_int *node_set_node_list /* List of nodes in node set */ ) { return ex_put_n_node_set(neid, node_set_id, start_node_num, num_node, node_set_node_list); } int ne_get_n_node_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to read */ void *node_set_df /* Distribution factors */ ) { return ex_get_n_node_set_df(neid, node_set_id, start_num, num_df_to_get, node_set_df); } int ne_put_n_node_set_df(int neid, /* NetCDF/Exodus file ID */ ex_entity_id node_set_id, /* Node-set ID */ int64_t start_num, /* Starting df number */ int64_t num_df_to_get, /* Number of df's to write */ void *node_set_df /* Distribution factors */ ) { return ex_put_n_node_set_df(neid, node_set_id, start_num, num_df_to_get, node_set_df); } int ne_get_n_coord(int neid, /* NetCDF/Exodus file ID */ int64_t start_node_num, /* Starting position to read from */ int64_t num_nodes, /* Number of coords to read */ void *x_coor, /* Vector of X coordinates */ void *y_coor, /* Vector of Y coordinates */ void *z_coor /* Vector of Z coordinates */ ) { return ex_get_n_coord(neid, start_node_num, num_nodes, x_coor, y_coor, z_coor); } int ne_put_n_coord(int neid, /* NetCDF/Exodus file ID */ int64_t start_node_num, /* Starting position to write to */ int64_t num_nodes, /* Number of coords to write */ void *x_coor, /* Vector of X coordinates */ void *y_coor, /* Vector of Y coordinates */ void *z_coor /* Vector of Z coordinates */ ) { return ex_put_n_coord(neid, start_node_num, num_nodes, x_coor, y_coor, z_coor); } int ne_get_n_elem_conn (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void_int *connect /* Connectivity vector */ ) { return ex_get_n_elem_conn(neid, elem_blk_id, start_elem_num, num_elems, connect); } int ne_put_n_elem_conn (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ const void_int *connect /* Connectivity vector */ ) { return ex_put_n_elem_conn(neid, elem_blk_id, start_elem_num, num_elems, connect); } int ne_get_n_elem_attr (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to read from */ int64_t num_elems, /* Number of elements to read */ void *attrib /* Attribute */ ) { return ex_get_n_elem_attr(neid, elem_blk_id, start_elem_num, num_elems, attrib); } int ne_put_n_elem_attr (int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ int64_t start_elem_num, /* Starting position to write to */ int64_t num_elems, /* Number of elements to write */ void *attrib /* Attribute */ ) { return ex_put_n_elem_attr(neid, elem_blk_id, start_elem_num, num_elems, attrib); } int ne_get_elem_type(int neid, /* NetCDF/Exodus file ID */ ex_entity_id elem_blk_id, /* Element block ID */ char *elem_type /* The name of the element type */ ) { return ex_get_elem_type(neid, elem_blk_id, elem_type); } /*============================================================================= * Variable Routines *===========================================================================*/ int ne_get_n_elem_var (int neid, /* NetCDF/Exodus file ID */ int time_step, /* time index */ int elem_var_index, /* elemental variable index */ ex_entity_id elem_blk_id, /* elemental block id */ int64_t num_elem_this_blk, /* number of elements in block */ int64_t start_elem_num, /* Starting position for read */ int64_t num_elem, /* Number of elements to read */ void *elem_var_vals /* variable values */ ) { return ex_get_n_var(neid, time_step, EX_ELEM_BLOCK, elem_var_index, elem_blk_id, start_elem_num, num_elem, elem_var_vals); } int ne_put_elem_var_slab (int neid, /* NetCDF/Exodus file ID */ int time_step, /* time index */ int elem_var_index, /* elemental variable index */ ex_entity_id elem_blk_id, /* elemental block id */ int64_t start_pos, /* Starting position to write to */ int64_t num_vals, /* Number of elements to write */ void *elem_var_vals /* variable values */ ) { return ex_put_elem_var_slab(neid, time_step, elem_var_index, elem_blk_id, start_pos, num_vals, elem_var_vals); } int ne_get_n_nodal_var(int neid, /* NetCDF/Exodus file ID */ int time_step, /* whole time step number */ int nodal_var_index, /* index of desired nodal var */ int64_t start_node_num, /* starting node number */ int64_t num_nodes, /* number of nodes to read */ void *nodal_vars /* array of nodal var values */ ) { return ex_get_n_var(neid, time_step, EX_NODAL, nodal_var_index, 1, start_node_num, num_nodes, nodal_vars); } int ne_put_nodal_var_slab(int neid, /* NetCDF/Exodus file ID */ int time_step, /* The time step index */ int nodal_var_index, /* Nodal variable index */ int64_t start_pos, /* Start position for write */ int64_t num_vals, /* Number of nodal variables */ void *nodal_var_vals /* Nodal variable values */ ) { return ex_put_nodal_var_slab(neid, time_step, nodal_var_index, start_pos, num_vals, nodal_var_vals); } /*============================================================================= * Number Map Routines *===========================================================================*/ int ne_get_n_elem_num_map (int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ void_int *elem_map /* element map numbers */ ) { return ex_get_n_elem_num_map(neid, start_ent, num_ents, elem_map); } int ne_put_n_elem_num_map (int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* Starting position to read from */ int64_t num_ents, /* Number of elements to read */ const void_int *elem_map /* element map numbers */ ) { return ex_put_partial_id_map(neid, EX_ELEM_MAP, start_ent, num_ents, elem_map); } int ne_get_n_node_num_map(int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ void_int *node_map /* vector for node map */ ) { return ex_get_n_node_num_map(neid, start_ent, num_ents, node_map); } int ne_put_n_node_num_map(int neid, /* NetCDF/Exodus file ID */ int64_t start_ent, /* starting node number */ int64_t num_ents, /* number of nodes to read */ const void_int *node_map /* vector for node map */ ) { return ex_put_partial_id_map(neid, EX_NODE_MAP, start_ent, num_ents, node_map); } int ne_get_node_map(int neid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* Processor IDs */ ) { return ex_get_processor_node_maps(neid, node_mapi, node_mapb, node_mape, processor); } int ne_put_node_map(int neid, /* NetCDF/Exodus file ID */ void_int *node_mapi, /* Internal FEM node IDs */ void_int *node_mapb, /* Border FEM node IDs */ void_int *node_mape, /* External FEM node IDs */ int processor /* This processor ID */ ) { return ex_put_processor_node_maps(neid, node_mapi, node_mapb, node_mape, processor); } int ne_get_elem_map(int neid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal element IDs */ void_int *elem_mapb, /* Border element IDs */ int processor /* Processor ID */ ) { return ex_get_processor_elem_maps(neid, elem_mapi, elem_mapb, processor); } int ne_put_elem_map(int neid, /* NetCDF/Exodus file ID */ void_int *elem_mapi, /* Internal FEM element IDs */ void_int *elem_mapb, /* Border FEM element IDs */ int processor /* This processor ID */ ) { return ex_put_processor_elem_maps(neid, elem_mapi, elem_mapb, processor); } /*============================================================================= * Communications Maps Routines *===========================================================================*/ int ne_get_cmap_params(int neid, /* NetCDF/Exodus file ID */ void_int *node_cmap_ids, /* Nodal comm. map IDs */ void_int *node_cmap_node_cnts, /* Number of nodes in each map */ void_int *elem_cmap_ids, /* Elemental comm. map IDs */ void_int *elem_cmap_elem_cnts, /* Number of elems in each map */ int processor /* This processor ID */ ) { return ex_get_cmap_params(neid, node_cmap_ids, node_cmap_node_cnts, elem_cmap_ids, elem_cmap_elem_cnts, processor); } int ne_put_cmap_params(int neid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts,/* Nodes in nodal comm */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts,/* Elems in elemental comm */ int64_t processor /* This processor ID */ ) { return ex_put_cmap_params(neid, node_map_ids, node_map_node_cnts, elem_map_ids, elem_map_elem_cnts, processor); } int ne_put_cmap_params_cc(int neid, /* NetCDF/Exodus file ID */ void_int *node_map_ids, /* Node map IDs */ void_int *node_map_node_cnts, /* Nodes in nodal comm */ void_int *node_proc_ptrs, /* Pointer into array for */ /* node maps */ void_int *elem_map_ids, /* Elem map IDs */ void_int *elem_map_elem_cnts, /* Elems in elemental comm */ void_int *elem_proc_ptrs /* Pointer into array for */ /* elem maps */ ) { return ex_put_cmap_params_cc(neid, node_map_ids, node_map_node_cnts, node_proc_ptrs, elem_map_ids, elem_map_elem_cnts, elem_proc_ptrs); } int ne_get_node_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ) { return ex_get_node_cmap(neid, map_id, node_ids, proc_ids, processor); } int ne_put_node_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Nodal comm map ID */ void_int *node_ids, /* FEM node IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ) { return ex_put_node_cmap(neid, map_id, node_ids, proc_ids, processor); } int ne_get_elem_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Element IDs */ void_int *side_ids, /* Element side IDs */ void_int *proc_ids, /* Processor IDs */ int processor /* This processor ID */ ) { return ex_get_elem_cmap(neid, map_id, elem_ids, side_ids, proc_ids, processor); } int ne_put_elem_cmap(int neid, /* NetCDF/Exodus file ID */ ex_entity_id map_id, /* Elemental comm map ID */ void_int *elem_ids, /* Vector of element IDs */ void_int *side_ids, /* Vector of side IDs */ void_int *proc_ids, /* Vector of processor IDs */ int processor /* This processor ID */ ) { return ex_put_elem_cmap(neid, map_id, elem_ids, side_ids, proc_ids, processor); } int ne_get_idx(int neid, /* NetCDF/Exodus file ID */ const char *ne_var_name, /* Nemesis index variable name */ int64_t *index, /* array of length 2 to hold results */ int pos /* position of this proc/cmap in index */ ) { return ex_get_idx(neid, ne_var_name, index, pos); }