Codebase list libcgns / 1bcf999
Update upstream source from tag 'upstream/4.2.0' Update to upstream version '4.2.0' with Debian dir a7703fe857af4ccbb62a1c6c4f4cbaa623ea5ea3 Gilles Filippini 2 years ago
92 changed file(s) with 9239 addition(s) and 3721 deletion(s). Raw diff Collapse all Expand all
0 osx_image: xcode8.1
10 dist: xenial
21 language: C
32 sudo: required
2120 sudo apt-get install -qq mpich;
2221 sudo apt-get install -qq libgl1-mesa-glx libglu1-mesa-dev libxmu-dev tk-dev tcl-dev;
2322 fi
24 - test $(uname) = "Darwin" && brew update || true
25 - test $(uname) = "Darwin" && brew tap homebrew/versions || true
26 - test $(uname) = "Darwin" && brew install gcc@6 || true
27 - test $(uname) = "Darwin" && brew link --overwrite gcc@6 || true
2823
2924 matrix:
3025 include:
3126 - os: linux
3227 compiler: gcc
3328 install: export CC="mpicc" export FC="mpif90" export F77="mpif90"
34 - os: osx
35 compiler: gcc
36 install: export CC="gcc" export FC="gfortran-6" export F77="gfortran-6"
3729
3830 before_script:
3931 - ./bin/install-hdf.sh
0 cmake_minimum_required(VERSION 2.8)
0 cmake_minimum_required(VERSION 3.8)
11 if(COMMAND cmake_policy)
22 cmake_policy(SET CMP0003 NEW)
33 endif(COMMAND cmake_policy)
44
5 if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10")
6 cmake_policy(SET CMP0015 NEW)
7 endif()
8 if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
9 cmake_policy(SET CMP0081 NEW)
10 endif()
11
512 set(CMAKE_BUILD_TYPE "Release" CACHE STRING
613 "one of: Release, Debug, RelWithDebInfo or MinSizeRel")
7 if (${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
8 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release;Debug;RelWithDebInfo;MinSizeRel")
9 endif (${CMAKE_MAJOR_VERSION} GREATER 2 OR ${CMAKE_MINOR_VERSION} GREATER 7)
1014
1115 project("cgns" C)
12 set(CGNS_VERSION "4.1")
16
17 # Determine CGNS_VERSION from src/cgnslib.h for
18 file (READ ${PROJECT_SOURCE_DIR}/src/cgnslib.h _cgnslib_h_contents)
19 string (REGEX REPLACE ".*#define[ \t]+CGNS_DOTVERS[ \t]+([0-9]*)\\.([0-9])[0-9]*.*$"
20 "\\1.\\2" CGNS_VERSION ${_cgnslib_h_contents})
1321
1422 # Allow for building a package
1523 set(CPACK_PACKAGE_VERSION "${CGNS_VERSION}")
3745
3846 # get some type sizes
3947 include(CheckTypeSize)
40 CHECK_TYPE_SIZE(long SIZE_OF_LONG)
41 CHECK_TYPE_SIZE(off_t SIZE_OF_OFF_T)
42
43 if ("${SIZE_OF_OFF_T}" LESS 8)
48 CHECK_TYPE_SIZE(long SIZEOF_LONG)
49 CHECK_TYPE_SIZE(off_t SIZEOF_OFF_T)
50
51 if ("${SIZEOF_OFF_T}" LESS 8)
4452 option(CGNS_ENABLE_LFS "Enable or disable large file support" "OFF")
45 endif ("${SIZE_OF_OFF_T}" LESS 8)
53 endif ("${SIZEOF_OFF_T}" LESS 8)
4654
4755 if ("${CMAKE_SIZEOF_VOID_P}" GREATER 4)
48 option(CGNS_ENABLE_64BIT "Enable or disable 64-bit code building" "OFF")
56 option(CGNS_ENABLE_64BIT "Enable or disable 64-bit code building" "ON")
4957 else ("${CMAKE_SIZEOF_VOID_P}" GREATER 4)
5058 set(CGNS_ENABLE_64BIT "OFF")
5159 endif ("${CMAKE_SIZEOF_VOID_P}" GREATER 4)
5462 option(CGNS_ENABLE_SCOPING "Enable or disable scoping of enumeration values" "OFF")
5563 option(CGNS_ENABLE_BASE_SCOPE "Enable or disable base scoped families or connectivities" "OFF")
5664 option(CGNS_ENABLE_MEM_DEBUG "Enable or disable memory debugging" "OFF")
65
66 set(CGNS_BUILD_SHARED "ON" CACHE BOOL "Build a shared version of the library")
5767
5868 if (CGNS_ENABLE_LEGACY)
5969 set(CGNS_ENABLE_64BIT "OFF")
106116
107117 # If we are using fortran, enable it and configure the C-Fortran interface
108118 # It would be nice to automatically detect this setting
109
110119 if(CGNS_ENABLE_FORTRAN)
111
112 enable_language("Fortran" OPTIONAL)
113
114 #-----------------------------------------------------------------------------
115 # Detect name mangling convention used between Fortran and C
116 #-----------------------------------------------------------------------------
117
120 enable_language("Fortran" OPTIONAL)
121
122 #-----------------------------------------------------------------------------
123 # Detect name mangling convention used between Fortran and C
124 #-----------------------------------------------------------------------------
118125 set(F2CLIST "LOWERCASE" "LOWERCASE_" "LOWERCASE__" "UPPERCASE" "UPPERCASE_" "UPPERCASE__")
119126 set(FORTRAN_NAMING_HELP
120127 "Configures how to link the Fortran components into the C library.
142149 file(REMOVE ${CMAKE_BINARY_DIR}/FCMangle.h)
143150
144151 if(CGNS_FC_FUNC MATCHES "^NAME(.*)")
145 set (FORTRAN_NAMING "UPPERCASE")
152 set (FORTRAN_NAMING "UPPERCASE")
146153 elseif(CGNS_FC_FUNC MATCHES "^name(.*)")
147 set (FORTRAN_NAMING "LOWERCASE")
154 set (FORTRAN_NAMING "LOWERCASE")
148155 endif()
149156 if(CGNS_FC_FUNC MATCHES "(.*)__$")
150 set (FORTRAN_NAMING "${FORTRAN_NAMING}__")
157 set (FORTRAN_NAMING "${FORTRAN_NAMING}__")
151158 elseif(CGNS_FC_FUNC MATCHES "(.*)_$")
152 set (FORTRAN_NAMING "${FORTRAN_NAMING}_")
159 set (FORTRAN_NAMING "${FORTRAN_NAMING}_")
153160 endif()
154161
155162 message(STATUS "Fortran name mangling convention: ${FORTRAN_NAMING}")
156163
157 # check that FORTRAN_NAMING is valid
164 # check that FORTRAN_NAMING is valid
158165 if (FORTRAN_NAMING STREQUAL "UNKNOWN")
159166 if (WIN32)
160167 set(FORTRAN_NAMING "UPPERCASE" CACHE STRING ${FORTRAN_NAMING_HELP})
176183 UPPERRCASE__")
177184 endif (ListIndex LESS 0)
178185 endif (FORTRAN_NAMING STREQUAL "UNKNOWN")
186
187 if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
188 SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
189 endif()
190
191 # Warn about a gfortran 10.2.0 bug (GCC Bug 100149) which
192 # causes cg_goto_f to segfault, other versions are fine.
193 if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
194 CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER "10.1" AND
195 CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "10.3")
196 message (WARNING "Fortran mapping (cg_goto_f) is broken for the specified gfortran version.
197 !!! IT'S ADVISABLE TO AVOID VERSION 10.2 !!!")
198 endif()
199
179200 endif (CGNS_ENABLE_FORTRAN)
180201
181202 # this forces cmake to set up the required Fortran variables
194215 set (FIND_HDF_COMPONENTS C shared)
195216 else (CGNS_BUILD_SHARED)
196217 set (FIND_HDF_COMPONENTS C static)
218 set(HDF5_USE_STATIC_LIBRARIES ON)
197219 endif (CGNS_BUILD_SHARED)
198220 message (STATUS "HDF5 find comps: ${FIND_HDF_COMPONENTS}")
199221
200 #set (SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
201222 set (SEARCH_PACKAGE_NAME "hdf5")
223
224 # If the first `find_package` below does not succeed, then the legacy `find_package`
225 # is tried (the `else` below). The legacy find_package uses `HDF5_ROOT`. But if
226 # this is set, then CMake will issue warning and mistakenly say that `HDF5_ROOT` is
227 # not used even though it might be. This can confuse user, so set policy to not
228 # issue that warning.
229 if (${CMAKE_VERSION} VERSION_GREATER "3.13")
230 cmake_policy(SET CMP0074 NEW)
231 endif()
202232
203233 find_package (HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS ${FIND_HDF_COMPONENTS})
204234 message (STATUS "HDF5 C libs:${HDF5_FOUND} static:${HDF5_static_C_FOUND} and shared:${HDF5_shared_C_FOUND}")
205235 if (HDF5_FOUND)
206 add_executable (h5dump IMPORTED)
207236 if (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
208237 set (FIND_HDF_COMPONENTS C)
209238
215244 else (HDF5_BUILD_SHARED_LIBS)
216245 add_definitions (-DH5_BUILT_AS_STATIC_LIB)
217246 endif (HDF5_BUILD_SHARED_LIBS)
218 if (BUILD_SHARED_LIBS AND WIN32)
219 set_property (TARGET h5dump PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dumpdll")
220 else (BUILD_SHARED_LIBS AND WIN32)
221 set_property (TARGET h5dump PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dump")
222 endif (BUILD_SHARED_LIBS AND WIN32)
223247 else (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
224 if (BUILD_SHARED_LIBS AND HDF5_shared_C_FOUND)
248 if (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
225249 set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_SHARED_LIBRARY})
226 else (HDF5_static_C_FOUND)
250 else (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
227251 set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_STATIC_LIBRARY})
228 endif (BUILD_SHARED_LIBS AND HDF5_shared_C_FOUND)
229 set_property (TARGET h5dump PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dump")
252 endif (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
230253 endif (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
231 set (HDF5_DUMP_EXECUTABLE $<TARGET_FILE:h5dump>)
232
233 set (HDF5_HAVE_H5PUBCONF_H 1)
234 set (HDF5_HAVE_HDF5 1)
235 set (HDF5_HDF5_HEADER "h5pubconf.h")
236 set (HDF5_INCLUDE_DIR_GEN ${HDF5_INCLUDE_DIR})
237 message (STATUS "HDF5-${HDF5_VERSION_STRING} found: INC=${HDF5_INCLUDE_DIR} TOOLS=${HDF5_TOOLS_DIR}")
254
238255 else (HDF5_FOUND)
239256 find_package (HDF5) # Legacy find
240 #Legacy find_package does not set HDF5_TOOLS_DIR, so we set it here
241 set(HDF5_TOOLS_DIR ${HDF5_LIBRARY_DIRS}/../bin)
242 #Legacy find_package does not set HDF5_BUILD_SHARED_LIBS, so we set it here
243 if (CGNS_BUILD_SHARED AND EXISTS "${HDF5_LIBRARY_DIRS}/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}")
257
258 #Legacy find_package does not set HDF5_TOOLS_DIR, so we set it here
259 set(HDF5_TOOLS_DIR ${HDF5_LIBRARY}/../bin)
260
261 #Legacy find_package does not set HDF5_BUILD_SHARED_LIBS, so we set it here
262 if (CGNS_BUILD_SHARED AND EXISTS "${HDF5_LIBRARY}/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}")
244263 set (HDF5_BUILD_SHARED_LIBS 1)
245264 add_definitions (-DH5_BUILT_AS_DYNAMIC_LIB)
246265 else ()
249268 endif ()
250269 set (LINK_LIBS ${LINK_LIBS} ${HDF5_LIBRARIES})
251270
252 add_executable (h5dump IMPORTED)
253 set_property (TARGET h5dump PROPERTY IMPORTED_LOCATION "${HDF5_TOOLS_DIR}/h5dump")
254 set (HDF5_DUMP_EXECUTABLE $<TARGET_FILE:h5dump>)
255271 endif (HDF5_FOUND)
256272 set (HDF5_PACKAGE_NAME ${SEARCH_PACKAGE_NAME})
257273
258274 if (HDF5_FOUND)
275 if (NOT DEFINED HDF5_INCLUDE_DIRS)
276 set (HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
277 endif()
259278 set (HDF5_HAVE_H5PUBCONF_H 1)
260279 set (HDF5_HAVE_HDF5 1)
261280 set (HDF5_HDF5_HEADER "h5pubconf.h")
262 set (HDF5_INCLUDE_DIR_GEN ${HDF5_INCLUDE_DIR})
263 message (STATUS "HDF5-${HDF5_VERSION_STRING} found: INC=${HDF5_INCLUDE_DIR} TOOLS=${HDF5_TOOLS_DIR} HDF5_BUILD_SHARED_LIBS=${HDF5_BUILD_SHARED_LIBS}")
264 INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIR})
281 message (STATUS "HDF5-${HDF5_VERSION} found: INC=${HDF5_INCLUDE_DIRS} TOOLS=${HDF5_TOOLS_DIR} HDF5_BUILD_SHARED_LIBS=${HDF5_BUILD_SHARED_LIBS}")
282 INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIRS})
265283 set (HDF5_LIBRARY ${LINK_LIBS})
266284 message (STATUS "HDF5 link libs: ${LINK_LIBS}")
267285 else (HDF5_FOUND)
276294 mark_as_advanced(FORCE ZLIB_LIBRARY)
277295 endif(HDF5_NEED_ZLIB)
278296
279 set(HDF5_NEED_SZIP "OFF" CACHE BOOL "Does the HDF5 library require linking to zlib?")
297 set(HDF5_NEED_SZIP "OFF" CACHE BOOL "Does the HDF5 library require linking to szip?")
280298 if (HDF5_NEED_SZIP)
281299 find_library(SZIP_LIBRARY szip)
282300 mark_as_advanced(CLEAR SZIP_LIBRARY)
325343 endif (CGNS_ENABLE_HDF5)
326344
327345 #################
328 # parallel cgns #
346 # Parallel CGNS #
329347 #################
330348
331349 if (CGNS_ENABLE_HDF5 AND HDF5_NEED_MPI)
333351 mark_as_advanced(CLEAR CGNS_ENABLE_PARALLEL)
334352 # Check that HDF5 has parallel support
335353 if (NOT (HDF5_IS_PARALLEL OR HDF5_ENABLE_PARALLEL))
336 message(FATAL_ERROR "HDF5 has been found, but is missing parallel support.")
354 message(FATAL_ERROR "HDF5 has been found, but is missing parallel support.")
337355 endif()
338356 else (CGNS_ENABLE_HDF5 AND HDF5_NEED_MPI)
339357 set(CGNS_ENABLE_PARALLEL "OFF")
360378 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
361379
362380 IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
363 set(CMAKE_MACOSX_RPATH TRUE)
381 set(CMAKE_MACOSX_RPATH TRUE)
364382 ENDIF()
365383 else(CGNS_BUILD_SHARED)
366 set(CMAKE_SKIP_RPATH TRUE)
384 set(CMAKE_SKIP_RPATH TRUE)
367385 endif(CGNS_BUILD_SHARED)
368386
369387 #-----------------------------------------------------------------------------
371389 #-----------------------------------------------------------------------------
372390 option (CGNS_BUILD_TESTING "Build CGNS Testing" OFF)
373391 if (CGNS_BUILD_TESTING)
374 set (DART_TESTING_TIMEOUT 1200
375 CACHE INTEGER
392 set (DART_TESTING_TIMEOUT "1200"
393 CACHE STRING
376394 "Timeout in seconds for each test (default 1200=20minutes)"
377395 )
378396 enable_testing ()
380398 include (${PROJECT_SOURCE_DIR}/CTestConfig.cmake)
381399 endif (CGNS_BUILD_TESTING)
382400
383
384
385401 ########
386402 # CGNS #
387403 ########
3636 - If HDF5 is built with `zlib` and `szip` support, these need to be flagged with `HDF5_NEEDS_ZLIB` and `HDF5_NEEDS_SZIP` as well as the paths for those libraries.
3737 - Fortran can be enabled by toggling the `CGNS_ENABLE_FORTRAN` variable.
3838 - A view of the attempt to autodetect the correct interface between Fortran and C is show, setting the value of `FORTRAN_NAMING`.
39 - For `gfortran` and `pgf90` the value of `FORTRAN_NAMING` shoud be `LOWERCASE_`.
40 - The build system must be reconfigured after variable changes by pressing `c`. Variables who's value has changed are maked with a `*` in the interface.
39 - For `gfortran` and `pgf90` the value of `FORTRAN_NAMING` should be `LOWERCASE_`.
40 - The build system must be reconfigured after variable changes by pressing `c`. Variables who's value has changed are marked with a `*` in the interface.
4141 - After configuration, the `Makefile`s must be generated by pressing `g`.
4242 6. Use `make` to build the library.
4343 ```shell
5555 1. Install HDF5 on your system.
5656 - HDF5 can use the standard GNU autotools, so `./configure`, `make`, `sudo make install` should install HDF5 without problems on most systems.
5757 2. Typically the standard `./configure`, `make`, `make install` will suffice.
58 3. Sample scripts for building parrallel CGNS can be found in `src/SampleScripts`.
58 3. Sample scripts for building parallel CGNS can be found in `src/SampleScripts`.
5959
6060 ## Usage
6161
8787
8888 http://www.opensource.org/licenses/zlib-license.php
8989
90 and supercedes the GNU Lesser General Public License (LGPL) which
90 and supersedes the GNU Lesser General Public License (LGPL) which
9191 previously governed the use and distribution of the software.
9292
9393 For details on the policy governing the distribution of the CGNS
101101 http://nvie.com/posts/a-successful-git-branching-model/
102102
103103
104 ![image](https://github.com/CGNS/cgns.github.io/blob/master/git-model.png)
104 ![image](https://github.com/CGNS/cgns.github.io/blob/master/git-model.png)
88 #---------------------------------#
99
1010 # version format
11 version: 4.1.{build}
11 version: 4.2.{build}
1212
13 image:
14 - Visual Studio 2017
15 - Visual Studio 2019
16
1317 # branches to build
1418 branches:
1519 # whitelist
2630 #---------------------------------#
2731 # environment configuration #
2832 #---------------------------------#
29
3033 environment:
3134 global:
3235 1_8: &1_8 1.8.21
33 1_10: &1_10 1.10.5
36 1_10: &1_10 1.10.6
37 1_12: &1_12 1.12.0
3438 HDF5_1_8_VER: *1_8
3539 HDF5_1_10_VER: *1_10
40 HDF5_1_12_VER: *1_12
3641 matrix:
3742 - build_opt: -D CGNS_BUILD_SHARED:BOOL=OFF -D CGNS_USE_SHARED:BOOL=OFF -D CGNS_ENABLE_64BIT:BOOL=OFF
3843 HDF5_VER: *1_8
4045 - build_opt: -D CGNS_BUILD_SHARED:BOOL=OFF -D CGNS_USE_SHARED:BOOL=OFF -D CGNS_ENABLE_64BIT:BOOL=ON
4146 HDF5_VER: *1_10
4247 HDF_DIR: "/Program Files/HDF_Group/HDF5/%HDF5_VER%/cmake"
48 - build_opt: -D CGNS_BUILD_SHARED:BOOL=ON -D CGNS_USE_SHARED:BOOL=ON -D CGNS_ENABLE_64BIT:BOOL=ON
49 HDF5_VER: *1_10
50 HDF_DIR: "/Program Files/HDF_Group/HDF5/%HDF5_VER%/cmake"
51 - build_opt: -D CGNS_BUILD_SHARED:BOOL=OFF -D CGNS_USE_SHARED:BOOL=OFF -D CGNS_ENABLE_64BIT:BOOL=ON
52 HDF5_VER: *1_12
53 HDF_DIR: "/Program Files/HDF_Group/HDF5/%HDF5_VER%/cmake"
54 - build_opt: -D CGNS_BUILD_SHARED:BOOL=ON -D CGNS_USE_SHARED:BOOL=ON -D CGNS_ENABLE_64BIT:BOOL=ON
55 HDF5_VER: *1_12
56 HDF_DIR: "/Program Files/HDF_Group/HDF5/%HDF5_VER%/cmake"
4357
44 # Operating system (build VM template)
45 os: Visual Studio 2015
58 for:
59 -
60 matrix:
61 only:
62 - image: Visual Studio 2019
63 environment:
64 GENERATOR: "Visual Studio 16 2019"
65 ARCH: "x64"
66 -
67 matrix:
68 only:
69 - image: Visual Studio 2017
70 environment:
71 GENERATOR: "Visual Studio 15 2017"
72 ARCH: "x64"
4673
4774 # scripts that are called at very beginning, before repo cloning
4875 init:
6693 - mkdir 1.8
6794 - cd 1.8
6895 - set HDF5_1_8_VER=%HDF5_1_8_VER%
69 - curl -O https://gamma.hdfgroup.org/ftp/pub/outgoing/QATEST/hdf518/relbinaries/windows/hdf5-%HDF5_1_8_VER%-Std-win10_64-vs14.zip
70 - ps: Expand-Archive hdf5-$($env:HDF5_1_8_VER)-Std-win10_64-vs14.zip -DestinationPath .
96 - curl -O https://gamma.hdfgroup.org/ftp/pub/outgoing/QATEST/hdf518/relbinaries/windows/hdf5-%HDF5_1_8_VER%-Std-win10_64-vs16.zip
97 - ps: Expand-Archive hdf5-$($env:HDF5_1_8_VER)-Std-win10_64-vs16.zip -DestinationPath .
7198 - cd hdf
7299 - msiexec /i HDF5-%HDF5_1_8_VER%-win64.msi /quiet /qn /norestart /log install.log
73100 - type install.log
75102 - mkdir 1.10
76103 - cd 1.10
77104 - set HDF5_1_10=%HDF5_1_10_VER%
78 - curl -O https://gamma.hdfgroup.org/ftp/pub/outgoing/QATEST/hdf5110/relbinaries/windows/hdf5-%HDF5_1_10_VER%-Std-win10_64-vs14.zip
79 - ps: Expand-Archive hdf5-$($env:HDF5_1_10_VER)-Std-win10_64-vs14.zip -DestinationPath .
105 - curl -O https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.6/bin/hdf5-%HDF5_1_10_VER%-Std-win10_64-vs16.zip
106 - ps: Expand-Archive hdf5-$($env:HDF5_1_10_VER)-Std-win10_64-vs16.zip -DestinationPath .
80107 - cd hdf
81108 - msiexec /i HDF5-%HDF5_1_10_VER%-win64.msi /quiet /qn /norestart /log install.log
109 - type install.log
110 - cd ..\..
111 - mkdir 1.12
112 - cd 1.12
113 - set HDF5_1_12=%HDF5_1_12_VER%
114 - curl -O https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/bin/hdf5-%HDF5_1_12_VER%-Std-win10_64-vs16.zip
115 - ps: Expand-Archive hdf5-$($env:HDF5_1_12_VER)-Std-win10_64-vs16.zip -DestinationPath .
116 - cd hdf
117 - msiexec /i HDF5-%HDF5_1_12_VER%-win64.msi /quiet /qn /norestart /log install.log
82118 - type install.log
83119 - cd ..\..
84120
105141 - cd c:\projects\CGNS_BUILD
106142 - cmake --version
107143 - SET HDF5_DIR=/Program Files/HDF_Group/HDF5/%HDF5_VER%/cmake
108 - cmake -G "Visual Studio 14 Win64" ^
144 - cmake -G "%GENERATOR%" -A "%ARCH%" ^
109145 %build_opt% ^
110146 -D CMAKE_C_FLAGS:STRING="" ^
111147 -D CMAKE_BUILD_TYPE:STRING=Release ^
124160 - cmd: cmake --build . --config "%configuration%"
125161
126162 test_script:
163 - cmd: set PATH=C:\projects\CGNS_BUILD\src\%configuration%;%PATH%
164 - cmd: set PATH=C:\Program Files\HDF_Group\HDF5\%HDF5_VER%\bin;%PATH%
127165 - cmd: ctest .
166
167 after_test:
168 - cmd: cmake --install . --config "%configuration%"
1818 --with-hdf5=$HOME/hdf5 \
1919 --with-fortran \
2020 --enable-lfs \
21 --enable-64bit \
2221 --disable-shared \
23 --enable-debug \
24 --enable-64bit
22 --enable-debug
2523
2624
2725
2826
27
00 #!/bin/sh
11
22 # Set odd/even days of the week
3 day=$(( $(date +%d) % 2 ))
3 day=$(( $(date +%e) % 2 ))
4
45
56 if [ $day -eq 0 ]; then #even day tests, HDF5 1.8 branch
67
78 HDF5_VER="hdf5_1_8"
8 OPTS=""
99
1010 else #odd day tests, HDF5 develop branch
1111
12 OPTS="--disable-tools --disable-tests"
1213 HDF5_VER="develop"
13 OPTS="--disable-tools --disable-tests"
1414
1515 fi
1616
2424
2525 http://www.opensource.org/licenses/zlib-license.php
2626
27 and supercedes the GNU Lesser General Public License (LGPL) which
27 and supersedes the GNU Lesser General Public License (LGPL) which
2828 previously governed the use and distribution of the software.
2929
3030 For details on the policy governing the distribution of the CGNS
0 CGNS version 4.2.0
1 =================================
2
3 INTRODUCTION
4 ------------
5
6 This document describes the difference between CGNS 4.1.2 and
7 CGNS 4.2.0 and contains information on known problems in
8 CGNS 4.2.0.
9
10 Links to the CGNS current released source code can be found at:
11
12 http://cgns.org/download.html
13
14 User documentation for the current release can be found at:
15
16 http://cgns.org/CGNS_docs_current/midlevel/index.html
17
18 For more information, see the CGNS home page:
19
20 http://cgns.org
21
22 CONTENTS
23 --------
24
25 - New Features
26 - Support for new platforms and languages
27 - Bug Fixes since CGNS 4.1.2
28 - Known Problems
29
30 New Features
31 ============
32
33 Configuration:
34 -------------
35 * The default was changed from 32-bit to 64-bit building of CGNS, PR#216
36 * The minimum CMake version was changed to 3.8.
37
38 Library:
39 --------
40 * New C and Fortran APIs that allows for reading/writing datatypes
41 that are different from cgsize_t:
42 cg_section_general_write(_f)
43 cg_section_initialize(_f)
44 cg_parent_data_write(_f)
45 cg_elements_general_write(_f)
46 cg_poly_elements_general_write(_f)
47 cg_elements_general_read(_f)
48 cg_poly_elements_general_read(_f)
49 cg_parent_elements_general_read(_f)
50 cg_parent_elements_position_general_read(_f)
51 CGNS-212
52 * Added a diskless option for creating a CGNS file in memory
53 (i.e. uses HDF5 "core" file driver), and then to optionally
54 persist the memory to disk. Enablable through cg_configure.
55 CGNS-239
56 * Mapping of X4/X8 was lost when moving from ADF to HDF5.
57 This fix reintroduces it as an experimental feature.
58 It uses an H5T_COMPOUND and is compatible with the standard C99 complex type.
59
60 Depending on the application, people can still store each part of a complex number
61 in separate arrays by prefixing with Re or Im the name of the array, CGNS-202
62
63 Parallel Library:
64 -----------------
65 * Tuned the parallel library algorithms to improve metadata type operations, PR#238,#236
66
67 Fortran Library:
68 ----------------
69 * Add Fortran wrapper for cg_configure, CGNS-243
70
71 Tools:
72 ------
73 * Experimental support for conversion of FamilySpecified BC for AFLR3 file format, PR#247
74 * Added check on node names according to SIDS (check that dot and slash are not at
75 the start of the name, see:https://cgns.github.io/CGNS_docs_current/hdf5/general.html) and
76 added warning if ZoneBC_t is missing while zone surfaces are present in a 3D mesh.
77
78
79 Bug Fixes since CGNS 4.1.2 release
80 ==================================
81
82 Library:
83 -------
84 * Fixed test_convert_elem failing with NAG 7.0 and gcc 10, CGNS-231
85 * Fixed cg_configure always reporting a false error
86 when using adfh parameters, CGNS-241
87 * Made the parameter CG_MODE_CLOSED private since it only
88 used internally, CGNS-240
89 * Fixed an issue with too many MPI communicators being created when
90 many CGNS files are open, CGNS-109
91 * Fixed issue of cg_open failing after calling cgp_open, CGNS-141
92 * Fixed MPI_Recv in test_poly_unstructured, PR#224
93 * Fixed MPI_Allgather in test_poly_unstructured #223
94 * VS 2019 issues: Fixed shared library builds on windows,
95 Rearranged header files, fixed #if/#ifdef bug, PR#208
96 * Misc. compiler issues and added check C99 Complex support
97 at compile time to enable it, PR#202
98 * Fixed cgio_copy_node() failing with INVALID_DATA_TYPE error
99 when HDF5 backend is employed, PR#198
100
101 Fortran:
102 --------
103 * Fixed test cgread_f03 failing for arch ppc64el, CGNS-179
104 * Fixed "Fortran types mismatch between actual argument" errors
105 with gfortran 10.x, CGNS-227
106
107 Configuration:
108 -------------
109 * Fixed configure issues with tcl, tk, CGNS-147
110 * Fixed build failures with HDF 1.10.3, CGNS-143
111 * Removed zlib and szip header checks when linking directory is provided
112 removed header checking for standard locations, CGNS-233
113 * Added warning about using gfortran 10.2 as a result of a compiler
114 bug, CGNS-246
115
116
117 Tools:
118 ------
119 * Fixed issue with cgnstools not being able to read hdf5 files, CGNS-203
120 * Fixed cgnscheck's strange warning about non-boundary elements, CGNS-234
121 * Added cgnscheck a warning for BC that should be of type FamilySpecified, PR#206
122 * Added .desktop startup files for GUI cgnstools, PR#200
123 * Allow relocation of cgnstools dir, PR#199
124
125 Known Problems
126 ==============
127
128 ************ FORTRAN ************
129
130 * A gfortran bug in version 10.2 broke Fortran mapping and caused cg_goto_f
131 to segfault. All other versions of gfortran are suitable.
132 (ref. CGNS-246, GNU BUG 100149)
133
134 * A bug in gfortran (all versions) causes cg_configure_f to fail,
135 GNU BUG 99982. Other Fortran compilers are fine.
136
137 ************ FORTRAN END ********
138
139 ************ CGNSVIEW ************
140
141 * cgnsview for OSX is not viewing properly and cgnsview under Windows
142 may fail to compile due to tcl/tk incompatibility.
143
144 ************ CGNSVIEW END ********
145
146 * For other issues, see https://cgnsorg.atlassian.net
147
148 Supported Platforms
149 ===================
150 The following platforms are supported and have been tested for this release.
151 They are built with the configure process unless specified otherwise.
152
153 Linux 3.10.0-1127.10.1.el7 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
154 #1 SMP ppc64 GNU/Linux g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
155 (echidna) GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
156
157 Linux 2.6.32-573.18.1.el6 IBM XL C/C++ V13.1
158 #1 SMP ppc64 GNU/Linux IBM XL Fortran V15.1
159 (ostrich)
160
161 Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++)
162 #1 SMP x86_64 GNU/Linux compilers:
163 (jelly/kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-39)
164 Versions 4.9.3, 5.3.0, 6.3.0, 7.2.0
165 8.3.0, 9.1.0, 10.1.0
166 Intel(R) C (icc), C++ (icpc), Fortran (icc)
167 compilers:
168 Version 17.0.0.098 Build 20160721
169 MPICH 3.3 compiled with GCC 7.2.0
170 OpenMPI 4.0.0 compiled with GCC 7.2.0
171 NAG Fortran Compiler Release 7.0(Yurakuchho) Build 7011
172
173 SunOS 5.11 11.4.5.12.5.0 Sun C 5.15 SunOS_sparc 2017/05/30
174 32- and 64-bit Studio 12.6 Fortran 95 8.8 SunOS_sparc 2017/05/30
175 (hedgehog) Sun C++ 5.15 SunOS_sparc 2017/05/30
176
177 Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
178 Visual Studio 2017 w/ Intel Fortran 19 (cmake)
179 Visual Studio 2019 w/ Intel Fortran 19 (cmake)
180 Visual Studio 2019 w/ MSMPI 10.1 (cmake)
181
182 macOS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang-1000.10.44.4)
183 64-bit gfortran GNU Fortran (GCC) 6.3.0
184 (bear) Intel icc/icpc/ifort version 19.0.4.233 20190416
185
186 macOS Mojave 10.14.6 Apple LLVM version 10.0.1 (clang-1001.0.46.4)
187 64-bit gfortran GNU Fortran (GCC) 6.3.0
188 (bobcat) Intel icc/icpc/ifort version 19.0.4.233 20190416
189
190 Tested Configuration Features Summary
191 =====================================
192
193 In the table below
194 y = tested
195 n = not tested in this release
196 x = not working in this release
197
198 | Platform | C | C[1] | Fortran | Fortran [1]|
199 |--------------------------------------|---|------|---------|------------|
200 | SunOS 5.11 32-bit | y | n | y | n |
201 | SunOS 5.11 64-bit | y | n | y | n |
202 | Windows 10 | y | n | n | n |
203 | Windows 10 x64 | y | n | n | n |
204 | Windows 10 Cygwin | n | n | x | n |
205 | Mac OS X El Capitan 10.11.6 64-bit | y | n | y | n |
206 | Mac OS Sierra 10.12.6 64-bit | y | n | y | n |
207 | Mac OS X High Sierra 10.13.6 64-bit | y | n | y | n |
208 | Mac OS X Mojave 10.14.6 64-bit | y | n | y | n |
209 | CentOS 7.2 Linux 3.10.0 x86_64 PGI | y | n | y | n |
210 | CentOS 7.2 Linux 3.10.0 x86_64 GNU | y | y | y | y |
211 | CentOS 7.2 Linux 3.10.0 x86_64 Intel | y | y | y | y |
212 | Linux 2.6.32-573.18.1.el6.ppc64 | y | n | y | n |
213
214 [1] Parallel
215
0216 CGNS version 4.1.2 (patch)
1217 =================================
2218
0 CGNS version 4.1.2 (patch)
0 CGNS version 4.2.0
11 =================================
22
33 INTRODUCTION
44 ------------
55
66 This document describes the difference between CGNS 4.1.2 and
7 CGNS 4.1.2, and contains information on known problems in
8 CGNS 4.1.2.
7 CGNS 4.2.0 and contains information on known problems in
8 CGNS 4.2.0.
99
1010 Links to the CGNS current released source code can be found at:
1111
2424
2525 - New Features
2626 - Support for new platforms and languages
27 - Bug Fixes since CGNS 4.1.1
27 - Bug Fixes since CGNS 4.1.2
2828 - Known Problems
2929
3030 New Features
3232
3333 Configuration:
3434 -------------
35 * The default was changed from 32-bit to 64-bit building of CGNS, PR#216
36 * The minimum CMake version was changed to 3.8.
3537
3638 Library:
3739 --------
40 * New C and Fortran APIs that allows for reading/writing datatypes
41 that are different from cgsize_t:
42 cg_section_general_write(_f)
43 cg_section_initialize(_f)
44 cg_parent_data_write(_f)
45 cg_elements_general_write(_f)
46 cg_poly_elements_general_write(_f)
47 cg_elements_general_read(_f)
48 cg_poly_elements_general_read(_f)
49 cg_parent_elements_general_read(_f)
50 cg_parent_elements_position_general_read(_f)
51 CGNS-212
52 * Added a diskless option for creating a CGNS file in memory
53 (i.e. uses HDF5 "core" file driver), and then to optionally
54 persist the memory to disk. Enablable through cg_configure.
55 CGNS-239
56 * Mapping of X4/X8 was lost when moving from ADF to HDF5.
57 This fix reintroduces it as an experimental feature.
58 It uses an H5T_COMPOUND and is compatible with the standard C99 complex type.
59
60 Depending on the application, people can still store each part of a complex number
61 in separate arrays by prefixing with Re or Im the name of the array, CGNS-202
3862
3963 Parallel Library:
4064 -----------------
65 * Tuned the parallel library algorithms to improve metadata type operations, PR#238,#236
4166
4267 Fortran Library:
4368 ----------------
69 * Add Fortran wrapper for cg_configure, CGNS-243
4470
4571 Tools:
4672 ------
47
48 Bug Fixes since CGNS 4.1.1 release
73 * Experimental support for conversion of FamilySpecified BC for AFLR3 file format, PR#247
74 * Added check on node names according to SIDS (check that dot and slash are not at
75 the start of the name, see:https://cgns.github.io/CGNS_docs_current/hdf5/general.html) and
76 added warning if ZoneBC_t is missing while zone surfaces are present in a 3D mesh.
77
78
79 Bug Fixes since CGNS 4.1.2 release
4980 ==================================
5081
5182 Library:
5283 -------
53
54 * (CGNS-214) Fixed the Compatibility issue between v3.4.0 and v4.1.1
55
56 * (CGNS-219) Change a wrong check in cg_poly_element_read to load
57 older CGNS file section with CGNS 4.x API
84 * Fixed test_convert_elem failing with NAG 7.0 and gcc 10, CGNS-231
85 * Fixed cg_configure always reporting a false error
86 when using adfh parameters, CGNS-241
87 * Made the parameter CG_MODE_CLOSED private since it only
88 used internally, CGNS-240
89 * Fixed an issue with too many MPI communicators being created when
90 many CGNS files are open, CGNS-109
91 * Fixed issue of cg_open failing after calling cgp_open, CGNS-141
92 * Fixed MPI_Recv in test_poly_unstructured, PR#224
93 * Fixed MPI_Allgather in test_poly_unstructured #223
94 * VS 2019 issues: Fixed shared library builds on windows,
95 Rearranged header files, fixed #if/#ifdef bug, PR#208
96 * Misc. compiler issues and added check C99 Complex support
97 at compile time to enable it, PR#202
98 * Fixed cgio_copy_node() failing with INVALID_DATA_TYPE error
99 when HDF5 backend is employed, PR#198
58100
59101 Fortran:
60102 --------
103 * Fixed test cgread_f03 failing for arch ppc64el, CGNS-179
104 * Fixed "Fortran types mismatch between actual argument" errors
105 with gfortran 10.x, CGNS-227
61106
62107 Configuration:
63108 -------------
109 * Fixed configure issues with tcl, tk, CGNS-147
110 * Fixed build failures with HDF 1.10.3, CGNS-143
111 * Removed zlib and szip header checks when linking directory is provided
112 removed header checking for standard locations, CGNS-233
113 * Added warning about using gfortran 10.2 as a result of a compiler
114 bug, CGNS-246
115
64116
65117 Tools:
66118 ------
119 * Fixed issue with cgnstools not being able to read hdf5 files, CGNS-203
120 * Fixed cgnscheck's strange warning about non-boundary elements, CGNS-234
121 * Added cgnscheck a warning for BC that should be of type FamilySpecified, PR#206
122 * Added .desktop startup files for GUI cgnstools, PR#200
123 * Allow relocation of cgnstools dir, PR#199
67124
68125 Known Problems
69126 ==============
70127
128 ************ FORTRAN ************
129
130 * A gfortran bug in version 10.2 broke Fortran mapping and caused cg_goto_f
131 to segfault. All other versions of gfortran are suitable.
132 (ref. CGNS-246, GNU BUG 100149)
133
134 * A bug in gfortran (all versions) causes cg_configure_f to fail,
135 GNU BUG 99982. Other Fortran compilers are fine.
136
137 ************ FORTRAN END ********
138
71139 ************ CGNSVIEW ************
72140
73 * cgnsview for OSX is not viewing properly, and cgnsview under Windows
74 * may fail to compile due to tcl/tk incompatibility.
75
76 **********************************
77
78 * For other issues, See https://cgnsorg.atlassian.net
141 * cgnsview for OSX is not viewing properly and cgnsview under Windows
142 may fail to compile due to tcl/tk incompatibility.
143
144 ************ CGNSVIEW END ********
145
146 * For other issues, see https://cgnsorg.atlassian.net
79147
80148 Supported Platforms
81149 ===================
82150 The following platforms are supported and have been tested for this release.
83151 They are built with the configure process unless specified otherwise.
84152
85 Linux 2.6.32-696.16.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
86 #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
87 (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
88 IBM XL C/C++ V13.1
89 IBM XL Fortran V15.1
90
91 Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++)
153 Linux 3.10.0-1127.10.1.el7 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
154 #1 SMP ppc64 GNU/Linux g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
155 (echidna) GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
156
157 Linux 2.6.32-573.18.1.el6 IBM XL C/C++ V13.1
158 #1 SMP ppc64 GNU/Linux IBM XL Fortran V15.1
159 (ostrich)
160
161 Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++)
92162 #1 SMP x86_64 GNU/Linux compilers:
93 (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4)
94 Version 4.9.3, 5.2.0, 7.1.0
163 (jelly/kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-39)
164 Versions 4.9.3, 5.3.0, 6.3.0, 7.2.0
165 8.3.0, 9.1.0, 10.1.0
95166 Intel(R) C (icc), C++ (icpc), Fortran (icc)
96167 compilers:
97168 Version 17.0.0.098 Build 20160721
98 MPICH 3.1.4
99
100 Linux-3.10.0- spectrum-mpi/rolling-release with cmake>3.10 and
101 862.14.4.1chaos.ch6.ppc64le clang/3.9,8.0
102 #1 SMP ppc64le GNU/Linux gcc/7.3
103 (ray) xl/2016,2019
104
105 Linux 3.10.0- openmpi/3.1,4.0 with cmake>3.10 and
106 957.12.2.1chaos.ch6.x86_64 clang 5.0
107 #1 SMP x86_64 GNU/Linux gcc/7.3,8.2
108 (serrano) intel/17.0,18.0/19.0
109
110 Linux 3.10.0- openmpi/3.1/4.0 with cmake>3.10 and
111 1062.1.1.1chaos.ch6.x86_64 clang/3.9,5.0,8.0
112 #1 SMP x86_64 GNU/Linux gcc/7.3,8.1,8.2
113 (chama,quartz) intel/16.0,18.0,19.0
114
115 Linux 4.4.180-94.100-default cray-mpich/7.7.6 with PrgEnv-*/6.0.5, cmake>3.10 and
116 #1 SMP x86_64 GNU/Linux gcc/7.2.0,8.2.0
117 (mutrino) intel/17.0,18.0
118
119 Linux 4.14.0- spectrum-mpi/rolling-release with cmake>3.10 and
120 49.18.1.bl6.ppc64le clang/6.0,8.0
121 #1 SMP ppc64le GNU/Linux gcc/7.3
122 (lassen) xl/2019
123
124 SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc
125 (emu) Sun Fortran 95 8.6 SunOS_sparc
126 Sun C++ 5.12 SunOS_sparc
169 MPICH 3.3 compiled with GCC 7.2.0
170 OpenMPI 4.0.0 compiled with GCC 7.2.0
171 NAG Fortran Compiler Release 7.0(Yurakuchho) Build 7011
172
173 SunOS 5.11 11.4.5.12.5.0 Sun C 5.15 SunOS_sparc 2017/05/30
174 32- and 64-bit Studio 12.6 Fortran 95 8.8 SunOS_sparc 2017/05/30
175 (hedgehog) Sun C++ 5.15 SunOS_sparc 2017/05/30
127176
128177 Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
129178 Visual Studio 2017 w/ Intel Fortran 19 (cmake)
130179 Visual Studio 2019 w/ Intel Fortran 19 (cmake)
131
132 macOS 10.13.6 High Sierra Apple LLVM version 10.0.0 (clang/clang++-1000.10.44.4)
180 Visual Studio 2019 w/ MSMPI 10.1 (cmake)
181
182 macOS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang-1000.10.44.4)
133183 64-bit gfortran GNU Fortran (GCC) 6.3.0
134 (bear) Intel icc/icpc/ifort version 19.0.4
135
136 macOS 10.14.6 Mohave Apple LLVM version 10.0.1 (clang/clang++-1001.0.46.4)
184 (bear) Intel icc/icpc/ifort version 19.0.4.233 20190416
185
186 macOS Mojave 10.14.6 Apple LLVM version 10.0.1 (clang-1001.0.46.4)
137187 64-bit gfortran GNU Fortran (GCC) 6.3.0
138 (bobcat) Intel icc/icpc/ifort version 19.0.4
188 (bobcat) Intel icc/icpc/ifort version 19.0.4.233 20190416
139189
140190 Tested Configuration Features Summary
141191 =====================================
152202 | Windows 10 | y | n | n | n |
153203 | Windows 10 x64 | y | n | n | n |
154204 | Windows 10 Cygwin | n | n | x | n |
155 | Mac OS X 10.13.6 64-bit | y | n | y | n |
156 | Mac OS X 10.14.6 64-bit | y | n | y | n |
157 | CentOS 6.7 Linux 2.6.32 x86_64 GNU | y | y | y | y |
158 | CentOS 6.7 Linux 2.6.32 x86_64 Intel | y | y | y | y |
159 | CentOS 6.7 Linux 2.6.32 x86_64 PGI | y | n | y | n |
205 | Mac OS X El Capitan 10.11.6 64-bit | y | n | y | n |
206 | Mac OS Sierra 10.12.6 64-bit | y | n | y | n |
207 | Mac OS X High Sierra 10.13.6 64-bit | y | n | y | n |
208 | Mac OS X Mojave 10.14.6 64-bit | y | n | y | n |
209 | CentOS 7.2 Linux 3.10.0 x86_64 PGI | y | n | y | n |
160210 | CentOS 7.2 Linux 3.10.0 x86_64 GNU | y | y | y | y |
161211 | CentOS 7.2 Linux 3.10.0 x86_64 Intel | y | y | y | y |
162 | Linux 2.6.32-431.11.2.el6.ppc64 | y | n | y | n |
212 | Linux 2.6.32-573.18.1.el6.ppc64 | y | n | y | n |
163213
164214 [1] Parallel
0 1) handles hdf5 and adf transparently through new cgns_io interface
1
2 2) added PYRA_13 and NFACE_n element types
3
4 3) element data is no longer read into memory when the file is opened,
5 only when requested. John Bussoletti fix (also in 2.5 under CVS)
6
7 4) Robert Magnum correction for cg_model_read(). (also in 2.5 under CVS)
8
9 5) added to cgnslib:
10
11 /* file_type defines */
12 #define CG_FILE_NONE 0
13 #define CG_FILE_ADF 1
14 #define CG_FILE_HDF5 2
15 #define CG_FILE_XML 3
16
17 int cg_save_as(int fn, const char *filename, int file_type, int follow_links);
18 cg_save_as_f(fn, filename, file_type, follow_links, ier)
19
20 int cg_set_file_type(int file_type);
21 int cg_get_file_type(int fn, int *file_type);
22 cg_set_file_type_f(file_type, ier)
23 cg_get_file_type_f(fn, file_type, ier)
24
25 /* these are wrappers on cg_configure() */
26
27 int cg_error_handler(void (*)(int, char *));
28
29 int cg_set_compress(int compress);
30 int cg_get_compress(int *compress);
31 cg_set_compress_f(compress, ier);
32 cg_get_compress_f(compress, ier);
33
34 int cg_set_path(const char *path);
35 int cg_add_path(const char *path);
36 cg_set_path_f(path, ier);
37 cg_add_path_f(path, ier);
38
39
40 6) changed in cgnslib
41
42 int cg_is_cgns(const char *filename);
43 cg_is_cgns_f(filename, ier)
44
45 to
46
47 int cg_is_cgns(const char *filename, int *file_type);
48 cg_is_cgns_f(filename, file_type, ier)
49
50
51 7) removed from cgnslib:
52
53 MODE_READ, MODE_WRITE, MODE_MODIFY, Null, UserDefined and Celsius defines
54
55
56 8) low-level file access should now be made through the cgio interface
57 rather than ADF (or ADFH) directly. Include cgns_io.h for the function
58 prototypes. The ADF and ADFH functions are still available by including
59 the appropriate ADF.h header file.
60
61 These are some of the defines, the CGIO_MODE_xxx and CGIO_FILE_xxx are the
62 same as the cgns counterparts. The CGIO_MAX_xxx defines are the same as
63 for the ADF library. There are also some configure defines, and error
64 code returns for the cgio routines. The specific implementation (ADF, HDF5)
65 can return additional error codes not defined there.
66
67 #define CGIO_MODE_READ 0
68 #define CGIO_MODE_WRITE 1
69 #define CGIO_MODE_MODIFY 2
70
71 #define CGIO_FILE_NONE 0
72 #define CGIO_FILE_ADF 1
73 #define CGIO_FILE_HDF5 2
74 #define CGIO_FILE_XML 3
75
76 #define CGIO_MAX_DATATYPE_LENGTH 2
77 #define CGIO_MAX_DIMENSIONS 12
78 #define CGIO_MAX_NAME_LENGTH 32
79 #define CGIO_MAX_LABEL_LENGTH 32
80 #define CGIO_MAX_VERSION_LENGTH 32
81 #define CGIO_MAX_ERROR_LENGTH 80
82 #define CGIO_MAX_LINK_DEPTH 100
83 #define CGIO_MAX_FILE_LENGTH 1024
84 #define CGIO_MAX_LINK_LENGTH 4096
85
86 The following lists the cgio functions. They are similar to the ADF routines
87 in terms of srgument list. Maybe I'll find some time to document them.
88
89 int cgio_path_add(const char *path);
90 cgio_path_add_f(ier, path)
91
92 int cgio_path_delete(const char *path);
93 cgio_path_delete_f(ier, path)
94
95 int cgio_find_file(const char *filename, int file_type,
96 int max_path_len, char *pathname);
97 cgio_find_file_f(ier, filename, file_type, pathname)
98
99 int cgio_is_supported(int file_type);
100 cgio_is_supported_f(ier, file_type);
101
102 int cgio_configure(int what, void *value);
103
104 void cgio_cleanup();
105 cgio_cleanup_f(ier)
106
107 int cgio_check_file(const char *filename, int *file_type);
108 cgio_check_file_f(ier, filename, file_type)
109
110 int cgio_compute_data_size(const char *data_type, int num_dims,
111 const int *dim_vals, unsigned long *count);
112 cgio_compute_data_size_f(ier, data_type, num_dims, dim_vals, count, size)
113
114 int cgio_open_file(const char *filename, int file_mode,
115 int file_type, int *cgio_num);
116 cgio_open_file_f(ier, filename, file_mode, file_type, cgio_num)
117
118 int cgio_close_file(int cgio_num);
119 cgio_close_file_f(ier, cgio_num);
120
121 int cgio_compress_file(int cgio_num, const char *filename);
122
123 int cgio_copy_file(int cgio_num_inp, int cgio_num_out, int follow_links);
124
125 int cgio_flush_to_disk(int cgio_num);
126 cgio_flush_to_disk_f(ier, cgio_num)
127
128 int cgio_library_version(int cgio_num, char *version);
129 cgio_library_version_f(ier, cgio_num, version)
130
131 int cgio_file_version(int cgio_num, char *file_version,
132 char *creation_date, char *modified_date);
133 cgio_file_version_f(ier, cgio_num, file_version, creation_date, modified_date)
134
135 int cgio_get_root_id(int cgio_num, double *rootid);
136 cgio_get_root_id_f(ier, cgio_num, rootid)
137
138 int cgio_get_file_type(int cgio_num, int *file_type);
139 cgio_get_file_type_f(ier, cgio_num, file_type)
140
141 void cgio_error_code(int *errcode, int *file_type);
142 cgio_error_code_f(errcode, file_type)
143
144 int cgio_error_message(int max_len, char *error_msg);
145 cgio_error_message_f(ier, error_msg)
146
147 void cgio_error_exit(const char *msg);
148 cgio_error_exit_f(msg)
149
150 int cgio_create_node(int cgio_num, double pid, const char *name, double *id);
151 cgio_create_node_f(ier, cgio_num, pid, name, id)
152
153 int cgio_new_node(int cgio_num, double pid, const char *name,
154 const char *label, const char *data_type, int ndims,
155 const int *dims, const void *data, double *id);
156
157 int cgio_delete_node(int cgio_num, double pid, double id);
158 cgio_delete_node_f(ier, cgio_num, pid, id)
159
160 int cgio_move_node(int cgio_num, double pid, double id, double new_pid);
161 cgio_move_node_f(ier, cgio_num, pid, id, new_pid)
162
163 int cgio_copy_node(int cgio_num_inp, double id_inp, int cgio_num_out,
164 double id_out);
165
166 int cgio_release_id(int cgio_num, double id);
167 cgio_release_id_f(ier, cgio_num, id)
168
169 int cgio_is_link(int cgio_num, double id, int *link_len);
170 cgio_is_link_f(ier, cgio_num, id, link_len)
171
172 int cgio_link_size(int cgio_num, double id, int *file_len, int *name_len);
173 cgio_link_size_f(ier, cgio_num, id, file_len, name_len)
174
175 int cgio_create_link(int cgio_num, double pid, const char *name,
176 const char *filename, const char *name_in_file,
177 double *id);
178 cgio_create_link_f(ier, cgio_num, pid, name, filename, name_in_file, id)
179
180 int cgio_get_link(int cgio_num, double id, char *filename,
181 char *name_in_file);
182 cgio_get_link_f(ier, cgio_num, id, filename, name_in_file)
183
184 int cgio_number_children(int cgio_num, double id, int *num_children);
185 cgio_number_children_f(ier, cgio_num, id, num_children)
186
187 int cgio_children_ids(int cgio_num, double pid, int start, int max_ret,
188 int *num_ret, double *ids);
189 cgio_children_ids_f(ier, cgio_num, pid, start, max_ret, num_ret, ids)
190
191 int cgio_children_names(int cgio_num, double pid, int start, int max_ret,
192 int name_len, int *num_ret, char *names);
193 cgio_children_names_f(ier, cgio_num, pid, start, max_ret, name_len,
194 num_ret, names)
195
196 int cgio_get_node_id(int cgio_num, double pid, const char *name, double *id);
197 cgio_get_node_id_f(ier, cgio_num, pid, name, id)
198
199 int cgio_get_name(int cgio_num, double id, char *name);
200 cgio_get_name_f(ier, cgio_num, id, name)
201
202 int cgio_get_label(int cgio_num, double id, char *label);
203 cgio_get_label_f(ier, cgio_num, id, label)
204
205 int cgio_get_data_type(int cgio_num, double id, char *data_type);
206 cgio_get_data_type_f(ier, cgio_num, id, data_type)
207
208 int cgio_get_data_size(int cgio_num, double id, unsigned long *data_size);
209 cgio_get_data_size_f(ier, cgio_num, id, data_size)
210
211 int cgio_get_dimensions(int cgio_num, double id, int *num_dims, int *dims);
212 cgio_get_dimensions_f(ier, cgio_num, id, num_dims, dims)
213
214 int cgio_read_all_data(int cgio_num, double id, void *data);
215 cgio_read_all_data_f(ier, cgio_num, id, data)
216
217 int cgio_read_data(int cgio_num, double id, const int *s_start,
218 const int *s_end, const int *s_stride, int m_num_dims,
219 const int *m_dims, const int *m_start, const int *m_end,
220 const int *m_stride, void *data);
221 cgio_read_data_f(ier, cgio_num, id, s_start, s_end, s_stride, m_num_dims,
222 m_dims, m_start, m_end, m_stride, data)
223
224 int cgio_set_name(int cgio_num, double pid, double id, const char *name);
225 cgio_set_name_f(ier, cgio_num, pid, id, name)
226
227 int cgio_set_label(int cgio_num, double id, const char *label);
228 cgio_set_label_f(ier, cgio_num, id, label)
229
230 int cgio_set_dimensions(int cgio_num, double id, const char *data_type,
231 int num_dims, const int *dims);
232 cgio_set_dimensions_f(ier, cgio_num, id, data_type, num_dims, dims)
233
234 int cgio_write_all_data(int cgio_num, double id, const void *data);
235 cgio_write_all_data_f(ier, cgio_num, id, data)
236
237 int cgio_write_data(int cgio_num, double id, const int *s_start,
238 const int *s_end, const int *s_stride, int m_num_dims,
239 const int *m_dims, const int *m_start, const int *m_end,
240 const int *m_stride, const void *data);
241 cgio_write_data_f(ier, cgio_num, id, s_start, s_end, s_stride, m_num_dims,
242 m_dims, m_start, m_end, m_stride, data)
243
244
245 9) changes to ADF
246
247 removed ADF_Search_Add() and ADF_Search_Delete() (now handled in cgio)
248 added ADF_Link_Size()
249 implemented Paul Edwards fix for reading blocks (also in 2.5 under CVS)
250
251
252 10) changes to ADFH
253
254 removed ADFH_Search_Add() and ADFH_Search_Delete() (now handled in cgio)
255 added ADFH_Link_Size()
256
257 updated with Marc's link file changes. The index swapping from Fortran to C
258 is implemented. (also in 2.5 under CVS)
259
0 <html><head><title>Changes in CGNS 3.1</title></head><body>
1
2 <h2>Changes in CGNS 3.1</h2>
3
4 <ul>
5 <li> <a href="#cpex0027">Time-dependent Connectivity</a>
6 <li> <a href="#cpex0030">Zone Subregions</a>
7 <li> <a href="#cpex0031">General SIDS Improvements</a>
8 <li> <a href="#64-bit">64-bit Implementation</a>
9 <ul>
10 <li> <a href="#c_interface">C Interface</a>
11 <li> <a href="#c_portability">C Portability</a>
12 <li> <a href="#fortran_interface">FORTRAN Interface</a>
13 <li> <a href="#fortran_issues">FORTRAN Issues and Portability</a>
14 <li> <a href="#examples">Examples</a>
15 </ul>
16 </ul>
17
18 <a name="cpex0027"></a>
19 <h2>Time-dependent Connectivity</h2>
20
21 <a href="http://cgns.sourceforge.net/ProposedExtensions/Timedepconn.pdf">CPEX0027</a>
22 has been implemented. The added functions to support this extension are described
23 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/timedep.html#zconn">Zone Grid Connectivity</a>
24 in the Mid-Level Library.
25
26 <a name="cpex0030"></a>
27 <h2>Zone Subregions</h2>
28
29 <a href="http://cgns.sourceforge.net/ProposedExtensions/RegionsIX.pdf">CPEX0030</a>
30 has been implemented. The added functions to support this extension are described
31 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#subregion">Zone Subregions</a>
32 in the Mid-Level Library.
33
34 <a name="cpex0031"></a>
35 <h2>General SIDS Improvements</h2>
36
37 <a href="http://cgns.sourceforge.net/ProposedExtensions/intro_parts_of_sids2.pdf">CPEX0031</a>
38 has been implemented. The added functions to support this extension are described
39 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#flowsolution">Flow Solution</a>
40 and <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#discretedata">Discrete Data</a> in
41 the Mid-Level Library. There are also changes to
42 <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/bc.html#bc">Boundary Conditions</a>
43 and numerous places in the SIDS.
44
45 <a name="64-bit"></a>
46 <h2>64-bit Implementation</h2>
47
48 You only need to read the following if you have a 64-bit computer and need to
49 work with problems that exceed 2 billion coordinates and/or elements.
50 Or, if you are bored.
51
52 <a name="c_interface"></a>
53 <h3>C Interface</h3>
54
55 The major change in 3.1 is the introduction of the data type <tt><b>cgsize_t</b></tt>,
56 which will be a 64-bit integer when building 64-bit code, and a 32-bit integer
57 otherwise. This is defined in a new header file, <tt><i>cgnstypes.h</i></tt>, which is
58 included in <tt><i>cgnslib.h</i></tt>. Some additional data types have also been
59 introduced, <tt><b>cglong_t</b></tt> which is always 64-bits, <tt><b>cgint_t</b></tt> and
60 <tt><b>cgerr_t</b></tt> which are 32-bit integers, and <tt><b>cgid_t</b></tt> which is a
61 64-bit floating point number (<tt>double</tt>). With the exception of <tt><b>cglong_t</b></tt>
62 these other data types are currently not used.
63 The <tt><b>cglong_t</b></tt> data type is used internally,
64 and may be used by application code in conjunction with
65 <tt><b><i>DataType_t</i> LongInteger</b></tt> to write 64-bit data
66 to the CGNS file, regardless of the compilation mode. The <tt><i>cgnstypes.h</i></tt>
67 header file also defines 3 flags, which describe the current build mode,
68 <tt><b>CG_BUILD_LEGACY</b></tt>, <tt><b>CG_BUILD_64BIT</b></tt>,
69 and <tt><b>CG_BUILD_SCOPE</b></tt>,
70 which are set to 0 or 1, depending on the build mode.
71 <p>
72 When the <tt><i>--enable-legacy</i></tt> option is given to <tt><i>configure</i></tt>,
73 <tt><b>cgsize_t</b></tt> is defined as an <tt><b>int</b></tt> (<tt><b>integer*4</b></tt>),
74 <tt><b>CG_BUILD_LEGACY</b></tt> is set to 1, and <tt><b>CG_BUILD_64BIT</b></tt> and
75 <tt><b>CG_BUILD_SCOPE</b></tt> are set to 0. The <tt><i>--enable-scope</i></tt> and
76 <tt><i>--enable-64bit</i></tt> options to <tt><i>configure</i></tt> are ignored.
77 This will generate the same code as for the versions prior to 3.1.
78 <p>
79 When the <tt><i>--enable-64bit</i></tt> option is given to <tt><i>configure</i></tt>,
80 <tt><b>cgsize_t</b></tt> is typedef'd as <tt><b>long</b></tt>, <tt><b>long long</b></tt> or
81 <tt><b>__int64</b></tt> (depending on the machine) and the equivalent FORTRAN
82 data type is <tt><b>integer*8</b></tt>. All other values are unchanged. This will
83 set <tt><b>CG_BUILD_64BIT</b></tt> to 1, and <tt><b>CG_BUILD_LEGACY</b></tt> to 0 in
84 <tt><i>cgnstypes.h</i></tt>. The value of <tt><b>CG_BUILD_SCOPE</b></tt> depends on
85 the <tt><i>configure</i></tt> option below.
86 <br>
87 If this option is not given, then <tt><b>cgsize_t</b></tt> is typedef'd as <tt><b>int</b></tt>,
88 and the equivalent FORTRAN data type is <tt><b>integer*4</b></tt>. The value of
89 <tt><b>CG_BUILD_64BIT</b></tt> is set to 0.
90 <p>
91 When the <tt><i>--enable-scope</i></tt> option is given to <tt><i>configure</i></tt>,
92 scoping of the enumeration values in cgnslib are enabled. This will
93 prefix all the enums with <tt><b>CG_</b></tt>. This is disabled by default and
94 when <tt><i>--enable-legacy</i></tt> is enabled. If enabled, this will set the
95 value of <tt><b>CG_BUILD_SCOPE</b></tt> in <tt><i>cgnstypes.h</i></tt> to 1.
96 <p>
97 These options are also available for <i>cmake</i> users, and have the same behavior.
98 <p>
99 When building 64-bit code, the ADF file format changes, and thus will not be
100 readable by prior versions of the library. All dimensions are stored as
101 64-bit integers, and the modifications to the ADF interface allow addressing
102 and storage up to 1,000 terabytes of data. The HDF5 interface
103 is also effected due to the the dimension sizes. I'm not sure of the HDF5
104 limitations to file size, but I expect it to be as large as that
105 addressable by a 64-bit integer.
106 <p>
107 Thus, when writing a CGNS file
108 in 64-bit mode it will only be readable by the version 3.1 software. A 32-bit
109 compilation of version 3.1 will be able to read the 64-bit CGNS file, but will fail
110 gracefully if the dimensions exceed those that can be handled by a 32-bit
111 integer. With a 32-bit mode compilation, the ADF version and HDF5 interfaces
112 are unchanged, and thus the CGNS files will be readable by earlier version
113 software.
114 <p>
115 Regardless of how the version 3.1 software is compiled, it is backwards
116 compatible with earlier version CGNS files.
117 <p>
118 A new data type has also been added to the CGNS MLL, <tt><b>LongInteger</b></tt>, which
119 is defined in the <tt><i>DataType_t</i></tt> enumeration. This refers to a true 64-bit
120 integer. Previous versions of the MLL did not explicitly allow for 64-bit integer data.
121 This data type is automatically used for dimensions, connectivity, boundary condition
122 points, holes and elements when compiled in 64-bit mode. It may also be used by an
123 application to define array data as 64-bit, regardless of the compilation mode. In this
124 case, the data should be defined as <tt><b>cglong_t</b></tt> in the code in order to
125 guarantee 64-bit data being passed to the array read or write routines.
126 <p>
127 The following routines have been modified to use the <tt><b>cgsize_t</b></tt> data type.
128 <br><pre>
129 cg_zone_read(int fn, int B, int Z, char *zonename, <i><font color="red">cgsize_t</font></i> *size);
130 cg_zone_write(int fn, int B, const char * zonename,
131 const <i><font color="red">cgsize_t</font></i> * size, CGNS_ENUMT(ZoneType_t) type, int *Z);
132
133 cg_coord_read(int fn, int B, int Z, const char * coordname,
134 CGNS_ENUMT(DataType_t) type, const <i><font color="red">cgsize_t</font></i> * rmin,
135 const <i><font color="red">cgsize_t</font></i> * rmax, void *coord);
136 cg_coord_partial_write(int fn, int B, int Z,
137 CGNS_ENUMT(DataType_t) type, const char * coordname,
138 const <i><font color="red">cgsize_t</font></i> *rmin, const <i><font color="red">cgsize_t</font></i> *rmax,
139 const void * coord_ptr, int *C);
140
141 cg_section_read(int file_number, int B, int Z, int S,
142 char *SectionName, CGNS_ENUMT(ElementType_t) *type,
143 <i><font color="red">cgsize_t</font></i> *start, <i><font color="red">cgsize_t</font></i> *end, int *nbndry, int *parent_flag);
144 cg_section_write(int file_number, int B, int Z,
145 const char * SectionName, CGNS_ENUMT(ElementType_t) type,
146 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, int nbndry, const <i><font color="red">cgsize_t</font></i> * elements,
147 int *S);
148 cg_section_partial_write(int file_number, int B, int Z,
149 const char * SectionName, CGNS_ENUMT(ElementType_t) type,
150 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, int nbndry, int *S);
151
152 cg_elements_read(int file_number, int B, int Z, int S,
153 <i><font color="red">cgsize_t</font></i> *elements, <i><font color="red">cgsize_t</font></i> *parent_data);
154 cg_elements_partial_write(int fn, int B, int Z, int S,
155 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, const <i><font color="red">cgsize_t</font></i> *elements);
156 cg_elements_partial_read(int file_number, int B, int Z, int S,
157 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, <i><font color="red">cgsize_t</font></i> *elements, <i><font color="red">cgsize_t</font></i> *parent_data);
158
159 cg_parent_data_write(int file_number, int B, int Z, int S,
160 const <i><font color="red">cgsize_t</font></i> * parent_data);
161 cg_parent_data_partial_write(int fn, int B, int Z, int S,
162 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, const <i><font color="red">cgsize_t</font></i> *ParentData);
163
164 cg_ElementDataSize(int file_number, int B, int Z, int S,
165 <i><font color="red">cgsize_t</font></i> *ElementDataSize);
166 cg_ElementPartialSize(int file_number, int B, int Z, int S,
167 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, <i><font color="red">cgsize_t</font></i> *ElementDataSize);
168
169 cg_field_read(int fn, int B, int Z, int S, const char *fieldname,
170 CGNS_ENUMT(DataType_t) type, const <i><font color="red">cgsize_t</font></i> *rmin,
171 const <i><font color="red">cgsize_t</font></i> *rmax, void *field_ptr);
172 cg_field_partial_write(int fn, int B, int Z, int S,
173 CGNS_ENUMT(DataType_t) type, const char * fieldname,
174 const <i><font color="red">cgsize_t</font></i> *rmin, const <i><font color="red">cgsize_t</font></i> *rmax,
175 const void * field_ptr, int *F);
176
177 cg_hole_info(int fn, int B, int Z, int I, char *holename,
178 CGNS_ENUMT(GridLocation_t) *location, CGNS_ENUMT(PointSetType_t) *ptset_type,
179 int *nptsets, <i><font color="red">cgsize_t</font></i> *npnts);
180 cg_hole_read(int fn, int B, int Z, int I, <i><font color="red">cgsize_t</font></i> *pnts);
181 cg_hole_write(int fn, int B, int Z, const char * holename,
182 CGNS_ENUMT(GridLocation_t) location, CGNS_ENUMT(PointSetType_t) ptset_type,
183 int nptsets, <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, int *I);
184
185 cg_conn_info(int file_number, int B, int Z, int I,
186 char *connectname, CGNS_ENUMT(GridLocation_t) *location,
187 CGNS_ENUMT(GridConnectivityType_t) *type,
188 CGNS_ENUMT(PointSetType_t) *ptset_type,
189 <i><font color="red">cgsize_t</font></i> *npnts, char *donorname,
190 CGNS_ENUMT(ZoneType_t) *donor_zonetype,
191 CGNS_ENUMT(PointSetType_t) *donor_ptset_type,
192 CGNS_ENUMT(DataType_t) *donor_datatype,
193 <i><font color="red">cgsize_t</font></i> *ndata_donor);
194 cg_conn_read(int file_number, int B, int Z, int I, <i><font color="red">cgsize_t</font></i> *pnts,
195 CGNS_ENUMT(DataType_t) donor_datatype,
196 <i><font color="red">cgsize_t</font></i> *donor_data);
197 cg_conn_write(int file_number, int B, int Z,
198 const char * connectname, CGNS_ENUMT(GridLocation_t) location,
199 CGNS_ENUMT(GridConnectivityType_t) type,
200 CGNS_ENUMT(PointSetType_t) ptset_type,
201 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, const char * donorname,
202 CGNS_ENUMT(ZoneType_t) donor_zonetype,
203 CGNS_ENUMT(PointSetType_t) donor_ptset_type,
204 CGNS_ENUMT(DataType_t) donor_datatype,
205 <i><font color="red">cgsize_t</font></i> ndata_donor, const <i><font color="red">cgsize_t</font></i> *donor_data, int *I);
206 cg_conn_write_short(int file_number, int B, int Z,
207 const char * connectname, CGNS_ENUMT(GridLocation_t) location,
208 CGNS_ENUMT(GridConnectivityType_t) type,
209 CGNS_ENUMT(PointSetType_t) ptset_type,
210 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, const char * donorname, int *I);
211 cg_conn_read_short(int file_number, int B, int Z, int I,
212 <i><font color="red">cgsize_t</font></i> *pnts);
213
214 cg_1to1_read(int fn, int B, int Z, int I, char *connectname,
215 char *donorname, <i><font color="red">cgsize_t</font></i> *range, <i><font color="red">cgsize_t</font></i> *donor_range, int *transform);
216 cg_1to1_write(int fn, int B, int Z, const char * connectname,
217 const char * donorname, const <i><font color="red">cgsize_t</font></i> * range,
218 const <i><font color="red">cgsize_t</font></i> * donor_range, const int * transform, int *I);
219 cg_1to1_read_global(int fn, int B, char **connectname,
220 char **zonename, char **donorname, <i><font color="red">cgsize_t</font></i> **range,
221 <i><font color="red">cgsize_t</font></i> **donor_range, int **transform);
222
223 cg_boco_info(int fn, int B, int Z, int BC, char *boconame,
224 CGNS_ENUMT(BCType_t) *bocotype, CGNS_ENUMT(PointSetType_t) *ptset_type,
225 <i><font color="red">cgsize_t</font></i> *npnts, int *NormalIndex, <i><font color="red">cgsize_t</font></i> *NormalListFlag,
226 CGNS_ENUMT(DataType_t) *NormalDataType, int *ndataset);
227 cg_boco_read(int fn, int B, int Z, int BC, <i><font color="red">cgsize_t</font></i> *pnts,
228 void *NormalList);
229 cg_boco_write(int file_number, int B, int Z, const char * boconame,
230 CGNS_ENUMT(BCType_t) bocotype, CGNS_ENUMT(PointSetType_t) ptset_type,
231 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, int *BC);
232
233 cg_array_info(int A, char *ArrayName,
234 CGNS_ENUMT(DataType_t) *DataType,
235 int *DataDimension, <i><font color="red">cgsize_t</font></i> *DimensionVector);
236 cg_array_write(const char * ArrayName,
237 CGNS_ENUMT(DataType_t) DataType, int DataDimension,
238 const <i><font color="red">cgsize_t</font></i> * DimensionVector, const void * Data);
239
240 cg_ptset_info(CGNS_ENUMT(PointSetType_t) *ptset_type,
241 <i><font color="red">cgsize_t</font></i> *npnts);
242 cg_ptset_write(CGNS_ENUMT(PointSetType_t) ptset_type,
243 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> *pnts);
244 cg_ptset_read(<i><font color="red">cgsize_t</font></i> *pnts);
245 </pre><p>
246 Note that, as in earlier versions of the library, the <tt><i>donor_datatype</i></tt>
247 argument to <tt><i>cg_conn_write</i></tt> and <tt><i>cg_conn_read</i></tt> are redundant. Earlier versions
248 required this value to be <tt><b>Integer</b></tt>. In 3.1 this is ignored altogether,
249 and is taken to <tt><b>Integer</b></tt> in 32-bit mode and
250 <tt><b>LongInteger</b></tt> in 64-bit mode. The corresponding <tt><i>donor_data</i></tt>
251 is always of type <tt><b>cgsize_t</b></tt>.
252 <p>
253 A new convenience function has been added to the MLL:
254 <pre>
255 cg_index_dim(int file_number, int B, int Z, int *index_dim)
256 </pre>
257 which gets the index dimension for the specified base and zone. The return value
258 will be the Cell Dimension for a structured grid, and 1 for an unstructured grid.
259
260 <a name="c_portability"></a>
261 <h3>C Portability</h3>
262
263 If you use the <tt><b>cgsize_t</b></tt> data type in new code, it will work in
264 both 32 and 64-bit compilation modes. In order to support CGNS versions prior
265 to 3.1, you may also want to add something like this to your code:
266 <pre>
267 #if CGNS_VERSION < 3100
268 #define cgsize_t int
269 #endif
270 </pre>
271 Existing code that uses <tt><b>int</b></tt> will not work with a CGNS 3.1 library
272 compiled with the <tt><i>enable-64bit</i></tt> option turned on. You may want
273 to add something like this to your code:
274 <pre>
275 #if CGNS_VERSION >= 3100 && CG_BUILD_64BIT
276 #error does not work in 64 bit mode
277 #endif
278 </pre>
279 or modify your code to use <tt><b>cgsize_t</b></tt>.
280
281 <a name="fortran_interface"></a>
282 <h3>FORTRAN Interface</h3>
283
284 All integer arguments in the FORTRAN interface are taken to be
285 <tt><b>integer*4</b></tt> in 32-bit mode and <tt><b>integer*8</b></tt>
286 in 64-bit mode. If you have used default or implicit integers in your FORTRAN
287 code, it should port to 64-bit mode in most cases by simply turning on your
288 compiler option that promotes implicit integers to <tt><b>integer*8</b></tt>.
289 However, be sure that you read the next section about issues.
290 For example, all the FORTRAN code in the User's Guide examples ported
291 unmodified when using the <tt><i>-fdefault-integer-8</i></tt> compiler option
292 with <tt><i>gfortran</i></tt>. If you have explicitly defined your integers
293 as <tt><b>integer*4</b></tt>, your code will not work in 64-bit mode.
294 In that case, you will either need to change them to <tt><b>integer</b></tt>
295 (recommended for portability) or <tt><b>integer*8</b></tt>.
296 <p>
297 The <tt><i>cgnslib_f.h</i></tt> header file has been modified to explicitly
298 define all integer values based on the CGNS library compilation mode,
299 <tt><b>integer*8</b></tt> when compiled in 64-bit mode and
300 <tt><b>integer*4</b></tt> otherwise. A new integer parameter has also
301 been added to the header, <tt><b>CG_BUILD_64BIT</b></tt>, which will be set
302 to 1 in 64-bit mode and 0 otherwise. You may use this parameter to check
303 if the CGNS library has been compiled in 64-bit mode or not, as in:
304 <pre>
305 if (CG_BUILD_64BIT .ne. 0) then
306 print *,'will not work in 64-bit mode'
307 stop
308 endif
309 </pre>
310 If you are using a CGNS library prior to version 3.1, this parameter will
311 not be defined and you will need to rely on your compiler initializing all
312 undefined values to 0 (not always the case) for this test to work.
313
314 <a name="fortran_issues"></a>
315 <h3>FORTRAN Issues and Portability</h3>
316
317 If your compiler supports automatic promotion of integers, and you use
318 implicit integers, your code should port to 64-bit with the following exception.
319 <p>
320 If you use an <tt><b>Integer</b></tt> data type in any routine that takes
321 a data type specification, and an implicit integer for the data, the code
322 will fail when compiled in 64-bit mode with automatic integer promotion.
323 An example of this would be:
324 <pre>
325 integer dim
326 integer data(dim)
327 call cg_array_write_f('array',Integer,1,dim,data)
328 </pre>
329 This is because the MLL interprets the <tt><b>Integer</b></tt> data type
330 as <tt><b>integer*4</b></tt> regardless of the compilation mode. The compiler,
331 however, has automatically promoted <tt><i>data</i></tt> to be
332 <tt><b>integer*8</b></tt>. What you will need to do to prevent this problem,
333 is to either explicitly define <tt><i>data</i></tt> as in:
334 <pre>
335 integer dim
336 integer*4 data(dim)
337 call cg_array_write_f('array',Integer,1,dim,data)
338 </pre>
339 or
340 <pre>
341 integer dim
342 integer*8 data(dim)
343 call cg_array_write_f('array',LongInteger,1,dim,data)
344 </pre>
345 or test on <tt><b>CG_BUILD_64BIT</b></tt> as in:
346 <pre>
347 integer dim
348 integer data(dim)
349 if (CG_BUILD_64BIT .eq. 0) then
350 call cg_array_write_f('array',Integer,1,dim,data)
351 else
352 call cg_array_write_f('array',LongInteger,1,dim,data)
353 endif
354 </pre>
355 The last 2 options will only work with CGNS Version 3.1, since
356 <tt><b>LongInteger</b></tt> and <tt><b>CG_BUILD_64BIT</b></tt> are
357 not defined in previous versions. Note also, that this does not
358 apply to the <tt><i>donor_datatype</i></tt>
359 argument to <tt><i>cg_conn_write</i></tt> and
360 <tt><i>cg_conn_read</i></tt> as discussed above.
361 <p>
362 You may also need to be careful when using integer constants as arguments
363 in 64-bit mode. If your compiler automatically promotes integer constants
364 to <tt><b>integer*8</b></tt>, then there is no problem. This is probably
365 the case if your compiler supports implicit integer promotion. If not,
366 then the constants will be <tt><b>integer*4</b></tt>, and your code
367 will not work in 64-bit mode. In that case you will need to do something like:
368 <pre>
369 integer*8 one,dim
370 integer*4 data(dim)
371 one = 1
372 call cg_array_write_f('array',Integer,one,dim,data)
373 </pre>
374 If you can't or don't want to use automatic integer promotion, but still want
375 to be able to port to 64-bit code, you may include the preprocessor header file,
376 <tt><i>cgnstypes_f.h</i></tt> in your code. In 64-bit mode, the <tt><b>CG_BUILD_64BIT</b></tt> define
377 in the header will be set to 1, and <tt><b>cgsize_t</b></tt> and <tt><b>CGSIZE_T</b></tt>
378 will be defined as <tt><b>integer*8</b></tt>, otherwise <tt><b>CG_BUILD_64BIT</b></tt> will
379 be 0 and <tt><b>cgsize_t</b></tt> and <tt><b>CGSIZE_T</b></tt> will be defined
380 as <tt><b>integer*4</b></tt>. By including this header file as a preprocessor
381 include (i.e. <tt><i>#include "cgnstypes_f.h"</i></tt>) you may then use
382 <tt><b>cgsize_t</b></tt> as variable type name. for example:
383 <pre>
384 #include "cgnstypes_f.h"
385 cgsize_t cgfile,cgbase,celldim,physdim
386 cgsize_t one,dim,ierr
387 cgsize_t data(dim)
388
389 call cg_open_f('file.cgns',CG_MODE_WRITE,cgfile,ierr)
390 celldim = 3
391 physdim = 3
392 call cg_base_write_f(cgfile,'base',celldim,physdim,cgbase,ierr)
393 ...
394 one = 1
395 #if CG_BUILD_64
396 call cg_array_write_f('array',Integer,one,dim,data)
397 #else
398 call cg_array_write_f('array',LongInteger,one,dim,data)
399 #endif
400 </pre>
401 Notice, that you will not be able to use integer constants, but your
402 FORTRAN code will be portable to 64-bit mode.
403 <p>
404 Lastly, you may use the header to simply limit the code to 32
405 or 64-bit modes, such as:
406 <pre>
407 #include "cgnstypes_f.h"
408 #if CG_BUILD_64BIT
409 # error can only be built in 32-bit mode
410 #endif
411 </pre>
412
413 <a name="examples"></a>
414 <h3>Examples</h3>
415
416 All the distributed C examples have been modified to use
417 <tt><b>cgsize_t</b></tt>. and will work in both 32 and 64-bit modes. They
418 are also fully compatible with previous CGNS versions.
419
420 <h4>C Test Program</h4>
421
422 There is a new C example in the <tt><i>tests</i></tt> subdirectory,
423 <tt><i>test64c.c</i></tt>, that you may use for simple 64-bit mode testing.
424 To compile it, do <tt>make test64</tt> from within the <tt><i>tests</i></tt>
425 subdirectory. The program allows you to write any number of coordinates or
426 tetrahedral elements using whatever amount of memory you specify. To
427 get the list of available options, enter:
428 <pre>
429 test64c -help
430 or
431 test64c --
432 </pre>
433 Without any options, the program will try to use 16 billion bytes of memory,
434 and write 4 billion float coordinates and 500 million tetrahedra. The number
435 of coordinates and tetrahedra default to the number that will fit within
436 the available memory, in this case (16b / 4) and (16b / 32). To specify the
437 amount of memory, use the <tt><i>-m</i></tt> option. For example, to
438 use 4 billion bytes, run as
439 <pre>
440 test64c -m4b
441 </pre>
442 In this case, the program will write 1 billion coordinates and 125 million
443 tetrahedra, by default. I recommend that you use less than the full amount
444 of available memory, otherwise swapping will result in your elapsed run
445 time going from minutes to hours (or even a day).
446 <p>
447 To specify the number of coordinates or elements to write, use the
448 <tt><i>-c</i></tt> and <tt><i>-e</i></tt> options. The number may be followed
449 by a qualifier (<tt><i>b</i></tt> for billion, <tt><i>m</i></tt> for million,
450 or <tt><i>k</i></tt> for thousand). For example, to write 10 billion
451 coordinates and 400 million tetrahedra using 2 billion bytes of memory, use:
452 <pre>
453 test64c -m2b -c10b -e400m
454 </pre>
455 If the memory required for either the coordinate or element data exceeds the
456 memory available, the program will use partial writes to write the data.
457 In the case above, the coordinates will be written 500m and the elements 62.5m
458 at a time. A value of 0 may also be used for the number of coordinates or
459 elements, in which case they are not written. Be aware, that 1 billion
460 coordinates and elements require a liitle over 4 Gb and 32Gb of disk space,
461 respectively.
462 <p>
463 To control the output file format, use <tt><i>-adf</i></tt> to force ADF
464 and <tt><i>-hdf5</i></tt> for HDF5 output. The last option is
465 <tt><i>-test</i></tt>, which will cause the file to be reopened in read-only
466 mode and the data read and checked for accuracy.
467
468 <h4>FORTRAN</h4>
469
470 The examples <tt><i>cgread.F</i></tt> and <tt><i>cgwrite.F</i></tt>
471 in the <tt><i>tests</i></tt> subdirectory have been modified to support
472 64-bit compilation. The <tt><i>cgnstype_f.h</i></tt> header was included
473 in these, and the <tt><b>cgsize_t</b></tt> definition for variables was used
474 as described above. This makes the code portable to 64-bit without requiring
475 any additional compiler options.
476 <p>
477 Another example, <tt><i>test64f.F</i></tt> has been created in this
478 directory. This program explicitly defines
479 the integer variables as <tt><b>integer*8</b></tt> and then tests
480 on the <tt><b>CG_BUILD_64BIT</b></tt> variable in order to prevent
481 the program from running (and failing) unless built in 64-bit mode.
482 <p>
483 These FORTRAN examples do not really require 64 bits to run, they are
484 provided to help with porting of your code. To build these,
485 do <tt>make fortran</tt> from within the <tt><i>tests</i></tt>
486 subdirectory.
487 </body>
488 </html>
2727 # create configured header files #
2828 ################################
2929
30 if ("${SIZE_OF_LONG}" GREATER 4)
30 if ("${SIZEOF_LONG}" GREATER 4)
3131 set(CGLONGT long)
32 else ("${SIZE_OF_LONG}" GREATER 4)
32 else ("${SIZEOF_LONG}" GREATER 4)
3333 set(CGLONGT "long long")
34 endif ("${SIZE_OF_LONG}" GREATER 4)
34 endif ("${SIZEOF_LONG}" GREATER 4)
3535
3636 set(BUILDLEGACY 0)
3737 set(BUILD64BIT 0)
7171 set(LIBS -lm)
7272 endif (WIN32)
7373
74 set(CMAKE_C_STANDARD 99)
75 set(CMAKE_C_STANDARD_REQUIRED ON)
76 include(CheckCCompilerFlag)
77 macro(check_and_add_compiler_option _option)
78 message(STATUS "Checking C compiler flag ${_option}")
79 string(REPLACE "=" "-" _temp_option_variable ${_option})
80 string(REGEX REPLACE "^-" "" _option_variable ${_temp_option_variable})
81 check_c_compiler_flag("${_option}" ${_option_variable})
82 if(${${_option_variable}})
83 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_option}")
84 endif()
85 endmacro()
86 if (CMAKE_C_COMPILER_ID MATCHES "GNU")
87 check_and_add_compiler_option("-std=gnu99")
88 elseif (CMAKE_C_COMPILER_ID MATCHES "XL")
89 check_and_add_compiler_option("-qlanglvl=extc99")
90 elseif(CMAKE_C_COMPILER_ID MATCHES "Sun")
91 check_and_add_compiler_option("-xc99")
92 endif()
93
7494 string(COMPARE EQUAL ${CMAKE_BUILD_TYPE} Debug IS_DEBUG)
7595 if (IS_DEBUG)
7696 set(BUILDDEBUG 1)
77 set(CFLAGS ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
78 set(LDFLAGS ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
97 set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
98 set(LDFLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
7999 else (IS_DEBUG)
80100 set(BUILDDEBUG 0)
81 set(CFLAGS ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
82 set(LDFLAGS ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
101 set(CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
102 set(LDFLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
83103 endif (IS_DEBUG)
84104
85105 set(BUILDHDF5 0)
102122 set(HDF5_HAVE_FILE_SPACE_STRATEGY 0)
103123 set(FORTRAN_DEFAULT_INTEGER_C_INT64_T 0)
104124 set(HAVE_STAT64_STRUCT 0)
125 set(HAVE_COMPLEX_C99_EXT 0)
126
127 #For cg_hash_types.h.in
128 CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
129 set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
130
131 include(CheckCSourceCompiles)
132 check_c_source_compiles("
133 #include <complex.h>
134 int main(int argc, char *argv[]){
135 #if !defined(_MSC_VER)
136 float _Complex a[2];
137 __real__(a[1]) = (float) 1.0;
138 __imag__(a[1]) = (float) 0.0;
139 #endif
140 return 0;
141 }
142 "
143 HAVE_COMPLEX_C99_EXT
144 )
105145
106146 if (BUILDFORTRAN)
107147
497537 ${CMAKE_CURRENT_BINARY_DIR}/cgnsconfig.h )
498538 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cgnsBuild.defs.in
499539 ${CMAKE_CURRENT_BINARY_DIR}/cgnsBuild.defs )
540 configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cg_hash_types.h.in
541 ${CMAKE_CURRENT_BINARY_DIR}/cg_hash_types.h )
500542
501543 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
502544
510552 cgns_internals.c
511553 cgns_io.c
512554 cgnslib.c
555 cg_hashmap.c
513556 adf/ADF_interface.c
514557 adf/ADF_internals.c)
515558
542585 set(cgns_FILES ${cgns_C_FILES})
543586 endif (CGNS_ENABLE_FORTRAN)
544587
545 set(CGNS_BUILD_SHARED "ON" CACHE BOOL "Build a shared version of the library")
546588 option(CGNS_USE_SHARED "Link programs to the CGNS shared library" "ON")
547589
548590 # Build a static version of the library
549591 if (CGNS_ENABLE_FORTRAN)
550 add_library(cgns_static STATIC ${cgns_FILES} $<TARGET_OBJECTS:cgns_f2c>)
592 add_library(cgns_static STATIC ${cgns_FILES} $<TARGET_OBJECTS:cgns_f2c>)
551593 else (CGNS_ENABLE_FORTRAN)
552594 add_library(cgns_static STATIC ${cgns_FILES})
553595 endif (CGNS_ENABLE_FORTRAN)
558600 if(CGNS_BUILD_SHARED)
559601 mark_as_advanced(CLEAR CGNS_USE_SHARED)
560602 if (CGNS_ENABLE_FORTRAN)
561 add_library(cgns_shared SHARED ${cgns_FILES} cgns_f.F90)
603 add_library(cgns_shared SHARED ${cgns_FILES} $<TARGET_OBJECTS:cgns_f2c>)
562604 else (CGNS_ENABLE_FORTRAN)
563605 add_library(cgns_shared SHARED ${cgns_FILES})
564606 endif (CGNS_ENABLE_FORTRAN)
565607 # under windows we need to define BUILD_DLL
566608 # and link with the HDF5 libraries to build a dll
567609 if (WIN32 OR CYGWIN)
568 add_definitions(-DBUILD_DLL)
610 target_compile_definitions(cgns_shared PRIVATE -DBUILD_DLL)
611 target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL)
569612 endif (WIN32 OR CYGWIN)
570613 if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY)
571614 target_link_libraries(cgns_shared ${HDF5_LIBRARY} ${CMAKE_DL_LIBS})
2020
2121 CGNSOBJS=\
2222 $(OBJDIR)/cgns_error.$(O) \
23 $(OBJDIR)/cg_hashmap.$(O) \
2324 $(OBJDIR)/cgns_internals.$(O) \
2425 $(OBJDIR)/cgns_io.$(O) \
2526 $(OBJDIR)/cgnslib.$(O)
204205 $(OBJDIR)/cgns_error.$(O) : cgns_error.c cgnslib.h cgns_header.h cgns_io.h
205206 $(CC) $(COPTS) $(COOUT)$@ -c cgns_error.c
206207
207 $(OBJDIR)/cgns_internals.$(O) : cgns_internals.c cgnslib.h cgns_header.h \
208 $(OBJDIR)/cg_hashmap.$(O) : cg_hashmap.c cg_hashmap.h cg_hash_types.h
209 $(CC) $(COPTS) $(HDF5INC) $(COOUT)$@ -c cg_hashmap.c
210
211 $(OBJDIR)/cgns_internals.$(O) : cgns_internals.c cg_hashmap.h cgnslib.h cgns_header.h \
208212 cgns_io.h
209213 $(CC) $(COPTS) $(HDF5INC) $(COOUT)$@ -c cgns_internals.c
210214
211 $(OBJDIR)/cgnslib.$(O) : cgnslib.c cgnslib.h cgns_header.h cgns_io.h
215 $(OBJDIR)/cgnslib.$(O) : cgnslib.c cgnslib.h cgns_header.h cgns_io.h cg_hashmap.h
212216 $(CC) $(COPTS) $(HDF5INC) $(MPIINC) $(COOUT)$@ -c cgnslib.c
213217
214218 $(OBJDIR)/cgns_io.$(O) : cgns_io.c cgnslib.h cgns_io.h \
22 #########
33
44 # Link all the executables to cgns and hdf5
5 link_libraries(cgns_static)
5 if(CGNS_BUILD_SHARED)
6 link_directories(.)
7 link_libraries(cgns_shared)
8 else(CGNS_BUILD_SHARED)
9 link_libraries(cgns_static)
10 endif(CGNS_BUILD_SHARED)
611
712 if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY)
813 link_libraries(${HDF5_LIBRARY})
4646 /* clear f since only partial read */
4747 for (n=0; n<(9+2)*(16+2)*(20+2); n++)
4848 {
49 f[0][0][n] = -0.123456f;
49 (&f[0][0][0])[n] = -0.123456f;
5050 }
5151
5252 /* READ FLOW SOLUTION FROM CGNS FILE */
22 #########
33
44 # Link all the executables to cgns and hdf5
5 link_libraries(cgns_static)
5 if(CGNS_BUILD_SHARED)
6 link_directories(.)
7 link_libraries(cgns_shared)
8 else(CGNS_BUILD_SHARED)
9 link_libraries(cgns_static)
10 endif(CGNS_BUILD_SHARED)
611
712 if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY)
813 link_libraries(${HDF5_LIBRARY})
4141 #include "hdf5.h"
4242 #include "cgns_io.h" /* for cgio_find_file */
4343
44 extern char hdf5_access[64];
45
4446 #if CG_BUILD_PARALLEL
4547 #include "mpi.h"
4648 extern int pcg_mpi_initialized;
6163 #if CG_BUILD_PARALLEL
6264 static MPI_Comm ParallelMPICommunicator = MPI_COMM_NULL;
6365 #endif
66
67 /*** HDF5's CORE FILE DRIVER PARAMETERS ****/
68
69 /* Enables using the core file driver */
70 static int core_vfd = 0;
71 /* specifies the increment by which allocated memory is
72 * to be increased each time more memory is required, 10MiB default. */
73 static size_t core_vfd_increment = 10L*1024L*1024L;
74 /* write the file contents to disk when the file is closed */
75 static hbool_t core_vfd_backing_store = 0;
6476
6577 #define TO_UPPER( c ) ((islower(c))?(toupper(c)):(c))
6678
125137 #define ADFH_U8 "U8"
126138 #define ADFH_R4 "R4"
127139 #define ADFH_R8 "R8"
128 /* these are not supported */
140 /* these have experimental support */
129141 #define ADFH_X4 "X4"
130142 #define ADFH_X8 "X8"
143 /* HDF5 Compound names used for complex value */
144 #define CMPLX_REAL_NAME "r"
145 #define CMPLX_IMAG_NAME "i"
131146
132147 /* file open modes */
133148
216231 {ADFH_ERR_NO_ATT, "Node attribute doesn't exist"},
217232 {ADFH_ERR_AOPEN, "H5Aopen:open of node attribute failed"},
218233 {ADFH_ERR_IGET_NAME, "H5Iget_name:failed to get node path from ID"},
219 {ADFH_ERR_GMOVE, "H5Gmove:moving a node group failed"},
234 {ADFH_ERR_LMOVE, "H5Lmove:moving a node group failed"},
220235 {ADFH_ERR_GUNLINK, "H5Gunlink:node group deletion failed"},
221236 {ADFH_ERR_GOPEN, "H5Gopen:open of a node group failed"},
222237 {ADFH_ERR_DGET_SPACE, "H5Dget_space:couldn't get node dataspace"},
263278
264279 /* useful macros */
265280
266 #define CMP_OSTAT(r,n) ((r)->objno[0]==(n)->objno[0] && \
267 (r)->objno[1]==(n)->objno[1] && \
268 (r)->fileno[0]==(n)->fileno[0] && \
269 (r)->fileno[1]==(n)->fileno[1])
270
271 static herr_t gfind_by_name(hid_t, const char *, void *);
281 #define CMP_OINFO(r,n) ((r)->fileno==(n)->fileno && \
282 (r)->addr==(n)->addr && (r)->addr != HADDR_UNDEF)
283
284
285 static herr_t gfind_by_name(hid_t, const char *, const H5L_info_t*, void *);
272286 static herr_t find_by_name(hid_t, const char *, const H5A_info_t*, void *);
273287
274 #define has_child(ID,NAME) H5Giterate(ID,".",NULL,gfind_by_name,(void *)NAME)
275 #define has_data(ID) H5Giterate(ID,".",NULL,gfind_by_name,(void *)D_DATA)
288 #if H5_VERSION_GE(1,12,0)
289 #define has_child(ID,NAME) H5Literate2(ID, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, gfind_by_name, (void *)NAME)
290 #define has_data(ID) H5Literate2(ID, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, gfind_by_name, (void *)D_DATA)
291 #else
292 #define has_child(ID,NAME) H5Literate(ID, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, gfind_by_name, (void *)NAME)
293 #define has_data(ID) H5Literate(ID, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, gfind_by_name, (void *)D_DATA)
294 #endif
295 #define child_exists(ID,NAME) H5Lexists(ID, NAME, H5P_DEFAULT)
296 #define data_exists(ID) H5Lexists(ID, D_DATA, H5P_DEFAULT)
276297
277298 #define has_att(ID,NAME) H5Aiterate2(ID,H5_INDEX_NAME,H5_ITER_NATIVE,NULL,find_by_name,(void *)NAME)
278299
280301 static herr_t gprint_name(hid_t, const char *, void *);
281302 static herr_t print_name(hid_t, const char *, const H5A_info_t*, void *);
282303
283 #define show_grp(ID) H5Giterate(ID,".",NULL,gprint_name,(void *)"GRP")
304 #define show_grp(ID) H5Literate_by_name(ID, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, gprint_name, (void *)"GRP", H5P_DEFAULT)
284305 #define show_att(ID,NAME) H5Aiterate2(ID,H5_INDEX_NAME,H5_ITER_NATIVE,NULL,print_name,(void *)NAME)
285306 #endif
286307
337358 {
338359 ssize_t n, nobj;
339360 hid_t *objs, fid = -1;
340 H5G_stat_t gstat, rstat;
341
361 H5O_info_t gstat, rstat;
362 int token_cmp;
342363 /* find the file ID from the root ID */
343364
344 if (H5Gget_objinfo(id, "/", 0, &gstat) >= 0) {
365 #if H5_VERSION_GE(1,12,0)
366 if (H5Oget_info_by_name3(id, "/", &gstat, H5O_INFO_BASIC, H5P_DEFAULT) >=0) {
367 #else
368 if (H5Oget_info_by_name(id, "/", &gstat, H5P_DEFAULT) >=0) {
369 #endif
345370 nobj = H5Fget_obj_count(H5F_OBJ_ALL, H5F_OBJ_FILE);
346371 if (nobj > 0) {
347372 objs = (hid_t *) malloc (nobj * sizeof(hid_t));
348373 if (objs == NULL) return fid;
349374 H5Fget_obj_ids(H5F_OBJ_ALL, H5F_OBJ_FILE, -1, objs);
350375 for (n = 0; n < nobj; n++) {
351 H5Gget_objinfo(objs[n], "/", 0, &rstat);
352 if (CMP_OSTAT(&gstat, &rstat)) {
376 #if H5_VERSION_GE(1,12,0)
377 H5Oget_info_by_name3(objs[n], "/", &rstat, H5O_INFO_BASIC, H5P_DEFAULT);
378 token_cmp = 1;
379 if(gstat.fileno == rstat.fileno){
380 H5Otoken_cmp(id, &gstat.token, &rstat.token, &token_cmp);
381 }
382 if (!token_cmp){
383 #else
384 H5Oget_info_by_name(objs[n], "/", &rstat, H5P_DEFAULT);
385 if (CMP_OINFO(&gstat, &rstat)) {
386 #endif
353387 fid = objs[n];
354388 break;
355389 }
445479
446480 static hid_t get_att_id(hid_t id, const char *name, int *err)
447481 {
448 hid_t aid = H5Aopen_name(id, name);
482 hid_t aid = H5Aopen_by_name(id, ".", name, H5P_DEFAULT, H5P_DEFAULT);
449483
450484 /* H5Aclose() performed elsewhere */
451485 if (aid < 0) {
470504 /* [1] the attribute is set on the GROUP (id is a group id) */
471505 /* [2] all datatypes should be H5T_STRING and not H5T_NATIVE_CHAR
472506 which requires an array (see case below with a H5Screate_simple
473 and providse an array of chars)
507 and provides an array of chars)
474508 */
475509 sid = H5Screate(H5S_SCALAR);
476510 if (sid < 0) {
742776 }
743777
744778 #if CG_BUILD_PARALLEL
745 if (pcg_mpi_initialized) {
779 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
746780 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
747781 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
748782 }
751785 status = H5Dwrite(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, xfer_prp, value);
752786
753787 #if CG_BUILD_PARALLEL
754 if (pcg_mpi_initialized) {
788 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
755789 H5Pclose(xfer_prp);
756790 }
757791 #endif
796830 H5Tset_precision(tid, 64);
797831 return tid;
798832 }
833 if (0 == strcmp(tp, ADFH_X4)) {
834 hid_t tid = H5Tcreate(H5T_COMPOUND, 8);
835 hid_t subid = H5Tcopy(H5T_NATIVE_FLOAT);
836 H5Tset_precision(subid, 32);
837 H5Tinsert(tid, CMPLX_REAL_NAME, 0, subid);
838 H5Tinsert(tid, CMPLX_IMAG_NAME, 4, subid);
839 H5Tclose(subid);
840 return tid;
841 }
842 if (0 == strcmp(tp, ADFH_X8)) {
843 hid_t tid = H5Tcreate(H5T_COMPOUND, 16);
844 hid_t subid = H5Tcopy(H5T_NATIVE_DOUBLE);
845 H5Tset_precision(subid, 64);
846 H5Tinsert(tid, CMPLX_REAL_NAME, 0, subid);
847 H5Tinsert(tid, CMPLX_IMAG_NAME, 8, subid);
848 H5Tclose(subid);
849 return tid;
850 }
799851 return 0;
800852 }
801853
810862 strcmp(tp, ADFH_U4) &&
811863 strcmp(tp, ADFH_U8) &&
812864 strcmp(tp, ADFH_R4) &&
813 strcmp(tp, ADFH_R8)) {
865 strcmp(tp, ADFH_R8) &&
866 strcmp(tp, ADFH_X4) &&
867 strcmp(tp, ADFH_X8)) {
814868 set_error(INVALID_DATA_TYPE, err);
815869 return 1;
816870 }
819873 }
820874
821875 /* =================================================================
822 * callback routines for H5Giterate and H5Aiterate
876 * callback routines for H5Literate and H5Aiterate
823877 * ================================================================= */
824878
825879 /* ----------------------------------------------------------------- */
826880
827 static herr_t gfind_by_name(hid_t id, const char *name, void *dsname)
881 static herr_t gfind_by_name(hid_t id, const char *name, const H5L_info_t* linfo, void *dsname)
828882 {
829883 if (0 == strcmp (name, (char *)dsname)) return 1;
830884 return 0;
858912
859913 /* ----------------------------------------------------------------- */
860914
861 static herr_t count_children(hid_t id, const char *name, void *number)
915 static herr_t count_children(hid_t id, const char *name, const H5L_info_t* linfo, void *number)
862916 {
863917 ADFH_CHECK_HID(id);
864918 ADFH_DEBUG(("count_children [%s][%d]",name,(*((int *)number))));
9531007
9541008 #ifndef ADFH_NO_ORDER
9551009 /* -----------------------------------------------------------------
956 called via H5Giterate in Move_Child & Delete functions.
1010 called via H5Literate in Move_Child & Delete functions.
9571011 removes gaps in _order index attributes */
9581012
9591013 static herr_t fix_order(hid_t id, const char *name, void *data)
9881042
9891043 /* ----------------------------------------------------------------- */
9901044
991 static herr_t compare_children(hid_t id, const char *name, void *data)
992 {
993 H5G_stat_t stat, *pstat;
1045 static herr_t compare_children(hid_t id, const char *name, const H5L_info_t *linfo, void *data)
1046 {
1047 H5O_info_t stat, *pstat;
1048 int token_cmp;
9941049
9951050 if (*name != D_PREFIX) {
996 pstat = (H5G_stat_t *)data;
997 if (H5Gget_objinfo(id, name, 0, &stat) >= 0)
998 return CMP_OSTAT(&stat, pstat);
1051 pstat = (H5O_info_t *)data;
1052 #if H5_VERSION_GE(1,12,0)
1053 if (H5Oget_info_by_name3(id, name, &stat, H5O_INFO_BASIC, H5P_DEFAULT) >= 0){
1054 token_cmp = 1;
1055 if(pstat->fileno == stat.fileno){
1056 H5Otoken_cmp(id, &pstat->token, &stat.token, &token_cmp);
1057 }
1058 if (!token_cmp){
1059 return 1;
1060 }
1061 return 0;
1062 }
1063 #else
1064 if (H5Oget_info_by_name(id, name, &stat, H5P_DEFAULT) >= 0){
1065 return CMP_OINFO(&stat, pstat);
1066 }
1067 #endif
9991068 }
10001069 return 0;
10011070 }
10211090
10221091 const char *file;
10231092 const char *path;
1024 H5G_stat_t sb; /* Object information */
1093 H5L_info_t sb;
10251094
10261095 char querybuff[512];
10271096
10381107 set_error(ADFH_ERR_LIBREG, err);
10391108 return -1;
10401109 }
1041 herr=H5Gget_objinfo(id, D_LINK, (hbool_t)0, &sb);
1110 herr = H5Lget_info(id, D_LINK, &sb, H5P_DEFAULT);
10421111
10431112 if (herr<0)
10441113 {
10501119 /* Soft link -> link to our current file */
10511120 /* Hard link (User defined) -> link to an external file */
10521121
1053 if (H5G_LINK != sb.type)
1122 if (H5L_TYPE_SOFT != sb.type)
10541123 {
1055 if (H5G_UDLINK != sb.type)
1124 if (H5L_TYPE_EXTERNAL != sb.type)
10561125 {
10571126 set_error(ADFH_ERR_NOTXLINK, err);
10581127 return -1;
10641133 return -1;
10651134 }
10661135
1067 if (H5Lunpack_elink_val(querybuff,sb.linklen,NULL,&file,&path)<0)
1136 if (H5Lunpack_elink_val(querybuff,sb.u.val_size,NULL,&file,&path)<0)
10681137 {
10691138 set_error(ADFH_ERR_XLINK_UNPACK, err);
10701139 return -1;
10871156 }
10881157 }
10891158 #ifdef ADFH_DEBUG_ON
1159 #if H5_VERSION_GE(1,12,0)
1160 H5Oget_info3(lid, &oinfo, H5O_INFO_BASIC);
1161 #else
10901162 H5Oget_info(lid, &oinfo);
1163 #endif
10911164 ADFH_DEBUG(("<ADFH open_link [%d]->[%d]:%d",id,lid,oinfo.rc));
10921165 #endif
10931166 return lid;
11301203 }
11311204 else
11321205 {
1133 /* H5G_stat_t sb; */
11341206 ADFH_DEBUG(("<ADFH open_node group [%d]",gid));
1135 /* H5Gget_objinfo(gid,".",0,&sb); */
11361207 return gid;
11371208 }
11381209 }
11701241
11711242 static void delete_node(hid_t pid, const char *name)
11721243 {
1173 H5Gunlink(pid, name); /* do we care about link ? no ? */
1174 }
1175
1176 /* ----------------------------------------------------------------- */
1177
1178 static herr_t delete_children(hid_t id, const char *name, void *data)
1244 H5Ldelete(pid, name, H5P_DEFAULT); /* do we care about link ? no ? */
1245 }
1246
1247 /* ----------------------------------------------------------------- */
1248
1249 static herr_t delete_children(hid_t id, const char *name, const H5L_info_t* linfo, void *data)
11791250 {
11801251 if (*name == D_PREFIX)
11811252 {
11831254 if (! is_link(id))
11841255 {
11851256 ADFH_DEBUG(("delete_children is not link [%s]",name));
1186 H5Gunlink(id, name);
1257 H5Ldelete(id, name, H5P_DEFAULT);
11871258 }
11881259 else
11891260 {
11931264 }
11941265 else {
11951266 ADFH_DEBUG(("delete_children loop"));
1196 if (! is_link(id)) H5Giterate(id, name, NULL, delete_children, data);
1267 #if H5_VERSION_GE(1,12,0)
1268 if (! is_link(id)) H5Literate_by_name2(id, name, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, delete_children, data, H5P_DEFAULT);
1269 #else
1270 if (! is_link(id)) H5Literate_by_name(id, name, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, delete_children, data, H5P_DEFAULT);
1271 #endif
11971272 delete_node(id, name);
11981273 }
11991274 return 0;
13191394 H5Dread(did, mid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
13201395 }
13211396 H5Dclose(did);
1322 H5Gunlink(hid, D_DATA);
1397 H5Ldelete(hid, D_DATA, H5P_DEFAULT);
13231398
13241399 /* rewrite data with new dimensions */
13251400 sid = H5Screate_simple(ndims, dims, NULL);
13411416
13421417 /* ----------------------------------------------------------------- */
13431418
1344 static herr_t fix_dimensions(hid_t id, const char *name, void *data)
1419 static herr_t fix_dimensions(hid_t id, const char *name, const H5L_info_t* linfo, void *data)
13451420 {
13461421 hid_t gid;
13471422 int err;
13491424
13501425 if (*name != D_PREFIX && (gid = H5Gopen2(id, name, H5P_DEFAULT)) >= 0 &&
13511426 !get_str_att(gid, A_TYPE, type, &err) && strcmp(type, ADFH_LK)) {
1352 H5Giterate(gid, ".", NULL, fix_dimensions, NULL);
1427 #if H5_VERSION_GE(1,12,0)
1428 H5Literate2(gid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, fix_dimensions, NULL);
1429 #else
1430 H5Literate(gid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, fix_dimensions, NULL);
1431 #endif
13531432 transpose_dimensions(gid,name);
13541433 H5Gclose(gid);
13551434 }
13721451 CompressData = 9;
13731452 else
13741453 CompressData = compress;
1454 set_error(NO_ERROR, err);
1455 }
1456 else if (option == ADFH_CONFIG_CORE) {
1457 core_vfd = (int)((size_t)value);
1458 set_error(NO_ERROR, err);
1459 }
1460 else if (option == ADFH_CONFIG_CORE_WRITE) {
1461 core_vfd_backing_store = (hbool_t)((size_t)value);
1462 set_error(NO_ERROR, err);
1463 }
1464 else if (option == ADFH_CONFIG_CORE_INCR) {
1465 core_vfd_increment = (size_t)value;
13751466 set_error(NO_ERROR, err);
13761467 }
13771468 #if CG_BUILD_PARALLEL
14111502 char nodename[ADF_NAME_LENGTH+1];
14121503 char *newpath;
14131504 herr_t status;
1414 H5G_stat_t stat;
1505 H5O_info_t stat;
14151506
14161507 to_HDF_ID(pid,hpid);
14171508 to_HDF_ID(id,hid);
14261517
14271518 /* check that node is actually child of the parent */
14281519
1429 if (H5Gget_objinfo(hid, ".", 0, &stat) < 0 ||
1430 !H5Giterate(hpid, ".", NULL, compare_children, (void *)&stat)) {
1520 #if H5_VERSION_GE(1,12,0)
1521 if (H5Oget_info_by_name3(hid, ".", &stat, H5O_INFO_BASIC, H5P_DEFAULT) < 0 ||
1522 !H5Literate2(hpid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, compare_children, (void *)&stat)) {
1523 #else
1524 if (H5Oget_info_by_name(hid, ".", &stat, H5P_DEFAULT) < 0 ||
1525 !H5Literate(hpid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, compare_children, (void *)&stat)) {
1526 #endif
14311527 set_error(CHILD_NOT_OF_GIVEN_PARENT, err);
14321528 return;
14331529 }
14581554 printf("%s to [%s]\n",ADFH_PREFIX,newpath);
14591555 #endif
14601556
1461 status = H5Gmove(hpid, nodename, newpath);
1557 status = H5Lmove(hpid, nodename, hnpid, newpath, H5P_DEFAULT, H5P_DEFAULT);
14621558 free(newpath);
14631559 if (status < 0) {
1464 set_error(ADFH_ERR_GMOVE, err);
1560 set_error(ADFH_ERR_LMOVE, err);
14651561 return;
14661562 }
14671563
14771573 set_int_att(hid, A_ORDER, new_order, err)) return;
14781574
14791575 /*see if we need to decrement any node _orders under the old parent*/
1480 *err = H5Giterate(hpid, ".", NULL, fix_order, (void *)&old_order);
1576 #if H5_VERSION_GE(1,12,0)
1577 *err = H5Literate2(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_order, (void *)&old_order);
1578 #else
1579 *err = H5Literate(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_order, (void *)&old_order);
1580 #endif
14811581 if (!*err)
14821582 set_error(NO_ERROR, err);
14831583 #endif
14911591 int *err)
14921592 {
14931593 hid_t hid;
1594 char label_name[ADF_NAME_LENGTH+1];
14941595
14951596 to_HDF_ID(id, hid);
14961597
15081609 set_error(ADFH_ERR_LINK_DATA, err);
15091610 return;
15101611 }
1511 set_str_att(hid, A_LABEL, label, err);
1612 strcpy(label_name, label);
1613 set_str_att(hid, A_LABEL, label_name, err);
15121614 }
15131615
15141616 /* ----------------------------------------------------------------- */
15331635 set_error(ADFH_ERR_LINK_DATA, err);
15341636 return;
15351637 }
1536 if (has_child(hpid, nname)) {
1638 if (child_exists(hpid, nname)) {
15371639 set_error(DUPLICATE_CHILD_NAME, err);
15381640 return;
15391641 }
15411643 #ifdef ADFH_DEBUG_ON
15421644 printf("%s change [%s] to [%s]\n",ADFH_PREFIX,oname,nname);
15431645 #endif
1544 if (H5Gmove(hpid, oname, nname) < 0)
1545 set_error(ADFH_ERR_GMOVE, err);
1646 if (H5Lmove(hpid, oname, hpid, nname, H5P_DEFAULT, H5P_DEFAULT) < 0)
1647 set_error(ADFH_ERR_LMOVE, err);
15461648 else
15471649 set_str_att(hid, A_NAME, nname, err);
15481650 }
16141716 hid_t hpid;
16151717 hid_t gid;
16161718 char *pname;
1719 static const char empty_label[ADF_NAME_LENGTH+1] = "";
16171720 #ifdef ADFH_DEBUG_ON
16181721 H5L_info_t lkbuff;
16191722 #endif
16331736 return;
16341737 }
16351738 */
1636 if (has_child(hpid, pname)) {
1739 if (child_exists(hpid, pname)) {
16371740 set_error(DUPLICATE_CHILD_NAME, err);
16381741 return;
16391742 }
16511754 else {
16521755 #ifdef ADFH_NO_ORDER
16531756 if (new_str_att(gid, A_NAME, pname, ADF_NAME_LENGTH, err) ||
1654 new_str_att(gid, A_LABEL, "", ADF_NAME_LENGTH, err) ||
1757 new_str_att(gid, A_LABEL, empty_label, ADF_NAME_LENGTH, err) ||
16551758 new_str_att(gid, A_TYPE, ADFH_MT, 2, err) ||
16561759 new_int_att(gid, A_FLAGS, mta_root->g_flags, err)) return;
16571760 #else
16581761 int order = 0;
1659 H5Giterate(hpid, ".", NULL, count_children, (void *)&order);
1762 #if H5_VERSION_GE(1,12,0)
1763 H5Literate2(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, count_children, (void *)&order);
1764 #else
1765 H5Literate(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, count_children, (void *)&order);
1766 #endif
16601767 if (new_str_att(gid, A_NAME, pname, ADF_NAME_LENGTH, err) ||
1661 new_str_att(gid, A_LABEL, "", ADF_NAME_LENGTH, err) ||
1768 new_str_att(gid, A_LABEL, empty_label, ADF_NAME_LENGTH, err) ||
16621769 new_str_att(gid, A_TYPE, ADFH_MT, 2, err) ||
16631770 new_int_att(gid, A_ORDER, order, err) ||
16641771 new_int_att(gid, A_FLAGS, mta_root->g_flags, err)) return;
16841791 #ifndef ADFH_NO_ORDER
16851792 int old_order;
16861793 #endif
1687 H5G_stat_t stat;
1794 H5O_info_t stat;
16881795
16891796 to_HDF_ID(pid, hpid);
16901797 to_HDF_ID(id, hid);
16981805
16991806 /* check that node is actually child of the parent */
17001807
1701 if (H5Gget_objinfo(hid, ".", 0, &stat) < 0 ||
1702 !H5Giterate(hpid, ".", NULL, compare_children, (void *)&stat)) {
1808 #if H5_VERSION_GE(1,12,0)
1809 if (H5Oget_info_by_name3(hid, ".", &stat, H5O_INFO_BASIC, H5P_DEFAULT) < 0 ||
1810 !H5Literate2(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, compare_children, (void *)&stat)){
1811 #else
1812 if (H5Oget_info_by_name(hid, ".", &stat, H5P_DEFAULT) < 0 ||
1813 !H5Literate(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, compare_children, (void *)&stat)){
1814 #endif
17031815 set_error(CHILD_NOT_OF_GIVEN_PARENT, err);
17041816 return;
17051817 }
17171829
17181830 if (! is_link(hid))
17191831 {
1720 H5Giterate(hid, ".", NULL, delete_children, NULL);
1832 #if H5_VERSION_GE(1,12,0)
1833 H5Literate2(hid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, delete_children, NULL);
1834 #else
1835 H5Literate(hid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, delete_children, NULL);
1836 #endif
17211837 }
17221838
17231839 /* delete current node */
17281844 /* decrement node orders */
17291845
17301846 #ifndef ADFH_NO_ORDER
1731 *err = H5Giterate(hpid, ".", NULL, fix_order, (void *)&old_order);
1847 #if H5_VERSION_GE(1,12,0)
1848 *err = H5Literate2(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_order, (void *)&old_order);
1849 #else
1850 *err = H5Literate(hpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_order, (void *)&old_order);
1851 #endif
17321852 if (!*err)
17331853 #endif
17341854 set_error(NO_ERROR, err);
17411861 int *err)
17421862 {
17431863 hid_t hid;
1744 int nn,gskip=0;
1864 int nn;
1865 hsize_t gskip=0;
17451866
17461867 ADFH_DEBUG((">ADFH_Number_of_Children"));
17471868
17521873
17531874 *number = 0;
17541875 if ((hid = open_node(id, err)) >= 0) {
1755 H5Giterate(hid, ".", &gskip, count_children, (void*)number);
1876 #if H5_VERSION_GE(1,12,0)
1877 H5Literate2(hid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, &gskip, count_children, (void *)number);
1878 #else
1879 H5Literate(hid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, &gskip, count_children, (void *)number);
1880 #endif
17561881 H5Gclose(hid);
17571882 }
17581883 nn=*number;
18571982 /*initialize names to null*/
18581983 memset(names, 0, ilen*name_length);
18591984 if ((hpid = open_node(pid, err)) >= 0) {
1985 #if H5_VERSION_GE(1,12,0)
1986 H5Literate2(hpid,H5_INDEX_CRT_ORDER,H5_ITER_INC,
1987 NULL,children_names,(void *)names);
1988 #else
18601989 H5Literate(hpid,H5_INDEX_CRT_ORDER,H5_ITER_INC,
18611990 NULL,children_names,(void *)names);
1991 #endif
18621992 if (names[0]==0)
18631993 {
1994 #if H5_VERSION_GE(1,12,0)
1995 H5Literate2(hpid,H5_INDEX_NAME,H5_ITER_INC,
1996 NULL,children_names,(void *)names);
1997 #else
18641998 H5Literate(hpid,H5_INDEX_NAME,H5_ITER_INC,
18651999 NULL,children_names,(void *)names);
2000 #endif
18662001 }
18672002 H5Gclose(hpid);
18682003 }
18972032 mta_root->i_count = 0;
18982033 #endif
18992034 if ((hpid = open_node(pid, err)) >= 0) {
2035 #if H5_VERSION_GE(1,12,0)
2036 H5Literate2(hpid,H5_INDEX_CRT_ORDER,H5_ITER_INC,
2037 NULL,children_ids,(void *)IDs);
2038 #else
19002039 H5Literate(hpid,H5_INDEX_CRT_ORDER,H5_ITER_INC,
19012040 NULL,children_ids,(void *)IDs);
2041 #endif
19022042 if (IDs[0]==-1)
19032043 {
2044 #if H5_VERSION_GE(1,12,0)
2045 H5Literate2(hpid,H5_INDEX_NAME,H5_ITER_INC,
2046 NULL,children_ids,(void *)IDs);
2047 #else
19042048 H5Literate(hpid,H5_INDEX_NAME,H5_ITER_INC,
19052049 NULL,children_ids,(void *)IDs);
2050 #endif
19062051 }
19072052 H5Gclose(hpid);
19082053 }
19312076 {
19322077 hid_t fid, gid;
19332078 char *format, buff[ADF_VERSION_LENGTH+1];
2079 static const char root_name[ADF_NAME_LENGTH+1] = "HDF5 MotherNode";
2080 static const char root_label[ADF_NAME_LENGTH+1] = "Root Node of HDF5 File";
19342081 int i, pos, mode;
19352082 hid_t g_propfileopen;
19362083
20452192 set_error(TOO_MANY_ADF_FILES_OPENED, err);
20462193 return;
20472194 }
2195
2196 g_propfileopen = H5Pcreate(H5P_FILE_ACCESS);
20482197
20492198 /* Patch from Manuel Gageik on IBM BLUEgene/Q systems for better cgp_open performance. */
20502199 #ifdef JFC_PATCH_2015_2
20732222
20742223 #endif
20752224
2076 g_propfileopen = H5Pcreate(H5P_FILE_ACCESS);
20772225 #ifdef ADFH_H5F_CLOSE_STRONG
20782226 /* set access property to close all open accesses when file closed */
20792227 H5Pset_fclose_degree(g_propfileopen, H5F_CLOSE_STRONG);
20802228 #endif
20812229
2082 /* H5Pset_latest_format(fapl, 1); */
2083 /* Performance patch applied by KSH on 2009.05.18 */
2084 H5Pset_libver_bounds(g_propfileopen,
2230 /* Patch to read file created with CGNS 3.3 and hdf5 > 1.8 */
2231 if (mode == ADFH_MODE_RDO) {
2232 H5Pset_libver_bounds(g_propfileopen,
2233 H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
2234 }
2235 else {
2236 /* Compatibility with V1.8 */
2237 H5Pset_libver_bounds(g_propfileopen,
20852238 #if H5_VERSION_GE(1,10,3)
2086 H5F_LIBVER_V18, H5F_LIBVER_V18);
2087 #else
2088 H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
2089 #endif
2239 H5F_LIBVER_V18, H5F_LIBVER_V18);
2240 #else
2241 H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
2242 #endif
2243 }
2244
20902245 /* open the file */
20912246
20922247 #if CG_BUILD_PARALLEL
21062261 }
21072262 }
21082263 #endif
2264 /* check for an error if core file driver is set to write memory to file,
2265 but the CGNS file mode was set to read only */
2266 if( (core_vfd_backing_store == 1) && (mode == ADFH_MODE_RDO) ) {
2267 ADFH_DEBUG(("File mode read-only, but diskless option set to write"));
2268 set_error(ADFH_ERR_INVALID_OPTION, err);
2269 return;
2270 }
2271 if(core_vfd == 1) {
2272 H5Pset_fapl_core(g_propfileopen, core_vfd_increment, core_vfd_backing_store);
2273 }
21092274
21102275 set_error(NO_ERROR, err);
21112276
21592324 memset(buff, 0, ADF_VERSION_LENGTH+1);
21602325 ADFH_Library_Version(buff, err);
21612326 format = native_format();
2162 if (new_str_att(gid, A_NAME, "HDF5 MotherNode", ADF_NAME_LENGTH, err) ||
2163 new_str_att(gid, A_LABEL, "Root Node of HDF5 File", ADF_NAME_LENGTH, err) ||
2327 if (new_str_att(gid, A_NAME, root_name, ADF_NAME_LENGTH, err) ||
2328 new_str_att(gid, A_LABEL, root_label, ADF_NAME_LENGTH, err) ||
21642329 new_str_att(gid, A_TYPE, ADFH_MT, 2, err) ||
21652330 new_str_data(gid, D_FORMAT, format, (int)strlen(format), err) ||
21662331 new_str_data(gid, D_VERSION, buff, ADF_VERSION_LENGTH, err)) {
21692334 }
21702335 }
21712336 else {
2337 #if H5_VERSION_GE(1,12,0)
2338 if (H5Fis_accessible(name, H5P_DEFAULT) <= 0) {
2339 #else
21722340 if (H5Fis_hdf5(name) <= 0) {
2341 #endif
21732342 H5Pclose(g_propfileopen);
21742343 set_error(ADFH_ERR_NOT_HDF5_FILE, err);
21752344 return;
21922361 }
21932362 gid = H5Gopen2(fid, "/", H5P_DEFAULT);
21942363 #ifdef ADFH_FORTRAN_INDEXING
2195 if (mode != ADFH_MODE_RDO && has_child(gid, D_OLDVERS)) {
2196 H5Giterate(gid, ".", NULL, fix_dimensions, NULL);
2197 H5Gmove(gid, D_OLDVERS, D_VERSION);
2364 if (mode != ADFH_MODE_RDO && child_exists(gid, D_OLDVERS)) {
2365 #if H5_VERSION_GE(1,12,0)
2366 H5Literate2(gid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_dimensions, NULL);
2367 #else
2368 H5Literate(gid, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, fix_dimensions, NULL);
2369 #endif
2370 H5Lmove(gid, D_OLDVERS, gid, D_VERSION, H5P_DEFAULT, H5P_DEFAULT);
21982371 }
21992372 #endif
22002373 }
22172390 if (NULL == name || 0 == *name)
22182391 *err = NULL_STRING_POINTER;
22192392 else
2393 #if H5_VERSION_GE(1,12,0)
2394 *err = H5Fis_accessible(name, H5P_DEFAULT);
2395 #else
22202396 *err = H5Fis_hdf5(name);
2397 #endif
22212398 }
22222399
22232400 /* ----------------------------------------------------------------- */
22502427 #if CG_BUILD_PARALLEL
22512428 hid_t fid = get_file_id(hid);
22522429 hid_t fapl=H5Fget_access_plist(fid);
2253 if (H5Pget_driver(fapl) == H5FD_MPIO) {
2430 hid_t driver_id = H5Pget_driver(fapl);
2431 H5Pclose(fapl); /* close the property list */
2432 if (driver_id == H5FD_MPIO) {
22542433 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
22552434 ADFH_CHECK_HID(xfer_prp);
22562435 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
22572436 }
22582437 #endif
2259
22602438 status = H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, xfer_prp, format);
2261
2439 H5Dclose(did);
22622440 #if CG_BUILD_PARALLEL
2263 if (H5Pget_driver(fapl) == H5FD_MPIO) {
2441 if (driver_id == H5FD_MPIO) {
22642442 H5Pclose(xfer_prp);
22652443 }
2266 H5Pclose(fapl); /* close the property list */
2267 #endif
2268 H5Dclose(did);
2269
2444 #endif
22702445 if (status < 0)
22712446 set_error(ADFH_ERR_DREAD, err);
22722447 }
22882463 {
22892464 ADFH_DEBUG(("ADFH_Database_Delete [%s]",name));
22902465
2466 #if H5_VERSION_GE(1,12,0)
2467 if (H5Fis_accessible(name, H5P_DEFAULT) <=0)
2468 #else
22912469 if (H5Fis_hdf5(name) <= 0)
2470 #endif
22922471 set_error(ADFH_ERR_NOT_HDF5_FILE, err);
22932472 else if (UNLINK(name))
22942473 set_error(ADFH_ERR_FILE_DELETE, err);
24612640 H5Dclose(did);
24622641 *link_path_length = (int)size;
24632642
2464 if (has_child(hid, D_FILE)) {
2643 if (child_exists(hid, D_FILE)) {
24652644 did = H5Dopen2(hid, D_FILE, H5P_DEFAULT);
24662645 ADFH_CHECK_HID(did);
24672646 sid = H5Dget_space(did);
25012680 H5Dclose(did);
25022681 *name_len = (int)size;
25032682
2504 if (has_child(hid, D_FILE)) {
2683 if (child_exists(hid, D_FILE)) {
25052684 did = H5Dopen2(hid, D_FILE, H5P_DEFAULT);
25062685 sid = H5Dget_space(did);
25072686 size = H5Sget_simple_extent_npoints(sid);
26712850 new_type[2] = 0;
26722851
26732852 if (0 == strcmp(new_type, ADFH_MT)) {
2674 if (has_data(hid))
2675 H5Gunlink(hid, D_DATA);
2853 if (data_exists(hid))
2854 H5Ldelete(hid, D_DATA, H5P_DEFAULT);
26762855 set_str_att(hid, A_TYPE, new_type, err);
26772856 return;
26782857 }
27012880 * in these rare cases.
27022881 */
27032882
2704 if(has_data(hid)) {
2883 if(data_exists(hid)) {
27052884 ADFH_DEBUG(("ADFH_Put_Dimension_Information unlink [%d]",hid));
2706 H5Gunlink(hid, D_DATA);
2885 H5Ldelete(hid, D_DATA, H5P_DEFAULT);
27072886 }
27082887
27092888 if (set_str_att(hid, A_TYPE, new_type, err)) {
27922971 }
27932972
27942973 #if CG_BUILD_PARALLEL
2795 if (pcg_mpi_initialized) {
2974 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
27962975 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
27972976 ADFH_CHECK_HID(xfer_prp);
27982977 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
28042983 H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, xfer_prp, link_path);
28052984 H5Dclose(did);
28062985
2807 if (has_child(hid, D_FILE)) {
2986 if (child_exists(hid, D_FILE)) {
28082987 did = H5Dopen2(hid, D_FILE, H5P_DEFAULT);
28092988 ADFH_CHECK_HID(did);
28102989 H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, xfer_prp, filename);
28162995 }
28172996
28182997 #if CG_BUILD_PARALLEL
2819 if (pcg_mpi_initialized) {
2998 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
28202999 H5Pclose(xfer_prp);
28213000 }
28223001 #endif
28793058
28803059 /* create a soft link */
28813060
2882 status = H5Glink(lid, H5G_LINK_SOFT, target, D_LINK);
3061 status = H5Lcreate_soft(target, lid, D_LINK, H5P_DEFAULT, H5P_DEFAULT);
28833062 free(target);
28843063 if (status < 0) {
28853064 set_error(ADFH_ERR_GLINK, err);
29673146 }
29683147 #if CG_BUILD_PARALLEL
29693148 hid_t fid = get_file_id(hid);
2970 hid_t fapl=H5Fget_access_plist(fid);
2971 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3149 hid_t fapl = H5Fget_access_plist(fid);
3150 hid_t driver_id = H5Pget_driver(fapl);
3151 H5Pclose(fapl); /* close the property list */
3152 if (driver_id == H5FD_MPIO) {
29723153 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
3154 ADFH_CHECK_HID(xfer_prp);
29733155 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
29743156 }
29753157 #endif
29763158 status = H5Dread(did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, xfer_prp, buff);
29773159 H5Dclose(did);
29783160 #if CG_BUILD_PARALLEL
2979
2980 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3161 if (driver_id == H5FD_MPIO) {
29813162 H5Pclose(xfer_prp);
29823163 }
29833164 #endif
30783259 }
30793260 if ((hid = open_node(ID, err)) < 0) return;
30803261
3081 if (!has_data(hid)) {
3262 if (!data_exists(hid)) {
30823263 H5Gclose(hid);
30833264 set_error(NO_DATA, err);
30843265 return;
31263307 #if CG_BUILD_PARALLEL
31273308 hid_t fid = get_file_id(hid);
31283309 hid_t fapl=H5Fget_access_plist(fid);
3129 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3310 hid_t driver_id = H5Pget_driver(fapl);
3311 H5Pclose(fapl); /* close the property list */
3312 if (driver_id == H5FD_MPIO) {
31303313 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
31313314 ADFH_CHECK_HID(xfer_prp);
31323315 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
31333316 }
31343317 #endif
3135
31363318 if (H5Dread(did, mid, H5S_ALL, H5S_ALL, xfer_prp, buff) < 0)
31373319 set_error(ADFH_ERR_DREAD, err);
31383320 else {
31413323 memcpy(data, &buff[offset], count);
31423324 set_error(NO_ERROR, err);
31433325 }
3144
31453326 free (buff);
31463327 #if CG_BUILD_PARALLEL
3147 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3328 if (driver_id == H5FD_MPIO) {
31483329 H5Pclose(xfer_prp);
31493330 }
31503331 #endif
31813362
31823363 if ((hid = open_node(ID, err)) < 0) return;
31833364
3184 if (!has_data(hid)) {
3365 if (!data_exists(hid)) {
31853366 H5Gclose(hid);
31863367 set_error(NO_DATA, err);
31873368 return;
33063487 #if CG_BUILD_PARALLEL
33073488 hid_t fid = get_file_id(hid);
33083489 hid_t fapl=H5Fget_access_plist(fid);
3309 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3490 hid_t driver_id = H5Pget_driver(fapl);
3491 H5Pclose(fapl); /* close the property list */
3492 if (driver_id == H5FD_MPIO) {
33103493 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
33113494 ADFH_CHECK_HID(xfer_prp);
33123495 H5Pset_dxpl_mpio(xfer_prp, default_pio_mode);
33143497 #endif
33153498
33163499 status = H5Dread(did, mid, mspace, dspace, xfer_prp, data);
3500 H5Dclose(did);
33173501
33183502 #if CG_BUILD_PARALLEL
3319 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3503 if (driver_id == H5FD_MPIO) {
33203504 H5Pclose(xfer_prp);
33213505 }
33223506 #endif
33233507 H5Sclose(mspace);
33243508 H5Sclose(dspace);
33253509 H5Tclose(mid);
3326 H5Dclose(did);
33273510 H5Gclose(hid);
33283511
33293512 if (status < 0)
33463529
33473530 if ((hid = open_node(id, err)) < 0) return;
33483531
3349 if (has_data(hid)) {
3532 if (data_exists(hid)) {
33503533 did = H5Dopen2(hid, D_DATA, H5P_DEFAULT);
33513534 ADFH_CHECK_HID(did);
33523535 if (m_data_type) {
33583541 }
33593542 ADFH_CHECK_HID(mid);
33603543 #if CG_BUILD_PARALLEL
3361 if (pcg_mpi_initialized) {
3544 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
33623545 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
33633546 ADFH_CHECK_HID(xfer_prp);
33643547 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
33703553 set_error(NO_ERROR, err);
33713554
33723555 #if CG_BUILD_PARALLEL
3373 if (pcg_mpi_initialized) {
3556 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
33743557 H5Pclose(xfer_prp);
33753558 }
33763559 #endif
34153598 set_error(ADFH_ERR_LINK_DATA, err);
34163599 return;
34173600 }
3418 if (!has_data(hid)) {
3601 if (!data_exists(hid)) {
34193602 set_error(NO_DATA, err);
34203603 return;
34213604 }
34573640 #if CG_BUILD_PARALLEL
34583641 hid_t fid = get_file_id(hid);
34593642 hid_t fapl=H5Fget_access_plist(fid);
3460 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3643 hid_t driver_id = H5Pget_driver(fapl);
3644 H5Pclose(fapl); /* close the property list */
3645 if (driver_id == H5FD_MPIO) {
34613646 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
34623647 ADFH_CHECK_HID(xfer_prp);
34633648 H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE);
34783663
34793664 free (buff);
34803665 #if CG_BUILD_PARALLEL
3481 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3666 if (driver_id == H5FD_MPIO) {
34823667 H5Pclose(xfer_prp);
34833668 }
34843669 #endif
35223707 set_error(ADFH_ERR_LINK_DATA, err);
35233708 return;
35243709 }
3525 if (!has_data(hid)) {
3710 if (!data_exists(hid)) {
35263711 set_error(NO_DATA, err);
35273712 return;
35283713 }
36433828 #if CG_BUILD_PARALLEL
36443829 hid_t fid = get_file_id(hid);
36453830 hid_t fapl=H5Fget_access_plist(fid);
3646 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3831 hid_t driver_id = H5Pget_driver(fapl);
3832 H5Pclose(fapl); /* close the property list */
3833
3834 if (driver_id == H5FD_MPIO) {
36473835 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
36483836 ADFH_CHECK_HID(xfer_prp);
36493837 H5Pset_dxpl_mpio(xfer_prp, default_pio_mode);
36533841 status = H5Dwrite(did, mid, mspace, dspace, xfer_prp, data);
36543842
36553843 #if CG_BUILD_PARALLEL
3656 if (H5Pget_driver(fapl) == H5FD_MPIO) {
3844 if (driver_id == H5FD_MPIO) {
36573845 H5Pclose(xfer_prp);
36583846 }
36593847 #endif
36923880 set_error(ADFH_ERR_LINK_DATA, err);
36933881 return;
36943882 }
3695 if (has_data(hid)) {
3883 if (data_exists(hid)) {
36963884 ADFH_CHECK_HID(hid);
36973885 did = H5Dopen2(hid, D_DATA, H5P_DEFAULT);
36983886 ADFH_CHECK_HID(did);
37063894 }
37073895 ADFH_CHECK_HID(mid);
37083896 #if CG_BUILD_PARALLEL
3709 if (pcg_mpi_initialized) {
3897 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
37103898 xfer_prp = H5Pcreate(H5P_DATASET_XFER);
37113899 ADFH_CHECK_HID(xfer_prp);
37123900 if (H5Pset_dxpl_mpio(xfer_prp, H5FD_MPIO_COLLECTIVE) < 0)
37193907 else
37203908 set_error(NO_ERROR, err);
37213909 #if CG_BUILD_PARALLEL
3722 if (pcg_mpi_initialized) {
3910 if (pcg_mpi_initialized && strcmp(hdf5_access, "PARALLEL") == 0) {
37233911 H5Pclose(xfer_prp);
37243912 }
37253913 #endif
37303918 else
37313919 set_error(NO_DATA, err);
37323920 }
3733
5151 #define ADF_STATUS_LENGTH 32
5252 #define ADF_VERSION_LENGTH 32
5353
54 #define NO_ERROR -1
54 #define NO_ERROR 0
5555 #define NUMBER_LESS_THAN_MINIMUM 1
5656 #define NUMBER_GREATER_THAN_MAXIMUM 2
5757 #define STRING_LENGTH_ZERO 3
125125 #define ADFH_ERR_NO_ATT 71
126126 #define ADFH_ERR_AOPEN 72
127127 #define ADFH_ERR_IGET_NAME 73
128 #define ADFH_ERR_GMOVE 74
128 #define ADFH_ERR_LMOVE 74
129129 #define ADFH_ERR_GUNLINK 75
130130 #define ADFH_ERR_GOPEN 76
131131 #define ADFH_ERR_DGET_SPACE 77
166166
167167 /* configuration options */
168168
169 #define ADFH_CONFIG_COMPRESS 1
170 #define ADFH_CONFIG_MPI_COMM 2
169 #define ADFH_CONFIG_COMPRESS 1
170 #define ADFH_CONFIG_MPI_COMM 2
171 #define ADFH_CONFIG_CORE 3
172 #define ADFH_CONFIG_CORE_INCR 4
173 #define ADFH_CONFIG_CORE_WRITE 5
174
171175
172176 /***********************************************************************
173177 Prototypes for Interface Routines
179179
180180 /*-----------------------------------------------------------------------*/
181181
182 CGNSDLL void cg_configure_c_ptr(cgint_f *what, void *value, cgint_f *ier)
183 {
184 /* CHARACTERS */
185 if( (int)*what == CG_CONFIG_SET_PATH ||
186 (int)*what == CG_CONFIG_ADD_PATH) {
187 *ier = (cgint_f)cg_configure((int)*what, value);
188
189 /* MPI COMMUNICATOR */
190 #if CG_BUILD_PARALLEL
191 } else if( (int)*what == CG_CONFIG_HDF5_MPI_COMM ) {
192 MPI_Fint F_comm = *(MPI_Fint *)value;
193 MPI_Comm C_comm = MPI_Comm_f2c(F_comm);
194 *ier = (cgint_f)cg_configure((int)*what, &C_comm);
195 #endif
196
197 /* RIND */
198 } else if( (int)*what == CG_CONFIG_RIND_INDEX) {
199 if(*(int*)value == 0) {
200 *ier = (cgint_f)cg_configure((int)*what, CG_CONFIG_RIND_ZERO);
201 } else if(*(int*)value == 1) {
202 *ier = (cgint_f)cg_configure((int)*what, CG_CONFIG_RIND_CORE);
203 } else {
204 *ier = (cgint_f)CG_ERROR;
205 return;
206 }
207
208 /* EVERYTHING ELSE */
209 } else {
210 *ier = (cgint_f)cg_configure((int)*what, (void *)(*(size_t *)value));
211 }
212 }
213 /*-----------------------------------------------------------------------*/
214
215 CGNSDLL void cg_configure_c_funptr(cgint_f *what, void *value, cgint_f *ier)
216 {
217 /* FUNCTION POINTER */
218 if( (int)*what == CG_CONFIG_ERROR ) {
219 *ier = (cgint_f)cg_configure((int)*what, value);
220 } else {
221 *ier = (cgint_f)CG_ERROR;
222 }
223 }
224
225 /*-----------------------------------------------------------------------*/
226
182227 CGNSDLL void cg_get_file_type_f(cgint_f *fn, cgint_f *ft, cgint_f *ier)
183228 {
184229 int i_ft;
11711216
11721217 /*-----------------------------------------------------------------------*/
11731218
1219 CGNSDLL void FMNAME(cg_section_general_write_f, CG_SECTION_GENERAL_WRITE_F)
1220 (cgint_f *fn, cgint_f *B, cgint_f *Z, STR_PSTR(section_name),
1221 CGNS_ENUMT(ElementType_t)*type, CGNS_ENUMT(DataType_t)* elementDataType,
1222 cgsize_t *start, cgsize_t *end, cgsize_t *elementDataSize,
1223 cgint_f *nbndry, cgint_f *S, cgint_f *ier STR_PLEN(section_name))
1224 {
1225 char c_name[CGIO_MAX_NAME_LENGTH+1];
1226 int i_S;
1227
1228 /* convert Fortran-text-string to a C-string */
1229 string_2_C_string(STR_PTR(section_name), STR_LEN(section_name),
1230 c_name, CGIO_MAX_NAME_LENGTH, ier);
1231 if (*ier) return;
1232
1233 *ier = (cgint_f)cg_section_general_write((int)*fn, (int)*B, (int)*Z, c_name,
1234 *type, *elementDataType, *start, *end, *elementDataSize,
1235 (int)*nbndry, &i_S);
1236 *S = (cgint_f)i_S;
1237 }
1238
1239 /*-----------------------------------------------------------------------*/
1240
1241 CGNSDLL void FMNAME(cg_section_initialize_f, CG_SECTION_INITIALIZE_F)
1242 (cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgint_f *ier)
1243 {
1244
1245 *ier = (cgint_f)cg_section_initialize((int)*fn, (int)*B, (int)*Z, (int) *S);
1246 }
1247
1248 /*-----------------------------------------------------------------------*/
1249
11741250 CGNSDLL void FMNAME(cg_parent_data_write_f, CG_PARENT_DATA_WRITE_F )(cgint_f *fn,
11751251 cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *parent_data, cgint_f *ier)
11761252 {
12091285
12101286 /*-----------------------------------------------------------------------*/
12111287
1288 CGNSDLL void FMNAME(cg_elements_general_write_f, CG_ELEMENTS_GENERAL_WRITE_F) (
1289 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1290 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype, void *elements, cgint_f *ier)
1291 {
1292
1293 *ier = (cgint_f)cg_elements_general_write((int)*fn, (int)*B, (int)*Z, (int)*S,
1294 *rmin, *rmax, *mtype, elements);
1295 }
1296
1297
1298 /*-----------------------------------------------------------------------*/
1299
12121300 CGNSDLL void FMNAME(cg_poly_elements_partial_write_f, CG_POLY_ELEMENTS_PARTIAL_WRITE_F) (
12131301 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
12141302 cgsize_t *rmax, cgsize_t *elements, cgsize_t *connect_offset, cgint_f *ier)
12191307
12201308 /*-----------------------------------------------------------------------*/
12211309
1310 CGNSDLL void FMNAME(cg_poly_elements_general_write_f, CG_POLY_ELEMENTS_GENERAL_WRITE_F) (
1311 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1312 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype,
1313 void *elements, void *connect_offset, cgint_f *ier)
1314 {
1315 *ier = (cgint_f)cg_poly_elements_general_write((int)*fn, (int)*B, (int)*Z, (int)*S,
1316 *rmin, *rmax, *mtype, elements, connect_offset);
1317 }
1318
1319 /*-----------------------------------------------------------------------*/
1320
12221321 CGNSDLL void FMNAME(cg_parent_data_partial_write_f, CG_PARENT_DATA_PARTIAL_WRITE_F) (
12231322 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
12241323 cgsize_t *rmax, cgsize_t *parent_data, cgint_f *ier)
12451344 {
12461345 *ier = (cgint_f)cg_poly_elements_partial_read((int)*fn, (int)*B, (int)*Z, (int)*S,
12471346 *rmin, *rmax, elements, connect_offset, parent);
1347 }
1348
1349 /*-----------------------------------------------------------------------*/
1350
1351 CGNSDLL void FMNAME(cg_elements_general_read_f, CG_ELEMENTS_GENERAL_READ_F) (
1352 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1353 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype, void *elements, cgint_f *ier)
1354 {
1355 *ier = (cgint_f)cg_elements_general_read((int)*fn, (int)*B, (int)*Z, (int)*S,
1356 *rmin, *rmax, *mtype, elements);
1357 }
1358
1359 /*-----------------------------------------------------------------------*/
1360
1361 CGNSDLL void FMNAME(cg_poly_elements_general_read_f, CG_POLY_ELEMENTS_GENERAL_READ_F) (
1362 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1363 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype, void *elements,
1364 void *connect_offset, cgint_f *ier)
1365 {
1366 *ier = (cgint_f)cg_poly_elements_general_read((int)*fn, (int)*B, (int)*Z, (int)*S,
1367 *rmin, *rmax, *mtype, elements, connect_offset);
1368 }
1369
1370 /*-----------------------------------------------------------------------*/
1371
1372 CGNSDLL void FMNAME(cg_parent_elements_general_read_f, CG_PARENT_ELEMENTS_GENERAL_READ_F) (
1373 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1374 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype, void *parelem, cgint_f *ier)
1375 {
1376 *ier = (cgint_f)cg_parent_elements_general_read((int)*fn, (int)*B, (int)*Z, (int)*S,
1377 *rmin, *rmax, *mtype, parelem);
1378 }
1379
1380 /*-----------------------------------------------------------------------*/
1381
1382 CGNSDLL void FMNAME(cg_parent_elements_position_general_read_f, CG_PARENT_ELEMENTS_POSITION_GENERAL_READ_F) (
1383 cgint_f *fn, cgint_f *B, cgint_f *Z, cgint_f *S, cgsize_t *rmin,
1384 cgsize_t *rmax, CGNS_ENUMT(DataType_t) *mtype, void *parface, cgint_f *ier)
1385 {
1386 *ier = (cgint_f)cg_parent_elements_position_general_read((int)*fn, (int)*B, (int)*Z, (int)*S,
1387 *rmin, *rmax, *mtype, parface);
12481388 }
12491389
12501390 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
28552995 CGNSDLL void FMNAME(cg_goto_f, CG_GOTO_F)(cgint_f *fn, cgint_f *B, cgint_f *ier, ...)
28562996 #endif
28572997 {
2858 #ifdef _CRAY
2859 _fcd cray_string;
2998 #ifndef _fcd
2999 #define _fcd char*
28603000 #endif
28613001 char *f_label[CG_MAX_GOTO_DEPTH], *label[CG_MAX_GOTO_DEPTH];
28623002 int index[CG_MAX_GOTO_DEPTH], n, i, len[CG_MAX_GOTO_DEPTH];
28693009
28703010 /* read arguments */
28713011 for (n = 0; n < CG_MAX_GOTO_DEPTH; n++) {
3012 f_label[n] = STR_PTR(va_arg(ap, _fcd));
28723013 #ifdef _CRAY
2873 cray_string = va_arg(ap, _fcd);
2874 f_label[n] = _fcdtocp(cray_string);
28753014 len[n] = _fcdlen(cray_string);
2876 #else
2877 f_label[n] = va_arg(ap, char *);
3015 #endif
28783016 # ifdef WIN32_FORTRAN
2879 /* In Windows, the arguments appear in a different order: char*, len, index,...*/
3017 /* In Windows, the arguments appear in order: char*, len, index,...*/
28803018 len[n] = (int)va_arg(ap, int);
28813019 # endif
2882 #endif
28833020 if (f_label[n][0] == ' ' || 0 == strncmp(f_label[n],"end",3) ||
28843021 0 == strncmp(f_label[n],"END",3)) break;
28853022
28903027 return;
28913028 }
28923029 }
2893
28943030 #if !defined(_CRAY) && !defined(WIN32_FORTRAN)
28953031 for (i=0; i<n; i++) {
28963032 len[i] = va_arg(ap, int);
29283064 #endif
29293065 char *f_label[CG_MAX_GOTO_DEPTH], *label[CG_MAX_GOTO_DEPTH];
29303066 int index[CG_MAX_GOTO_DEPTH], n, i, len[CG_MAX_GOTO_DEPTH];
3067
29313068 va_list ap;
29323069
29333070 if (posit == 0) {
29693106 return;
29703107 }
29713108 }
2972
29733109 #if !defined(_CRAY) && !defined(WIN32_FORTRAN)
29743110 for (i=0; i<n; i++) {
29753111 len[i] = va_arg(ap, int);
29923128
29933129 for (i=0; i<n; i++) CGNS_FREE(label[i]);
29943130 return;
3131 }
3132
3133 CGNSDLL void FMNAME(cg_goto_f1, CG_GOTO_F1)(cgint_f *fn, cgint_f *B, cgint_f *ier, STR_PSTR(name), cgint_f *index STR_PLEN(name))
3134 {
3135 int length;
3136 char *c_label[2];
3137 int c_index[2], n;
3138
3139 if (*index < 0) {
3140 cgi_error("Incorrect input to function cg_goto_f");
3141 *ier = 1;
3142 return;
3143 }
3144
3145 length = (int) STR_LEN(name);
3146 c_label[0] = CGNS_NEW(char, length+1);
3147 c_label[1] = "end";
3148 c_index[0] = (int)*index;
3149 c_index[1] = 0;
3150
3151 string_2_C_string(STR_PTR(name), STR_LEN(name), c_label[0], length, ier);
3152
3153 if (*ier == 0) {
3154 if (c_label[0][0] == ' ' || 0 == strncmp(c_label[0],"end",3) ||
3155 0 == strncmp(c_label[0],"END",3)) {
3156 n=0;
3157 } else {
3158 n=1;
3159 }
3160 *ier = (cgint_f)cgi_set_posit((int)*fn, (int)*B, n, c_index, c_label);
3161 }
3162
3163 CGNS_FREE(c_label[0]);
3164 }
3165
3166 CGNSDLL void FMNAME(cg_gorel_f1, CG_GOREL_F1)(cgint_f *fn, cgint_f *ier, STR_PSTR(name), cgint_f *index STR_PLEN(name))
3167 {
3168 int length;
3169 char *c_label[2];
3170 int c_index[2], n;
3171
3172 if (posit == 0) {
3173 cgi_error ("position not set with cg_goto");
3174 *ier = (cgint_f)CG_ERROR;
3175 return;
3176 }
3177 if ((int)*fn != posit_file) {
3178 cgi_error("current position is in the wrong file");
3179 *ier = (cgint_f)CG_ERROR;
3180 return;
3181 }
3182 if (*index < 0) {
3183 cgi_error("Incorrect input to function cg_gorel_f1");
3184 *ier = 1;
3185 return;
3186 }
3187
3188 length = (int) STR_LEN(name);
3189 c_label[0] = CGNS_NEW(char, length+1);
3190 c_label[1] = "end";
3191 c_index[0] = (int)*index;
3192 c_index[1] = 0;
3193
3194 string_2_C_string(STR_PTR(name), STR_LEN(name), c_label[0], length, ier);
3195
3196 if (*ier == 0) {
3197 if (c_label[0][0] == ' ' || 0 == strncmp(c_label[0],"end",3) ||
3198 0 == strncmp(c_label[0],"END",3)) {
3199 n=0;
3200 } else {
3201 n=1;
3202 }
3203 *ier = (cgint_f)cgi_update_posit(n, c_index, c_label);
3204 }
3205
3206 CGNS_FREE(c_label[0]);
29953207 }
29963208
29973209 /*-----------------------------------------------------------------------*/
0 #ifndef CGNS_HASH_TYPES_H
1 #define CGNS_HASH_TYPES_H
2 #include <stdint.h>
3
4 /* Typedef used by hashmap */
5 /* Not stored in cgnstypes.h to not leak them */
6
7 #define SIZEOF_LONG @SIZEOF_LONG@
8 #define SIZEOF_VOID_P @SIZEOF_VOID_P@
9 #if @BUILD64BIT@
10 typedef int64_t map_ssize_t;
11 typedef uint64_t map_usize_t;
12 #define SIZEOF_MAP_USIZE_T 8
13 #else
14 typedef int32_t map_ssize_t;
15 typedef uint32_t map_usize_t;
16 #define SIZEOF_MAP_USIZE_T 4
17 #endif
18 typedef char char_name[33];
19
20 #endif
0 #include "cg_hashmap.h"
1 #include <stdint.h>
2 #include <string.h>
3 #include <stdlib.h>
4 #include <assert.h>
5
6 #if defined(_MSC_VER)
7 #include <intrin.h>
8 #endif
9
10 /* The hashmap is unordered.
11 As long as no item is deleted the insertion order is kept
12 */
13
14 #define PERTURB_SHIFT 5
15 #define MAP_SIZE(map) ((map)->table_size)
16 #if SIZEOF_VOID_P > 4
17 #define MAP_IXSIZE(map) \
18 (MAP_SIZE(map) <= 0xff ? \
19 1 : MAP_SIZE(map) <= 0xffff ? \
20 2 : MAP_SIZE(map) <= 0xffffffff ? \
21 4 : sizeof(int64_t))
22 #else
23 #define MAP_IXSIZE(map) \
24 (MAP_SIZE(map) <= 0xff ? \
25 1 : MAP_SIZE(map) <= 0xffff ? \
26 2 : sizeof(int32_t))
27 #endif
28 #define MAP_ENTRIES(map) \
29 ((cgns_hashmap_entry*)(&((int8_t*)((map)->map_indices))[MAP_SIZE(map) * MAP_IXSIZE(map)]))
30
31 #define MAP_MASK(map) (((map)->table_size)-1)
32 #define IS_POWER_OF_2(x) (((x) & (x-1)) == 0)
33
34
35 /* lookup indices. returns MAPIX_EMPTY, MAPIX_DUMMY, or ix >=0 */
36 static inline map_ssize_t
37 cgi_hashmap_get_index(const cgns_hashmap_keyobject *keys, map_ssize_t i)
38 {
39 map_ssize_t s = MAP_SIZE(keys);
40 map_ssize_t ix;
41
42 if (s <= 0xff) {
43 const int8_t *indices = (const int8_t*)(keys->map_indices);
44 ix = indices[i];
45 }
46 else if (s <= 0xffff) {
47 const int16_t *indices = (const int16_t*)(keys->map_indices);
48 ix = indices[i];
49 }
50 #if SIZEOF_VOID_P > 4
51 else if (s > 0xffffffff) {
52 const int64_t *indices = (const int64_t*)(keys->map_indices);
53 ix = indices[i];
54 }
55 #endif
56 else {
57 const int32_t *indices = (const int32_t*)(keys->map_indices);
58 ix = indices[i];
59 }
60 assert(ix >= MAPIX_DUMMY);
61 return ix;
62 }
63
64 /* write to indices. */
65 static inline void
66 cgi_hashmap_set_index(cgns_hashmap_keyobject *keys, map_ssize_t i, map_ssize_t ix)
67 {
68 map_ssize_t s = MAP_SIZE(keys);
69
70 assert(ix >= MAPIX_DUMMY);
71
72 if (s <= 0xff) {
73 int8_t *indices = (int8_t*)(keys->map_indices);
74 assert(ix <= 0x7f);
75 indices[i] = (char)ix;
76 }
77 else if (s <= 0xffff) {
78 int16_t *indices = (int16_t*)(keys->map_indices);
79 assert(ix <= 0x7fff);
80 indices[i] = (int16_t)ix;
81 }
82 #if SIZEOF_VOID_P > 4
83 else if (s > 0xffffffff) {
84 int64_t *indices = (int64_t*)(keys->map_indices);
85 indices[i] = ix;
86 }
87 #endif
88 else {
89 int32_t *indices = (int32_t*)(keys->map_indices);
90 assert(ix <= 0x7fffffff);
91 indices[i] = (int32_t)ix;
92 }
93 }
94
95 #if SIZEOF_MAP_USIZE_T == 4
96 #define _fnvprefix 0x811c9dc5
97 #define _fnvmult 0x01000193
98 #elif SIZEOF_MAP_USIZE_T == 8
99 #define _fnvprefix 0xcbf29ce484222325
100 #define _fnvmult 0x00000100000001B3
101 #else
102 #define _fnvprefix 0
103 #define _fnvmult 0
104 #endif
105
106 static map_ssize_t
107 cgi_hash_cstr(const char* a)
108 {
109 const unsigned char* p = (unsigned char *) a;
110 map_ssize_t len;
111 map_usize_t x;
112 map_ssize_t remainder, blocks;
113 union {
114 map_usize_t value;
115 unsigned char bytes[SIZEOF_MAP_USIZE_T];
116 } block;
117
118 len = (map_ssize_t) strlen(a);
119 if (len == 0) {
120 return 0;
121 }
122
123 remainder = len % SIZEOF_MAP_USIZE_T;
124 if (remainder == 0) {
125 remainder = SIZEOF_MAP_USIZE_T;
126 }
127 blocks = (len - remainder) / SIZEOF_MAP_USIZE_T;
128 x = (map_usize_t) _fnvprefix;
129 x ^= (map_usize_t) *p << 7;
130 while (blocks--) {
131 memcpy(block.bytes, p, SIZEOF_MAP_USIZE_T);
132 x = (_fnvmult * x) ^ block.value;
133 p += SIZEOF_MAP_USIZE_T;
134 }
135 /* add remainder */
136 for (; remainder > 0; remainder--)
137 x = (_fnvmult * x) ^ (map_usize_t)*p++;
138 x ^= (map_usize_t) len;
139 /* no suffix */
140 if (x == (map_usize_t)-1)
141 x = (map_usize_t)-2;
142 return x;
143 }
144
145 #define USABLE_FRACTION(n) (((n) << 1)/3)
146
147 static const unsigned int BitLengthTable[32] = {
148 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
149 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
150 };
151
152 unsigned int _bit_length(unsigned long d) {
153 unsigned int d_bits = 0;
154 while (d >= 32) {
155 d_bits += 6;
156 d >>= 6;
157 }
158 d_bits += BitLengthTable[d];
159 return d_bits;
160 }
161
162 /* Find the smallest table_size >= minsize. */
163 static inline map_ssize_t
164 cgi_calculate_keysize(map_ssize_t minsize)
165 {
166 #if SIZEOF_LONG == SIZEOF_VOID_P
167 minsize = (minsize | MAP_MINSIZE) - 1;
168 return 1LL << _bit_length(minsize | (MAP_MINSIZE-1));
169 #elif defined(_MSC_VER)
170 // On 64bit Windows, sizeof(long) == 4.
171 minsize = (minsize | MAP_MINSIZE) - 1;
172 unsigned long msb;
173 _BitScanReverse64(&msb, (uint64_t)minsize);
174 return 1LL << (msb + 1);
175 #else
176 map_ssize_t size;
177 for (size = MAP_MINSIZE;
178 size < minsize && size > 0;
179 size <<= 1)
180 ;
181 return size;
182 #endif
183 }
184
185
186 /* estimate_keysize is reverse function of USABLE_FRACTION.
187 *
188 * This can be used to reserve enough size to insert n entries without
189 * resizing.
190 */
191 static inline map_ssize_t
192 cgi_estimate_keysize(map_ssize_t n)
193 {
194 return cgi_calculate_keysize((n*3 + 1) / 2);
195 }
196
197 /* GROWTH_RATE. Growth rate upon hitting maximum load.
198 * Currently set to used*2.
199 * This means that hashtable double in size when growing without deletions,
200 * but have more head room when the number of deletions is on a par with the
201 * number of insertions.
202 *
203 */
204 #define GROWTH_RATE(d) ((d)->ma_used*2)
205
206 /* This immutable, empty cgns_hashmap_keyobject is used for HashMap_Clear()
207 * (which cannot fail and thus can do no allocation).
208 */
209 static cgns_hashmap_keyobject empty_keys_struct = {
210 1, /* table_size */
211 0, /* map_usable (immutable) */
212 0, /* map_nentries */
213 {MAPIX_EMPTY, MAPIX_EMPTY, MAPIX_EMPTY, MAPIX_EMPTY,
214 MAPIX_EMPTY, MAPIX_EMPTY, MAPIX_EMPTY, MAPIX_EMPTY}, /* map_indices */
215 };
216
217 #define MAP_EMPTY_KEYS &empty_keys_struct
218
219 static cgns_hashmap_keyobject*
220 cgi_new_keys_object(map_ssize_t size)
221 {
222 cgns_hashmap_keyobject *keymap;
223 map_ssize_t es, usable;
224
225 assert(size >= MAP_MINSIZE);
226 assert(IS_POWER_OF_2(size));
227
228 usable = USABLE_FRACTION(size);
229 if (size <= 0xff) {
230 es = 1;
231 }
232 else if (size <= 0xffff) {
233 es = 2;
234 }
235 #if SIZEOF_VOID_P > 4
236 else if (size <= 0xffffffff) {
237 es = 4;
238 }
239 #endif
240 else {
241 es = sizeof(map_ssize_t);
242 }
243
244 keymap = malloc(sizeof(cgns_hashmap_keyobject)
245 + es * size
246 + sizeof(cgns_hashmap_entry) * usable);
247 if (keymap == NULL) {
248 return NULL;
249 }
250 keymap->table_size = size;
251 keymap->map_usable = usable;
252 keymap->map_nentries = 0;
253 memset(&keymap->map_indices[0], 0xff, es * size);
254 //memset(&keymap->map_indices[0], MAPIX_EMPTY, es * size);
255 memset(MAP_ENTRIES(keymap), 0, sizeof(cgns_hashmap_entry) * usable);
256 // Set to false the index value;
257 cgns_hashmap_entry* ep = MAP_ENTRIES(keymap);
258 for (map_ssize_t i = 0; i < usable; i++) {
259 ep->me_value = -1;
260 ep++;
261 }
262 return keymap;
263 }
264
265
266 /* Consumes a reference to the keys object */
267 static cgns_hashmap_object *
268 cgi_allocate_hashmap(cgns_hashmap_keyobject *keys)
269 {
270 cgns_hashmap_object *mp;
271 assert(keys != NULL);
272
273 mp = (cgns_hashmap_object *) malloc(sizeof(cgns_hashmap_object));
274 if (mp == NULL) {
275 return NULL;
276 }
277
278 mp->ma_keys = keys;
279 mp->ma_used = 0;
280
281 return mp;
282 }
283
284
285 cgns_hashmap_object *
286 cgi_new_hashmap(void)
287 {
288 return cgi_allocate_hashmap(MAP_EMPTY_KEYS);
289 }
290
291 cgns_hashmap_object *
292 cgi_new_presized_hashmap(map_ssize_t minused)
293 {
294 const map_ssize_t max_presize = 128 * 1024;
295 map_ssize_t newsize;
296 cgns_hashmap_keyobject *new_keys;
297
298 if (minused <= USABLE_FRACTION(MAP_MINSIZE)) {
299 return cgi_new_hashmap();
300 }
301 /* There are no strict guarantee that returned hashmap can contain minused
302 * items without resize. So we create medium size table instead of very
303 * large table.
304 */
305 if (minused > USABLE_FRACTION(max_presize)) {
306 newsize = max_presize;
307 }
308 else {
309 newsize = cgi_estimate_keysize(minused);
310 }
311
312 new_keys = cgi_new_keys_object(newsize);
313 if (new_keys == NULL)
314 return NULL;
315 return cgi_allocate_hashmap(new_keys);
316 }
317
318 /* Search index of hash table from offset of entry table */
319 static map_ssize_t
320 cgi_index_lookup(cgns_hashmap_keyobject *k, map_ssize_t hash, map_ssize_t index)
321 {
322 size_t mask = MAP_MASK(k);
323 size_t perturb = (size_t)hash;
324 size_t i = (size_t)hash & mask;
325
326 for (;;) {
327 map_ssize_t ix = cgi_hashmap_get_index(k, i);
328 if (ix == index) {
329 return i;
330 }
331 if (ix == MAPIX_EMPTY) {
332 return MAPIX_EMPTY;
333 }
334 perturb >>= PERTURB_SHIFT;
335 i = mask & (i*5 + perturb + 1);
336 }
337 // Not reachable ...
338 }
339
340 /* Search index of hash table from hash and name key
341 * It also retrieves the pointed cgns node
342 */
343 static map_ssize_t
344 cgi_name_lookup(cgns_hashmap_object *mp, const char *key,
345 map_ssize_t hash, map_ssize_t *value_addr)
346 {
347 cgns_hashmap_entry *ep0 = MAP_ENTRIES(mp->ma_keys); // compact storage
348 //
349 size_t mask = MAP_MASK(mp->ma_keys);
350 size_t perturb = (size_t)hash;
351 size_t i = (size_t)hash & mask;
352
353 for (;;) {
354 map_ssize_t ix = cgi_hashmap_get_index(mp->ma_keys, i);
355 if (ix == MAPIX_EMPTY) {
356 *value_addr = -1;
357 return MAPIX_EMPTY;
358 }
359 if (ix >= 0) {
360 cgns_hashmap_entry *ep = &ep0[ix];
361 if (ep->me_hash == hash && strcmp(ep->me_key, key) == 0) {
362 *value_addr = ep->me_value;
363 return ix;
364 }
365 }
366 perturb >>= PERTURB_SHIFT;
367 i = mask & (i*5 + perturb + 1);
368 }
369 // unreachable
370 }
371
372 /* Internal function to find slot for an item from its hash
373 when it is known that the key is not present in the hashtable. */
374 static map_ssize_t
375 cgi_find_empty_slot(cgns_hashmap_keyobject *keys, map_ssize_t hash)
376 {
377 assert(keys != NULL);
378 if (keys == NULL) { return -1; }
379 const size_t mask = MAP_MASK(keys);
380 size_t i = hash & mask;
381 map_ssize_t ix = cgi_hashmap_get_index(keys, i);
382 for (size_t perturb = hash; ix >= 0;) {
383 perturb >>= PERTURB_SHIFT;
384 i = (i*5 + perturb + 1) & mask;
385 ix = cgi_hashmap_get_index(keys, i);
386 }
387 return i;
388 }
389
390 /*
391 Internal routine used by cgi_resize_hashmap() to build a hashtable of entries.
392 */
393 static void
394 cgi_build_indices(cgns_hashmap_keyobject* keys, cgns_hashmap_entry* ep, map_ssize_t n)
395 {
396 size_t mask = (size_t)MAP_SIZE(keys) - 1;
397 for (map_ssize_t ix = 0; ix != n; ix++, ep++) {
398 map_ssize_t hash = ep->me_hash;
399 size_t i = hash & mask;
400 for (size_t perturb = hash; cgi_hashmap_get_index(keys, i) != MAPIX_EMPTY;) {
401 perturb >>= PERTURB_SHIFT;
402 i = mask & (i * 5 + perturb + 1);
403 }
404 cgi_hashmap_set_index(keys, i, ix);
405 }
406 }
407
408
409 /*
410 Restructure the table by allocating a new table and reinserting all
411 items again. When entries have been deleted, the new table may
412 actually be smaller than the old one.
413 */
414 static int
415 cgi_resize_hashmap(cgns_hashmap_object* mp, map_ssize_t newsize)
416 {
417 map_ssize_t numentries;
418 cgns_hashmap_keyobject* oldkeys;
419 cgns_hashmap_entry* oldentries, * newentries;
420
421 if (newsize <= 0) {
422 //set message with memory error
423 return -1;
424 }
425 assert(IS_POWER_OF_2(newsize));
426 assert(newsize >= MAP_MINSIZE);
427
428 oldkeys = mp->ma_keys;
429
430 /* Allocate a new table. */
431 mp->ma_keys = cgi_new_keys_object(newsize);
432 if (mp->ma_keys == NULL) {
433 mp->ma_keys = oldkeys;
434 return -1;
435 }
436 // New table must be large enough.
437 assert(mp->ma_keys->map_usable >= mp->ma_used);
438
439 numentries = mp->ma_used;
440 oldentries = MAP_ENTRIES(oldkeys);
441 newentries = MAP_ENTRIES(mp->ma_keys);
442
443 if (oldkeys->map_nentries == numentries) {
444 memcpy(newentries, oldentries, numentries * sizeof(cgns_hashmap_entry));
445 }
446 else {
447 cgns_hashmap_entry* ep = oldentries;
448 for (map_ssize_t i = 0; i < numentries; i++) {
449 while (ep->me_value == -1)
450 ep++;
451 newentries[i].me_hash = ep->me_hash;
452 strcpy(newentries[i].me_key, ep->me_key);
453 newentries[i].me_value = ep->me_value;
454 ep++;
455 }
456 }
457 free(oldkeys);
458
459 cgi_build_indices(mp->ma_keys, newentries, numentries);
460 mp->ma_keys->map_usable -= numentries;
461 mp->ma_keys->map_nentries = numentries;
462 return 0;
463 }
464
465 static int
466 cgi_insertion_resize(cgns_hashmap_object *mp)
467 {
468 return cgi_resize_hashmap(mp, cgi_calculate_keysize(GROWTH_RATE(mp)));
469 }
470
471 /*
472 Internal routine to insert a new item into the table.
473 Used both by the internal resize routine and by the public insert routine.
474 Returns -1 if an error occurred, or 0 on success.
475 */
476 static int
477 cgi_insert_key(cgns_hashmap_object *mp, const char *key, map_ssize_t hash, map_ssize_t value)
478 {
479 map_ssize_t old_value = -1;
480
481 map_ssize_t ix = cgi_name_lookup(mp, key, hash, &old_value);
482 if (ix == MAPIX_ERROR)
483 return -1;
484
485 if (ix == MAPIX_EMPTY) {
486 /* Insert into new slot. */
487 assert(old_value == -1);
488 if (mp->ma_keys->map_usable <= 0) {
489 /* Need to resize. */
490 if (cgi_insertion_resize(mp) < 0)
491 return -1;
492 }
493 map_ssize_t hashpos = cgi_find_empty_slot(mp->ma_keys, hash);
494 cgns_hashmap_entry *ep;
495 ep = &MAP_ENTRIES(mp->ma_keys)[mp->ma_keys->map_nentries];
496 cgi_hashmap_set_index(mp->ma_keys, hashpos, mp->ma_keys->map_nentries);
497 strcpy(ep->me_key, key);
498 ep->me_hash = hash;
499 ep->me_value = value;
500
501 mp->ma_used++;
502 mp->ma_keys->map_usable--;
503 mp->ma_keys->map_nentries++;
504 assert(mp->ma_keys->map_usable >= 0);
505
506 return 0;
507 }
508
509 if (old_value != value) {
510 assert(old_value != -1);
511 MAP_ENTRIES(mp->ma_keys)[ix].me_value = value;
512 }
513
514 return 0;
515 }
516
517 // Same to insert but specialized for ma_keys = MAP_EMPTY_KEYS.
518 static int
519 cgi_insert_to_emptymap(cgns_hashmap_object *mp, const char *key, map_ssize_t hash, map_ssize_t value)
520 {
521 assert(mp->ma_keys == MAP_EMPTY_KEYS);
522
523 cgns_hashmap_keyobject *newkeys = cgi_new_keys_object(MAP_MINSIZE);
524 if (newkeys == NULL) {
525 return -1;
526 }
527
528 mp->ma_keys = newkeys;
529
530 size_t hashpos = (size_t)hash & (MAP_MINSIZE-1);
531 cgns_hashmap_entry *ep = MAP_ENTRIES(mp->ma_keys);
532 cgi_hashmap_set_index(mp->ma_keys, hashpos, 0);
533 strcpy(ep->me_key, key);
534 ep->me_hash = hash;
535 ep->me_value = value;
536 mp->ma_used++;
537
538 mp->ma_keys->map_usable--;
539 mp->ma_keys->map_nentries++;
540 return 0;
541 }
542
543 map_ssize_t
544 cgi_map_get_item(cgns_hashmap_object *op, const char *key)
545 {
546 map_ssize_t ix;
547 map_ssize_t hash;
548 map_ssize_t value;
549
550 if (op == NULL) {
551 return -1;
552 }
553
554 hash = cgi_hash_cstr(key);
555 if (hash == -1) {
556 return -1;
557 }
558
559 ix = cgi_name_lookup(op, key, hash, &value);
560 if (ix < 0)
561 return -1;
562 return value;
563 }
564
565 int
566 cgi_map_set_item(cgns_hashmap_object *op, const char *key, map_ssize_t value)
567 {
568 map_ssize_t hash;
569 if (op == NULL) {
570 return -1;
571 }
572 assert(key);
573 assert(value != -1);
574 hash = cgi_hash_cstr(key);
575 if (hash == -1){
576 return -1;
577 }
578
579 if (op->ma_keys == MAP_EMPTY_KEYS) {
580 return cgi_insert_to_emptymap(op, key, hash, value);
581 }
582 /* cgi_insert_key() handles any resizing that might be necessary */
583 return cgi_insert_key(op, key, hash, value);
584 }
585
586
587 /* Return 1 if `key` is in hashmap `op`, 0 if not, and -1 on error. */
588 int
589 cgi_map_contains(cgns_hashmap_object *op, const char *key)
590 {
591 map_ssize_t hash;
592 map_ssize_t ix;
593 map_ssize_t value;
594
595 hash = cgi_hash_cstr(key);
596 if (hash == -1){
597 return -1;
598 }
599 ix = cgi_name_lookup(op, key, hash, &value);
600 if (ix == MAPIX_ERROR)
601 return -1;
602 return (ix != MAPIX_EMPTY && value != -1);
603 }
604
605 void cgi_hashmap_clear(cgns_hashmap_object* op)
606 {
607 cgns_hashmap_keyobject * oldkeys;
608
609 if (op == NULL)
610 return;
611
612 oldkeys = op->ma_keys;
613 /* Empty the hashtable... */
614
615 op->ma_keys = MAP_EMPTY_KEYS;
616 op->ma_used = 0;
617
618 free(oldkeys);
619 }
620
621
622
623 int
624 _cg_del_shift_item_known_hash(cgns_hashmap_object* op, const char* key, map_ssize_t hash)
625 {
626 map_ssize_t ix;
627 cgns_hashmap_entry* ep;
628 map_ssize_t old_value;
629
630 if (op == NULL) {
631 //error bad memory
632 return -1;
633 }
634 assert(key);
635 assert(hash != -1);
636
637 ix = cgi_name_lookup(op, key, hash, &old_value);
638 if (ix == MAPIX_ERROR)
639 return -1;
640 if (ix == MAPIX_EMPTY || old_value == -1) {
641 // set error bad key
642 return -1;
643 }
644
645 map_ssize_t hashpos = cgi_index_lookup(op->ma_keys, hash, ix);
646 assert(hashpos >= 0);
647
648 op->ma_used--;
649 ep = &MAP_ENTRIES(op->ma_keys)[ix];
650 cgi_hashmap_set_index(op->ma_keys, hashpos, MAPIX_DUMMY);;
651 strcpy(ep->me_key, "\0");
652 ep->me_value = -1;
653 /* Shift down upper indices */
654 ep = MAP_ENTRIES(op->ma_keys);
655 for (map_ssize_t i = 0; i < op->ma_keys->map_usable; i++) {
656 if ( ep->me_value > old_value ) {
657 ep->me_value--;
658 }
659 ep++;
660 }
661
662 return 0;
663 }
664
665 int
666 cgi_map_del_shift_item(cgns_hashmap_object* op, const char* key)
667 {
668 map_ssize_t hash;
669 assert(key);
670 hash = cgi_hash_cstr(key);
671 if (hash == -1) {
672 return -1;
673 }
674 return _cg_del_shift_item_known_hash(op, key, hash);
675 }
0 #ifndef CGNS_HASHMAP_H
1 #define CGNS_HASHMAP_H
2 #include "cg_hash_types.h"
3
4 /* This is a simple hashmap inspired by cpython dict
5 * It maps a char[33] name to its array index.
6 * The indexing struct is compact to be cache friendly.
7 * One of the difficulty is to keep the hash table indices in sync
8 * with the cgns_zone list when there is deletion.
9 */
10 #define MAP_MINSIZE 8
11
12 typedef struct {
13 /* Cached hash code of me_key. */
14 map_ssize_t me_hash; /* signed integer same size as size_t */
15 map_ssize_t me_value; /* index of key in mapped vector */
16 char_name me_key; /* zone name */
17 } cgns_hashmap_entry;
18
19 #define MAPIX_EMPTY (-1)
20 #define MAPIX_DUMMY (-2)
21 #define MAPIX_ERROR (-3)
22
23 struct _hashmapobject {
24
25 /* Size of the hash table (map_indices). It must be a power of 2. */
26 map_ssize_t table_size;
27
28 /* Function to lookup in the hash table (dk_indices):
29
30 - lookdict_unicode(): specialized to Unicode string keys, comparison of
31 which can never raise an exception; that function can never return
32 DKIX_ERROR.
33
34 - lookdict_unicode_nodummy(): similar to lookdict_unicode() but further
35 specialized for Unicode string keys that cannot be the <dummy> value.*/
36
37 /* Number of usable entries in map_entries. */
38 map_ssize_t map_usable;
39
40 /* Number of used entries in map_entries. */
41 map_ssize_t map_nentries;
42
43 /* Actual hash table of map_size entries. It holds indices in map_entries,
44 or MAPIX_EMPTY(-1) or MAPIX_DUMMY(-2).
45
46 Indices must be: 0 <= indice < USABLE_FRACTION(map_size).
47
48 The size in bytes of an indice depends on map_size:
49
50 - 1 byte if map_size <= 0xff (char*)
51 - 2 bytes if map_size <= 0xffff (int16_t*)
52 - 4 bytes if map_size <= 0xffffffff (int32_t*)
53 - 8 bytes otherwise (int64_t*)
54
55 Dynamically sized, SIZEOF_VOID_P is minimum. */
56 char map_indices[]; /* char is required to avoid strict aliasing. */
57
58 /* "HashMapKeyEntry map_entries[dk_usable];" array follows:
59 see the MAP_ENTRIES() macro */
60 };
61
62 typedef struct _hashmapobject cgns_hashmap_keyobject;
63
64 typedef struct {
65
66 /* Number of items in the hashmap */
67 map_ssize_t ma_used;
68
69 /* Key and values are stored in a combined continuous struct
70 to be cache friendly. */
71 cgns_hashmap_keyobject *ma_keys;
72
73 } cgns_hashmap_object;
74
75 cgns_hashmap_object* cgi_new_hashmap(void);
76 cgns_hashmap_object* cgi_new_presized_hashmap(map_ssize_t minused);
77 void cgi_hashmap_clear(cgns_hashmap_object* op);
78
79 map_ssize_t cgi_map_get_item(cgns_hashmap_object* op, const char* key);
80 int cgi_map_set_item(cgns_hashmap_object* op, const char* key, map_ssize_t value);
81 int cgi_map_contains(cgns_hashmap_object* op, const char* key);
82 int cgi_map_del_shift_item(cgns_hashmap_object* op, const char* key);
83
84 #endif
6262 * VERSION NUMBER *
6363 \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
6464
65 #define CGNS_VERSION 4100
66 #define CGNS_DOTVERS 4.10
65 #define CGNS_VERSION 4200
66 #define CGNS_DOTVERS 4.20
6767 #define CGNS_COMPATVERSION 2540
6868 #define CGNS_COMPATDOTVERS 2.54
6969
7878 #define CG_MODE_READ 0
7979 #define CG_MODE_WRITE 1
8080 #define CG_MODE_MODIFY 2
81 #define CG_MODE_CLOSED 3
8281
8382 /* function return codes */
8483
476475 #ifdef __CGNS_ENUMS__
477476 typedef enum {
478477 DataTypeNull, DataTypeUserDefined, Integer, RealSingle,
479 RealDouble, Character, LongInteger
478 RealDouble, Character, LongInteger, ComplexSingle, ComplexDouble
480479 } DataType_t;
481480 #endif
482 #define NofValidDataTypes 7
481 #define NofValidDataTypes 9
483482
484483 #define Integer_s "Integer"
485484 #define RealSingle_s "RealSingle"
486485 #define RealDouble_s "RealDouble"
487486 #define Character_s "Character"
488487 #define LongInteger_s "LongInteger"
488 #define ComplexSingle_s "ComplexSingle"
489 #define ComplexDouble_s "ComplexDouble"
489490
490491 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
491492 * Element types *
3535 !
3636 MODULE cgns
3737
38 USE ISO_C_BINDING, ONLY : C_INT, C_FLOAT, C_DOUBLE, C_LONG_LONG, C_CHAR, C_PTR
38 USE ISO_C_BINDING, ONLY : C_INT, C_FLOAT, C_DOUBLE, C_LONG_LONG, C_CHAR, C_PTR, C_FUNPTR
3939 IMPLICIT NONE
4040
4141 #include "cgnstypes_f03.h"
139139 INTEGER(C_INT), PARAMETER :: CG_MODE_READ = 0
140140 INTEGER(C_INT), PARAMETER :: CG_MODE_WRITE = 1
141141 INTEGER(C_INT), PARAMETER :: CG_MODE_MODIFY = 2
142 INTEGER(C_INT), PARAMETER :: CG_MODE_CLOSED = 3
143142
144143 ! file open modes (found in cgns_io.h)
145144 INTEGER(C_INT), PARAMETER :: CGIO_MODE_READ = 0
183182 PARAMETER (ERROR = 1)
184183 PARAMETER (NODE_NOT_FOUND = 2)
185184 PARAMETER (INCORRECT_PATH = 3)
185
186 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
187 !* Configuration options (found in cgnslib.h) *
188 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
189 INTEGER, PARAMETER :: CG_CONFIG_ERROR = 1
190 INTEGER, PARAMETER :: CG_CONFIG_COMPRESS = 2
191 INTEGER, PARAMETER :: CG_CONFIG_SET_PATH = 3
192 INTEGER, PARAMETER :: CG_CONFIG_ADD_PATH = 4
193 INTEGER, PARAMETER :: CG_CONFIG_FILE_TYPE = 5
194 INTEGER, PARAMETER :: CG_CONFIG_RIND_INDEX = 6
195
196 INTEGER, PARAMETER :: CG_CONFIG_HDF5_COMPRESS = 201
197 INTEGER, PARAMETER :: CG_CONFIG_HDF5_MPI_COMM = 202
198 INTEGER, PARAMETER :: CG_CONFIG_HDF5_DISKLESS = 203
199 INTEGER, PARAMETER :: CG_CONFIG_HDF5_DISKLESS_INCR = 204
200 INTEGER, PARAMETER :: CG_CONFIG_HDF5_DISKLESS_WRITE = 205
201
202 INTEGER, PARAMETER :: CG_CONFIG_RIND_ZERO = 0
203 INTEGER, PARAMETER :: CG_CONFIG_RIND_CORE = 1
186204
187205 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
188206 !* Parallel CGNS parameters *
462480 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
463481 !* Data types *
464482 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
465 CHARACTER(LEN=MAX_LEN) :: DataTypeName(0:6)
483 CHARACTER(LEN=MAX_LEN) :: DataTypeName(0:8)
466484 ENUM, BIND(C)
467485 ENUMERATOR :: CGNS_ENUMV(DataTypeNull)
468486 ENUMERATOR :: CGNS_ENUMV(DataTypeUserDefined)
471489 ENUMERATOR :: CGNS_ENUMV(RealDouble)
472490 ENUMERATOR :: CGNS_ENUMV(Character)
473491 ENUMERATOR :: CGNS_ENUMV(LongInteger)
492 ENUMERATOR :: CGNS_ENUMV(ComplexSingle)
493 ENUMERATOR :: CGNS_ENUMV(ComplexDouble)
474494 END ENUM
475495
476496 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
734754
735755 DATA DataTypeName / 'Null','UserDefined', &
736756 'Integer','RealSingle','RealDouble','Character', &
737 'LongInteger' /
757 'LongInteger','ComplexSingle','ComplexDouble' /
738758
739759 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
740760 !* BCData_t types *
829849 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: filename
830850 INTEGER, INTENT(OUT) :: file_type
831851 END FUNCTION cg_is_cgns
832 END INTERFACE
833
834 INTERFACE
852
835853 INTEGER(C_INT) FUNCTION cg_open(filename, mode, fn) BIND(C,NAME="cg_open")
836854 USE ISO_C_BINDING
837855 IMPLICIT NONE
839857 INTEGER(C_INT), INTENT(IN), VALUE :: mode
840858 INTEGER, INTENT(OUT) :: fn
841859 END FUNCTION cg_open
842 END INTERFACE
843
844 INTERFACE
860
845861 SUBROUTINE cg_version_f(fn,FileVersion, ier) BIND(C,NAME="cg_version_f")
846862 USE ISO_C_BINDING
847863 IMPLICIT NONE
849865 REAL(C_FLOAT) :: FileVersion
850866 INTEGER, INTENT(OUT) :: ier
851867 END SUBROUTINE cg_version_f
852 END INTERFACE
853
854 INTERFACE
868
855869 SUBROUTINE cg_precision_f(fn, PRECISION, ier) BIND(C,NAME="cg_precision_f")
856870 IMPLICIT NONE
857871 INTEGER :: fn
858872 INTEGER :: PRECISION
859873 INTEGER, INTENT(OUT) :: ier
860874 END SUBROUTINE cg_precision_f
861 END INTERFACE
862
863 INTERFACE
875
864876 SUBROUTINE cg_close_f(fn, ier) BIND(C,NAME="cg_close_f")
865877 IMPLICIT NONE
866878 INTEGER :: fn
867879 INTEGER, INTENT(OUT) :: ier
868880 END SUBROUTINE cg_close_f
869 END INTERFACE
870
871 INTERFACE
881
872882 SUBROUTINE cg_save_as_f(fn, filename, file_type, follow_links, ier) ! BIND(C,NAME="cg_save_as_f")
873883 USE ISO_C_BINDING
874884 IMPLICIT NONE
878888 INTEGER :: follow_links
879889 INTEGER, INTENT(OUT) :: ier
880890 END SUBROUTINE cg_save_as_f
881 END INTERFACE
882
883 INTERFACE
891
884892 SUBROUTINE cg_set_file_type_f(ft, ier) BIND(C,NAME="cg_set_file_type_f")
885893 IMPLICIT NONE
886894 INTEGER :: ft
887895 INTEGER, INTENT(OUT) :: ier
888896 END SUBROUTINE cg_set_file_type_f
889 END INTERFACE
890
891 INTERFACE
897
892898 SUBROUTINE cg_get_file_type_f(fn, ft, ier) BIND(C,NAME="cg_get_file_type_f")
893899 IMPLICIT NONE
894900 INTEGER :: fn
895901 INTEGER :: ft
896902 INTEGER, INTENT(OUT) :: ier
897903 END SUBROUTINE cg_get_file_type_f
898 END INTERFACE
899
900 INTERFACE
904
901905 SUBROUTINE cg_set_compress_f(cmpr, ier) BIND(C, NAME="cg_set_compress_f")
902906 IMPLICIT NONE
903907 INTEGER :: cmpr
904908 INTEGER, INTENT(OUT) :: ier
905909 END SUBROUTINE cg_set_compress_f
906 END INTERFACE
907
908 INTERFACE
910
909911 SUBROUTINE cg_get_compress_f(cmpr, ier) BIND(C, NAME="cg_get_compress_f")
910912 INTEGER :: cmpr
911913 INTEGER, INTENT(OUT) :: ier
912914 END SUBROUTINE cg_get_compress_f
913 END INTERFACE
914
915 INTERFACE
915
916916 SUBROUTINE cg_set_path_f(pathname, ier) !BIND(C, NAME="cg_set_path_f")
917917 USE ISO_C_BINDING
918918 IMPLICIT NONE
919919 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: pathname
920920 INTEGER, INTENT(OUT) :: ier
921921 END SUBROUTINE cg_set_path_f
922 END INTERFACE
923
924 INTERFACE
922
925923 SUBROUTINE cg_add_path_f(pathname, ier) !BIND(C, NAME="cg_add_path_f")
926924 USE ISO_C_BINDING
927925 IMPLICIT NONE
928926 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: pathname
929927 INTEGER, INTENT(OUT) :: ier
930928 END SUBROUTINE cg_add_path_f
931 END INTERFACE
932
933 INTERFACE
929
934930 SUBROUTINE cg_set_rind_zero_f(ier) BIND(C, NAME="cg_set_rind_zero_f")
935931 IMPLICIT NONE
936932 INTEGER, INTENT(OUT) :: ier
937933 END SUBROUTINE cg_set_rind_zero_f
938 END INTERFACE
939
940 INTERFACE
934
941935 SUBROUTINE cg_set_rind_core_f(ier) BIND(C, NAME="cg_set_rind_core_f")
942936 IMPLICIT NONE
943937 INTEGER, INTENT(OUT) :: ier
944938 END SUBROUTINE cg_set_rind_core_f
945 END INTERFACE
946
947 INTERFACE
939
940 SUBROUTINE cg_configure_c_ptr(what, value, ier) BIND(C,NAME="cg_configure_c_ptr")
941 IMPORT :: C_PTR
942 IMPLICIT NONE
943 INTEGER, INTENT(IN) :: what
944 TYPE(C_PTR), VALUE :: value
945 INTEGER, INTENT(OUT) :: ier
946 END SUBROUTINE cg_configure_c_ptr
947
948 SUBROUTINE cg_configure_c_funptr(what, value, ier) BIND(C,NAME="cg_configure_c_funptr")
949 IMPORT :: C_FUNPTR
950 IMPLICIT NONE
951 INTEGER, INTENT(IN) :: what
952 TYPE(C_FUNPTR), VALUE :: value
953 INTEGER, INTENT(OUT) :: ier
954 END SUBROUTINE cg_configure_c_funptr
955
948956 SUBROUTINE cg_get_cgio_f(fn, cgio_num, ier) BIND(C, NAME="cg_get_cgio_f")
949957 IMPLICIT NONE
950958 INTEGER :: fn
951959 INTEGER :: cgio_num
952960 INTEGER, INTENT(OUT) :: ier
953961 END SUBROUTINE cg_get_cgio_f
954 END INTERFACE
955
956 INTERFACE
962
957963 SUBROUTINE cg_root_id_f(fn, rootid, ier) BIND(C, NAME="cg_root_id_f")
958964 USE ISO_C_BINDING
959965 IMPLICIT NONE
961967 REAL(C_DOUBLE) :: rootid
962968 INTEGER, INTENT(OUT) :: ier
963969 END SUBROUTINE cg_root_id_f
964 END INTERFACE
965970
966971 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
967972 ! Read and write CGNSBase_t Nodes
968973 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
969974
970 INTERFACE
971975 SUBROUTINE cg_nbases_f(fn, nbases, ier) BIND(C, NAME="cg_nbases_f")
972976 IMPLICIT NONE
973977 INTEGER :: fn
974978 INTEGER :: nbases
975979 INTEGER, INTENT(OUT) :: ier
976980 END SUBROUTINE cg_nbases_f
977 END INTERFACE
978
979 INTERFACE
981
980982 SUBROUTINE cg_base_read_f(fn, B, basename, cell_dim, phys_dim, ier) !BIND(C, NAME="cg_base_read_f")
981983 USE ISO_C_BINDING
982984 IMPLICIT NONE
987989 INTEGER :: phys_dim
988990 INTEGER, INTENT(OUT) :: ier
989991 END SUBROUTINE cg_base_read_f
990 END INTERFACE
991
992 INTERFACE
992
993993 SUBROUTINE cg_base_id_f(fn, B, base_id, ier) BIND(C, NAME="cg_base_id_f")
994994 USE ISO_C_BINDING
995995 IMPLICIT NONE
998998 REAL(C_DOUBLE) :: base_id
999999 INTEGER, INTENT(OUT) :: ier
10001000 END SUBROUTINE cg_base_id_f
1001 END INTERFACE
1002
1003 INTERFACE
1001
10041002 SUBROUTINE cg_base_write_f(fn, basename, cell_dim, phys_dim, B, ier) !BIND(C, NAME="cg_base_write_f")
10051003 USE ISO_C_BINDING
10061004 IMPLICIT NONE
10111009 INTEGER :: B
10121010 INTEGER, INTENT(OUT) :: ier
10131011 END SUBROUTINE cg_base_write_f
1014 END INTERFACE
1015
1016 INTERFACE
1012
10171013 SUBROUTINE cg_cell_dim_f(fn, B, dim, ier) BIND(C, NAME="cg_cell_dim_f")
10181014 IMPLICIT NONE
10191015 INTEGER :: fn
10211017 INTEGER :: dim
10221018 INTEGER, INTENT(OUT) :: ier
10231019 END SUBROUTINE cg_cell_dim_f
1024 END INTERFACE
10251020
10261021 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10271022 ! Read and write Zone_t Nodes
10281023 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10291024
1030 INTERFACE
10311025 SUBROUTINE cg_nzones_f(fn, B, nzones, ier) BIND(C, NAME="cg_nzones_f")
10321026 IMPLICIT NONE
10331027 INTEGER :: fn
10351029 INTEGER :: nzones
10361030 INTEGER, INTENT(OUT) :: ier
10371031 END SUBROUTINE cg_nzones_f
1038 END INTERFACE
1039
1040 INTERFACE
1032
10411033 SUBROUTINE cg_zone_type_f(fn, B, Z, type, ier) BIND(C, NAME="cg_zone_type_f")
10421034 IMPORT :: cgenum_t, c_char
10431035 IMPLICIT NONE
10471039 INTEGER(cgenum_t) :: type
10481040 INTEGER, INTENT(OUT) :: ier
10491041 END SUBROUTINE cg_zone_type_f
1050 END INTERFACE
1051
1052 INTERFACE
1042
10531043 SUBROUTINE cg_zone_read_f(fn, B, Z, zonename, size, ier) !BIND(C, NAME="cg_zone_read_f")
10541044 IMPORT :: CGSIZE_T, c_char
10551045 IMPLICIT NONE
10601050 INTEGER(CGSIZE_T), DIMENSION(*) :: size
10611051 INTEGER, INTENT(OUT) :: ier
10621052 END SUBROUTINE cg_zone_read_f
1063 END INTERFACE
1064
1065 INTERFACE
1053
10661054 SUBROUTINE cg_zone_id_f(fn, B, Z, zone_id, ier) BIND(C, NAME="cg_zone_id_f")
10671055 IMPORT :: c_double
10681056 IMPLICIT NONE
10721060 REAL(C_DOUBLE) :: zone_id
10731061 INTEGER, INTENT(OUT) :: ier
10741062 END SUBROUTINE cg_zone_id_f
1075 END INTERFACE
1076
1077 INTERFACE
1063
10781064 SUBROUTINE cg_zone_write_f(fn, B, zonename, size, TYPE, Z, ier) !BIND(C, NAME="cg_zone_write_f")
10791065 IMPORT :: cgenum_t, c_char, cgsize_t
10801066 IMPLICIT NONE
10861072 INTEGER, INTENT(OUT) :: Z
10871073 INTEGER, INTENT(OUT) :: ier
10881074 END SUBROUTINE cg_zone_write_f
1089 END INTERFACE
1090
1091 INTERFACE
1075
10921076 SUBROUTINE cg_index_dim_f(fn, B, Z, dim, ier) BIND(C, NAME="cg_index_dim_f")
10931077 IMPLICIT NONE
10941078 INTEGER :: fn
10971081 INTEGER :: dim
10981082 INTEGER, INTENT(OUT) :: ier
10991083 END SUBROUTINE cg_index_dim_f
1100 END INTERFACE
11011084
11021085 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
11031086 ! Read and write Family_t Nodes *
11041087 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
11051088
1106 INTERFACE
11071089 SUBROUTINE cg_nfamilies_f(fn, B, nfamilies, ier) BIND(C, NAME="cg_nfamilies_f")
11081090 IMPLICIT NONE
11091091 INTEGER :: fn
11111093 INTEGER :: nfamilies
11121094 INTEGER, INTENT(OUT) :: ier
11131095 END SUBROUTINE cg_nfamilies_f
1114 END INTERFACE
1115
1116 INTERFACE
1096
11171097 SUBROUTINE cg_family_read_f(fn, B, F, family_name, nboco, ngeos, ier) !BIND(C, NAME="cg_family_read_f")
11181098 IMPORT :: c_char
11191099 IMPLICIT NONE
11251105 INTEGER :: ngeos
11261106 INTEGER, INTENT(OUT) :: ier
11271107 END SUBROUTINE cg_family_read_f
1128 END INTERFACE
1129
1130 INTERFACE
1108
11311109 SUBROUTINE cg_family_write_f(fn, B, family_name, F, ier) !BIND(C, NAME="cg_family_write_f")
11321110 IMPORT :: c_char
11331111 IMPLICIT NONE
11371115 INTEGER :: F
11381116 INTEGER, INTENT(OUT) :: ier
11391117 END SUBROUTINE cg_family_write_f
1140 END INTERFACE
1141
1142 INTERFACE
1118
11431119 SUBROUTINE cg_nfamily_names_f(fn, B, F, nnames, ier) BIND(C, NAME="cg_nfamily_names_f")
11441120 IMPLICIT NONE
11451121 INTEGER :: fn
11481124 INTEGER :: nnames
11491125 INTEGER, INTENT(OUT) :: ier
11501126 END SUBROUTINE cg_nfamily_names_f
1151 END INTERFACE
1152
1153 INTERFACE
1127
11541128 SUBROUTINE cg_family_name_read_f(fn, B, F, N, name, family, ier) !BIND(C, NAME="cg_family_name_read_f")
11551129 IMPORT :: c_char
11561130 IMPLICIT NONE
11621136 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
11631137 INTEGER, INTENT(OUT) :: ier
11641138 END SUBROUTINE cg_family_name_read_f
1165 END INTERFACE
1166
1167 INTERFACE
1139
11681140 SUBROUTINE cg_family_name_write_f(fn, B, F, name, family, ier) !BIND(C, NAME="cg_family_name_write_f")
11691141 IMPORT :: c_char
11701142 IMPLICIT NONE
11751147 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
11761148 INTEGER, INTENT(OUT) :: ier
11771149 END SUBROUTINE cg_family_name_write_f
1178 END INTERFACE
1179
1180 INTERFACE
1150
11811151 SUBROUTINE cg_node_family_write_f(family_name, F, ier) !BIND(C, NAME="cg_node_family_write_f")
11821152 IMPORT :: c_char
11831153 IMPLICIT NONE
11851155 INTEGER :: F
11861156 INTEGER, INTENT(OUT) :: ier
11871157 END SUBROUTINE cg_node_family_write_f
1188 END INTERFACE
1189
1190 INTERFACE
1158
11911159 SUBROUTINE cg_node_nfamilies_f(nfamilies, ier) BIND(C, NAME="cg_node_nfamilies_f")
11921160 IMPLICIT NONE
11931161 INTEGER :: nfamilies
11941162 INTEGER, INTENT(OUT) :: ier
11951163 END SUBROUTINE cg_node_nfamilies_f
1196 END INTERFACE
1197
1198 INTERFACE
1164
11991165 SUBROUTINE cg_node_family_read_f(F,family_name, nboco, ngeos, ier) !BIND(C, NAME="cg_node_family_read_f")
12001166 IMPORT :: c_char
12011167 IMPLICIT NONE
12051171 INTEGER :: ngeos
12061172 INTEGER, INTENT(OUT) :: ier
12071173 END SUBROUTINE cg_node_family_read_f
1208 END INTERFACE
1209
1210 INTERFACE
1174
12111175 SUBROUTINE cg_node_family_name_write_f(name, family, ier) !BIND(C, NAME="cg_node_family_name_write_f")
12121176 IMPORT :: c_char
12131177 IMPLICIT NONE
12151179 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
12161180 INTEGER, INTENT(OUT) :: ier
12171181 END SUBROUTINE cg_node_family_name_write_f
1218 END INTERFACE
1219
1220 INTERFACE
1182
12211183 SUBROUTINE cg_node_nfamily_names_f(nnames, ier) BIND(C, NAME="cg_node_nfamily_names_f")
12221184 IMPLICIT NONE
12231185 INTEGER :: nnames
12241186 INTEGER, INTENT(OUT) :: ier
12251187 END SUBROUTINE cg_node_nfamily_names_f
1226 END INTERFACE
1227
1228 INTERFACE
1188
12291189 SUBROUTINE cg_node_family_name_read_f(N, name, family, ier) !BIND(C, NAME="cg_node_family_name_read_f")
12301190 IMPORT :: c_char
12311191 IMPLICIT NONE
12341194 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
12351195 INTEGER, INTENT(OUT) :: ier
12361196 END SUBROUTINE cg_node_family_name_read_f
1237 END INTERFACE
12381197
12391198 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
12401199 ! Read and write FamBC_t Nodes *
12411200 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
12421201
1243 INTERFACE
12441202 SUBROUTINE cg_fambc_read_f(fn, B, F, BC, fambc_name, bocotype, ier) !BIND(C, NAME="cg_fambc_read_f")
12451203 IMPORT :: c_char, cgenum_t
12461204 IMPLICIT NONE
12521210 INTEGER(cgenum_t) :: bocotype
12531211 INTEGER, INTENT(OUT) :: ier
12541212 END SUBROUTINE cg_fambc_read_f
1255 END INTERFACE
1256
1257 INTERFACE
1213
12581214 SUBROUTINE cg_fambc_write_f(fn, B, F, fambc_name, bocotype, BC, ier) !BIND(C, NAME="cg_fambc_write_f")
12591215 IMPORT :: c_char, cgenum_t
12601216 IMPLICIT NONE
12661222 INTEGER :: BC
12671223 INTEGER, INTENT(OUT) :: ier
12681224 END SUBROUTINE cg_fambc_write_f
1269 END INTERFACE
1270
1271 INTERFACE
1225
12721226 SUBROUTINE cg_node_fambc_read_f(BC, fambc_name, bocotype, ier) !BIND(C, NAME="cg_node_fambc_read_f")
12731227 IMPORT :: c_char, cgenum_t
12741228 IMPLICIT NONE
12771231 INTEGER(cgenum_t) :: bocotype
12781232 INTEGER, INTENT(OUT) :: ier
12791233 END SUBROUTINE cg_node_fambc_read_f
1280 END INTERFACE
1281
1282 INTERFACE
1234
12831235 SUBROUTINE cg_node_fambc_write_f(fambc_name, bocotype, BC, ier) !BIND(C, NAME="cg_node_fambc_write_f")
12841236 IMPORT :: c_char, cgenum_t
12851237 IMPLICIT NONE
12881240 INTEGER :: BC
12891241 INTEGER, INTENT(OUT) :: ier
12901242 END SUBROUTINE cg_node_fambc_write_f
1291 END INTERFACE
12921243
12931244
12941245 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
12951246 ! Read and write GeometryReference_t Nodes *
12961247 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
12971248
1298 INTERFACE
12991249 SUBROUTINE cg_geo_read_f(fn, B, F, G, geo_name, geo_file, CAD_name, npart, ier) !BIND(C, NAME="cg_geo_read_f")
13001250 IMPORT :: c_char
13011251 IMPLICIT NONE
13091259 INTEGER :: npart
13101260 INTEGER, INTENT(OUT) :: ier
13111261 END SUBROUTINE cg_geo_read_f
1312 END INTERFACE
1313
1314 INTERFACE
1262
13151263 SUBROUTINE cg_geo_write_f(fn, B, F, geo_name, geo_file, CAD_name, G, ier) !BIND(C, NAME="cg_geo_write_f")
13161264 IMPORT :: c_char
13171265 IMPLICIT NONE
13241272 INTEGER :: G
13251273 INTEGER, INTENT(OUT) :: ier
13261274 END SUBROUTINE cg_geo_write_f
1327 END INTERFACE
1328
1329 INTERFACE
1275
13301276 SUBROUTINE cg_node_geo_read_f(G, geo_name, geo_file, CAD_name, npart, ier) !BIND(C, NAME="cg_node_geo_read_f")
13311277 IMPORT :: c_char
13321278 IMPLICIT NONE
13371283 INTEGER :: npart
13381284 INTEGER, INTENT(OUT) :: ier
13391285 END SUBROUTINE cg_node_geo_read_f
1340 END INTERFACE
1341
1342 INTERFACE
1286
13431287 SUBROUTINE cg_node_geo_write_f(geo_name, geo_file, CAD_name, G, ier) !BIND(C, NAME="cg_node_geo_write_f")
13441288 IMPORT :: c_char
13451289 IMPLICIT NONE
13491293 INTEGER :: G
13501294 INTEGER, INTENT(OUT) :: ier
13511295 END SUBROUTINE cg_node_geo_write_f
1352 END INTERFACE
13531296
13541297 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
13551298 ! Read and write GeometryEntity_t Nodes *
13561299 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
13571300
1358 INTERFACE
13591301 SUBROUTINE cg_part_read_f(fn, B, F,G, P, part_name, ier) !BIND(C, NAME="cg_part_read_f")
13601302 IMPORT :: c_char
13611303 IMPLICIT NONE
13671309 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: part_name
13681310 INTEGER, INTENT(OUT) :: ier
13691311 END SUBROUTINE cg_part_read_f
1370 END INTERFACE
1371
1372 INTERFACE
1312
13731313 SUBROUTINE cg_part_write_f(fn, B, F, G, part_name, P, ier) !BIND(C, NAME="cg_part_write_f")
13741314 IMPORT :: c_char
13751315 IMPLICIT NONE
13811321 INTEGER :: P
13821322 INTEGER, INTENT(OUT) :: ier
13831323 END SUBROUTINE cg_part_write_f
1384 END INTERFACE
1385
1386 INTERFACE
1324
13871325 SUBROUTINE cg_node_part_read_f(G, P, part_name, ier) !BIND(C, NAME="cg_node_part_read_f")
13881326 IMPORT :: c_char
13891327 IMPLICIT NONE
13921330 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: part_name
13931331 INTEGER, INTENT(OUT) :: ier
13941332 END SUBROUTINE cg_node_part_read_f
1395 END INTERFACE
1396
1397 INTERFACE
1333
13981334 SUBROUTINE cg_node_part_write_f(G, part_name, P, ier) !BIND(C, NAME="cg_node_part_write_f")
13991335 IMPORT :: c_char
14001336 IMPLICIT NONE
14031339 INTEGER :: P
14041340 INTEGER, INTENT(OUT) :: ier
14051341 END SUBROUTINE cg_node_part_write_f
1406 END INTERFACE
14071342
14081343 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
14091344 ! Read and write DiscreteData_t Nodes *
14101345 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
14111346
1412 INTERFACE
14131347 SUBROUTINE cg_ndiscrete_f(fn, B, Z, ndiscrete, ier) BIND(C, NAME="cg_ndiscrete_f")
14141348 IMPLICIT NONE
14151349 INTEGER :: fn
14181352 INTEGER :: ndiscrete
14191353 INTEGER, INTENT(OUT) :: ier
14201354 END SUBROUTINE cg_ndiscrete_f
1421 END INTERFACE
1422
1423 INTERFACE
1355
14241356 SUBROUTINE cg_discrete_read_f(fn, B, Z, D, discrete_name, ier) !BIND(C, NAME="cg_discrete_read_f")
14251357 IMPORT :: c_char
14261358 IMPLICIT NONE
14311363 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: discrete_name
14321364 INTEGER, INTENT(OUT) :: ier
14331365 END SUBROUTINE cg_discrete_read_f
1434 END INTERFACE
1435
1436 INTERFACE
1366
14371367 SUBROUTINE cg_discrete_write_f(fn, B, Z, discrete_name, D, ier) !BIND(C, NAME="cg_discrete_write_f")
14381368 IMPORT :: c_char
14391369 IMPLICIT NONE
14441374 INTEGER :: D
14451375 INTEGER, INTENT(OUT) :: ier
14461376 END SUBROUTINE cg_discrete_write_f
1447 END INTERFACE
1448
1449 INTERFACE
1377
14501378 SUBROUTINE cg_discrete_size_f(fn, B, Z, D, ndim, dims, ier) BIND(C, NAME="cg_discrete_size_f")
14511379 IMPORT :: CGSIZE_T
14521380 IMPLICIT NONE
14581386 INTEGER(CGSIZE_T), DIMENSION(*) :: dims
14591387 INTEGER, INTENT(OUT) :: ier
14601388 END SUBROUTINE cg_discrete_size_f
1461 END INTERFACE
1462
1463 INTERFACE
1389
14641390 SUBROUTINE cg_discrete_ptset_info_f(fn, B, Z, S, ptype, npnts, ier) BIND(C, NAME="cg_discrete_ptset_info_f")
14651391 IMPORT :: cgenum_t, CGSIZE_T
14661392 IMPLICIT NONE
14721398 INTEGER(CGSIZE_T) :: npnts
14731399 INTEGER, INTENT(OUT) :: ier
14741400 END SUBROUTINE cg_discrete_ptset_info_f
1475 END INTERFACE
1476
1477 INTERFACE
1401
14781402 SUBROUTINE cg_discrete_ptset_read_f( fn, B, Z, S, pnts, ier) BIND(C, NAME="cg_discrete_ptset_read_f")
14791403 IMPORT :: CGSIZE_T
14801404 IMPLICIT NONE
14851409 INTEGER(CGSIZE_T) :: pnts
14861410 INTEGER, INTENT(OUT) :: ier
14871411 END SUBROUTINE cg_discrete_ptset_read_f
1488 END INTERFACE
1489
1490 INTERFACE
1491 SUBROUTINE cg_discrete_ptset_write_f( fn, B, Z, name, location, ptype, npnts, pnts, D, ier) !BIND(C, NAME="cg_discrete_ptset_write_f")
1412
1413 SUBROUTINE cg_discrete_ptset_write_f( fn, B, Z, name, location, ptype, &
1414 npnts, pnts, D, ier) !BIND(C, NAME="cg_discrete_ptset_write_f")
14921415 IMPORT :: CGSIZE_T, cgenum_t, c_char
14931416 IMPLICIT NONE
14941417 INTEGER :: fn
15021425 INTEGER :: D
15031426 INTEGER, INTENT(OUT) :: ier
15041427 END SUBROUTINE cg_discrete_ptset_write_f
1505 END INTERFACE
15061428
15071429 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
15081430 ! Read and write GridCoordinates_t/DataArray_t Nodes *
15091431 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
15101432
1511 INTERFACE
15121433 SUBROUTINE cg_ncoords_f(fn, B, Z, ncoords, ier) BIND(C, NAME="cg_ncoords_f")
15131434 IMPLICIT NONE
15141435 INTEGER :: fn
15171438 INTEGER :: ncoords
15181439 INTEGER, INTENT(OUT) :: ier
15191440 END SUBROUTINE cg_ncoords_f
1520 END INTERFACE
1521
1522 INTERFACE
1441
15231442 SUBROUTINE cg_coord_info_f(fn, B, Z, C, TYPE, coordname, ier) !BIND(C, NAME="cg_coord_info_f")
15241443 IMPORT :: c_char, cgenum_t
15251444 IMPLICIT NONE
15311450 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: coordname
15321451 INTEGER, INTENT(OUT) :: ier
15331452 END SUBROUTINE cg_coord_info_f
1453
15341454 END INTERFACE
15351455
15361456 #if HAVE_FORTRAN_2008
15761496 TYPE(C_PTR), VALUE :: coord
15771497 INTEGER, INTENT(OUT) :: ier
15781498 END SUBROUTINE cg_coord_read_f03
1579 END INTERFACE
1499 END INTERFACE
15801500 #endif
15811501
1582 INTERFACE
1502 INTERFACE
15831503 SUBROUTINE cg_coord_id_f(fn, B, Z, C, coord_id, ier) BIND(C, NAME="cg_coord_id_f")
15841504 IMPORT :: c_double
15851505 IMPLICIT NONE
15901510 REAL(C_DOUBLE) :: coord_id
15911511 INTEGER, INTENT(OUT) :: ier
15921512 END SUBROUTINE cg_coord_id_f
1593 END INTERFACE
1594
1595 !!$ INTERFACE
1513
15961514 !!$ SUBROUTINE cg_coord_write_f(fn, B, Z, TYPE, coordname, coord, C, ier) BIND(C, NAME="")
15971515 !!$ IMPORT :: c_char, cgenum_t, c_ptr
15981516 !!$ IMPLICIT NONE
16051523 !!$ INTEGER :: C
16061524 !!$ INTEGER, INTENT(OUT) :: ier
16071525 !!$ END SUBROUTINE cg_coord_write_f
1608 !!$ END INTERFACE
1609
1610 !!$ INTERFACE
1526
16111527 !!$ SUBROUTINE cg_coord_partial_write_f( fn, B, Z, TYPE, coordname, rmin, rmax, coord, C, ier) BIND(C, NAME="")
16121528 !!$ IMPORT :: c_char, cgenum_t, CGSIZE_T, c_ptr
16131529 !!$ IMPLICIT NONE
16221538 !!$ INTEGER :: C
16231539 !!$ INTEGER, INTENT(OUT) :: ier
16241540 !!$ END SUBROUTINE cg_coord_partial_write_f
1625 !!$ END INTERFACE
16261541
16271542 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
16281543 ! Read and write Elements_t Nodes *
16291544 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
16301545
1631 INTERFACE
16321546 SUBROUTINE cg_nsections_f(fn, B, Z, nsections, ier) BIND(C, NAME="cg_nsections_f")
16331547 IMPLICIT NONE
16341548 INTEGER :: fn
16371551 INTEGER :: nsections
16381552 INTEGER, INTENT(OUT) :: ier
16391553 END SUBROUTINE cg_nsections_f
1640 END INTERFACE
1641
1642 INTERFACE
1643 SUBROUTINE cg_section_read_f(fn, B, Z, E, section_name, TYPE, start, END, nbndry, parent_flag, ier) !BIND(C, NAME="cg_section_read_f")
1554
1555 SUBROUTINE cg_section_read_f(fn, B, Z, E, section_name, TYPE, start, END, nbndry, &
1556 parent_flag, ier) !BIND(C, NAME="cg_section_read_f")
16441557 IMPORT :: c_char, cgenum_t, CGSIZE_T
16451558 IMPLICIT NONE
16461559 INTEGER :: fn
16551568 INTEGER :: parent_flag
16561569 INTEGER, INTENT(OUT) :: ier
16571570 END SUBROUTINE cg_section_read_f
1658 END INTERFACE
1659
1660 !!$ INTERFACE
1661 !!$ SUBROUTINE cg_elements_read_f(fn, B, Z, E, elements, parent_data, ier) BIND(C, NAME="cg_elements_read_f")
1571
1572 !!$!!$ SUBROUTINE cg_elements_read_f(fn, B, Z, E, elements, parent_data, ier) BIND(C, NAME="cg_elements_read_f")
16621573 !!$ IMPORT :: CGSIZE_T
16631574 !!$ IMPLICIT NONE
16641575 !!$ INTEGER :: fn
16691580 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: parent_data
16701581 !!$ INTEGER, INTENT(OUT) :: ier
16711582 !!$ END SUBROUTINE cg_elements_read_f
1672 !!$ END INTERFACE
1673
1674 INTERFACE
1583 !!$
16751584 SUBROUTINE cg_elementdatasize_f(fn, B, Z, E, ElementDataSize, ier) BIND(C, NAME="cg_elementdatasize_f")
16761585 IMPORT :: CGSIZE_T
16771586 IMPLICIT NONE
16821591 INTEGER(CGSIZE_T) :: ElementDataSize
16831592 INTEGER, INTENT(OUT) :: ier
16841593 END SUBROUTINE cg_elementdatasize_f
1685 END INTERFACE
1686
1687 INTERFACE
1594
16881595 SUBROUTINE cg_elementpartialsize_f(fn, B, Z, E, start, END, ElementDataSize, ier) BIND(C, NAME="cg_elementpartialsize_f")
16891596 IMPORT :: CGSIZE_T
16901597 IMPLICIT NONE
16971604 INTEGER(CGSIZE_T) :: ElementDataSize
16981605 INTEGER, INTENT(OUT) :: ier
16991606 END SUBROUTINE cg_elementpartialsize_f
1700 END INTERFACE
1701
1702 !!$ INTERFACE
1703 !!$ SUBROUTINE cg_section_write_f(fn, B, Z, section_name, TYPE, start, END, nbndry, elements, S, ier) !BIND(C, NAME="cg_section_write_f")
1607
1608 !!$!!$ SUBROUTINE cg_section_write_f(fn, B, Z, section_name, TYPE, start, END, nbndry, elements, S, ier) !BIND(C, NAME="cg_section_write_f")
17041609 !!$ IMPORT :: c_char, cgenum_t, CGSIZE_T
17051610 !!$ IMPLICIT NONE
17061611 !!$ INTEGER :: fn
17151620 !!$ INTEGER :: S
17161621 !!$ INTEGER, INTENT(OUT) :: ier
17171622 !!$ END SUBROUTINE cg_section_write_f
1718 !!$ END INTERFACE
1719
1720 !!$ INTERFACE
1721 !!$ SUBROUTINE cg_parent_data_write_f(fn, B, Z, S, parent_data, ier) BIND(C, NAME="cg_parent_data_write_f")
1623 !!$
1624 !!$!!$ SUBROUTINE cg_parent_data_write_f(fn, B, Z, S, parent_data, ier) BIND(C, NAME="cg_parent_data_write_f")
17221625 !!$ IMPORT :: CGSIZE_T
17231626 !!$ IMPLICIT NONE
17241627 !!$ INTEGER :: fn
17281631 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: parent_data
17291632 !!$ INTEGER, INTENT(OUT) :: ier
17301633 !!$ END SUBROUTINE cg_parent_data_write_f
1731 !!$ END INTERFACE
1732
1733 INTERFACE
1734 SUBROUTINE cg_section_partial_write_f( fn, B, Z, section_name, TYPE, start, END, nbndry, S, ier) !BIND(C, NAME="cg_section_partial_write_f")
1634 !!$
1635 SUBROUTINE cg_section_partial_write_f( fn, B, Z, section_name, TYPE, start, END, &
1636 nbndry, S, ier) !BIND(C, NAME="cg_section_partial_write_f")
17351637 IMPORT :: c_char, CGSIZE_T, cgenum_t
17361638 IMPLICIT NONE
17371639 INTEGER :: fn
17451647 INTEGER :: S
17461648 INTEGER, INTENT(OUT) :: ier
17471649 END SUBROUTINE cg_section_partial_write_f
1748 END INTERFACE
1749
1750 !!$ INTERFACE
1751 !!$ SUBROUTINE cg_elements_partial_write_f(fn, B, Z, S, rmin, rmax, elements, ier) &
1650
1651 !!$!!$ SUBROUTINE cg_elements_partial_write_f(fn, B, Z, S, rmin, rmax, elements, ier) &
17521652 !!$ BIND(C, NAME="cg_elements_partial_write_f")
17531653 !!$ IMPORT :: CGSIZE_T
17541654 !!$ IMPLICIT NONE
17611661 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: elements
17621662 !!$ INTEGER, INTENT(OUT) :: ier
17631663 !!$ END SUBROUTINE cg_elements_partial_write_f
1764 !!$ END INTERFACE
1765
1766 !!$ INTERFACE
1767 !!$ SUBROUTINE cg_parent_data_partial_write_f(fn, B, Z, S, rmin, rmax, parent_data, ier) &
1664 !!$
1665 !!$!!$ SUBROUTINE cg_parent_data_partial_write_f(fn, B, Z, S, rmin, rmax, parent_data, ier) &
17681666 !!$ BIND(C, NAME="cg_parent_data_partial_write_f")
17691667 !!$ IMPORT :: CGSIZE_T
17701668 !!$ IMPLICIT NONE
17781676 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: parent_data
17791677 !!$ INTEGER, INTENT(OUT) :: ier
17801678 !!$ END SUBROUTINE cg_parent_data_partial_write_f
1781 !!$ END INTERFACE
1782 !!$
1783 !!$ INTERFACE
1784 !!$ SUBROUTINE cg_elements_partial_read_f(fn, B, Z, S, rmin, rmax, elements, parent, ier) &
1679 !!$!!$
1680 !!$!!$ SUBROUTINE cg_elements_partial_read_f(fn, B, Z, S, rmin, rmax, elements, parent, ier) &
17851681 !!$ BIND(C, NAME="cg_elements_partial_read_f")
17861682 !!$ IMPORT :: CGSIZE_T
17871683 !!$ IMPLICIT NONE
17961692 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: parent
17971693 !!$ INTEGER, INTENT(OUT) :: ier
17981694 !!$ END SUBROUTINE cg_elements_partial_read_f
1799 !!$ END INTERFACE
1800
1695 !!$
18011696 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
18021697 ! Read and write FlowSolution_t Nodes *
18031698 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
18041699
1805 INTERFACE
18061700 SUBROUTINE cg_nsols_f(fn, B, Z, nsols, ier) BIND(C, NAME="cg_nsols_f")
18071701 IMPLICIT NONE
18081702 INTEGER :: fn
18111705 INTEGER :: nsols
18121706 INTEGER, INTENT(OUT) :: ier
18131707 END SUBROUTINE cg_nsols_f
1814 END INTERFACE
1815
1816 INTERFACE
1708
18171709 SUBROUTINE cg_sol_info_f(fn, B, Z, S, solname, location, ier) !BIND(C, NAME="cg_sol_info_f")
18181710 IMPORT :: c_char, cgenum_t
18191711 IMPLICIT NONE
18251717 INTEGER(cgenum_t) :: location
18261718 INTEGER, INTENT(OUT) :: ier
18271719 END SUBROUTINE cg_sol_info_f
1828 END INTERFACE
1829
1830 INTERFACE
1720
18311721 SUBROUTINE cg_sol_id_f(fn, B, Z, S, sol_id, ier) BIND(C, NAME="cg_sol_id_f")
18321722 IMPORT :: c_double
18331723 IMPLICIT NONE
18381728 REAL(C_DOUBLE) :: sol_id
18391729 INTEGER, INTENT(OUT) :: ier
18401730 END SUBROUTINE cg_sol_id_f
1841 END INTERFACE
1842
1843 INTERFACE
1731
18441732 SUBROUTINE cg_sol_write_f(fn, B, Z, solname, location, S, ier) !BIND(C, NAME="cg_sol_write_f")
18451733 IMPORT :: c_char, cgenum_t
18461734 IMPLICIT NONE
18521740 INTEGER :: S
18531741 INTEGER, INTENT(OUT) :: ier
18541742 END SUBROUTINE cg_sol_write_f
1855 END INTERFACE
1856
1857 INTERFACE
1743
18581744 SUBROUTINE cg_sol_size_f(fn, B, Z, S, ndim, dims, ier) BIND(C, NAME="cg_sol_size_f")
18591745 IMPORT :: CGSIZE_T
18601746 IMPLICIT NONE
18661752 INTEGER(CGSIZE_T), DIMENSION(*) :: dims
18671753 INTEGER, INTENT(OUT) :: ier
18681754 END SUBROUTINE cg_sol_size_f
1869 END INTERFACE
1870
1871 INTERFACE
1755
18721756 SUBROUTINE cg_sol_ptset_info_f( fn, B, Z, S, ptype, npnts, ier) BIND(C, NAME="cg_sol_ptset_info_f")
18731757 IMPORT :: cgenum_t, CGSIZE_T
18741758 IMPLICIT NONE
18801764 INTEGER(CGSIZE_T) :: npnts
18811765 INTEGER, INTENT(OUT) :: ier
18821766 END SUBROUTINE cg_sol_ptset_info_f
1883 END INTERFACE
1884
1885 INTERFACE
1767
18861768 SUBROUTINE cg_sol_ptset_read_f(fn, B, Z, S, pnts, ier) BIND(C, NAME="cg_sol_ptset_read_f")
18871769 IMPORT :: CGSIZE_T
18881770 IMPLICIT NONE
18931775 INTEGER(CGSIZE_T) ::pnts
18941776 INTEGER, INTENT(OUT) :: ier
18951777 END SUBROUTINE cg_sol_ptset_read_f
1896 END INTERFACE
1897
1898 INTERFACE
1778
18991779 SUBROUTINE cg_sol_ptset_write_f(fn, B, Z, name, location, ptype, npnts, pnts, S, ier) !BIND(C, NAME="cg_sol_ptset_write_f")
19001780 IMPORT :: c_char, cgenum_t, CGSIZE_T
19011781 IMPLICIT NONE
19101790 INTEGER :: S
19111791 INTEGER, INTENT(OUT) :: ier
19121792 END SUBROUTINE cg_sol_ptset_write_f
1913 END INTERFACE
19141793
19151794 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
19161795 ! Read and write solution DataArray_t Nodes *
19171796 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
19181797
1919 INTERFACE
19201798 SUBROUTINE cg_nfields_f(fn, B, Z, S, nfields, ier) BIND(C, NAME="cg_nfields_f")
19211799 IMPLICIT NONE
19221800 INTEGER :: fn
19261804 INTEGER :: nfields
19271805 INTEGER, INTENT(OUT) :: ier
19281806 END SUBROUTINE cg_nfields_f
1929 END INTERFACE
1930
1931 INTERFACE
1807
19321808 SUBROUTINE cg_field_info_f(fn, B, Z, S, F, TYPE, fieldname, ier) !BIND(C, NAME="cg_field_info_f")
19331809 IMPORT :: c_char, cgenum_t
19341810 IMPLICIT NONE
19411817 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: fieldname
19421818 INTEGER, INTENT(OUT) :: ier
19431819 END SUBROUTINE cg_field_info_f
1944 END INTERFACE
19451820
19461821 !!$INTERFACE
19471822 !!$ SUBROUTINE cg_field_read_f(fn, B, Z, S, fieldname), TYPE, rmin, rmax, field_ptr, ier) BIND(C, NAME="")
19561831 !!$ END SUBROUTINE cg_field_read_f
19571832 !!$END INTERFACE
19581833
1959 INTERFACE
19601834 SUBROUTINE cg_field_id_f(fn, B, Z, S, F, field_id, ier) !BIND(C, NAME="cg_field_id_f")
19611835 IMPORT :: c_double
19621836 IMPLICIT NONE
19681842 REAL(C_DOUBLE) :: field_id
19691843 INTEGER, INTENT(OUT) :: ier
19701844 END SUBROUTINE cg_field_id_f
1971 END INTERFACE
1972
1973 !!$INTERFACE
1845
19741846 !!$ SUBROUTINE cg_field_write_f(fn, B, Z, S, TYPE, fieldname, field_ptr, F, ier) BIND(C, NAME="")
19751847 !!$ INTEGER :: fn
19761848 !!$ INTEGER :: B,
19821854 !!$ INTEGER :: F
19831855 !!$ INTEGER, INTENT(OUT) :: ier
19841856 !!$ END SUBROUTINE cg_field_write_f
1985 !!$END INTERFACE
1986
1987 !!$INTERFACE
1857
19881858 !!$ SUBROUTINE cg_field_partial_write_f) (fn, B, Z, S, TYPE, fieldname, rmin, rmax, void *field_ptr, F, ier) BIND(C, NAME="")
19891859 !!$ INTEGER :: fn,
19901860 !!$ INTEGER :: B
19971867 !!$ INTEGER :: F
19981868 !!$ INTEGER, INTENT(OUT) :: ier
19991869 !!$ END SUBROUTINE cg_field_partial_write_f
2000 !!$END INTERFACE
20011870
20021871 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
20031872 ! Read and write ZoneSubRegion_t Nodes *
20041873 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
20051874
2006 INTERFACE
20071875 SUBROUTINE cg_nsubregs_f(fn, B, Z, nsubreg, ier) BIND(C, NAME="cg_nsubregs_f")
20081876 IMPLICIT NONE
20091877 INTEGER :: fn
20121880 INTEGER :: nsubreg
20131881 INTEGER, INTENT(OUT) :: ier
20141882 END SUBROUTINE cg_nsubregs_f
2015 END INTERFACE
2016
2017 INTERFACE
1883
20181884 SUBROUTINE cg_subreg_info_f(fn, B, Z, S, regname, DIMENSION, &
20191885 location, ptset_type, npnts, bcname_len, gcname_len, ier) !BIND(C, NAME="cg_subreg_info_f")
20201886 IMPORT :: c_char, cgenum_t, CGSIZE_T
20321898 INTEGER :: gcname_len
20331899 INTEGER, INTENT(OUT) :: ier
20341900 END SUBROUTINE cg_subreg_info_f
2035 END INTERFACE
2036
2037 INTERFACE
1901
20381902 SUBROUTINE cg_subreg_ptset_read_f( fn, B, Z, S, pnts, ier) BIND(C, NAME="cg_subreg_ptset_read_f")
20391903 IMPORT :: CGSIZE_T
20401904 IMPLICIT NONE
20451909 INTEGER(CGSIZE_T), DIMENSION(*) :: pnts
20461910 INTEGER, INTENT(OUT) :: ier
20471911 END SUBROUTINE cg_subreg_ptset_read_f
2048 END INTERFACE
2049
2050 INTERFACE
1912
20511913 SUBROUTINE cg_subreg_bcname_read_f( fn, B, Z, S, bcname, ier) !BIND(C, NAME="cg_subreg_bcname_read_f")
20521914 IMPORT :: c_char
20531915 IMPLICIT NONE
20581920 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: bcname
20591921 INTEGER, INTENT(OUT) :: ier
20601922 END SUBROUTINE cg_subreg_bcname_read_f
2061 END INTERFACE
2062
2063 INTERFACE
1923
20641924 SUBROUTINE cg_subreg_gcname_read_f(fn, B, Z, S, gcname, ier) !BIND(C, NAME="cg_subreg_gcname_read_f")
20651925 IMPORT :: c_char
20661926 IMPLICIT NONE
20711931 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: gcname
20721932 INTEGER, INTENT(OUT) :: ier
20731933 END SUBROUTINE cg_subreg_gcname_read_f
2074 END INTERFACE
2075
2076 INTERFACE
2077 SUBROUTINE cg_subreg_ptset_write_f(fn, B, Z, regname, DIMENSION, location, ptset_type, npnts, pnts, S, ier) !BIND(C, NAME="cg_subreg_ptset_write_f")
1934
1935 SUBROUTINE cg_subreg_ptset_write_f(fn, B, Z, regname, DIMENSION, location, ptset_type, npnts, &
1936 pnts, S, ier) !BIND(C, NAME="cg_subreg_ptset_write_f")
20781937 IMPORT :: cgenum_t, c_char, CGSIZE_T
20791938 IMPLICIT NONE
20801939 INTEGER :: fn
20891948 INTEGER :: S
20901949 INTEGER, INTENT(OUT) :: ier
20911950 END SUBROUTINE cg_subreg_ptset_write_f
2092 END INTERFACE
2093
2094 INTERFACE
1951
20951952 SUBROUTINE cg_subreg_bcname_write_f( fn, B, Z, regname, DIMENSION, bcname, S, ier) !BIND(C, NAME="cg_subreg_bcname_write_f")
20961953 IMPORT :: c_char
20971954 IMPLICIT NONE
21041961 INTEGER :: S
21051962 INTEGER, INTENT(OUT) :: ier
21061963 END SUBROUTINE cg_subreg_bcname_write_f
2107 END INTERFACE
2108
2109 INTERFACE
1964
21101965 SUBROUTINE cg_subreg_gcname_write_f( fn, B, Z, regname, DIMENSION, gcname, S, ier) !BIND(C, NAME="cg_subreg_gcname_write_f")
21111966 IMPORT :: c_char
21121967 IMPLICIT NONE
21191974 INTEGER :: S
21201975 INTEGER, INTENT(OUT) :: ier
21211976 END SUBROUTINE cg_subreg_gcname_write_f
2122 END INTERFACE
21231977
21241978 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
21251979 ! Read and write ZoneGridConnectivity_t Nodes *
21261980 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
21271981
2128 INTERFACE
21291982 SUBROUTINE cg_nzconns_f(fn, B, Z, nzconns, ier) BIND(C, NAME="cg_nzconns_f")
21301983 IMPLICIT NONE
21311984 INTEGER :: fn
21341987 INTEGER :: nzconns
21351988 INTEGER, INTENT(OUT) :: ier
21361989 END SUBROUTINE cg_nzconns_f
2137 END INTERFACE
2138
2139 INTERFACE
1990
21401991 SUBROUTINE cg_zconn_read_f(fn, B, Z, C, name, ier) !BIND(C, NAME="cg_zconn_read_f")
21411992 IMPORT :: c_char
21421993 IMPLICIT NONE
21471998 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name
21481999 INTEGER, INTENT(OUT) :: ier
21492000 END SUBROUTINE cg_zconn_read_f
2150 END INTERFACE
2151
2152 INTERFACE
2001
21532002 SUBROUTINE cg_zconn_write_f(fn, B, Z, name, C, ier) !BIND(C, NAME="cg_zconn_write_f")
21542003 IMPORT :: c_char
21552004 IMPLICIT NONE
21602009 INTEGER :: C
21612010 INTEGER, INTENT(OUT) :: ier
21622011 END SUBROUTINE cg_zconn_write_f
2163 END INTERFACE
2164
2165 INTERFACE
2012
21662013 SUBROUTINE cg_zconn_get_f(fn, B, Z, C, ier) BIND(C, NAME="cg_zconn_get_f")
21672014 IMPLICIT NONE
21682015 INTEGER :: fn
21712018 INTEGER :: C
21722019 INTEGER, INTENT(OUT) :: ier
21732020 END SUBROUTINE cg_zconn_get_f
2174 END INTERFACE
2175
2176 INTERFACE
2021
21772022 SUBROUTINE cg_zconn_set_f(fn, B, Z, C, ier) BIND(C, NAME="cg_zconn_set_f")
21782023 IMPLICIT NONE
21792024 INTEGER :: fn
21822027 INTEGER :: C
21832028 INTEGER, INTENT(OUT) :: ier
21842029 END SUBROUTINE cg_zconn_set_f
2185 END INTERFACE
21862030
21872031 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
21882032 ! Read and write OversetHoles_t Nodes *
21892033 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
21902034
2191 INTERFACE
21922035 SUBROUTINE cg_nholes_f(fn, B, Z, nholes, ier) BIND(C, NAME="cg_nholes_f")
21932036 IMPLICIT NONE
21942037 INTEGER :: fn
21972040 INTEGER :: nholes
21982041 INTEGER, INTENT(OUT) :: ier
21992042 END SUBROUTINE cg_nholes_f
2200 END INTERFACE
2201
2202 INTERFACE
2043
22032044 SUBROUTINE cg_hole_info_f(fn, B, Z, I, holename, location, ptset_type, nptsets, npnts, ier) !BIND(C, NAME="cg_hole_info_f")
22042045 IMPORT :: c_char, cgenum_t, CGSIZE_T
22052046 IMPLICIT NONE
22142055 INTEGER(CGSIZE_T) :: npnts
22152056 INTEGER, INTENT(OUT) :: ier
22162057 END SUBROUTINE cg_hole_info_f
2217 END INTERFACE
2218
2219 INTERFACE
2058
22202059 SUBROUTINE cg_hole_read_f(fn, B, Z, I, pnts, ier) BIND(C, NAME="cg_hole_read_f")
22212060 IMPORT :: CGSIZE_T
22222061 IMPLICIT NONE
22272066 INTEGER(CGSIZE_T), DIMENSION(*) :: pnts
22282067 INTEGER, INTENT(OUT) :: ier
22292068 END SUBROUTINE cg_hole_read_f
2230 END INTERFACE
2231
2232 INTERFACE
2069
22332070 SUBROUTINE cg_hole_id_f(fn, B, Z, I, hole_id, ier) BIND(C, NAME="cg_hole_id_f")
22342071 IMPORT :: c_double
22352072 IMPLICIT NONE
22402077 REAL(C_DOUBLE) :: hole_id
22412078 INTEGER, INTENT(OUT) :: ier
22422079 END SUBROUTINE cg_hole_id_f
2243 END INTERFACE
2244
2245 INTERFACE
2246 SUBROUTINE cg_hole_write_f(fn, B, Z, holename, location, ptset_type, nptsets, npnts, pnts, I, ier) !BIND(C, NAME="cg_hole_write_f")
2080
2081 SUBROUTINE cg_hole_write_f(fn, B, Z, holename, location, ptset_type, nptsets, npnts, &
2082 pnts, I, ier) !BIND(C, NAME="cg_hole_write_f")
22472083 IMPORT :: c_char, cgenum_t, CGSIZE_T
22482084 IMPLICIT NONE
22492085 INTEGER :: fn
22582094 INTEGER :: I
22592095 INTEGER, INTENT(OUT) :: ier
22602096 END SUBROUTINE cg_hole_write_f
2261 END INTERFACE
22622097
22632098 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
22642099 ! Read and write GridConnectivity_t Nodes *
22652100 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
22662101
2267 INTERFACE
22682102 SUBROUTINE cg_nconns_f(fn, B, Z, nconns, ier) BIND(C, NAME="cg_nconns_f")
22692103 IMPLICIT NONE
22702104 INTEGER :: fn
22732107 INTEGER :: nconns
22742108 INTEGER, INTENT(OUT) :: ier
22752109 END SUBROUTINE cg_nconns_f
2276 END INTERFACE
2277
2278 INTERFACE
2110
22792111 SUBROUTINE cg_conn_info_f(fn, B, Z, I, connectname, location, &
22802112 TYPE, ptset_type, npnts, donorname, donor_zonetype, donor_ptset_type, &
22812113 donor_datatype, ndata_donor, ier) !BIND(C, NAME="cg_conn_info_f")
22972129 INTEGER(CGSIZE_T) :: ndata_donor
22982130 INTEGER, INTENT(OUT) :: ier
22992131 END SUBROUTINE cg_conn_info_f
2300 END INTERFACE
2301
2302 INTERFACE
2132
23032133 SUBROUTINE cg_conn_read_f(fn, B, Z, I, pnts, donor_datatype, donor_data, ier) BIND(C, NAME="cg_conn_read_f")
23042134 IMPORT :: cgenum_t, CGSIZE_T
23052135 IMPLICIT NONE
23122142 INTEGER(CGSIZE_T), DIMENSION(*) :: donor_data
23132143 INTEGER, INTENT(OUT) :: ier
23142144 END SUBROUTINE cg_conn_read_f
2315 END INTERFACE
2316
2317 INTERFACE
2145
23182146 SUBROUTINE cg_conn_read_short_f(fn, B, Z, I, pnts, ier) BIND(C, NAME="cg_conn_read_short_f")
23192147 IMPORT :: CGSIZE_T
23202148 IMPLICIT NONE
23252153 INTEGER(CGSIZE_T) ::pnts
23262154 INTEGER, INTENT(OUT) :: ier
23272155 END SUBROUTINE cg_conn_read_short_f
2328 END INTERFACE
2329
2330 INTERFACE
2156
23312157 SUBROUTINE cg_conn_id_f(fn, B, Z, I, conn_id, ier) BIND(C, NAME="cg_conn_id_f")
23322158 IMPORT :: c_double
23332159 IMPLICIT NONE
23382164 REAL(C_DOUBLE) :: conn_id
23392165 INTEGER, INTENT(OUT) :: ier
23402166 END SUBROUTINE cg_conn_id_f
2341 END INTERFACE
2342
2343 INTERFACE
2167
23442168 SUBROUTINE cg_conn_write_f(fn, B, Z, connectname, location, TYPE, ptset_type, &
23452169 npnts, pnts, donorname, donor_zonetype, donor_ptset_type, &
23462170 donor_datatype, ndata_donor, donor_data, I, ier) !BIND(C, NAME="cg_conn_write_f")
23642188 INTEGER :: I
23652189 INTEGER, INTENT(OUT) :: ier
23662190 END SUBROUTINE cg_conn_write_f
2367 END INTERFACE
2368
2369 INTERFACE
2191
23702192 SUBROUTINE cg_conn_write_short_f(fn, B, Z, connectname, location, &
23712193 TYPE, ptset_type, npnts, pnts, donorname, I, ier) !BIND(C, NAME="cg_conn_write_short_f")
23722194 IMPORT :: c_char, cgenum_t, CGSIZE_T
23842206 INTEGER :: I
23852207 INTEGER, INTENT(OUT) :: ier
23862208 END SUBROUTINE cg_conn_write_short_f
2387 END INTERFACE
23882209
23892210 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
23902211 ! Read and write GridConnectivity1to1_t Nodes in a zone *
23912212 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
23922213
2393 INTERFACE
23942214 SUBROUTINE cg_n1to1_f(fn, B, Z, n1to1, ier) BIND(C, NAME="cg_n1to1_f")
23952215 IMPLICIT NONE
23962216 INTEGER :: fn
23992219 INTEGER :: n1to1
24002220 INTEGER, INTENT(OUT) :: ier
24012221 END SUBROUTINE cg_n1to1_f
2402 END INTERFACE
2403
2404 INTERFACE
2222
24052223 SUBROUTINE cg_1to1_read_f(fn, B, Z, I, connectname, donorname, &
24062224 range, donor_range, transform, ier) !BIND(C, NAME="cg_1to1_read_f")
24072225 IMPORT :: c_char, CGSIZE_T
24172235 INTEGER, DIMENSION(*) :: transform
24182236 INTEGER, INTENT(OUT) :: ier
24192237 END SUBROUTINE cg_1to1_read_f
2420 END INTERFACE
2421
2422 INTERFACE
2238
24232239 SUBROUTINE cg_1to1_id_f(fn, B, Z, I, one21_id, ier) !BIND(C, NAME="cg_1to1_id_f")
24242240 IMPORT :: c_double
24252241 IMPLICIT NONE
24302246 REAL(C_DOUBLE) :: one21_id
24312247 INTEGER, INTENT(OUT) :: ier
24322248 END SUBROUTINE cg_1to1_id_f
2433 END INTERFACE
2434
2435 INTERFACE
2249
24362250 SUBROUTINE cg_1to1_write_f(fn, B, Z, connectname, donorname, range, &
24372251 donor_range, transform, I, ier) !BIND(C, NAME="cg_1to1_write_f")
24382252 IMPORT :: c_char, CGSIZE_T
24482262 INTEGER :: I
24492263 INTEGER, INTENT(OUT) :: ier
24502264 END SUBROUTINE cg_1to1_write_f
2451 END INTERFACE
24522265
24532266 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
24542267 ! Read all GridConnectivity1to1_t Nodes of a base *
24552268 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
24562269
2457 INTERFACE
24582270 SUBROUTINE cg_n1to1_global_f(fn, B, n1to1_global, ier) BIND(C, NAME="cg_n1to1_global_f")
24592271 IMPLICIT NONE
24602272 INTEGER :: fn
24622274 INTEGER :: n1to1_global
24632275 INTEGER, INTENT(OUT) :: ier
24642276 END SUBROUTINE cg_n1to1_global_f
2465 END INTERFACE
2466
2467 INTERFACE
2277
24682278 SUBROUTINE cg_1to1_read_global_f(fn, B, connectname, zonename, donorname, &
24692279 range, donor_range, transform, ier) !BIND(C, NAME="cg_1to1_read_global_f")
24702280 IMPORT :: c_char, CGSIZE_T
24792289 INTEGER, DIMENSION(*) :: transform
24802290 INTEGER, INTENT(OUT) :: ier
24812291 END SUBROUTINE cg_1to1_read_global_f
2482 END INTERFACE
24832292
24842293 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
24852294 ! Read and write BC_t Nodes *
24862295 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
24872296
2488 INTERFACE
24892297 SUBROUTINE cg_nbocos_f(fn, B, Z, nbocos, ier) BIND(C, NAME="cg_nbocos_f")
24902298 IMPLICIT NONE
24912299 INTEGER :: fn
24942302 INTEGER :: nbocos
24952303 INTEGER, INTENT(OUT) :: ier
24962304 END SUBROUTINE cg_nbocos_f
2497 END INTERFACE
2498
2499 INTERFACE
2305
25002306 SUBROUTINE cg_boco_info_f(fn, B, Z, BC, boconame, bocotype, &
25012307 ptset_type, npnts, NormalIndex, &
25022308 NormalListSize, NormalDataType, ndataset, ier) !BIND(C, NAME="cg_boco_info_f")
25162322 INTEGER :: ndataset
25172323 INTEGER, INTENT(OUT) :: ier
25182324 END SUBROUTINE cg_boco_info_f
2519 END INTERFACE
25202325
25212326 !!$ INTERFACE
25222327 !!$ SUBROUTINE cg_boco_read_f(fn, B, Z, BC, pnts, NormalList, ier) BIND(C, NAME="")
25322337 !!$ END SUBROUTINE cg_boco_read_f
25332338 !!$ END INTERFACE
25342339
2535 INTERFACE
25362340 SUBROUTINE cg_boco_id_f(fn, B, Z, BC, boco_id, ier) BIND(C, NAME="cg_boco_id_f")
25372341 IMPORT :: c_double
25382342 IMPLICIT NONE
25432347 REAL(C_DOUBLE) :: boco_id
25442348 INTEGER, INTENT(OUT) :: ier
25452349 END SUBROUTINE cg_boco_id_f
2546 END INTERFACE
2547
2548 INTERFACE
2350
25492351 SUBROUTINE cg_boco_write_f(fn, B, Z, boconame, bocotype, ptset_type, npnts, pnts, BC, ier) !BIND(C, NAME="cg_boco_write_f")
25502352 IMPORT :: c_char, cgenum_t, CGSIZE_T
25512353 IMPLICIT NONE
25602362 INTEGER :: BC
25612363 INTEGER, INTENT(OUT) :: ier
25622364 END SUBROUTINE cg_boco_write_f
2563 END INTERFACE
2564
2565 !!$ INTERFACE
2365
25662366 !!$ SUBROUTINE cg_boco_normal_write_f( fn, B, Z, BC, NormalIndex, NormalListFlag,
25672367 !!$ NormalDataType, NormalList, ier) BIND(C, NAME="")
25682368 !!$
25762376 !!$ ! void *NormalList,
25772377 !!$ INTEGER, INTENT(OUT) :: ier
25782378 !!$ END SUBROUTINE cg_boco_normal_write_f
2579 !!$ END INTERFACE
2580
2581 INTERFACE
2379
25822380 SUBROUTINE cg_boco_gridlocation_read_f(fn, B, Z, BC, location, ier) BIND(C, NAME="cg_boco_gridlocation_read_f")
25832381 IMPORT :: cgenum_t
25842382 IMPLICIT NONE
25892387 INTEGER(cgenum_t) :: location
25902388 INTEGER, INTENT(OUT) :: ier
25912389 END SUBROUTINE cg_boco_gridlocation_read_f
2592 END INTERFACE
2593
2594 INTERFACE
2390
25952391 SUBROUTINE cg_boco_gridlocation_write_f( fn, B, Z, BC, location, ier) BIND(C, NAME="cg_boco_gridlocation_write_f")
25962392 IMPORT :: cgenum_t
25972393 IMPLICIT NONE
26022398 INTEGER(cgenum_t) :: location
26032399 INTEGER, INTENT(OUT) :: ier
26042400 END SUBROUTINE cg_boco_gridlocation_write_f
2605 END INTERFACE
26062401
26072402 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
26082403 ! Read and write BCProperty_t/WallFunction_t Nodes *
26092404 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
26102405
2611 INTERFACE
26122406 SUBROUTINE cg_bc_wallfunction_read_f(fn, B, Z, BC, WallFunctionType, ier) BIND(C, NAME="cg_bc_wallfunction_read_f")
26132407 IMPORT :: cgenum_t
26142408 IMPLICIT NONE
26192413 INTEGER(cgenum_t) :: WallFunctionType
26202414 INTEGER, INTENT(OUT) :: ier
26212415 END SUBROUTINE cg_bc_wallfunction_read_f
2622 END INTERFACE
2623
2624 INTERFACE
2416
26252417 SUBROUTINE cg_bc_wallfunction_write_f(fn, B, Z, BC, WallFunctionType, ier) BIND(C, NAME="cg_bc_wallfunction_write_f")
26262418 IMPORT :: cgenum_t
26272419 IMPLICIT NONE
26322424 INTEGER(cgenum_t) :: WallFunctionType
26332425 INTEGER, INTENT(OUT) :: ier
26342426 END SUBROUTINE cg_bc_wallfunction_write_f
2635 END INTERFACE
26362427
26372428 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
26382429 ! Read and write BCProperty_t/Area_t Nodes *
26392430 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
26402431
2641 INTERFACE
26422432 SUBROUTINE cg_bc_area_read_f(fn, B, Z, BC, AreaType, SurfaceArea, RegionName, ier) !BIND(C, NAME="cg_bc_area_read_f")
26432433 IMPORT :: c_char, cgenum_t, c_float
26442434 IMPLICIT NONE
26512441 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: RegionName
26522442 INTEGER, INTENT(OUT) :: ier
26532443 END SUBROUTINE cg_bc_area_read_f
2654 END INTERFACE
2655
2656 INTERFACE
2444
26572445 SUBROUTINE cg_bc_area_write_f(fn, B, Z, BC, AreaType, SurfaceArea, RegionName, ier) !BIND(C, NAME="cg_bc_area_write_f")
26582446 IMPORT :: c_char, cgenum_t, c_float
26592447 IMPLICIT NONE
26662454 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: RegionName
26672455 INTEGER, INTENT(OUT) :: ier
26682456 END SUBROUTINE cg_bc_area_write_f
2669 END INTERFACE
26702457
26712458 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
26722459 ! Read and write GridConnectivityProperty_t/Periodic_t Nodes *
26732460 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
26742461
2675 INTERFACE
26762462 SUBROUTINE cg_conn_periodic_read_f(fn, B, Z, I, RotationCenter, RotationAngle, Translation, ier) &
26772463 BIND(C, NAME="cg_conn_periodic_read_f")
26782464 IMPORT :: c_float
26862472 REAL(C_FLOAT), DIMENSION(*) :: Translation
26872473 INTEGER, INTENT(OUT) :: ier
26882474 END SUBROUTINE cg_conn_periodic_read_f
2689 END INTERFACE
2690
2691 INTERFACE
2475
26922476 SUBROUTINE cg_conn_periodic_write_f( fn, B, Z, I, RotationCenter, RotationAngle, Translation, ier) &
26932477 BIND(C, NAME="cg_conn_periodic_write_f")
26942478 IMPORT :: c_float
27022486 REAL(C_FLOAT), DIMENSION(*) :: Translation
27032487 INTEGER, INTENT(OUT) :: ier
27042488 END SUBROUTINE cg_conn_periodic_write_f
2705 END INTERFACE
2706
2707 INTERFACE
2489
27082490 SUBROUTINE cg_1to1_periodic_read_f(fn, B, Z, I, RotationCenter, RotationAngle, Translation, ier) &
27092491 BIND(C, NAME="cg_1to1_periodic_read_f")
27102492 IMPORT :: c_float
27182500 REAL(C_FLOAT), DIMENSION(*) :: Translation
27192501 INTEGER, INTENT(OUT) :: ier
27202502 END SUBROUTINE cg_1to1_periodic_read_f
2721 END INTERFACE
2722
2723 INTERFACE
2503
27242504 SUBROUTINE cg_1to1_periodic_write_f(fn, B, Z, I, RotationCenter, RotationAngle, Translation, ier) &
27252505 BIND(C, NAME="cg_1to1_periodic_write_f")
27262506 IMPORT :: c_float
27342514 REAL(C_FLOAT), DIMENSION(*) :: Translation
27352515 INTEGER, INTENT(OUT) :: ier
27362516 END SUBROUTINE cg_1to1_periodic_write_f
2737 END INTERFACE
27382517
27392518 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
27402519 ! Read and write GridConnectivityProperty_t/AverageInterface_t Nodes *
27412520 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
27422521
2743 INTERFACE
27442522 SUBROUTINE cg_conn_average_read_f(fn, B, Z, I, AverageInterfaceType, ier) &
27452523 BIND(C, NAME="cg_conn_average_read_f")
27462524 IMPORT :: cgenum_t
27522530 INTEGER(cgenum_t) :: AverageInterfaceType
27532531 INTEGER, INTENT(OUT) :: ier
27542532 END SUBROUTINE cg_conn_average_read_f
2755 END INTERFACE
2756
2757 INTERFACE
2533
27582534 SUBROUTINE cg_conn_average_write_f(fn, B, Z, I, AverageInterfaceType, ier) &
27592535 BIND(C, NAME="cg_conn_average_write_f")
27602536 IMPORT :: cgenum_t
27662542 INTEGER(cgenum_t) :: AverageInterfaceType
27672543 INTEGER, INTENT(OUT) :: ier
27682544 END SUBROUTINE cg_conn_average_write_f
2769 END INTERFACE
2770
2771 INTERFACE
2545
27722546 SUBROUTINE cg_1to1_average_read_f(fn, B, Z, I, AverageInterfaceType, ier) &
27732547 BIND(C, NAME="cg_1to1_average_read_f")
27742548 IMPORT :: cgenum_t
27802554 INTEGER(cgenum_t) :: AverageInterfaceType
27812555 INTEGER, INTENT(OUT) :: ier
27822556 END SUBROUTINE cg_1to1_average_read_f
2783 END INTERFACE
2784
2785 INTERFACE
2557
27862558 SUBROUTINE cg_1to1_average_write_f(fn, B, Z, I,AverageInterfaceType, ier) BIND(C, NAME="cg_1to1_average_write_f")
27872559 IMPORT :: cgenum_t
27882560 IMPLICIT NONE
27932565 INTEGER(cgenum_t) :: AverageInterfaceType
27942566 INTEGER, INTENT(OUT) :: ier
27952567 END SUBROUTINE cg_1to1_average_write_f
2796 END INTERFACE
27972568
27982569 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
27992570 ! Read and write BCDataSet_t Nodes *
28002571 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
28012572
2802 INTERFACE
28032573 SUBROUTINE cg_dataset_read_f(fn, B, Z, BC, DSet, Dataset_name, BCType, DirichletFlag, &
28042574 NeumannFlag, ier) !BIND(C, NAME="cg_dataset_read_f")
28052575 IMPORT :: c_char, cgenum_t
28152585 INTEGER :: NeumannFlag
28162586 INTEGER, INTENT(OUT) :: ier
28172587 END SUBROUTINE cg_dataset_read_f
2818 END INTERFACE
2819
2820 INTERFACE
2588
28212589 SUBROUTINE cg_dataset_write_f(fn, B, Z, BC, Dataset_name,BCType, Dset, ier) !BIND(C, NAME="cg_dataset_write_f")
28222590 IMPORT :: c_char, cgenum_t
28232591 IMPLICIT NONE
28302598 INTEGER :: Dset
28312599 INTEGER, INTENT(OUT) :: ier
28322600 END SUBROUTINE cg_dataset_write_f
2833 END INTERFACE
2834
2835 INTERFACE
2601
28362602 SUBROUTINE cg_bcdataset_write_f(Dataset_name, BCType, BCDataType, ier) !BIND(C, NAME="cg_bcdataset_write_f")
28372603 IMPORT :: c_char, cgenum_t
28382604 IMPLICIT NONE
28412607 INTEGER(cgenum_t) :: BCDataType
28422608 INTEGER, INTENT(OUT) :: ier
28432609 END SUBROUTINE cg_bcdataset_write_f
2844 END INTERFACE
2845
2846 INTERFACE
2610
28472611 SUBROUTINE cg_bcdataset_info_f(ndataset, ier) BIND(C, NAME="cg_bcdataset_info_f")
28482612 IMPLICIT NONE
28492613 INTEGER :: ndataset
28502614 INTEGER, INTENT(OUT) :: ier
28512615 END SUBROUTINE cg_bcdataset_info_f
2852 END INTERFACE
2853
2854 INTERFACE
2616
28552617 SUBROUTINE cg_bcdataset_read_f(index, Dataset_name, BCType, &
28562618 DirichletFlag, NeumannFlag,ier) !BIND(C, NAME="cg_bcdataset_read_f")
28572619 IMPORT :: c_char, cgenum_t, CGSIZE_T
28632625 INTEGER :: NeumannFlag
28642626 INTEGER, INTENT(OUT) :: ier
28652627 END SUBROUTINE cg_bcdataset_read_f
2866 END INTERFACE
28672628
28682629 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
28692630 ! Read and write BCData_t Nodes *
28702631 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
28712632
2872 INTERFACE
28732633 SUBROUTINE cg_bcdata_write_f(fn, B, Z, BC, Dset, BCDataType, ier) BIND(C, NAME="cg_bcdata_write_f")
28742634 IMPORT :: cgenum_t
28752635 IMPLICIT NONE
28812641 INTEGER(cgenum_t) :: BCDataType
28822642 INTEGER, INTENT(OUT) :: ier
28832643 END SUBROUTINE cg_bcdata_write_f
2884 END INTERFACE
28852644
28862645 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
28872646 ! Read and write RigidGridMotion_t Nodes *
28882647 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
28892648
2890 INTERFACE
28912649 SUBROUTINE cg_n_rigid_motions_f(fn, B, Z, n_rigid_motions, ier) BIND(C, NAME="cg_n_rigid_motions_f")
28922650 IMPLICIT NONE
28932651 INTEGER :: fn
28962654 INTEGER :: n_rigid_motions
28972655 INTEGER, INTENT(OUT) :: ier
28982656 END SUBROUTINE cg_n_rigid_motions_f
2899 END INTERFACE
2900
2901 INTERFACE
2657
29022658 SUBROUTINE cg_rigid_motion_read_f(fn, B, Z, R, rmotion_name, TYPE, ier) !BIND(C, NAME="cg_rigid_motion_read_f")
29032659 IMPORT :: c_char, cgenum_t
29042660 IMPLICIT NONE
29102666 INTEGER(cgenum_t) :: TYPE
29112667 INTEGER, INTENT(OUT) :: ier
29122668 END SUBROUTINE cg_rigid_motion_read_f
2913 END INTERFACE
2914
2915 INTERFACE
2669
29162670 SUBROUTINE cg_rigid_motion_write_f(fn, B, Z, rmotion_name, TYPE, R, ier) !BIND(C, NAME="cg_rigid_motion_write_f")
29172671 IMPORT :: c_char, cgenum_t
29182672 IMPLICIT NONE
29242678 INTEGER :: R
29252679 INTEGER, INTENT(OUT) :: ier
29262680 END SUBROUTINE cg_rigid_motion_write_f
2927 END INTERFACE
29282681
29292682 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
29302683 ! Read and write ArbitraryGridMotion_t Nodes *
29312684 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
29322685
2933 INTERFACE
29342686 SUBROUTINE cg_n_arbitrary_motions_f( fn, B, Z, n_arbitrary_motions, ier) BIND(C, NAME="cg_n_arbitrary_motions_f")
29352687 IMPLICIT NONE
29362688 INTEGER :: fn
29392691 INTEGER :: n_arbitrary_motions
29402692 INTEGER, INTENT(OUT) :: ier
29412693 END SUBROUTINE cg_n_arbitrary_motions_f
2942 END INTERFACE
2943
2944 INTERFACE
2694
29452695 SUBROUTINE cg_arbitrary_motion_read_f(fn, B, Z, A, amotion_name, TYPE, ier) !BIND(C, NAME="cg_arbitrary_motion_read_f")
29462696 IMPORT :: c_char, cgenum_t
29472697 IMPLICIT NONE
29532703 INTEGER(cgenum_t) :: TYPE
29542704 INTEGER, INTENT(OUT) :: ier
29552705 END SUBROUTINE cg_arbitrary_motion_read_f
2956 END INTERFACE
2957
2958 INTERFACE
2706
29592707 SUBROUTINE cg_arbitrary_motion_write_f(fn, B, Z, amotion_name, TYPE, A, ier) !BIND(C, NAME="cg_arbitrary_motion_write_f")
29602708 IMPORT :: c_char, cgenum_t
29612709 IMPLICIT NONE
29672715 INTEGER :: A
29682716 INTEGER, INTENT(OUT) :: ier
29692717 END SUBROUTINE cg_arbitrary_motion_write_f
2970 END INTERFACE
29712718
29722719 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
29732720 ! Read and write GridCoordinates_t Nodes *
29742721 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
29752722
2976 INTERFACE
29772723 SUBROUTINE cg_ngrids_f(fn, B, Z, ngrids, ier) BIND(C, NAME="cg_ngrids_f")
29782724 IMPLICIT NONE
29792725 INTEGER :: fn
29822728 INTEGER :: ngrids
29832729 INTEGER, INTENT(OUT) :: ier
29842730 END SUBROUTINE cg_ngrids_f
2985 END INTERFACE
2986
2987 INTERFACE
2731
29882732 SUBROUTINE cg_grid_read_f(fn, B, Z, G, gridname, ier) ! BIND(C, NAME="cg_grid_read_f")
29892733 IMPORT :: c_char
29902734 IMPLICIT NONE
29952739 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: gridname
29962740 INTEGER, INTENT(OUT) :: ier
29972741 END SUBROUTINE cg_grid_read_f
2998 END INTERFACE
2999
3000 INTERFACE
2742
30012743 SUBROUTINE cg_grid_write_f(fn, B, Z, gridname, G, ier) !BIND(C, NAME="cg_grid_write_f")
30022744 IMPORT :: c_char
30032745 IMPLICIT NONE
30082750 INTEGER :: G
30092751 INTEGER, INTENT(OUT) :: ier
30102752 END SUBROUTINE cg_grid_write_f
3011 END INTERFACE
3012
3013 !!$ INTERFACE
2753
30142754 !!$ SUBROUTINE cg_grid_bounding_box_read_f(fn, B, Z, G, datatype, array, ier) ! BIND(C, NAME="cg_grid_bounding_box_read_f")
30152755 !!$ IMPORT :: cgenum_t
30162756 !!$ IMPLICIT NONE
30222762 !!$ TYPE(*), DIMENSION(*) :: array
30232763 !!$ INTEGER, INTENT(OUT) :: ier
30242764 !!$ END SUBROUTINE cg_grid_bounding_box_read_f
3025 !!$ END INTERFACE
30262765
3027 !!$ INTERFACE
3028 !!$ SUBROUTINE cg_grid_bounding_box_write_f(fn, B, Z, G, datatype, array, ier) !BIND(C, NAME="cg_grid_bounding_box_write_f")
2766 !!$!!$ SUBROUTINE cg_grid_bounding_box_write_f(fn, B, Z, G, datatype, array, ier) !BIND(C, NAME="cg_grid_bounding_box_write_f")
30292767 !!$ IMPORT :: cgenum_t, c_ptr
30302768 !!$ IMPLICIT NONE
30312769 !!$ INTEGER :: fn
30362774 !!$ void *array
30372775 !!$ INTEGER, INTENT(OUT) :: ier
30382776 !!$ END SUBROUTINE cg_grid_bounding_box_write_f
3039 !!$ END INTERFACE
3040
2777 !!$
30412778 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
30422779 ! Read and write SimulationType_t Node *
30432780 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
30442781
3045 INTERFACE
30462782 SUBROUTINE cg_simulation_type_read_f(fn, B, TYPE, ier) BIND(C, NAME="cg_simulation_type_read_f")
30472783 IMPORT :: cgenum_t
30482784 IMPLICIT NONE
30512787 INTEGER(cgenum_t) :: TYPE
30522788 INTEGER, INTENT(OUT) :: ier
30532789 END SUBROUTINE cg_simulation_type_read_f
3054 END INTERFACE
3055
3056 INTERFACE
2790
30572791 SUBROUTINE cg_simulation_type_write_f(fn, B, TYPE, ier) BIND(C, NAME="cg_simulation_type_write_f")
30582792 IMPORT :: cgenum_t
30592793 IMPLICIT NONE
30622796 INTEGER(cgenum_t) :: TYPE
30632797 INTEGER, INTENT(OUT) :: ier
30642798 END SUBROUTINE cg_simulation_type_write_f
3065 END INTERFACE
30662799
30672800 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
30682801 ! Read and write BaseIterativeData_t Node *
30692802 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
30702803
3071 INTERFACE
30722804 SUBROUTINE cg_biter_read_f(fn, B, bitername, nsteps, ier) !BIND(C, NAME="cg_biter_read_f")
30732805 IMPORT :: c_char
30742806 IMPLICIT NONE
30782810 INTEGER :: nsteps
30792811 INTEGER, INTENT(OUT) :: ier
30802812 END SUBROUTINE cg_biter_read_f
3081 END INTERFACE
3082
3083 INTERFACE
2813
30842814 SUBROUTINE cg_biter_write_f(fn, B, bitername, nsteps, ier) !BIND(C, NAME="cg_biter_write_f")
30852815 IMPORT :: c_char
30862816 IMPLICIT NONE
30902820 INTEGER :: nsteps
30912821 INTEGER, INTENT(OUT) :: ier
30922822 END SUBROUTINE cg_biter_write_f
3093 END INTERFACE
30942823
30952824 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
30962825 ! Read and write ZoneIterativeData_t Nodes *
30972826 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
30982827
3099 INTERFACE
31002828 SUBROUTINE cg_ziter_read_f(fn, B, Z, zitername, ier) !BIND(C, NAME="cg_ziter_read_f")
31012829 IMPORT :: c_char
31022830 IMPLICIT NONE
31062834 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: zitername
31072835 INTEGER, INTENT(OUT) :: ier
31082836 END SUBROUTINE cg_ziter_read_f
3109 END INTERFACE
3110
3111
3112 INTERFACE
2837
2838
31132839 SUBROUTINE cg_ziter_write_f(fn, B, Z, zitername, ier) !BIND(C, NAME="cg_ziter_write_f")
31142840 IMPORT :: c_char
31152841 IMPLICIT NONE
31192845 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: zitername
31202846 INTEGER, INTENT(OUT) :: ier
31212847 END SUBROUTINE cg_ziter_write_f
3122 END INTERFACE
31232848
31242849 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
31252850 ! Read and write Gravity_t Node *
31262851 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
31272852
3128 INTERFACE
31292853 SUBROUTINE cg_gravity_read_f(fn, B, gravity_vector, ier) BIND(C, NAME="cg_gravity_read_f")
31302854 IMPORT :: c_float
31312855 IMPLICIT NONE
31342858 REAL(C_FLOAT), DIMENSION(*) :: gravity_vector
31352859 INTEGER, INTENT(OUT) :: ier
31362860 END SUBROUTINE cg_gravity_read_f
3137 END INTERFACE
3138
3139 INTERFACE
2861
31402862 SUBROUTINE cg_gravity_write_f(fn, B, gravity_vector, ier) BIND(C, NAME="cg_gravity_write_f")
31412863 IMPORT :: c_float
31422864 IMPLICIT NONE
31452867 REAL(C_FLOAT), DIMENSION(*) :: gravity_vector
31462868 INTEGER, INTENT(OUT) :: ier
31472869 END SUBROUTINE cg_gravity_write_f
3148 END INTERFACE
31492870
31502871 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
31512872 ! Read and write Axisymmetry_t Node *
31522873 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
31532874
3154 INTERFACE
31552875 SUBROUTINE cg_axisym_read_f(fn, B, ref_point, axis, ier) BIND(C, NAME="cg_axisym_read_f")
31562876 IMPORT :: c_float
31572877 IMPLICIT NONE
31612881 REAL(C_FLOAT), DIMENSION(*) :: axis
31622882 INTEGER, INTENT(OUT) :: ier
31632883 END SUBROUTINE cg_axisym_read_f
3164 END INTERFACE
3165
3166 INTERFACE
2884
31672885 SUBROUTINE cg_axisym_write_f(fn, B, ref_point, axis, ier) BIND(C, NAME="cg_axisym_write_f")
31682886 IMPORT :: c_float
31692887 IMPLICIT NONE
31732891 REAL(C_FLOAT), DIMENSION(*) :: axis
31742892 INTEGER, INTENT(OUT) :: ier
31752893 END SUBROUTINE cg_axisym_write_f
3176 END INTERFACE
31772894
31782895
31792896 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
31802897 ! Read and write RotatingCoordinates_t Node *
31812898 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
31822899
3183 INTERFACE
31842900 SUBROUTINE cg_rotating_read_f(rot_rate, rot_center, ier) BIND(C, NAME="cg_rotating_read_f")
31852901 IMPORT :: c_float
31862902 IMPLICIT NONE
31882904 REAL(C_FLOAT), DIMENSION(*) :: rot_center
31892905 INTEGER, INTENT(OUT) :: ier
31902906 END SUBROUTINE cg_rotating_read_f
3191 END INTERFACE
3192
3193 INTERFACE
2907
31942908 SUBROUTINE cg_rotating_write_f(rot_rate, rot_center, ier) BIND(C, NAME="cg_rotating_write_f")
31952909 IMPORT :: c_float
31962910 IMPLICIT NONE
31982912 REAL(C_FLOAT), DIMENSION(*) :: rot_center
31992913 INTEGER, INTENT(OUT) :: ier
32002914 END SUBROUTINE cg_rotating_write_f
3201 END INTERFACE
32022915
32032916 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
32042917 ! Read and write IndexArray/Range_t Nodes *
32052918 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
32062919
3207 INTERFACE
32082920 SUBROUTINE cg_ptset_info_f(ptset_type, npnts, ier) BIND(C, NAME="cg_ptset_info_f")
32092921 IMPORT :: cgenum_t, CGSIZE_T
32102922 IMPLICIT NONE
32122924 INTEGER(CGSIZE_T) :: npnts
32132925 INTEGER, INTENT(OUT) :: ier
32142926 END SUBROUTINE cg_ptset_info_f
3215 END INTERFACE
3216
3217 !!$ INTERFACE
3218 !!$ SUBROUTINE cg_ptset_read_f(pnts, ier) BIND(C, NAME="cg_ptset_read_f")
2927
2928 !!$!!$ SUBROUTINE cg_ptset_read_f(pnts, ier) BIND(C, NAME="cg_ptset_read_f")
32192929 !!$ IMPORT :: cgenum_t, CGSIZE_T
32202930 !!$ IMPLICIT NONE
32212931 !!$ INTEGER(CGSIZE_T), DIMENSION(*) :: pnts
32222932 !!$ INTEGER, INTENT(OUT) :: ier
32232933 !!$ END SUBROUTINE cg_ptset_read_f
3224 !!$ END INTERFACE
3225
3226 !!$ INTERFACE
3227 !!$ SUBROUTINE cg_ptset_write_f(ptset_type, npnts, pnts, ier) BIND(C, NAME="cg_ptset_write_f")
2934 !!$
2935 !!$!!$ SUBROUTINE cg_ptset_write_f(ptset_type, npnts, pnts, ier) BIND(C, NAME="cg_ptset_write_f")
32282936 !!$ IMPORT :: cgenum_t, CGSIZE_T
32292937 !!$ IMPLICIT NONE
32302938 !!$ INTEGER(cgenum_t) :: ptset_type
32322940 !!$ INTEGER(CGSIZE_T), DIMENSION() :: pnts
32332941 !!$ INTEGER, INTENT(OUT) :: ier
32342942 !!$ END SUBROUTINE cg_ptset_write_f
3235 !!$ END INTERFACE
3236
2943 !!$
32372944 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
32382945 ! Go - To Function *
32392946 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
32402947
3241 !!$ INTERFACE
3242 !!$ SUBROUTINE cg_goto_f, CG_GOTO_F)(cgint_f *fn, cgint_f *B, ier, ...)
3243 !!$cgint_f *fn, cgint_f *B, ier, ...)
2948 SUBROUTINE cg_goto_f1(fn, B, ier, name1, index1)
2949 IMPORT :: c_char
2950 IMPLICIT NONE
2951 INTEGER :: fn
2952 INTEGER :: B
2953 INTEGER, INTENT(OUT) :: ier
2954 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name1
2955 INTEGER :: index1
2956 END SUBROUTINE
2957
2958 SUBROUTINE cg_gorel_f1(fn, ier, name1, index1)
2959 IMPORT :: c_char
2960 IMPLICIT NONE
2961 INTEGER :: fn
2962 INTEGER, INTENT(OUT) :: ier
2963 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name1
2964 INTEGER :: index1
2965 END SUBROUTINE
2966
2967 !!$ SUBROUTINE cg_goto_f, CG_GOTO_F)(cgint_f *fn, cgint_f *B, ier, ...)
2968 !!$ cgint_f *fn, cgint_f *B, ier, ...)
32442969 !!$
3245 !!$ INTEGER, INTENT(OUT) :: ier
3246 !!$ END SUBROUTINE
3247 !!$ END INTERFACE
2970 !!$ INTEGER, INTENT(OUT) :: ier
2971 !!$ END SUBROUTINE
32482972 !!$
3249 !!$ INTERFACE
3250 !!$ SUBROUTINE cg_gorel_f, CG_GOREL_F)(cgint_f *fn, ier, ...)
3251 !!$cgint_f *fn, ier, ...)
3252 !!$ INTEGER, INTENT(OUT) :: ier
3253 !!$ END SUBROUTINE
3254 !!$ END INTERFACE
3255
3256 INTERFACE
2973 !!$ SUBROUTINE cg_gorel_f, CG_GOREL_F)(cgint_f *fn, ier, ...)
2974 !!$ cgint_f *fn, ier, ...)
2975 !!$ INTEGER, INTENT(OUT) :: ier
2976 !!$ END SUBROUTINE
2977 !!$
32572978 SUBROUTINE cg_gopath_f(fn,path, ier) !BIND(C, NAME="cg_gopath_f")
32582979 IMPORT :: C_CHAR
32592980 IMPLICIT NONE
32612982 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: path
32622983 INTEGER, INTENT(OUT) :: ier
32632984 END SUBROUTINE cg_gopath_f
3264 END INTERFACE
32652985
32662986 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
3267 ! Read Multiple path nodes *
2987 ! Read Multiple path nodes *
32682988 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
32692989
3270 INTERFACE
32712990 SUBROUTINE cg_famname_read_f(famname, ier) !BIND(C, NAME="cg_famname_read_f")
32722991 IMPORT :: c_char
32732992 IMPLICIT NONE
32742993 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: famname
32752994 INTEGER, INTENT(OUT) :: ier
32762995 END SUBROUTINE cg_famname_read_f
3277 END INTERFACE
3278
3279 INTERFACE
2996
32802997 SUBROUTINE cg_nmultifam_f(nfam, ier) BIND(C, NAME="cg_nmultifam_f")
32812998 IMPLICIT NONE
32822999 INTEGER :: nfam
32833000 INTEGER, INTENT(OUT) :: ier
32843001 END SUBROUTINE cg_nmultifam_f
3285 END INTERFACE
3286
3287 INTERFACE
3002
32883003 SUBROUTINE cg_multifam_read_f(N,name, family, ier) !BIND(C, NAME="cg_multifam_read_f")
32893004 IMPORT :: c_char
32903005 IMPLICIT NONE
32933008 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
32943009 INTEGER, INTENT(OUT) :: ier
32953010 END SUBROUTINE cg_multifam_read_f
3296 END INTERFACE
3297
3298 INTERFACE
3011
32993012 SUBROUTINE cg_convergence_read_f(iterations, NormDefinitions, ier) !BIND(C, NAME="cg_convergence_read_f")
33003013 IMPORT :: c_char
33013014 IMPLICIT NONE
33033016 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: NormDefinitions
33043017 INTEGER, INTENT(OUT) :: ier
33053018 END SUBROUTINE cg_convergence_read_f
3306 END INTERFACE
3307
3308 INTERFACE
3019
33093020 SUBROUTINE cg_state_size_f(size, ier) !BIND(C, NAME="cg_state_size_f")
33103021 IMPLICIT NONE
33113022 INTEGER :: size
33123023 INTEGER, INTENT(OUT) :: ier
33133024 END SUBROUTINE cg_state_size_f
3314 END INTERFACE
3315
3316 INTERFACE
3025
33173026 SUBROUTINE cg_state_read_f(StateDescription, ier) !BIND(C, NAME="cg_state_read_f")
33183027 IMPORT :: c_char
33193028 IMPLICIT NONE
33203029 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: StateDescription
33213030 INTEGER, INTENT(OUT) :: ier
33223031 END SUBROUTINE cg_state_read_f
3323 END INTERFACE
3324
3325 INTERFACE
3032
33263033 SUBROUTINE cg_equationset_read_f(EquationDimension, GoverningEquationsFlag, &
33273034 GasModelFlag, ViscosityModelFlag, ThermalConductivityModelFlag, &
33283035 TurbulenceClosureFlag, TurbulenceModelFlag, ier) BIND(C, NAME="cg_equationset_read_f")
33363043 INTEGER :: TurbulenceModelFlag
33373044 INTEGER, INTENT(OUT) :: ier
33383045 END SUBROUTINE cg_equationset_read_f
3339 END INTERFACE
3340
3341 INTERFACE
3046
33423047 SUBROUTINE cg_equationset_chemistry_read_f(ThermalRelaxationFlag, ChemicalKineticsFlag, ier) &
33433048 BIND(C, NAME="cg_equationset_chemistry_read_f")
33443049 IMPLICIT NONE
33463051 INTEGER :: ChemicalKineticsFlag
33473052 INTEGER, INTENT(OUT) :: ier
33483053 END SUBROUTINE cg_equationset_chemistry_read_f
3349 END INTERFACE
3350
3351 INTERFACE
3054
33523055 SUBROUTINE cg_equationset_elecmagn_read_f(ElecFldModelFlag, MagnFldModelFlag, &
33533056 ConductivityModelFlag, ier) BIND(C, NAME="cg_equationset_elecmagn_read_f")
33543057 IMPLICIT NONE
33573060 INTEGER :: ConductivityModelFlag
33583061 INTEGER, INTENT(OUT) :: ier
33593062 END SUBROUTINE cg_equationset_elecmagn_read_f
3360 END INTERFACE
3361
3362 INTERFACE
3063
33633064 SUBROUTINE cg_governing_read_f(EquationsType, ier) BIND(C, NAME="cg_governing_read_f")
33643065 IMPORT :: cgenum_t
33653066 IMPLICIT NONE
33663067 INTEGER(cgenum_t) :: EquationsType
33673068 INTEGER, INTENT(OUT) :: ier
33683069 END SUBROUTINE cg_governing_read_f
3369 END INTERFACE
3370
3371 INTERFACE
3070
33723071 SUBROUTINE cg_diffusion_read_f(diffusion_model, ier) BIND(C, NAME="cg_diffusion_read_f")
33733072 IMPLICIT NONE
33743073 INTEGER, DIMENSION(*) :: diffusion_model
33753074 INTEGER, INTENT(OUT) :: ier
33763075 END SUBROUTINE cg_diffusion_read_f
3377 END INTERFACE
3378
3379 INTERFACE
3076
33803077 SUBROUTINE cg_model_read_f(ModelLabel, ModelType, ier) !BIND(C, NAME="cg_model_read_f")
33813078 IMPORT :: c_char, cgenum_t
33823079 IMPLICIT NONE
33843081 INTEGER(cgenum_t) :: ModelType
33853082 INTEGER, INTENT(OUT) :: ier
33863083 END SUBROUTINE cg_model_read_f
3387 END INTERFACE
3388
3389 INTERFACE
3084
33903085 SUBROUTINE cg_narrays_f(narrays, ier) BIND(C, NAME="cg_narrays_f")
33913086 IMPLICIT NONE
33923087 INTEGER :: narrays
33933088 INTEGER, INTENT(OUT) :: ier
33943089 END SUBROUTINE cg_narrays_f
3395 END INTERFACE
3396
3397 INTERFACE
3090
33983091 SUBROUTINE cg_array_info_f(A, ArrayName, DataType, DataDimension, DimensionVector, ier) !BIND(C, NAME="cg_array_info_f")
33993092 IMPORT :: c_char, CGSIZE_T, cgenum_t
34003093 IMPLICIT NONE
34053098 INTEGER(CGSIZE_T), DIMENSION(*) :: DimensionVector
34063099 INTEGER, INTENT(OUT) :: ier
34073100 END SUBROUTINE cg_array_info_f
3408 END INTERFACE
3409
3410 !$ INTERFACE
3101
34113102 !!$ SUBROUTINE cg_array_read_f(A, DATA, ier) BIND(C, NAME="")
34123103 !!$ INTEGER :: A,
34133104 !!$ void *DATA,
34143105 !!$ INTEGER, INTENT(OUT) :: ier
34153106 !!$ END SUBROUTINE cg_array_read_f
3416 !!$ END INTERFACE
3417
3418 !!$ INTERFACE
3107
34193108 !!$ SUBROUTINE cg_array_read_as_f(A, TYPE, DATA, ier) BIND(C, NAME="")
34203109 !!$ IMPORT :: cgenum_t
34213110 !!$ IMPLICIT NONE
34243113 !!$ void *DATA
34253114 !!$ INTEGER, INTENT(OUT) :: ier
34263115 !!$ END SUBROUTINE cg_array_read_as_f
3427 !!$ END INTERFACE
3428
3429 INTERFACE
3116
34303117 SUBROUTINE cg_nintegrals_f(nintegrals, ier) BIND(C, NAME="cg_nintegrals_f")
34313118 IMPLICIT NONE
34323119 INTEGER :: nintegrals
34333120 INTEGER, INTENT(OUT) :: ier
34343121 END SUBROUTINE cg_nintegrals_f
3435 END INTERFACE
3436
3437 INTERFACE
3122
34383123 SUBROUTINE cg_integral_read_f(IntegralDataIndex, IntegralDataName,ier) !BIND(C, NAME="cg_integral_read_f")
34393124 IMPORT :: c_char
34403125 IMPLICIT NONE
34423127 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: IntegralDataName
34433128 INTEGER, INTENT(OUT) :: ier
34443129 END SUBROUTINE cg_integral_read_f
3445 END INTERFACE
3446
3447 INTERFACE
3130
34483131 SUBROUTINE cg_rind_read_f(RindData, ier) BIND(C, NAME="cg_rind_read_f")
34493132 IMPLICIT NONE
34503133 INTEGER, DIMENSION(*) :: RindData
34513134 INTEGER, INTENT(OUT) :: ier
34523135 END SUBROUTINE cg_rind_read_f
3453 END INTERFACE
3454
3455 INTERFACE
3136
34563137 SUBROUTINE cg_ndescriptors_f(ndescriptors, ier) BIND(C, NAME="cg_ndescriptors_f")
34573138 IMPLICIT NONE
34583139 INTEGER :: ndescriptors
34593140 INTEGER, INTENT(OUT) :: ier
34603141 END SUBROUTINE cg_ndescriptors_f
3461 END INTERFACE
3462
3463 INTERFACE
3142
34643143 SUBROUTINE cg_descriptor_size_f(descr_no, descr_size, ier) BIND(C, NAME="cg_descriptor_size_f")
34653144 IMPLICIT NONE
34663145 INTEGER :: descr_no
34673146 INTEGER :: descr_size
34683147 INTEGER, INTENT(OUT) :: ier
34693148 END SUBROUTINE cg_descriptor_size_f
3470 END INTERFACE
3471
3472 INTERFACE
3149
34733150 SUBROUTINE cg_descriptor_read_f(descr_no, descr_name, descr_text, ier) !BIND(C, NAME="cg_descriptor_read_f")
34743151 IMPORT :: c_char
34753152 IMPLICIT NONE
34783155 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: descr_text
34793156 INTEGER, INTENT(OUT) :: ier
34803157 END SUBROUTINE cg_descriptor_read_f
3481 END INTERFACE
3482
3483 INTERFACE
3158
34843159 SUBROUTINE cg_nunits_f(nunits, ier) BIND(C, NAME="cg_nunits_f")
34853160 IMPLICIT NONE
34863161 INTEGER :: nunits
34873162 INTEGER, INTENT(OUT) :: ier
34883163 END SUBROUTINE cg_nunits_f
3489 END INTERFACE
3490
3491 INTERFACE
3164
34923165 SUBROUTINE cg_units_read_f(mass, length, time, temperature, angle, ier) BIND(C, NAME="cg_units_read_f")
34933166 IMPORT :: cgenum_t
34943167 IMPLICIT NONE
34993172 INTEGER(cgenum_t) :: angle
35003173 INTEGER, INTENT(OUT) :: ier
35013174 END SUBROUTINE cg_units_read_f
3502 END INTERFACE
3503
3504 INTERFACE
3175
35053176 SUBROUTINE cg_unitsfull_read_f(mass, length, time, temperature, angle, current, &
35063177 amount, intensity, ier) BIND(C, NAME="cg_unitsfull_read_f")
35073178 IMPORT :: cgenum_t
35163187 INTEGER(cgenum_t) :: intensity
35173188 INTEGER, INTENT(OUT) :: ier
35183189 END SUBROUTINE cg_unitsfull_read_f
3519 END INTERFACE
3520
3521 INTERFACE
3190
35223191 SUBROUTINE cg_exponents_info_f(DataType, ier) BIND(C, NAME="cg_exponents_info_f")
35233192 IMPORT :: cgenum_t
35243193 IMPLICIT NONE
35253194 INTEGER(cgenum_t) :: DataType
35263195 INTEGER, INTENT(OUT) :: ier
35273196 END SUBROUTINE cg_exponents_info_f
3528 END INTERFACE
3529
3530 INTERFACE
3197
35313198 SUBROUTINE cg_nexponents_f(nexps, ier) BIND(C, NAME="cg_nexponents_f")
35323199 IMPLICIT NONE
35333200 INTEGER :: nexps
35343201 INTEGER, INTENT(OUT) :: ier
35353202 END SUBROUTINE cg_nexponents_f
3536 END INTERFACE
3537
3538 !!$ INTERFACE
3203
35393204 !!$ SUBROUTINE cg_exponents_read_f(void *exponents, ier) BIND(C, NAME="")
35403205 !!$ void *exponents
35413206 !!$ INTEGER, INTENT(OUT) :: ier
35423207 !!$ END SUBROUTINE cg_exponents_read_f
3543 !!$ END INTERFACE
3544
3545 !!$ INTERFACE
3208
35463209 !!$ SUBROUTINE cg_expfull_read_f(exponents, ier) BIND(C, NAME="")
35473210 !!$ void *exponents,
35483211 !!$ INTEGER, INTENT(OUT) :: ier
35493212 !!$ END SUBROUTINE cg_expfull_read_f
3550 !!$ END INTERFACE
3551
3552 INTERFACE
3213
35533214 SUBROUTINE cg_conversion_info_f(DataType, ier) BIND(C, NAME="cg_conversion_info_f")
35543215 IMPORT :: cgenum_t
35553216 IMPLICIT NONE
35563217 INTEGER(cgenum_t) :: DataType
35573218 INTEGER, INTENT(OUT) :: ier
35583219 END SUBROUTINE cg_conversion_info_f
3559 END INTERFACE
3560
3561 !!$ INTERFACE
3220
35623221 !!$ SUBROUTINE cg_conversion_read_f(ConversionFactors, ier) BIND(C, NAME="")
35633222 !!$ void *ConversionFactors,
35643223 !!$ INTEGER, INTENT(OUT) :: ier
35653224 !!$ END SUBROUTINE cg_conversion_read_f
3566 !!$ END INTERFACE
3567
3568 INTERFACE
3225
35693226 SUBROUTINE cg_dataclass_read_f(dataclass, ier) BIND(C, NAME="cg_dataclass_read_f")
35703227 IMPORT :: cgenum_t
35713228 IMPLICIT NONE
35723229 INTEGER(cgenum_t) :: dataclass
35733230 INTEGER, INTENT(OUT) :: ier
35743231 END SUBROUTINE cg_dataclass_read_f
3575 END INTERFACE
3576
3577 INTERFACE
3232
35783233 SUBROUTINE cg_gridlocation_read_f(GridLocation, ier) BIND(C, NAME="cg_gridlocation_read_f")
35793234 IMPORT :: cgenum_t
35803235 IMPLICIT NONE
35813236 INTEGER(cgenum_t) :: GridLocation
35823237 INTEGER, INTENT(OUT) :: ier
35833238 END SUBROUTINE cg_gridlocation_read_f
3584 END INTERFACE
3585
3586 INTERFACE
3239
35873240 SUBROUTINE cg_ordinal_read_f(Ordinal, ier) BIND(C, NAME="cg_ordinal_read_f")
35883241 IMPORT :: cgenum_t
35893242 IMPLICIT NONE
35903243 INTEGER :: Ordinal
35913244 INTEGER, INTENT(OUT) :: ier
35923245 END SUBROUTINE cg_ordinal_read_f
3593 END INTERFACE
3594
3595 INTERFACE
3246
35963247 SUBROUTINE cg_npe_f(TYPE,npe, ier) BIND(C, NAME="cg_npe_f")
35973248 IMPORT :: cgenum_t
35983249 IMPLICIT NONE
36003251 INTEGER :: npe
36013252 INTEGER, INTENT(OUT) :: ier
36023253 END SUBROUTINE cg_npe_f
3603 END INTERFACE
3604
3605 INTERFACE
3254
36063255 SUBROUTINE cg_is_link_f(path_length, ier) BIND(C, NAME="cg_is_link_f")
36073256 IMPLICIT NONE
36083257 INTEGER :: path_length
36093258 INTEGER, INTENT(OUT) :: ier
36103259 END SUBROUTINE cg_is_link_f
3611 END INTERFACE
3612
3613 INTERFACE
3260
36143261 SUBROUTINE cg_link_read_f(filename, link_path, ier) !BIND(C, NAME="cg_link_read_f")
36153262 IMPORT :: c_char
36163263 IMPLICIT NONE
36183265 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: link_path
36193266 INTEGER, INTENT(OUT) :: ier
36203267 END SUBROUTINE cg_link_read_f
3621 END INTERFACE
3622
3623 INTERFACE
3268
36243269 SUBROUTINE cg_nuser_data_f(nuser_data, ier) BIND(C, NAME="cg_nuser_data_f")
36253270 IMPLICIT NONE
36263271 INTEGER :: nuser_data
36273272 INTEGER, INTENT(OUT) :: ier
36283273 END SUBROUTINE cg_nuser_data_f
3629 END INTERFACE
3630
3631 INTERFACE
3274
36323275 SUBROUTINE cg_user_data_read_f(index,dataname, ier) !BIND(C, NAME="cg_user_data_read_f")
36333276 IMPORT :: c_char
36343277 IMPLICIT NONE
36363279 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: dataname
36373280 INTEGER, INTENT(OUT) :: ier
36383281 END SUBROUTINE cg_user_data_read_f
3639 END INTERFACE
36403282
36413283 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
36423284 ! Write Multiple path nodes *
36433285 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36443286
3645 INTERFACE
36463287 SUBROUTINE cg_famname_write_f(family_name, ier) !BIND(C, NAME="cg_famname_write_f")
36473288 IMPORT :: c_char
36483289 IMPLICIT NONE
36493290 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family_name
36503291 INTEGER, INTENT(OUT) :: ier
36513292 END SUBROUTINE cg_famname_write_f
3652 END INTERFACE
3653
3654 INTERFACE
3293
36553294 SUBROUTINE cg_multifam_write_f(name, family, ier) !BIND(C, NAME="cg_multifam_write_f")
36563295 IMPORT :: c_char
36573296 IMPLICIT NONE
36593298 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: family
36603299 INTEGER, INTENT(OUT) :: ier
36613300 END SUBROUTINE cg_multifam_write_f
3662 END INTERFACE
3663
3664 INTERFACE
3301
36653302 SUBROUTINE cg_convergence_write_f(iterations, NormDefinitions, ier) !BIND(C, NAME="cg_convergence_write_f")
36663303 IMPORT :: c_char
36673304 IMPLICIT NONE
36693306 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: NormDefinitions
36703307 INTEGER, INTENT(OUT) :: ier
36713308 END SUBROUTINE cg_convergence_write_f
3672 END INTERFACE
3673
3674 INTERFACE
3309
36753310 SUBROUTINE cg_state_write_f(StateDescription, ier) !BIND(C, NAME="cg_state_write_f")
36763311 IMPORT :: c_char
36773312 IMPLICIT NONE
36783313 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: StateDescription
36793314 INTEGER, INTENT(OUT) :: ier
36803315 END SUBROUTINE cg_state_write_f
3681 END INTERFACE
3682
3683 INTERFACE
3316
36843317 SUBROUTINE cg_equationset_write_f(EquationDimension, ier) BIND(C, NAME="cg_equationset_write_f")
36853318 IMPLICIT NONE
36863319 INTEGER :: EquationDimension
36873320 INTEGER, INTENT(OUT) :: ier
36883321 END SUBROUTINE cg_equationset_write_f
3689 END INTERFACE
3690
3691 INTERFACE
3322
36923323 SUBROUTINE cg_governing_write_f(Equationstype, ier) BIND(C, NAME="cg_governing_write_f")
36933324 IMPORT :: cgenum_t
36943325 IMPLICIT NONE
36953326 INTEGER(cgenum_t) :: Equationstype
36963327 INTEGER, INTENT(OUT) :: ier
36973328 END SUBROUTINE cg_governing_write_f
3698 END INTERFACE
3699
3700 INTERFACE
3329
37013330 SUBROUTINE cg_diffusion_write_f(diffusion_model, ier) BIND(C, NAME="cg_diffusion_write_f")
37023331 IMPLICIT NONE
37033332 INTEGER, DIMENSION(*) :: diffusion_model
37043333 INTEGER, INTENT(OUT) :: ier
37053334 END SUBROUTINE cg_diffusion_write_f
3706 END INTERFACE
3707
3708 INTERFACE
3335
37093336 SUBROUTINE cg_model_write_f(ModelLabel, ModelType, ier) !BIND(C, NAME="cg_model_write_f")
37103337 IMPORT :: c_char, cgenum_t
37113338 IMPLICIT NONE
37133340 INTEGER(cgenum_t) :: ModelType
37143341 INTEGER, INTENT(OUT) :: ier
37153342 END SUBROUTINE cg_model_write_f
3716 END INTERFACE
3717
3718 !!$ INTERFACE
3343
37193344 !!$ SUBROUTINE cg_array_write_f(ArrayName, DataType, DataDimension, DimensionVector, &
37203345 !!$ void *Data, ier) BIND(C, NAME="")
37213346 !!$ CHARACTER(KIND=C_CHAR), DIMENSION(*) :: ArrayName
37253350 !!$ void *DATA
37263351 !!$ INTEGER, INTENT(OUT) :: ier
37273352 !!$ END SUBROUTINE cg_array_write_f
3728 !!$ END INTERFACE
3729
3730 !!$ INTERFACE
3353
37313354 !!$ SUBROUTINE cg_array_write_f03(ArrayName, DataType, DataDimension, DimensionVector, DATA, ier) &
37323355 !!$ BIND(C, NAME="cg_array_write_f03")
37333356 !!$ IMPORT :: c_char, cgenum_t, cgsize_t, c_ptr
37383361 !!$ TYPE(C_PTR), VALUE :: Data
37393362 !!$ INTEGER, INTENT(OUT) :: ier
37403363 !!$ END SUBROUTINE cg_array_write_f03
3741 !!$ END INTERFACE
3742
3743 INTERFACE
3364
37443365 SUBROUTINE cg_integral_write_f(IntegralDataName, ier) !BIND(C, NAME="cg_integral_write_f")
37453366 IMPORT :: c_char
37463367 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: IntegralDataName
37473368 INTEGER, INTENT(OUT) :: ier
37483369 END SUBROUTINE cg_integral_write_f
3749 END INTERFACE
3750
3751 INTERFACE
3370
37523371 SUBROUTINE cg_rind_write_f(RindData, ier) BIND(C, NAME="cg_rind_write_f")
37533372 IMPLICIT NONE
37543373 INTEGER, DIMENSION(*) :: RindData
37553374 INTEGER, INTENT(OUT) :: ier
37563375 END SUBROUTINE cg_rind_write_f
3757 END INTERFACE
3758
3759 INTERFACE
3376
37603377 SUBROUTINE cg_descriptor_write_f(descr_name, descr_text, ier) !BIND(C, NAME="cg_descriptor_write_f")
37613378 IMPORT :: c_char
37623379 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: descr_name
37633380 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: descr_text
37643381 INTEGER, INTENT(OUT) :: ier
37653382 END SUBROUTINE cg_descriptor_write_f
3766 END INTERFACE
3767
3768 INTERFACE
3383
37693384 SUBROUTINE cg_units_write_f(mass, length, time, temperature, angle, ier) BIND(C, NAME="cg_units_write_f")
37703385 IMPORT :: cgenum_t
37713386 IMPLICIT NONE
37763391 INTEGER(cgenum_t) :: angle
37773392 INTEGER, INTENT(OUT) :: ier
37783393 END SUBROUTINE cg_units_write_f
3779 END INTERFACE
3780
3781 INTERFACE
3394
37823395 SUBROUTINE cg_unitsfull_write_f(mass, length, time, temperature, angle, current, &
37833396 amount, intensity, ier) BIND(C, NAME="cg_unitsfull_write_f")
37843397 IMPORT :: cgenum_t
37933406 INTEGER(cgenum_t) :: intensity
37943407 INTEGER, INTENT(OUT) :: ier
37953408 END SUBROUTINE cg_unitsfull_write_f
3796 END INTERFACE
3797
3798 !!$ INTERFACE
3409
37993410 !!$ SUBROUTINE cg_exponents_write_f(DataType, void *exponents, ier) BIND(C, NAME="")
38003411 !!$
38013412 !!$ INTEGER(cgenum_t) :: DataType_t)*DataType, void *exponents,
38023413 !!$ INTEGER, INTENT(OUT) :: ier
38033414 !!$ END SUBROUTINE cg_exponents_write_f
3804 !!$ END INTERFACE
3805
3806 !!$ INTERFACE
3415
38073416 !!$ SUBROUTINE cg_expfull_write_f(DataType, void *exponents, ier) BIND(C, NAME="")
38083417 !!$ INTEGER(cgenum_t) :: DataType
38093418 !!$ void *exponents,
38103419 !!$ INTEGER, INTENT(OUT) :: ier
38113420 !!$ END SUBROUTINE cg_expfull_write_f
3812 !!$ END INTERFACE
3813
3814 !!$ INTERFACE
3421
38153422 !!$ SUBROUTINE cg_conversion_write_f( DataType, ConversionFactors, ier) BIND(C, NAME="")
38163423 !!$ INTEGER(cgenum_t) :: DataType
38173424 !!$ void *ConversionFactors
38183425 !!$ INTEGER, INTENT(OUT) :: ier
38193426 !!$ END SUBROUTINE cg_conversion_write_f
3820 !!$ END INTERFACE
3821
3822 INTERFACE
3427
38233428 SUBROUTINE cg_dataclass_write_f(dataclass, ier) BIND(C, NAME="cg_dataclass_write_f")
38243429 IMPORT :: cgenum_t
38253430 IMPLICIT NONE
38263431 INTEGER(cgenum_t) :: dataclass
38273432 INTEGER, INTENT(OUT) :: ier
38283433 END SUBROUTINE cg_dataclass_write_f
3829 END INTERFACE
3830
3831 INTERFACE
3434
38323435 SUBROUTINE cg_gridlocation_write_f(GridLocation, ier) BIND(C, NAME="cg_gridlocation_write_f")
38333436 IMPORT :: cgenum_t
38343437 IMPLICIT NONE
38353438 INTEGER(cgenum_t) :: GridLocation
38363439 INTEGER, INTENT(OUT) :: ier
38373440 END SUBROUTINE cg_gridlocation_write_f
3838 END INTERFACE
3839
3840 INTERFACE
3441
38413442 SUBROUTINE cg_ordinal_write_f(Ordinal, ier) BIND(C, NAME="cg_ordinal_write_f")
38423443 IMPLICIT NONE
38433444 INTEGER :: Ordinal
38443445 INTEGER, INTENT(OUT) :: ier
38453446 END SUBROUTINE cg_ordinal_write_f
3846 END INTERFACE
3847
3848 INTERFACE
3447
38493448 SUBROUTINE cg_link_write_f(nodename, filename, name_in_file, ier) !BIND(C, NAME="cg_link_write_f")
38503449 IMPORT :: c_char
38513450 IMPLICIT NONE
38543453 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name_in_file
38553454 INTEGER, INTENT(OUT) :: ier
38563455 END SUBROUTINE cg_link_write_f
3857 END INTERFACE
3858
3859 INTERFACE
3456
38603457 SUBROUTINE cg_user_data_write_f(dataname, ier) ! BIND(C, NAME="cg_user_data_write_f")
38613458 IMPORT :: c_char
38623459 IMPLICIT NONE
38633460 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: dataname
38643461 INTEGER, INTENT(OUT) :: ier
38653462 END SUBROUTINE cg_user_data_write_f
3866 END INTERFACE
38673463
38683464 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
3869 ! General Delete Function *
3465 ! General Delete Function *
38703466 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38713467
3872 INTERFACE
38733468 SUBROUTINE cg_delete_node_f(node_name, ier) !BIND(C, NAME="cg_delete_node_f")
38743469 IMPORT :: c_char
38753470 IMPLICIT NONE
38763471 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: node_name
38773472 INTEGER, INTENT(OUT) :: ier
38783473 END SUBROUTINE cg_delete_node_f
3879 END INTERFACE
38803474
38813475 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
38823476 ! Error Handling Functions *
38833477 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
38843478
3885 INTERFACE
38863479 SUBROUTINE cg_get_error_f(errmsg) !BIND(C, NAME="cg_get_error_f")
38873480 IMPORT :: c_char
38883481 IMPLICIT NONE
38893482 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: errmsg
38903483 END SUBROUTINE cg_get_error_f
3891 END INTERFACE
3892
3893 INTERFACE
3484
38943485 SUBROUTINE cg_error_exit_f() BIND(C, NAME="cg_error_exit_f")
38953486 IMPLICIT NONE
38963487 END SUBROUTINE cg_error_exit_f
3897 END INTERFACE
3898
3899 INTERFACE
3488
39003489 SUBROUTINE cg_error_print_f() BIND(C, NAME="cg_error_print_f")
39013490 IMPLICIT NONE
39023491 END SUBROUTINE cg_error_print_f
3903 END INTERFACE
3904
3905 INTERFACE
3492
39063493 SUBROUTINE cg_exit_on_error_f(flag) BIND(C, NAME="cg_exit_on_error_f")
39073494 IMPLICIT NONE
39083495 INTEGER :: flag
39093496 END SUBROUTINE cg_exit_on_error_f
3910 END INTERFACE
39113497
39123498 #if CG_BUILD_PARALLEL_F
39133499
39153501 ! parallel IO interface
39163502 !======================================================================
39173503
3918 INTERFACE
39193504 SUBROUTINE cgp_mpi_comm_f( mpi_comm_f, ier) BIND(C, NAME="cgp_mpi_comm_f")
39203505 IMPLICIT NONE
39213506 INTEGER :: mpi_comm_f
39223507 INTEGER, INTENT(OUT) :: ier
39233508 END SUBROUTINE cgp_mpi_comm_f
3924 END INTERFACE
3925
3926 INTERFACE
3509
39273510 SUBROUTINE cgp_pio_mode_f( mode, ier) BIND(C, NAME="cgp_pio_mode_f")
39283511 IMPORT :: C_INT
39293512 IMPLICIT NONE
39303513 INTEGER(C_INT) :: mode
39313514 INTEGER, INTENT(OUT) :: ier
39323515 END SUBROUTINE cgp_pio_mode_f
3933 END INTERFACE
3934
3935 INTERFACE
3516
39363517 SUBROUTINE cgp_open_f(filename, mode, fn, ier) !BIND(C, NAME="cgp_open_f")
39373518 IMPORT :: C_CHAR, C_INT
39383519 IMPLICIT NONE
39413522 INTEGER :: fn
39423523 INTEGER, INTENT(OUT) :: ier
39433524 END SUBROUTINE cgp_open_f
3944 END INTERFACE
3945
3946 INTERFACE
3525
39473526 SUBROUTINE cgp_close_f(fn, ier) BIND(C, NAME="cgp_close_f")
39483527 IMPLICIT NONE
39493528 INTEGER, INTENT(IN) :: fn
39503529 INTEGER, INTENT(OUT) :: ier
39513530 END SUBROUTINE cgp_close_f
3952 END INTERFACE
3953
3954 INTERFACE
3531
39553532 SUBROUTINE cgp_coord_write_f(fn, B, Z, type, coordname, C, ier) !BIND(C, NAME="cgp_coord_write_f")
39563533 IMPORT :: cgenum_t, c_char
39573534 IMPLICIT NONE
39633540 INTEGER, INTENT(IN) :: C
39643541 INTEGER, INTENT(OUT) :: ier
39653542 END SUBROUTINE cgp_coord_write_f
3966 END INTERFACE
3967
3968 !!$ INTERFACE
3543
39693544 !!$ SUBROUTINE cgp_coord_write_data_f(fn, B, Z, C,
39703545 !!$ CGSIZE_T *rmin, CGSIZE_T *rmax, void *data, ier) BIND(C, NAME="")
39713546 !!$
39763551 !!$ INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax, void *DATA,
39773552 !!$ INTEGER, INTENT(OUT) :: ier
39783553 !!$END SUBROUTINE cgp_coord_write_data_f
3979 !!$END INTERFACE
3980
3981 !!$ INTERFACE
3982 !!$ SUBROUTINE cgp_coord_read_data_f(
3554
3555 !!$ !!$ SUBROUTINE cgp_coord_read_data_f(
39833556 !!$ fn, B, Z, C,
39843557 !!$ CGSIZE_T *rmin, CGSIZE_T *rmax, void *data, ier) BIND(C, NAME="")
39853558 !!$
39903563 !!$ INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax, void *data,
39913564 !!$ INTEGER, INTENT(OUT) :: ier
39923565 !!$ END SUBROUTINE
3993 !!$ END INTERFACE
3994
3995 INTERFACE
3566 !!$
39963567 SUBROUTINE cgp_section_write_f( fn, B, Z, section_name, &
39973568 TYPE,start,END, nbndry, S, ier) !BIND(C, NAME="cgp_section_write_f")
39983569 IMPORT :: cgenum_t, cgsize_t, c_char
40083579 INTEGER, INTENT(IN) :: S
40093580 INTEGER, INTENT(OUT) :: ier
40103581 END SUBROUTINE cgp_section_write_f
4011 END INTERFACE
4012
4013 !!$ INTERFACE
4014 !!$ SUBROUTINE cgp_elements_write_data_f( fn, B, Z, S, CGSIZE_T *start, &
3582
3583 !!$!!$ SUBROUTINE cgp_elements_write_data_f( fn, B, Z, S, CGSIZE_T *start, &
40153584 !!$ CGSIZE_T *END, CGSIZE_T *elements, ier) BIND(C, NAME="cgp_elements_write_data_f")
40163585 !!$ IMPORT :: cgsize_t
40173586 !!$ IMPLICIT NONE
40253594 !!$ INTEGER(CGSIZE_T) , INTENT(IN) :: elements
40263595 !!$ INTEGER, INTENT(OUT) :: ier
40273596 !!$ END SUBROUTINE cgp_elements_write_data_f
4028 !!$ END INTERFACE
4029
4030 !!$ INTERFACE
4031 !!$ SUBROUTINE cgp_elements_read_data_f(fn, B, Z, S, start, &
3597 !!$
3598 !!$!!$ SUBROUTINE cgp_elements_read_data_f(fn, B, Z, S, start, &
40323599 !!$ end, elements, ier) BIND(C, NAME="cgp_elements_read_data_f")
40333600 !!$ IMPORT :: cgsize_t
40343601 !!$ IMPLICIT NONE
40413608 !!$ INTEGER(CGSIZE_T) :: elements
40423609 !!$ INTEGER, INTENT(OUT) :: ier
40433610 !!$ END SUBROUTINE cgp_elements_read_data_f
4044 !!$ END INTERFACE
4045
4046 INTERFACE
3611 !!$
40473612 SUBROUTINE cgp_field_write_f(fn, B, Z, S, TYPE, fieldname, F, ier)! BIND(C, NAME="cgp_field_write_f")
40483613 IMPORT :: cgenum_t, c_char
40493614 IMPLICIT NONE
40563621 INTEGER :: F
40573622 INTEGER, INTENT(OUT) :: ier
40583623 END SUBROUTINE cgp_field_write_f
4059 END INTERFACE
40603624
40613625 !!$ INTERFACE
40623626 !!$ SUBROUTINE cgp_field_read_data_f( fn, B, Z, S, F, rmin, rmax, void *field_ptr,
40693633 !!$ INTEGER :: F, INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax, void *field_ptr
40703634 !!$ INTEGER, INTENT(OUT) :: ier
40713635 !!$ END SUBROUTINE
4072 !!$ END INTERFACE
4073
4074 !!$ INTERFACE
4075 !!$ SUBROUTINE cgp_array_write_f(ArrayName, DataType, DataDimension, DimensionVector, A, ier) !BIND(C, NAME="cgp_array_write_f")
3636 !!$
3637 !!$!!$ SUBROUTINE cgp_array_write_f(ArrayName, DataType, DataDimension, DimensionVector, A, ier) !BIND(C, NAME="cgp_array_write_f")
40763638 !!$ IMPORT :: cgenum_t, cgsize_t, c_char
40773639 !!$ IMPLICIT NONE
40783640 !!$ CHARACTER(KIND=C_CHAR), DIMENSION(*) :: ArrayName
40823644 !!$ INTEGER :: A
40833645 !!$ INTEGER, INTENT(OUT) :: ier
40843646 !!$ END SUBROUTINE cgp_array_write_f
4085 !!$ END INTERFACE
4086
4087 !!$ INTERFACE
4088 !!$ SUBROUTINE cgp_array_write_data_f(
3647 !!$
3648 !!$ !!$ SUBROUTINE cgp_array_write_data_f(
40893649 !!$ A, CGSIZE_T *rmin, CGSIZE_T *rmax, void *data,
40903650 !!$ ier) BIND(C, NAME="")
40913651 !!$ INTEGER :: A, INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax, void *data,
40923652 !!$ INTEGER, INTENT(OUT) :: ier
40933653 !!$ END SUBROUTINE
4094 !!$ END INTERFACE
4095
4096 !!$ INTERFACE
4097 !!$ SUBROUTINE cgp_array_read_data_f(
3654 !!$
3655 !!$ !!$ SUBROUTINE cgp_array_read_data_f(
40983656 !!$ A, CGSIZE_T *rmin, CGSIZE_T *rmax, void *data,
40993657 !!$ ier) BIND(C, NAME="")
41003658 !!$ INTEGER :: A, INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax, void *data,
41013659 !!$
41023660 !!$ INTEGER, INTENT(OUT) :: ier
41033661 !!$ END SUBROUTINE
4104 !!$ END INTERFACE
4105
4106 INTERFACE
3662 !!$
41073663 SUBROUTINE cgp_error_exit_f() BIND(C, NAME="cgp_error_exit_f")
41083664 IMPLICIT NONE
41093665 END SUBROUTINE cgp_error_exit_f
4110 END INTERFACE
4111
4112 INTERFACE
4113 SUBROUTINE cgp_mpi_info_f(pcg_mpi_info_f, ier) BIND(C,NAME='cgp_mpi_info_f')
3666
3667 SUBROUTINE cgp_mpi_info_f(pcg_mpi_info_f, ier) BIND(C,NAME="cgp_mpi_info_f")
41143668 IMPORT :: C_INT
41153669 IMPLICIT NONE
4116 INTEGER(C_INT), INTENT(IN) :: pcg_mpi_info_f
3670 INTEGER(C_INT), INTENT(IN) :: pcg_mpi_info_f
41173671 INTEGER, INTENT(OUT) :: ier
41183672 END SUBROUTINE cgp_mpi_info_f
4119 END INTERFACE
3673
41203674 !!$
4121 !!$ INTERFACE
4122 !!$ SUBROUTINE cgp_coord_multi_read_data_f, CGP_COORD_MULTI_READ_DATA_F)(fn, B, Z, C,
3675 !!$ !!$ SUBROUTINE cgp_coord_multi_read_data_f, CGP_COORD_MULTI_READ_DATA_F)(fn, B, Z, C,
41233676 !!$ CGSIZE_T *rmin, CGSIZE_T *rmax,
41243677 !!$ void *coordsX, void *coordsY, void *coordsZ, ier) BIND(C, NAME="")
41253678 !!$INTEGER :: fn
41303683 !!$ void *coordsX, void *coordsY, void *coordsZ,
41313684 !!$ INTEGER, INTENT(OUT) :: ier
41323685 !!$ END SUBROUTINE
4133 !!$ END INTERFACE
4134 !!$
3686 !!$ !!$
41353687 !!$
41363688 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
41373689 !!$! cgp_coord_multi_write_data Function *
41383690 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41393691 !!$
41403692 !!$
4141 !!$ INTERFACE
4142 !!$ SUBROUTINE cgp_coord_multi_write_data_f, CGP_COORD_MULTI_WRITE_DATA_F)(fn, B, Z, C,
3693 !!$ !!$ SUBROUTINE cgp_coord_multi_write_data_f, CGP_COORD_MULTI_WRITE_DATA_F)(fn, B, Z, C,
41433694 !!$ CGSIZE_T *rmin, CGSIZE_T *rmax,
41443695 !!$ void *coordsX, void *coordsY, void *coordsZ, ier) BIND(C, NAME="")
41453696 !!$INTEGER :: fn
41513702 !!$
41523703 !!$ INTEGER, INTENT(OUT) :: ier
41533704 !!$ END SUBROUTINE
4154 !!$ END INTERFACE
4155 !!$
3705 !!$ !!$
41563706 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
41573707 !!$! cgp_field_multi_write_data Function *
41583708 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41593709 !!$
4160 !!$ INTERFACE
4161 !!$ SUBROUTINE cgp_field_multi_write_data_f(
3710 !!$ !!$ SUBROUTINE cgp_field_multi_write_data_f(
41623711 !!$ fn, B, Z, S,
41633712 !!$ F, CGSIZE_T *rmin, CGSIZE_T *rmax, ier, CGSIZE_T *nsets, ...)
41643713 !!$ fn, B, Z, S,
41663715 !!$
41673716 !!$ INTEGER, INTENT(OUT) :: ier
41683717 !!$ END SUBROUTINE
4169 !!$ END INTERFACE
4170 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
3718 !!$ !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
41713719 !!$! cgp_field_multi_read_data Function *
41723720 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41733721 !!$
4174 !!$ INTERFACE
4175 !!$ SUBROUTINE cgp_field_multi_read_data_f(
3722 !!$ !!$ SUBROUTINE cgp_field_multi_read_data_f(
41763723 !!$ INTEGER :: fn
41773724 !!$ INTEGER :: B
41783725 !!$ INTEGER :: Z
41873734 !!$ INTEGER :: nsets, ...
41883735 !!$ INTEGER, INTENT(OUT) :: ier
41893736 !!$ END SUBROUTINE
4190 !!$ END INTERFACE
4191 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
3737 !!$ !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
41923738 !!$! cgp_array_multi_write_data Function *
41933739 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
41943740 !!$
4195 !!$ INTERFACE
4196 !!$ SUBROUTINE cgp_array_multi_write_data_f(
3741 !!$ !!$ SUBROUTINE cgp_array_multi_write_data_f(
41973742 !!$ fn, A, CGSIZE_T *rmin, CGSIZE_T *rmax,
41983743 !!$ ier, nsets, ...)
41993744 !!$ INTEGER :: fn
42023747 !!$ INTEGER :: nsets, ...
42033748 !!$ INTEGER, INTENT(OUT) :: ier
42043749 !!$ END SUBROUTINE
4205 !!$ END INTERFACE
4206 !!$
3750 !!$ !!$
42073751 !!$
42083752 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *\
42093753 !!$! cgp_array_multi_read_data Function *
42103754 !!$! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
42113755 !!$
4212 !!$ INTERFACE
4213 !!$ SUBROUTINE cgp_array_multi_read_data_f(
3756 !!$ !!$ SUBROUTINE cgp_array_multi_read_data_f(
42143757 !!$ fn, A, CGSIZE_T *rmin, CGSIZE_T *rmax,
42153758 !!$ ier, nsets, ...)
42163759 !!$
42183761 !!$ INTEGER :: A, INTEGER(CGSIZE_T) :: rmin, INTEGER(CGSIZE_T) :: rmax,
42193762 !!$ INTEGER, INTENT(OUT) :: ier
42203763 !!$ END SUBROUTINE
4221 !!$ END INTERFACE
4222 !!$
3764 !!$ !!$
42233765 !!$#endif HDF5_HAVE_MULTI_DATASETS
42243766 #endif
42253767
42263768 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
42273769 !* INTERFACES FOR THE C FUNCTIONS *
42283770 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
4229 !!$ INTERFACE
4230 !!$ INTEGER(C_INT) FUNCTION cgp_open(filename, mode, fn) BIND(C, name='cgp_open')
3771 !!$!!$ INTEGER(C_INT) FUNCTION cgp_open(filename, mode, fn) BIND(C, name="cgp_open")
42313772 !!$ IMPORT :: c_int, c_char
42323773 !!$ IMPLICIT NONE
42333774 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: filename
42343775 !!$ INTEGER(C_INT), INTENT(IN), VALUE :: mode
42353776 !!$ INTEGER(C_INT), INTENT(OUT) :: fn
42363777 !!$ END FUNCTION cgp_open
4237 !!$ END INTERFACE
4238 !!$
4239 !!$ INTERFACE
4240 !!$ INTEGER(C_INT) FUNCTION cgp_pio_mode(mode) BIND(C, name='cgp_pio_mode')
3778 !!$!!$
3779 !!$!!$ INTEGER(C_INT) FUNCTION cgp_pio_mode(mode) BIND(C, name="cgp_pio_mode")
42413780 !!$ USE ISO_C_BINDING
42423781 !!$ INTEGER(KIND(CGP_COLLECTIVE)), INTENT(IN), VALUE :: mode
42433782 !!$ END FUNCTION cgp_pio_mode
4244 !!$ END INTERFACE
4245 !!$
4246 !!$ INTERFACE
4247 !!$ INTEGER(C_INT) FUNCTION cg_base_write(fn, basename, cell_dim, phys_dim, B) BIND(C, name='cg_base_write')
3783 !!$!!$
3784 !!$!!$ INTEGER(C_INT) FUNCTION cg_base_write(fn, basename, cell_dim, phys_dim, B) BIND(C, name="cg_base_write")
42483785 !!$ USE ISO_C_BINDING
42493786 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
42503787 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: basename
42523789 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: phys_dim
42533790 !!$ INTEGER(C_INT) , INTENT(OUT) :: B
42543791 !!$ END FUNCTION cg_base_write
4255 !!$ END INTERFACE
4256 !!$
4257 !!$ INTERFACE
4258 !!$ INTEGER(C_INT) FUNCTION cg_zone_write(fn, B, zonename, nijk, itype, Z) BIND(C, name='cg_zone_write')
3792 !!$!!$
3793 !!$!!$ INTEGER(C_INT) FUNCTION cg_zone_write(fn, B, zonename, nijk, itype, Z) BIND(C, name="cg_zone_write")
42593794 !!$ USE ISO_C_BINDING
42603795 !!$ IMPORT :: CGSIZE_T
42613796 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
42653800 !!$ INTEGER(KIND(CGP_COLLECTIVE)), INTENT(IN), VALUE :: itype
42663801 !!$ INTEGER(C_INT) , INTENT(OUT) :: Z
42673802 !!$ END FUNCTION cg_zone_write
4268 !!$ END INTERFACE
4269 !!$
4270 !!$ INTERFACE
4271 !!$ INTEGER(C_INT) FUNCTION cg_base_read(fn, B, basename, cell_dim, phys_dim) BIND(C, name='cg_base_read')
3803 !!$!!$
3804 !!$!!$ INTEGER(C_INT) FUNCTION cg_base_read(fn, B, basename, cell_dim, phys_dim) BIND(C, name="cg_base_read")
42723805 !!$ USE ISO_C_BINDING
42733806 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
42743807 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: B
42763809 !!$ INTEGER(C_INT) , INTENT(OUT) :: cell_dim
42773810 !!$ INTEGER(C_INT) , INTENT(OUT) :: phys_dim
42783811 !!$ END FUNCTION cg_base_read
4279 !!$ END INTERFACE
4280 !!$
4281 !!$ INTERFACE
4282 !!$ INTEGER(C_INT) FUNCTION cg_zone_read(fn, B, Z, zonename, nijk) !BIND(C, name='cg_zone_read')
3812 !!$!!$
3813 !!$!!$ INTEGER(C_INT) FUNCTION cg_zone_read(fn, B, Z, zonename, nijk) !BIND(C, name="cg_zone_read")
42833814 !!$ USE ISO_C_BINDING
42843815 !!$ IMPORT :: CGSIZE_T
42853816 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
42883819 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(OUT) :: zonename
42893820 !!$ INTEGER(CGSIZE_T), DIMENSION(*), INTENT(OUT) :: nijk
42903821 !!$ END FUNCTION cg_zone_read
4291 !!$ END INTERFACE
4292 !!$
4293 !!$ INTERFACE
4294 !!$ INTEGER(C_INT) FUNCTION cgp_coord_write(fn, B, Z, itype, coordname, C) BIND(C, name='cgp_coord_write')
3822 !!$!!$
3823 !!$!!$ INTEGER(C_INT) FUNCTION cgp_coord_write(fn, B, Z, itype, coordname, C) BIND(C, name="cgp_coord_write")
42953824 !!$ USE ISO_C_BINDING
42963825 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
42973826 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: B
43003829 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: coordname
43013830 !!$ INTEGER(C_INT) , INTENT(OUT) :: C
43023831 !!$ END FUNCTION cgp_coord_write
4303 !!$ END INTERFACE
4304 !!$
4305 !!$ INTERFACE
4306 !!$ INTEGER(C_INT) FUNCTION cgp_coord_write_data(fn, B, Z, C, rmin, rmax, coords) BIND(C, name='cgp_coord_write_data')
3832 !!$!!$
3833 !!$!!$ INTEGER(C_INT) FUNCTION cgp_coord_write_data(fn, B, Z, C, rmin, rmax, coords) BIND(C, name="cgp_coord_write_data")
43073834 !!$ USE ISO_C_BINDING
43083835 !!$ IMPORT :: CGSIZE_T
43093836 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43143841 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
43153842 !!$ TYPE(C_PTR), VALUE :: coords
43163843 !!$ END FUNCTION cgp_coord_write_data
4317 !!$ END INTERFACE
4318 !!$
4319 !!$ INTERFACE
4320 !!$ INTEGER(C_INT) FUNCTION cgp_field_write(fn, B, Z, S, itype, fieldname, F) BIND(C, name='cgp_field_write')
3844 !!$!!$
3845 !!$!!$ INTEGER(C_INT) FUNCTION cgp_field_write(fn, B, Z, S, itype, fieldname, F) BIND(C, name="cgp_field_write")
43213846 !!$ USE ISO_C_BINDING
43223847 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43233848 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: B
43273852 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: fieldname
43283853 !!$ INTEGER(C_INT) , INTENT(OUT) :: F
43293854 !!$ END FUNCTION cgp_field_write
4330 !!$ END INTERFACE
4331 !!$
4332 !!$ INTERFACE
4333 !!$ INTEGER(C_INT) FUNCTION cgp_field_write_data(fn, B, Z, S, F, rmin, rmax, data) BIND(C, name='cgp_field_write_data')
3855 !!$!!$
3856 !!$!!$ INTEGER(C_INT) FUNCTION cgp_field_write_data(fn, B, Z, S, F, rmin, rmax, data) BIND(C, name="cgp_field_write_data")
43343857 !!$ USE ISO_C_BINDING
43353858 !!$ IMPORT :: CGSIZE_T
43363859 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43423865 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
43433866 !!$ TYPE(C_PTR), VALUE :: data
43443867 !!$ END FUNCTION cgp_field_write_data
4345 !!$ END INTERFACE
4346 !!$
4347 !!$ INTERFACE
4348 !!$ INTEGER(C_INT) FUNCTION cgp_field_read_data(fn, B, Z, S, F, rmin, rmax, data) BIND(C, name='cgp_field_read_data')
3868 !!$!!$
3869 !!$!!$ INTEGER(C_INT) FUNCTION cgp_field_read_data(fn, B, Z, S, F, rmin, rmax, data) BIND(C, name="cgp_field_read_data")
43493870 !!$ USE ISO_C_BINDING
43503871 !!$ IMPORT :: CGSIZE_T
43513872 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43573878 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
43583879 !!$ TYPE(C_PTR), VALUE :: data
43593880 !!$ END FUNCTION cgp_field_read_data
4360 !!$ END INTERFACE
4361 !!$
4362 !!$ INTERFACE
4363 !!$ INTEGER(C_INT) FUNCTION cgp_coord_read_data(fn, B, Z, C, rmin, rmax, coords) BIND(C, name='cgp_coord_read_data')
3881 !!$!!$
3882 !!$!!$ INTEGER(C_INT) FUNCTION cgp_coord_read_data(fn, B, Z, C, rmin, rmax, coords) BIND(C, name="cgp_coord_read_data")
43643883 !!$ USE ISO_C_BINDING
43653884 !!$ IMPORT :: CGSIZE_T
43663885 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43713890 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
43723891 !!$ TYPE(C_PTR), VALUE :: coords
43733892 !!$ END FUNCTION cgp_coord_read_data
4374 !!$ END INTERFACE
4375 !!$
4376 !!$ INTERFACE
4377 !!$ INTEGER(C_INT) FUNCTION cgp_section_write(fn,B,Z,sectionname,itype,start,end,nbndry,S) BIND(C, name='cgp_section_write')
3893 !!$!!$
3894 !!$!!$ INTEGER(C_INT) FUNCTION cgp_section_write(fn,B,Z,sectionname,itype,start,end,nbndry,S) BIND(C, name="cgp_section_write")
43783895 !!$ USE ISO_C_BINDING
43793896 !!$ IMPORT :: CGSIZE_T
43803897 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
43873904 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: nbndry
43883905 !!$ INTEGER(C_INT) , INTENT(OUT) :: S
43893906 !!$ END FUNCTION cgp_section_write
4390 !!$ END INTERFACE
4391 !!$
4392 !!$ INTERFACE
4393 !!$ INTEGER(C_INT) FUNCTION cgp_array_write(arrayname,itype,DataDimension,DimensionVector,A) BIND(C, name='cgp_array_write')
3907 !!$!!$
3908 !!$!!$ INTEGER(C_INT) FUNCTION cgp_array_write(arrayname,itype,DataDimension,DimensionVector,A) BIND(C, name="cgp_array_write")
43943909 !!$ USE ISO_C_BINDING
43953910 !!$ IMPORT :: CGSIZE_T
43963911 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: arrayname
43993914 !!$ INTEGER(CGSIZE_T), DIMENSION(1:DataDimension), INTENT(IN) :: DimensionVector
44003915 !!$ INTEGER(C_INT) , INTENT(OUT) :: A
44013916 !!$ END FUNCTION cgp_array_write
4402 !!$ END INTERFACE
4403 !!$
4404 !!$ INTERFACE
4405 !!$ INTEGER(C_INT) FUNCTION cgp_array_write_data(A, rmin, rmax, data) BIND(C, name='cgp_array_write_data')
3917 !!$!!$
3918 !!$!!$ INTEGER(C_INT) FUNCTION cgp_array_write_data(A, rmin, rmax, data) BIND(C, name="cgp_array_write_data")
44063919 !!$ USE ISO_C_BINDING
44073920 !!$ IMPORT :: CGSIZE_T
44083921 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: A
44103923 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
44113924 !!$ TYPE(C_PTR), VALUE :: data
44123925 !!$ END FUNCTION cgp_array_write_data
4413 !!$ END INTERFACE
4414 !!$
4415 !!$ INTERFACE
4416 !!$ INTEGER(C_INT) FUNCTION cgp_elements_write_data(fn,B,Z,S,emin,emax,elements) BIND(C, name='cgp_elements_write_data')
3926 !!$!!$
3927 !!$!!$ INTEGER(C_INT) FUNCTION cgp_elements_write_data(fn,B,Z,S,emin,emax,elements) BIND(C, name="cgp_elements_write_data")
44173928 !!$ USE ISO_C_BINDING
44183929 !!$ IMPORT :: CGSIZE_T
44193930 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
44243935 !!$ INTEGER(CGSIZE_T), INTENT(IN), VALUE :: emax
44253936 !!$ TYPE(C_PTR), VALUE :: elements
44263937 !!$ END FUNCTION cgp_elements_write_data
4427 !!$ END INTERFACE
4428 !!$
4429 !!$ INTERFACE
4430 !!$ INTEGER(C_INT) FUNCTION cgp_elements_read_data(fn,B,Z,S,start,end,elements) BIND(C, name='cgp_elements_read_data')
3938 !!$!!$
3939 !!$!!$ INTEGER(C_INT) FUNCTION cgp_elements_read_data(fn,B,Z,S,start,end,elements) BIND(C, name="cgp_elements_read_data")
44313940 !!$ USE ISO_C_BINDING
44323941 !!$ IMPORT :: CGSIZE_T
44333942 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
44383947 !!$ INTEGER(CGSIZE_T), INTENT(IN), VALUE :: end
44393948 !!$ TYPE(C_PTR), VALUE :: elements
44403949 !!$ END FUNCTION cgp_elements_read_data
4441 !!$ END INTERFACE
4442 !!$
4443 !!$ INTERFACE
4444 !!$ INTEGER(C_INT) FUNCTION cgp_array_read_data(A, rmin, rmax, data) BIND(C, name='cgp_array_read_data')
3950 !!$!!$
3951 !!$!!$ INTEGER(C_INT) FUNCTION cgp_array_read_data(A, rmin, rmax, data) BIND(C, name="cgp_array_read_data")
44453952 !!$ USE ISO_C_BINDING
44463953 !!$ IMPORT :: CGSIZE_T
44473954 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: A
44493956 !!$ INTEGER(CGSIZE_T), INTENT(IN) :: rmax
44503957 !!$ TYPE(C_PTR), VALUE :: data
44513958 !!$ END FUNCTION cgp_array_read_data
4452 !!$ END INTERFACE
4453 !!$
4454 !!$ INTERFACE
4455 !!$ INTEGER(C_INT) FUNCTION cg_sol_write(fn,B,Z,solname,location,S) BIND(C, name='cg_sol_write')
3959 !!$!!$
3960 !!$!!$ INTEGER(C_INT) FUNCTION cg_sol_write(fn,B,Z,solname,location,S) BIND(C, name="cg_sol_write")
44563961 !!$ USE ISO_C_BINDING
44573962 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: fn
44583963 !!$ INTEGER(C_INT) , INTENT(IN), VALUE :: B
44613966 !!$ INTEGER(KIND(CGP_INDEPENDENT)), INTENT(IN), VALUE :: location
44623967 !!$ INTEGER(C_INT) , INTENT(OUT) :: S
44633968 !!$ END FUNCTION cg_sol_write
4464 !!$ END INTERFACE
4465 !!$
4466 !!$ INTERFACE
4467 !!$ INTEGER(C_INT) FUNCTION cgp_error_exit() BIND(C, name='cgp_error_exit')
3969 !!$!!$
3970 !!$!!$ INTEGER(C_INT) FUNCTION cgp_error_exit() BIND(C, name="cgp_error_exit")
44683971 !!$ USE ISO_C_BINDING
44693972 !!$ END FUNCTION cgp_error_exit
4470 !!$ END INTERFACE
4471 !!$
4472 !!$ INTERFACE
4473 !!$ INTEGER(C_INT) FUNCTION cgp_close(fn) BIND(C, name='cgp_close')
3973 !!$!!$
3974 !!$!!$ INTEGER(C_INT) FUNCTION cgp_close(fn) BIND(C, name="cgp_close")
44743975 !!$ USE ISO_C_BINDING
44753976 !!$ INTEGER(C_INT), INTENT(IN), VALUE :: fn
44763977 !!$ END FUNCTION cgp_close
4477 !!$ END INTERFACE
4478 !!$
4479 !!$ INTERFACE
4480 !!$ INTEGER(C_INT) FUNCTION cgp_queue_set(use_queue) BIND(C, name='cgp_queue_set')
3978 !!$!!$
3979 !!$!!$ INTEGER(C_INT) FUNCTION cgp_queue_set(use_queue) BIND(C, name="cgp_queue_set")
44813980 !!$ USE ISO_C_BINDING
44823981 !!$ INTEGER(C_INT), INTENT(IN), VALUE :: use_queue
44833982 !!$ END FUNCTION cgp_queue_set
4484 !!$ END INTERFACE
4485 !!$
4486 !!$ INTERFACE
4487 !!$ INTEGER(C_INT) FUNCTION cgp_queue_flush() BIND(C, name='cgp_queue_flush')
3983 !!$!!$
3984 !!$!!$ INTEGER(C_INT) FUNCTION cgp_queue_flush() BIND(C, name="cgp_queue_flush")
44883985 !!$ USE ISO_C_BINDING
44893986 !!$ END FUNCTION cgp_queue_flush
4490 !!$ END INTERFACE
4491 !!$
4492 !!$ INTERFACE
4493 !!$ INTEGER(C_INT) FUNCTION cg_user_data_write(UserDataName) BIND(C, name='cg_user_data_write')
3987 !!$!!$
3988 !!$!!$ INTEGER(C_INT) FUNCTION cg_user_data_write(UserDataName) BIND(C, name="cg_user_data_write")
44943989 !!$ USE ISO_C_BINDING
44953990 !!$ CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN) :: UserDataName
44963991 !!$ END FUNCTION cg_user_data_write
4497 !!$ END INTERFACE
4498
3992 !!$
44993993 #if HAVE_FORTRAN_2008TS
45003994 ! THE FOLLOWING CODE ONLY WORKS FOR COMPILERS HAVING F2008 STANDARD EXTENSION:
45013995 ! TS 29113 Further Interoperability of FORTRAN with C WG5/N1942
45023996
45033997 ! The number of optional parameters should be set to
45043998 ! CG_MAX_GOTO_DEPTH, which is currently set to 20.
4505 INTERFACE
45063999 INTEGER(C_INT) FUNCTION cg_gorel(fn, &
45074000 UserDataName1, i1, UserDataName2, i2, &
45084001 UserDataName3, i3, UserDataName4, i4, &
45144007 UserDataName15, i15, UserDataName16, i16, &
45154008 UserDataName17, i17, UserDataName18, i18, &
45164009 UserDataName19, i19, UserDataName20, i20, &
4517 end) BIND(C, name='cg_gorel_f08')
4010 end) BIND(C, name="cg_gorel_f08")
45184011
45194012 USE ISO_C_BINDING
45204013 INTEGER(C_INT) , INTENT(IN), VALUE :: fn
45274020 i17, i18, i19, i20
45284021 CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN), OPTIONAL :: end
45294022 END FUNCTION cg_gorel
4530 END INTERFACE
45314023
45324024 ! The number of optional parameters should be set to
45334025 ! CG_MAX_GOTO_DEPTH, which is currently set to 20.
45344026
4535 INTERFACE
45364027 INTEGER(C_INT) FUNCTION cg_goto(fn, B, &
45374028 UserDataName1, i1, UserDataName2, i2, &
45384029 UserDataName3, i3, UserDataName4, i4, &
45444035 UserDataName15, i15, UserDataName16, i16, &
45454036 UserDataName17, i17, UserDataName18, i18, &
45464037 UserDataName19, i19, UserDataName20, i20, &
4547 end) BIND(C, name='cg_goto_f08')
4038 end) BIND(C, name="cg_goto_f08")
45484039
45494040 USE ISO_C_BINDING
45504041 INTEGER(C_INT) , INTENT(IN), VALUE :: fn
45574048 i17, i18, i19, i20
45584049 CHARACTER(C_CHAR), DIMENSION(*), INTENT(IN), OPTIONAL :: end
45594050 END FUNCTION cg_goto
4560 END INTERFACE
4561
45624051 #endif
4563 INTERFACE
4052
45644053 SUBROUTINE cg_open_f(filename, mode, fn, ier)
45654054 IMPORT :: C_CHAR, C_INT
45664055 IMPLICIT NONE
45694058 INTEGER, INTENT(OUT) :: fn
45704059 INTEGER, INTENT(OUT) :: ier
45714060 END SUBROUTINE cg_open_f
4572 END INTERFACE
4573
4574 INTERFACE
4061
45754062 SUBROUTINE cg_is_cgns_f(filename, file_type, ier)
45764063 IMPORT :: C_CHAR
45774064 IMPLICIT NONE
45884075 MODULE PROCEDURE cg_get_type_c_double
45894076 END INTERFACE
45904077
4078 INTERFACE cg_configure_f
4079 MODULE PROCEDURE cg_configure_ptr
4080 MODULE PROCEDURE cg_configure_funptr
4081 END INTERFACE
4082
45914083 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
45924084 !* INTERFACES FOR THE CGIO FORTRAN FUNCTIONS *
45934085 !* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
45944086
4087 INTERFACE
45954088 !*=========================================================
45964089 !* paths for searching for linked-to files
45974090 !*=========================================================
45984091
4599 INTERFACE
4600 SUBROUTINE cgio_path_add_f(path, ier) ! BIND(C,NAME='cgio_path_add_f')
4092 SUBROUTINE cgio_path_add_f(path, ier) ! BIND(C,NAME="cgio_path_add_f")
46014093 IMPORT :: c_char
46024094 IMPLICIT NONE
46034095 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: path
46044096 INTEGER, INTENT(OUT) :: ier
46054097 END SUBROUTINE cgio_path_add_f
4606 END INTERFACE
46074098
46084099 !*---------------------------------------------------------
4609 INTERFACE
4610 SUBROUTINE cgio_path_delete_f(path, ier) ! BIND(C,NAME='cgio_path_delete_f')
4100 SUBROUTINE cgio_path_delete_f(path, ier) ! BIND(C,NAME="cgio_path_delete_f")
46114101 IMPORT :: c_char
46124102 IMPLICIT NONE
46134103 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: path
46144104 INTEGER, INTENT(OUT) :: ier
46154105 END SUBROUTINE cgio_path_delete_f
4616 END INTERFACE
4617
4106
46184107 !*=========================================================
46194108 !* utility routines independent of open files
46204109 !*=========================================================
4621 INTERFACE
4622 SUBROUTINE cgio_is_supported_f(file_type, ier) BIND(C,NAME='cgio_is_supported_f')
4110 SUBROUTINE cgio_is_supported_f(file_type, ier) BIND(C,NAME="cgio_is_supported_f")
46234111 IMPORT :: CGSIZE_T
46244112 IMPLICIT NONE
46254113 INTEGER(CGSIZE_T) :: file_type
46264114 INTEGER, INTENT(OUT) :: ier
46274115 END SUBROUTINE cgio_is_supported_f
4628 END INTERFACE
4629
4116
46304117 !*---------------------------------------------------------
4631 INTERFACE
4632 SUBROUTINE cgio_check_file_f(filename, file_type, ier) !BIND(C,NAME='cgio_check_file_f')
4118 SUBROUTINE cgio_check_file_f(filename, file_type, ier) !BIND(C,NAME="cgio_check_file_f")
46334119 IMPORT :: c_char
46344120 IMPLICIT NONE
46354121 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: filename
46364122 INTEGER :: file_type
46374123 INTEGER, INTENT(OUT) :: ier
46384124 END SUBROUTINE cgio_check_file_f
4639 END INTERFACE
46404125
46414126 !*=========================================================
46424127 !* file operations
46434128 !*=========================================================
4644 INTERFACE
4645 SUBROUTINE cgio_open_file_f(filename, file_mode, file_type, cgio_num, ier) ! BIND(C,NAME='cgio_open_file_f')
4129 SUBROUTINE cgio_open_file_f(filename, file_mode, file_type, cgio_num, ier) ! BIND(C,NAME="cgio_open_file_f")
46464130 IMPORT :: c_char
46474131 IMPLICIT NONE
46484132 CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: filename
46514135 INTEGER :: cgio_num
46524136 INTEGER, INTENT(OUT) :: ier
46534137 END SUBROUTINE cgio_open_file_f
4654 END INTERFACE
46554138
46564139 !*---------------------------------------------------------
4657 INTERFACE
4658 SUBROUTINE cgio_close_file_f(cgio_num, ier) BIND(C,NAME='cgio_close_file_f')
4140 SUBROUTINE cgio_close_file_f(cgio_num, ier) BIND(C,NAME="cgio_close_file_f")
46594141 IMPLICIT NONE
46604142 INTEGER :: cgio_num
46614143 INTEGER, INTENT(OUT) :: ier
46624144 END SUBROUTINE cgio_close_file_f
4663 END INTERFACE
46644145
46654146 !*---------------------------------------------------------
4666 INTERFACE
4667 SUBROUTINE cgio_flush_to_disk_f(cgio_num, ier) BIND(C,NAME='cgio_flush_to_disk_f')
4147 SUBROUTINE cgio_flush_to_disk_f(cgio_num, ier) BIND(C,NAME="cgio_flush_to_disk_f")
46684148 IMPLICIT NONE
46694149 INTEGER :: cgio_num
46704150 INTEGER, INTENT(OUT) :: ier
46714151 END SUBROUTINE cgio_flush_to_disk_f
4672 END INTERFACE
46734152
46744153 !*=========================================================
46754154 !* file information
46764155 !*=========================================================
4677 INTERFACE
4678 SUBROUTINE cgio_library_version_f(cgio_num, version, ier) ! BIND(C,NAME='cgio_library_version_f')
4156 SUBROUTINE cgio_library_version_f(cgio_num, version, ier) ! BIND(C,NAME="cgio_library_version_f")
46794157 IMPORT :: c_char
46804158 IMPLICIT NONE
46814159 INTEGER :: cgio_num
46824160 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: version
46834161 INTEGER, INTENT(OUT) :: ier
46844162 END SUBROUTINE cgio_library_version_f
4685 END INTERFACE
46864163
46874164 !*---------------------------------------------------------
4688 INTERFACE
4689 SUBROUTINE cgio_file_version_f(cgio_num, file_version, creation_date, modified_date, ier) ! BIND(C,NAME='cgio_file_version_f')
4165 SUBROUTINE cgio_file_version_f(cgio_num, file_version, creation_date, modified_date, ier) ! BIND(C,NAME="cgio_file_version_f")
46904166 IMPORT :: c_char
46914167 IMPLICIT NONE
46924168 INTEGER :: cgio_num
46954171 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: modified_date
46964172 INTEGER, INTENT(OUT) :: ier
46974173 END SUBROUTINE
4698 END INTERFACE
46994174
47004175 !*---------------------------------------------------------
4701 INTERFACE
4702 SUBROUTINE cgio_get_root_id_f(cgio_num, rootid, ier) BIND(C,NAME='cgio_get_root_id_f')
4176 SUBROUTINE cgio_get_root_id_f(cgio_num, rootid, ier) BIND(C,NAME="cgio_get_root_id_f")
47034177 IMPORT :: c_double
47044178 IMPLICIT NONE
47054179 INTEGER :: cgio_num
47064180 REAL(c_double) :: rootid
47074181 INTEGER, INTENT(OUT) :: ier
47084182 END SUBROUTINE cgio_get_root_id_f
4709 END INTERFACE
47104183
47114184 !*---------------------------------------------------------
4712 INTERFACE
4713 SUBROUTINE cgio_get_file_type_f(cgio_num, file_type, ier) BIND(C,NAME='cgio_get_file_type_f')
4185 SUBROUTINE cgio_get_file_type_f(cgio_num, file_type, ier) BIND(C,NAME="cgio_get_file_type_f")
47144186 IMPLICIT NONE
47154187 INTEGER :: cgio_num
47164188 INTEGER :: file_type
47174189 INTEGER, INTENT(OUT) :: ier
47184190 END SUBROUTINE cgio_get_file_type_f
4719 END INTERFACE
47204191
47214192 !*=========================================================
47224193 !* error handling
47234194 !*=========================================================
4724 INTERFACE
4725 SUBROUTINE cgio_error_code_f(errcode, file_type) BIND(C,NAME='cgio_error_code_f')
4195 SUBROUTINE cgio_error_code_f(errcode, file_type) BIND(C,NAME="cgio_error_code_f")
47264196 IMPLICIT NONE
47274197 INTEGER :: errcode
47284198 INTEGER :: file_type
47294199 END SUBROUTINE cgio_error_code_f
4730 END INTERFACE
47314200
47324201 !*---------------------------------------------------------
4733 INTERFACE
4734 SUBROUTINE cgio_error_message_f(errmsg, ier) ! BIND(C,NAME='cgio_error_message_f')
4202 SUBROUTINE cgio_error_message_f(errmsg, ier) ! BIND(C,NAME="cgio_error_message_f")
47354203 IMPORT :: c_char
47364204 IMPLICIT NONE
47374205 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: errmsg
47384206 INTEGER, INTENT(OUT) :: ier
47394207 END SUBROUTINE cgio_error_message_f
4740 END INTERFACE
47414208
47424209 !*---------------------------------------------------------
4743 INTERFACE
4744 SUBROUTINE cgio_error_exit_f(errmsg) ! BIND(C,NAME='cgio_error_exit_f')
4210 SUBROUTINE cgio_error_exit_f(errmsg) ! BIND(C,NAME="cgio_error_exit_f")
47454211 IMPORT :: c_char
47464212 IMPLICIT NONE
47474213 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: errmsg
47484214 END SUBROUTINE cgio_error_exit_f
4749 END INTERFACE
47504215
47514216 !*---------------------------------------------------------
4752 INTERFACE
4753 SUBROUTINE cgio_error_abort_f(abort_flag) BIND(C,NAME='cgio_error_abort_f')
4217 SUBROUTINE cgio_error_abort_f(abort_flag) BIND(C,NAME="cgio_error_abort_f")
47544218 IMPLICIT NONE
47554219 INTEGER :: abort_flag
47564220 END SUBROUTINE cgio_error_abort_f
4757 END INTERFACE
47584221
47594222 !*=========================================================
47604223 !* basic node operations
47614224 !*=========================================================
4762 INTERFACE
4763 SUBROUTINE cgio_create_node_f(cgio_num, pid, name, id, ier) ! BIND(C,NAME='cgio_create_node_f')
4225 SUBROUTINE cgio_create_node_f(cgio_num, pid, name, id, ier) ! BIND(C,NAME="cgio_create_node_f")
47644226 IMPORT :: c_char, c_double
47654227 IMPLICIT NONE
47664228 INTEGER :: cgio_num
47694231 REAL(C_DOUBLE) :: id
47704232 INTEGER, INTENT(OUT) :: ier
47714233 END SUBROUTINE cgio_create_node_f
4772 END INTERFACE
47734234
47744235 !*---------------------------------------------------------
4775 !!$ INTERFACE
4776 !!$ SUBROUTINE cgio_new_node_f(cgio_num, pid, name, label, data_type, ndims, dims, DATA, id, ier) BIND(C,NAME='')
4236 !!$!!$ SUBROUTINE cgio_new_node_f(cgio_num, pid, name, label, data_type, ndims, dims, DATA, id, ier) BIND(C,NAME="")
47774237 !!$ IMPORT :: c_char, c_double
47784238 !!$ IMPLICIT NONE
47794239 !!$ INTEGER :: cgio_num
47874247 !!$ REAL(C_DOUBLE) :: id
47884248 !!$ INTEGER, INTENT(OUT) :: ier
47894249 !!$ END SUBROUTINE cgio_new_node_f
4790 !!$ END INTERFACE
4791
4250 !!$
47924251 !*---------------------------------------------------------
4793 INTERFACE
4794 SUBROUTINE cgio_delete_node_f(cgio_num, pid, id, ier) BIND(C,NAME='cgio_delete_node_f')
4252 SUBROUTINE cgio_delete_node_f(cgio_num, pid, id, ier) BIND(C,NAME="cgio_delete_node_f")
47954253 IMPORT :: c_double
47964254 IMPLICIT NONE
47974255 INTEGER :: cgio_num
47994257 REAL(C_DOUBLE) :: id
48004258 INTEGER, INTENT(OUT) :: ier
48014259 END SUBROUTINE cgio_delete_node_f
4802 END INTERFACE
48034260
48044261 !*---------------------------------------------------------
4805 INTERFACE
4806 SUBROUTINE cgio_move_node_f(cgio_num, pid, id, npid, ier) BIND(C,NAME='cgio_move_node_f')
4262 SUBROUTINE cgio_move_node_f(cgio_num, pid, id, npid, ier) BIND(C,NAME="cgio_move_node_f")
48074263 IMPORT :: c_double
48084264 IMPLICIT NONE
48094265 INTEGER :: cgio_num
48124268 REAL(C_DOUBLE) :: npid
48134269 INTEGER, INTENT(OUT) :: ier
48144270 END SUBROUTINE cgio_move_node_f
4815 END INTERFACE
48164271
48174272 !*---------------------------------------------------------
4818 INTERFACE
4819 SUBROUTINE cgio_release_id_f(cgio_num, id, ier) BIND(C,NAME='cgio_release_id_f')
4273 SUBROUTINE cgio_release_id_f(cgio_num, id, ier) BIND(C,NAME="cgio_release_id_f")
48204274 IMPORT :: c_double
48214275 IMPLICIT NONE
48224276 INTEGER :: cgio_num
48234277 REAL(C_DOUBLE) :: id
48244278 INTEGER, INTENT(OUT) :: ier
48254279 END SUBROUTINE cgio_release_id_f
4826 END INTERFACE
48274280
48284281 !*=========================================================
48294282 !* links
48304283 !*=========================================================
4831 INTERFACE
4832 SUBROUTINE cgio_is_link_f(cgio_num, id, link_len, ier) BIND(C,NAME='cgio_is_link_f')
4284 SUBROUTINE cgio_is_link_f(cgio_num, id, link_len, ier) BIND(C,NAME="cgio_is_link_f")
48334285 IMPORT :: c_double
48344286 IMPLICIT NONE
48354287 INTEGER :: cgio_num
48374289 INTEGER :: link_len
48384290 INTEGER, INTENT(OUT) :: ier
48394291 END SUBROUTINE cgio_is_link_f
4840 END INTERFACE
48414292
48424293 !*---------------------------------------------------------
4843 INTERFACE
4844 SUBROUTINE cgio_link_size_f(cgio_num, id, file_len, name_len, ier) BIND(C,NAME='cgio_link_size_f')
4294 SUBROUTINE cgio_link_size_f(cgio_num, id, file_len, name_len, ier) BIND(C,NAME="cgio_link_size_f")
48454295 IMPORT :: c_double
48464296 IMPLICIT NONE
48474297 INTEGER :: cgio_num
48504300 INTEGER :: name_len
48514301 INTEGER, INTENT(OUT) :: ier
48524302 END SUBROUTINE cgio_link_size_f
4853 END INTERFACE
48544303
48554304 !*---------------------------------------------------------
4856 INTERFACE
4857 SUBROUTINE cgio_create_link_f(cgio_num, pid, name, filename, name_in_file, id, ier) ! BIND(C,NAME='cgio_create_link_f')
4305 SUBROUTINE cgio_create_link_f(cgio_num, pid, name, filename, name_in_file, id, ier) ! BIND(C,NAME="cgio_create_link_f")
48584306 IMPORT :: c_char, c_double
48594307 IMPLICIT NONE
48604308 INTEGER :: cgio_num
48654313 REAL(C_DOUBLE) :: id
48664314 INTEGER, INTENT(OUT) :: ier
48674315 END SUBROUTINE cgio_create_link_f
4868 END INTERFACE
48694316
48704317 !*---------------------------------------------------------
4871 INTERFACE
4872 SUBROUTINE cgio_get_link_f(cgio_num, id, filename, name_in_file, ier) ! BIND(C,NAME='cgio_get_link_f')
4318 SUBROUTINE cgio_get_link_f(cgio_num, id, filename, name_in_file, ier) ! BIND(C,NAME="cgio_get_link_f")
48734319 IMPORT :: c_char, c_double
48744320 IMPLICIT NONE
48754321 INTEGER :: cgio_num
48784324 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name_in_file
48794325 INTEGER, INTENT(OUT) :: ier
48804326 END SUBROUTINE cgio_get_link_f
4881 END INTERFACE
48824327
48834328 !*=========================================================
48844329 !* node children
48854330 !*=========================================================
4886 INTERFACE
48874331 SUBROUTINE cgio_number_children_f(cgio_num, pid, num_children, ier) &
4888 BIND(C,NAME='cgio_number_children_f')
4332 BIND(C,NAME="cgio_number_children_f")
48894333 IMPORT :: c_double
48904334 IMPLICIT NONE
48914335 INTEGER :: cgio_num
48934337 INTEGER :: num_children
48944338 INTEGER, INTENT(OUT) :: ier
48954339 END SUBROUTINE cgio_number_children_f
4896 END INTERFACE
48974340
48984341 !*---------------------------------------------------------
4899 INTERFACE
49004342 SUBROUTINE cgio_children_ids_f(cgio_num, pid, start, max_ret, num_ret, ids, ier) &
4901 BIND(C,NAME='cgio_children_ids_f')
4343 BIND(C,NAME="cgio_children_ids_f")
49024344 IMPORT :: c_double
49034345 IMPLICIT NONE
49044346 INTEGER :: cgio_num
49094351 REAL(C_DOUBLE) :: ids
49104352 INTEGER, INTENT(OUT) :: ier
49114353 END SUBROUTINE cgio_children_ids_f
4912 END INTERFACE
49134354
49144355 !*---------------------------------------------------------
4915 INTERFACE
4916 SUBROUTINE cgio_children_names_f(cgio_num, pid, start, max_ret, name_len, num_ret, names, ier) !BIND(C,NAME='cgio_children_names_f')
4356 SUBROUTINE cgio_children_names_f(cgio_num, pid, start, max_ret, name_len, &
4357 num_ret, names, ier) !BIND(C,NAME="cgio_children_names_f")
49174358 IMPORT :: c_char, c_double
49184359 IMPLICIT NONE
49194360 INTEGER :: cgio_num
49254366 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: names
49264367 INTEGER, INTENT(OUT) :: ier
49274368 END SUBROUTINE cgio_children_names_f
4928 END INTERFACE
49294369
49304370 !*=========================================================
49314371 !* read nodes
49324372 !*=========================================================
4933 INTERFACE
4934 SUBROUTINE cgio_get_node_id_f(cgio_num, pid, name, id, ier) !BIND(C,NAME='cgio_get_node_id_f')
4373 SUBROUTINE cgio_get_node_id_f(cgio_num, pid, name, id, ier) !BIND(C,NAME="cgio_get_node_id_f")
49354374 IMPORT :: c_char, c_double
49364375 IMPLICIT NONE
49374376 INTEGER :: cgio_num
49404379 REAL(C_DOUBLE) :: id
49414380 INTEGER, INTENT(OUT) :: ier
49424381 END SUBROUTINE cgio_get_node_id_f
4943 END INTERFACE
49444382
49454383 !*---------------------------------------------------------
4946 INTERFACE
4947 SUBROUTINE cgio_get_name_f(cgio_num, id, name, ier) !BIND(C,NAME='cgio_get_name_f')
4384 SUBROUTINE cgio_get_name_f(cgio_num, id, name, ier) !BIND(C,NAME="cgio_get_name_f")
49484385 IMPORT :: c_char, c_double
49494386 IMPLICIT NONE
49504387 INTEGER :: cgio_num
49524389 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name
49534390 INTEGER, INTENT(OUT) :: ier
49544391 END SUBROUTINE cgio_get_name_f
4955 END INTERFACE
49564392
49574393 !*---------------------------------------------------------
4958 INTERFACE
4959 SUBROUTINE cgio_get_label_f(cgio_num, id, label, ier) !BIND(C,NAME='cgio_get_label_f')
4394 SUBROUTINE cgio_get_label_f(cgio_num, id, label, ier) !BIND(C,NAME="cgio_get_label_f")
49604395 IMPORT :: c_char, c_double
49614396 IMPLICIT NONE
49624397 INTEGER :: cgio_num
49644399 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: label
49654400 INTEGER, INTENT(OUT) :: ier
49664401 END SUBROUTINE cgio_get_label_f
4967 END INTERFACE
49684402
49694403 !*---------------------------------------------------------
4970 INTERFACE
4971 SUBROUTINE cgio_get_data_type_f(cgio_num, id, data_type, ier) !BIND(C,NAME='cgio_get_data_type_f')
4404 SUBROUTINE cgio_get_data_type_f(cgio_num, id, data_type, ier) !BIND(C,NAME="cgio_get_data_type_f")
49724405 IMPORT :: c_char, c_double
49734406 IMPLICIT NONE
49744407 INTEGER :: cgio_num
49764409 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: data_type
49774410 INTEGER, INTENT(OUT) :: ier
49784411 END SUBROUTINE cgio_get_data_type_f
4979 END INTERFACE
49804412
49814413 !*---------------------------------------------------------
4982 INTERFACE
4983 SUBROUTINE cgio_get_data_size_f(cgio_num, id, size, ier) BIND(C,NAME='cgio_get_data_size_f')
4414 SUBROUTINE cgio_get_data_size_f(cgio_num, id, size, ier) BIND(C,NAME="cgio_get_data_size_f")
49844415 IMPORT :: c_double, cgsize_t
49854416 IMPLICIT NONE
49864417 INTEGER :: cgio_num
49884419 INTEGER(CGSIZE_T) :: size
49894420 INTEGER, INTENT(OUT) :: ier
49904421 END SUBROUTINE cgio_get_data_size_f
4991 END INTERFACE
49924422
49934423 !*=========================================================
49944424 !* write nodes
49954425 !*=========================================================
4996 INTERFACE
4997 SUBROUTINE cgio_set_name_f(cgio_num, pid, id, name, ier) !BIND(C,NAME='cgio_set_name_f')
4426 SUBROUTINE cgio_set_name_f(cgio_num, pid, id, name, ier) !BIND(C,NAME="cgio_set_name_f")
49984427 IMPORT :: c_char, c_double
49994428 IMPLICIT NONE
50004429 INTEGER :: cgio_num
50034432 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name
50044433 INTEGER, INTENT(OUT) :: ier
50054434 END SUBROUTINE cgio_set_name_f
5006 END INTERFACE
50074435
50084436 !*---------------------------------------------------------
5009 INTERFACE
5010 SUBROUTINE cgio_set_label_f(cgio_num, id, label, ier) !BIND(C,NAME='cgio_set_label_f')
4437 SUBROUTINE cgio_set_label_f(cgio_num, id, label, ier) !BIND(C,NAME="cgio_set_label_f")
50114438 IMPORT :: c_char, c_double
50124439 IMPLICIT NONE
50134440 INTEGER :: cgio_num
50154442 CHARACTER(KIND=C_CHAR), DIMENSION(*) :: label
50164443 INTEGER, INTENT(OUT) :: ier
50174444 END SUBROUTINE cgio_set_label_f
5018 END INTERFACE
50194445
50204446
50214447 !*---------------------------------------------------------
5022 !!$ INTERFACE
5023 !!$ SUBROUTINE cgio_write_all_data_f(
5024 !!$ cgint_f *cgio_num, double *id, void *data, cgint_f *ier) BIND(C,NAME='')
5025 !!$ END INTERFACE
5026
4448 !!$!!$ SUBROUTINE cgio_write_all_data_f(
4449 !!$ cgint_f *cgio_num, double *id, void *data, cgint_f *ier) BIND(C,NAME="")
4450 !!$
50274451 !*---------------------------------------------------------
5028 !!$ INTERFACE
5029 !!$ SUBROUTINE cgio_write_block_data_f(
4452 !!$!!$ SUBROUTINE cgio_write_block_data_f(
50304453 !!$ cgint_f *cgio_num, double *id, cgsize_t *b_start, cgsize_t *b_end,
5031 !!$ void *data, cgint_f *ier) BIND(C,NAME='')
4454 !!$ void *data, cgint_f *ier) BIND(C,NAME="")
50324455 !!$
5033 !!$ END INTERFACE
5034
4456 !!$
50354457 !*---------------------------------------------------------
5036 !!$ INTERFACE
5037 !!$ SUBROUTINE cgio_write_data_f(
4458 !!$!!$ SUBROUTINE cgio_write_data_f(
50384459 !!$ cgint_f *cgio_num, double *id, cgsize_t *s_start, cgsize_t *s_end,
50394460 !!$ cgsize_t *s_stride, cgsize_t *m_ndims, cgsize_t *m_dims, cgsize_t *m_start,
5040 !!$ cgsize_t *m_end, cgsize_t *m_stride, void *data, cgint_f *ier) BIND(C,NAME='')
4461 !!$ cgsize_t *m_end, cgsize_t *m_stride, void *data, cgint_f *ier) BIND(C,NAME="")
50414462 !!$
5042 !!$ END INTERFACE
5043
5044
4463 !!$
4464 END INTERFACE
4465
4466 PRIVATE cg_configure_ptr, cg_configure_funptr
50454467
50464468 CONTAINS
4469
4470 SUBROUTINE cg_goto_f(fn, B, ier, &
4471 UserDataName1, i1, UserDataName2, i2, &
4472 UserDataName3, i3, UserDataName4, i4, &
4473 UserDataName5, i5, UserDataName6, i6, &
4474 UserDataName7, i7, UserDataName8, i8, &
4475 UserDataName9, i9, UserDataName10, i10, &
4476 UserDataName11, i11, UserDataName12, i12, &
4477 UserDataName13, i13, UserDataName14, i14, &
4478 UserDataName15, i15, UserDataName16, i16, &
4479 UserDataName17, i17, UserDataName18, i18, &
4480 UserDataName19, i19, UserDataName20, i20, &
4481 end)
4482 IMPLICIT NONE
4483 INTEGER, INTENT(IN) :: fn
4484 INTEGER, INTENT(IN) :: B
4485 INTEGER, INTENT(OUT) :: ier
4486 CHARACTER(*), DIMENSION(*), INTENT(IN), OPTIONAL :: UserDataName1,UserDataName2, &
4487 UserDataName3,UserDataName4,UserDataName5,UserDataName6,UserDataName7,UserDataName8, &
4488 UserDataName9,UserDataName10,UserDataName11,UserDataName12,UserDataName13,UserDataName14, &
4489 UserDataName15,UserDataName16,UserDataName17,UserDataName18,UserDataName19,UserDataName20
4490 INTEGER, INTENT(IN), OPTIONAL :: i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16, &
4491 i17, i18, i19, i20
4492 CHARACTER(*), DIMENSION(*), INTENT(IN), OPTIONAL :: end
4493
4494 IF (.NOT. PRESENT(i1)) THEN
4495 CALL cg_goto_f1(fn, B, ier, UserDataName1, 0)
4496 RETURN
4497 ELSE
4498 CALL cg_goto_f1(fn, B, ier, UserDataName1, i1)
4499 IF(ier .NE. 0) RETURN
4500 END IF
4501 IF (PRESENT(i2)) THEN
4502 CALL cg_gorel_f1(fn, ier, UserDataName2, i2)
4503 IF(ier .NE. 0) RETURN
4504 END IF
4505 IF (PRESENT(i3)) THEN
4506 CALL cg_gorel_f1(fn, ier, UserDataName3, i3)
4507 IF(ier .NE. 0) RETURN
4508 END IF
4509 IF (PRESENT(i4)) THEN
4510 CALL cg_gorel_f1(fn, ier, UserDataName4, i4)
4511 IF(ier .NE. 0) RETURN
4512 END IF
4513 IF (PRESENT(i5)) THEN
4514 CALL cg_gorel_f1(fn, ier, UserDataName5, i5)
4515 IF(ier .NE. 0) RETURN
4516 END IF
4517 IF (PRESENT(i6)) THEN
4518 CALL cg_gorel_f1(fn, ier, UserDataName6, i6)
4519 IF(ier .NE. 0) RETURN
4520 END IF
4521 IF (PRESENT(i7)) THEN
4522 CALL cg_gorel_f1(fn, ier, UserDataName7, i7)
4523 IF(ier .NE. 0) RETURN
4524 END IF
4525 IF (PRESENT(i8)) THEN
4526 CALL cg_gorel_f1(fn, ier, UserDataName8, i8)
4527 IF(ier .NE. 0) RETURN
4528 END IF
4529 IF (PRESENT(i9)) THEN
4530 CALL cg_gorel_f1(fn, ier, UserDataName9, i9)
4531 IF(ier .NE. 0) RETURN
4532 END IF
4533 IF (PRESENT(i10)) THEN
4534 CALL cg_gorel_f1(fn, ier, UserDataName10, i10)
4535 IF(ier .NE. 0) RETURN
4536 END IF
4537 IF (PRESENT(i11)) THEN
4538 CALL cg_gorel_f1(fn, ier, UserDataName11, i11)
4539 IF(ier .NE. 0) RETURN
4540 END IF
4541 IF (PRESENT(i12)) THEN
4542 CALL cg_gorel_f1(fn, ier, UserDataName12, i12)
4543 IF(ier .NE. 0) RETURN
4544 END IF
4545 IF (PRESENT(i13)) THEN
4546 CALL cg_gorel_f1(fn, ier, UserDataName13, i13)
4547 IF(ier .NE. 0) RETURN
4548 END IF
4549 IF (PRESENT(i14)) THEN
4550 CALL cg_gorel_f1(fn, ier, UserDataName14, i14)
4551 IF(ier .NE. 0) RETURN
4552 END IF
4553 IF (PRESENT(i15)) THEN
4554 CALL cg_gorel_f1(fn, ier, UserDataName15, i15)
4555 IF(ier .NE. 0) RETURN
4556 END IF
4557 IF (PRESENT(i16)) THEN
4558 CALL cg_gorel_f1(fn, ier, UserDataName16, i16)
4559 IF(ier .NE. 0) RETURN
4560 END IF
4561 IF (PRESENT(i17)) THEN
4562 CALL cg_gorel_f1(fn, ier, UserDataName17, i17)
4563 IF(ier .NE. 0) RETURN
4564 END IF
4565 IF (PRESENT(i18)) THEN
4566 CALL cg_gorel_f1(fn, ier, UserDataName18, i18)
4567 IF(ier .NE. 0) RETURN
4568 END IF
4569 IF (PRESENT(i19)) THEN
4570 CALL cg_gorel_f1(fn, ier, UserDataName19, i19)
4571 IF(ier .NE. 0) RETURN
4572 END IF
4573 IF (PRESENT(i20)) THEN
4574 CALL cg_gorel_f1(fn, ier, UserDataName20, i20)
4575 IF(ier .NE. 0) RETURN
4576 END IF
4577 END SUBROUTINE cg_goto_f
4578
4579 SUBROUTINE cg_gorel_f(fn, ier, &
4580 UserDataName1, i1, UserDataName2, i2, &
4581 UserDataName3, i3, UserDataName4, i4, &
4582 UserDataName5, i5, UserDataName6, i6, &
4583 UserDataName7, i7, UserDataName8, i8, &
4584 UserDataName9, i9, UserDataName10, i10, &
4585 UserDataName11, i11, UserDataName12, i12, &
4586 UserDataName13, i13, UserDataName14, i14, &
4587 UserDataName15, i15, UserDataName16, i16, &
4588 UserDataName17, i17, UserDataName18, i18, &
4589 UserDataName19, i19, UserDataName20, i20, &
4590 end)
4591 IMPLICIT NONE
4592 INTEGER, INTENT(IN) :: fn
4593 INTEGER, INTENT(OUT) :: ier
4594 CHARACTER(*), DIMENSION(*), INTENT(IN), OPTIONAL :: UserDataName1,UserDataName2, &
4595 UserDataName3,UserDataName4,UserDataName5,UserDataName6,UserDataName7,UserDataName8, &
4596 UserDataName9,UserDataName10,UserDataName11,UserDataName12,UserDataName13,UserDataName14, &
4597 UserDataName15,UserDataName16,UserDataName17,UserDataName18,UserDataName19,UserDataName20
4598 INTEGER, INTENT(IN), OPTIONAL :: i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16, &
4599 i17, i18, i19, i20
4600 CHARACTER(*), DIMENSION(*), INTENT(IN), OPTIONAL :: end
4601
4602 IF (PRESENT(i1)) THEN
4603 CALL cg_gorel_f1(fn, ier, UserDataName1, i1)
4604 ELSE
4605 CALL cg_gorel_f1(fn, ier, UserDataName1, 0)
4606 RETURN
4607 END IF
4608 IF (PRESENT(i2)) THEN
4609 CALL cg_gorel_f1(fn, ier, UserDataName2, i2)
4610 IF(ier .NE. 0) RETURN
4611 END IF
4612 IF (PRESENT(i3)) THEN
4613 CALL cg_gorel_f1(fn, ier, UserDataName3, i3)
4614 IF(ier .NE. 0) RETURN
4615 END IF
4616 IF (PRESENT(i4)) THEN
4617 CALL cg_gorel_f1(fn, ier, UserDataName4, i4)
4618 IF(ier .NE. 0) RETURN
4619 END IF
4620 IF (PRESENT(i5)) THEN
4621 CALL cg_gorel_f1(fn, ier, UserDataName5, i5)
4622 IF(ier .NE. 0) RETURN
4623 END IF
4624 IF (PRESENT(i6)) THEN
4625 CALL cg_gorel_f1(fn, ier, UserDataName6, i6)
4626 IF(ier .NE. 0) RETURN
4627 END IF
4628 IF (PRESENT(i7)) THEN
4629 CALL cg_gorel_f1(fn, ier, UserDataName7, i7)
4630 IF(ier .NE. 0) RETURN
4631 END IF
4632 IF (PRESENT(i8)) THEN
4633 CALL cg_gorel_f1(fn, ier, UserDataName8, i8)
4634 IF(ier .NE. 0) RETURN
4635 END IF
4636 IF (PRESENT(i9)) THEN
4637 CALL cg_gorel_f1(fn, ier, UserDataName9, i9)
4638 IF(ier .NE. 0) RETURN
4639 END IF
4640 IF (PRESENT(i10)) THEN
4641 CALL cg_gorel_f1(fn, ier, UserDataName10, i10)
4642 IF(ier .NE. 0) RETURN
4643 END IF
4644 IF (PRESENT(i11)) THEN
4645 CALL cg_gorel_f1(fn, ier, UserDataName11, i11)
4646 IF(ier .NE. 0) RETURN
4647 END IF
4648 IF (PRESENT(i12)) THEN
4649 CALL cg_gorel_f1(fn, ier, UserDataName12, i12)
4650 IF(ier .NE. 0) RETURN
4651 END IF
4652 IF (PRESENT(i13)) THEN
4653 CALL cg_gorel_f1(fn, ier, UserDataName13, i13)
4654 IF(ier .NE. 0) RETURN
4655 END IF
4656 IF (PRESENT(i14)) THEN
4657 CALL cg_gorel_f1(fn, ier, UserDataName14, i14)
4658 IF(ier .NE. 0) RETURN
4659 END IF
4660 IF (PRESENT(i15)) THEN
4661 CALL cg_gorel_f1(fn, ier, UserDataName15, i15)
4662 IF(ier .NE. 0) RETURN
4663 END IF
4664 IF (PRESENT(i16)) THEN
4665 CALL cg_gorel_f1(fn, ier, UserDataName16, i16)
4666 IF(ier .NE. 0) RETURN
4667 END IF
4668 IF (PRESENT(i17)) THEN
4669 CALL cg_gorel_f1(fn, ier, UserDataName17, i17)
4670 IF(ier .NE. 0) RETURN
4671 END IF
4672 IF (PRESENT(i18)) THEN
4673 CALL cg_gorel_f1(fn, ier, UserDataName18, i18)
4674 IF(ier .NE. 0) RETURN
4675 END IF
4676 IF (PRESENT(i19)) THEN
4677 CALL cg_gorel_f1(fn, ier, UserDataName19, i19)
4678 IF(ier .NE. 0) RETURN
4679 END IF
4680 IF (PRESENT(i20)) THEN
4681 CALL cg_gorel_f1(fn, ier, UserDataName20, i20)
4682 IF(ier .NE. 0) RETURN
4683 END IF
4684 END SUBROUTINE cg_gorel_f
50474685
50484686 FUNCTION cg_get_type_c_int(a)
50494687 USE ISO_C_BINDING
50734711 cg_get_type_c_double = CGNS_ENUMV(RealDouble)
50744712 END FUNCTION cg_get_type_c_double
50754713
4714 FUNCTION cg_get_type_c_complex_float(a)
4715 USE ISO_C_BINDING
4716 COMPLEX(C_FLOAT_COMPLEX) :: a
4717 INTEGER(KIND(CGNS_ENUMV(ComplexSingle))) :: cg_get_type_c_complex_float
4718 cg_get_type_c_complex_float = CGNS_ENUMV(ComplexSingle)
4719 END FUNCTION cg_get_type_c_complex_float
4720
4721 FUNCTION cg_get_type_c_complex_double(a)
4722 USE ISO_C_BINDING
4723 COMPLEX(C_DOUBLE_COMPLEX) :: a
4724 INTEGER(KIND(CGNS_ENUMV(ComplexDouble))) :: cg_get_type_c_complex_double
4725 cg_get_type_c_complex_double = CGNS_ENUMV(ComplexDouble)
4726 END FUNCTION cg_get_type_c_complex_double
4727
50764728 ! These have issues when using xlf and the calling
50774729 ! program does not use the modules, CGNS-25
5078 ! SUBROUTINE cg_is_cgns_f(filename, file_type, ier) BIND(C,NAME='')
4730 ! SUBROUTINE cg_is_cgns_f(filename, file_type, ier) BIND(C,NAME="")
50794731 ! USE ISO_C_BINDING
50804732 ! IMPLICIT NONE
50814733 ! CHARACTER(KIND=C_CHAR, LEN=*), INTENT(IN) :: filename
50864738 !
50874739 ! END SUBROUTINE cg_is_cgns_f
50884740 !
5089 ! SUBROUTINE cg_open_f(filename, mode, fn, ier) BIND(C,NAME='')
4741 ! SUBROUTINE cg_open_f(filename, mode, fn, ier) BIND(C,NAME="")
50904742 ! USE ISO_C_BINDING
50914743 ! IMPLICIT NONE
50924744 ! CHARACTER(KIND=C_CHAR, LEN=*), INTENT(IN) :: filename
50984750 !
50994751 ! END SUBROUTINE cg_open_f
51004752
4753 SUBROUTINE cg_configure_ptr(what, value, ier)
4754 USE ISO_C_BINDING, ONLY : C_PTR
4755 IMPLICIT NONE
4756 INTEGER, INTENT(IN) :: what
4757 TYPE(C_PTR), VALUE :: value
4758 INTEGER, INTENT(OUT) :: ier
4759
4760 CALL cg_configure_c_ptr(what, value, ier)
4761
4762 END SUBROUTINE cg_configure_ptr
4763
4764 SUBROUTINE cg_configure_funptr(what, value, ier)
4765 USE ISO_C_BINDING, ONLY : C_FUNPTR
4766 IMPLICIT NONE
4767 INTEGER, INTENT(IN) :: what
4768 TYPE(C_FUNPTR), VALUE :: value
4769 INTEGER, INTENT(OUT) :: ier
4770
4771 CALL cg_configure_c_funptr(what, value, ier)
4772
4773 END SUBROUTINE cg_configure_funptr
4774
51014775 END MODULE cgns
219219 CGNS_mp_cg_error_exit_f
220220 CGNS_mp_cg_error_print_f
221221 CGNS_mp_cg_exit_on_error_f
222 CGNS_mp_cg_configure_c_ptr
223 CGNS_mp_cg_configure_c_funptr
222224 CGNS_mp_cgio_set_dimensions_f_0
223225 CGNS_mp_cgio_set_dimensions_f_1
224226 CGNS_mp_cgio_get_dimensions_f_0
2323 #include <math.h> /* included for definition of HUGE */
2424 #include "cgnstypes.h"
2525 #include "cgns_io.h"
26 #include "cg_hashmap.h"
2627
2728 typedef char char_33[33];
2829 #ifdef CG_BUILD_BASESCOPE
134135 #define SKIP_DATA 0
135136 #define READ_DATA 1
136137
138 #define CG_MODE_CLOSED 99
139
137140 /* flag for parallel reading or parallel writing */
138141 typedef enum {
139142 CGI_Read,
907910 cgns_descr *descr; /* ptrs to in-memory copy of descr */
908911 int nzones; /* number of zones in base */
909912 cgns_zone *zone; /* ptrs to in-memory copies of zones */
913 cgns_hashmap_object *zonemap; /* hashmap to check for duplicate zone names */
910914 int nfamilies; /* number of families */
911915 cgns_family *family; /* ptrs to in-memory copies of families */
912916 cgns_state *state; /* ptrs to in-memory copies of Ref.state*/
10031007 CGNSDLL cgns_array *cgi_get_field (cgns_file *cg, int B, int Z, int S, int F);
10041008 CGNSDLL cgns_zconn *cgi_get_zconnZC(cgns_file *cg, int B, int Z, int C);
10051009 CGNSDLL cgns_zconn *cgi_get_zconn (cgns_file *cg, int B, int Z);
1006 CGNSDLL cgns_hole *cgi_get_hole (cgns_file *cg, int B, int Z, int I);
1007 CGNSDLL cgns_conn *cgi_get_conn (cgns_file *cg, int B, int Z, int I);
1008 CGNSDLL cgns_1to1 *cgi_get_1to1 (cgns_file *cg, int B, int Z, int I);
1010 CGNSDLL cgns_hole *cgi_get_hole (cgns_file *cg, int B, int Z, int J);
1011 CGNSDLL cgns_conn *cgi_get_conn (cgns_file *cg, int B, int Z, int J);
1012 CGNSDLL cgns_1to1 *cgi_get_1to1 (cgns_file *cg, int B, int Z, int J);
10091013 CGNSDLL cgns_zboco *cgi_get_zboco (cgns_file *cg, int B, int Z);
10101014 CGNSDLL cgns_boco *cgi_get_boco (cgns_file *cg, int B, int Z, int BC);
10111015 CGNSDLL cgns_dataset *cgi_get_dataset(cgns_file *cg, int B, int Z, int BC, int DSet);
10221026 CGNSDLL cgns_amotion *cgi_get_amotion (cgns_file *cg, int B, int Z, int R);
10231027 CGNSDLL cgns_rotating *cgi_get_rotating (cgns_file *cg, int B, int Z);
10241028 CGNSDLL cgns_bprop *cgi_get_bprop (cgns_file *cg, int B, int Z, int BC);
1025 CGNSDLL cgns_cprop *cgi_get_cprop (cgns_file *cg, int B, int Z, int I);
1029 CGNSDLL cgns_cprop *cgi_get_cprop (cgns_file *cg, int B, int Z, int J);
10261030 CGNSDLL cgns_subreg *cgi_get_subreg (cgns_file *cg, int B, int Z, int S);
10271031
10281032 /* find position lead by the goto function */
11271131 cgns_subreg **subreg);
11281132 cgns_link *cgi_read_link(double node_id);
11291133
1130 CGNSDLL int cgi_datasize(int Idim, cgsize_t *CurrentDim,
1134 CGNSDLL int cgi_datasize(int ndim, cgsize_t *dims,
11311135 CGNS_ENUMT(GridLocation_t) location,
11321136 int *rind_planes, cgsize_t *DataSize);
11331137
11511155 int cgi_write_dataset(double parent_id, const char *label, cgns_dataset *dataset);
11521156 int cgi_write_bcdata(double bcdata_id, cgns_bcdata *bcdata);
11531157 int cgi_write_ptset(double id, char_33 name, cgns_ptset *ptset,
1154 int Ndim, void *ptset_ptr);
1158 int ndim, void *ptset_ptr);
11551159 int cgi_write_equations(double parent_id, cgns_equations *equations);
11561160 int cgi_write_model(double parent_id, cgns_model *model);
11571161 int cgi_write_state(double parent_id, cgns_state *state);
12581262 int cgi_check_dimensions(int ndims, cglong_t *dims);
12591263 int cgi_check_location(int dim, CGNS_ENUMT(ZoneType_t) type,
12601264 CGNS_ENUMT(GridLocation_t) loc);
1265
12611266 CGNSDLL int cgi_read_int_data(double id, char_33 data_type, cgsize_t cnt, cgsize_t *data);
1267 int cgi_read_offset_data_type(double id, char const *data_type, cgsize_t start, cgsize_t end, char const *to_type, void *to_data);
12621268 int cgi_convert_data(cgsize_t cnt,
12631269 CGNS_ENUMT(DataType_t) from_type, const void *from_data,
12641270 CGNS_ENUMT(DataType_t) to_type, void *to_data);
2222 #include <string.h>
2323 #include <time.h>
2424 #include <sys/types.h>
25
2526 #if !defined(_WIN32) || defined(__NUTC__)
2627 #include <unistd.h>
2728 #endif
2930 #include "cgnslib.h"
3031 #include "cgns_header.h"
3132 #include "cgns_io.h"
33 #include "cg_hashmap.h"
3234 #ifdef MEM_DEBUG
3335 #include "cg_malloc.h"
3436 #endif
3537 #if CG_BUILD_HDF5
3638 #include "adfh/ADFH.h"
3739 #include "hdf5.h"
40 #endif
41
42 #if CG_BUILD_COMPLEX_C99_EXT
43 #include <complex.h>
44 #undef I
45 #if defined(_MSC_VER)
46 #define cg_complex_float _Fcomplex
47 #define cg_complex_double _Dcomplex
48 #define __real__(c) c._Val[0]
49 #define __imag__(c) c._Val[1]
50 #else
51 #define cg_complex_float float _Complex
52 #define cg_complex_double double _Complex
53 #endif
3854 #endif
3955
4056 #define CGNS_NAN(x) (!((x) < HUGE_VAL && (x) > -HUGE_VAL))
6581 {
6682 void *buf = calloc(cnt, size);
6783 if (buf == NULL) {
68 cgi_error("calloc failed for %d values of size %d", cnt, size);
84 cgi_error("calloc failed for %zu values of size %zu", cnt, size);
6985 exit (1);
7086 }
7187 return buf;
7591 {
7692 void *buf = realloc(oldbuf, bytes);
7793 if (buf == NULL) {
78 cgi_error("realloc failed for %d bytes", bytes);
94 cgi_error("realloc failed for %zu bytes", bytes);
7995 exit (1);
8096 }
8197 return buf;
841857 }
842858 if (strcmp(zcoor[0][g].coord[z].data_type,"R4") &&
843859 strcmp(zcoor[0][g].coord[z].data_type,"R8")) {
844 cgi_error("Datatype %d not supported for coordinates",zcoor[0][g].coord[z].data_type);
860 cgi_error("Datatype %s not supported for coordinates",zcoor[0][g].coord[z].data_type);
845861 return CG_ERROR;
846862 }
847863 }
15521568 if (strcmp(sol[0][s].field[z].data_type,"I4") &&
15531569 strcmp(sol[0][s].field[z].data_type,"I8") &&
15541570 strcmp(sol[0][s].field[z].data_type,"R4") &&
1555 strcmp(sol[0][s].field[z].data_type,"R8")) {
1556 cgi_error("Datatype %d not supported for flow solutions",sol[0][s].field[z].data_type);
1571 strcmp(sol[0][s].field[z].data_type,"R8") &&
1572 strcmp(sol[0][s].field[z].data_type,"X4") &&
1573 strcmp(sol[0][s].field[z].data_type,"X8")) {
1574 cgi_error("Datatype %s not supported for flow solutions",sol[0][s].field[z].data_type);
15571575 return CG_ERROR;
15581576 }
15591577 }
31273145
31283146 /* verify dimension vector */
31293147 if (!(ndim==2 && dim_vals[0]>0 && dim_vals[1]>0)) {
3130 cgi_error("Invalid definition of point set: ptset->type='%s', ndim=%d, dim_vals[0]=%d",
3148 cgi_error("Invalid definition of point set: ptset->type='%s', ndim=%d, dim_vals[0]=%ld",
31313149 PointSetTypeName[ptset->type], ndim, dim_vals[0]);
31323150 return CG_ERROR;
31333151 }
40474065 strcmp(discrete[0][n].array[i].data_type,"I8") &&
40484066 strcmp(discrete[0][n].array[i].data_type,"R4") &&
40494067 strcmp(discrete[0][n].array[i].data_type,"R8")) {
4050 cgi_error("Datatype %d not supported for Discrete Data",discrete[0][n].array[i].data_type);
4068 cgi_error("Datatype %s not supported for Discrete Data",discrete[0][n].array[i].data_type);
40514069 return CG_ERROR;
40524070 }
40534071 }
42924310 }
42934311 if (strcmp(amotion[0][n].array[i].data_type,"R4") &&
42944312 strcmp(amotion[0][n].array[i].data_type,"R8") ) {
4295 cgi_error("Datatype %d not supported for ArbitraryGridMotion array",amotion[0][n].array[i].data_type);
4313 cgi_error("Datatype %s not supported for ArbitraryGridMotion array",amotion[0][n].array[i].data_type);
42964314 return CG_ERROR;
42974315 }
42984316 }
54985516 return CG_OK;
54995517 }
55005518
5501 int cgi_datasize(int Idim, cgsize_t *CurrentDim,
5519 int cgi_datasize(int ndim, cgsize_t *dims,
55025520 CGNS_ENUMV(GridLocation_t) location,
55035521 int *rind_planes, cgsize_t *DataSize)
55045522 {
55055523 int j;
55065524
55075525 if (location==CGNS_ENUMV( Vertex )) {
5508 for (j=0; j<Idim; j++)
5509 DataSize[j] = CurrentDim[j] + rind_planes[2*j] + rind_planes[2*j+1];
5526 for (j=0; j<ndim; j++)
5527 DataSize[j] = dims[j] + rind_planes[2*j] + rind_planes[2*j+1];
55105528
55115529 } else if (location==CGNS_ENUMV(CellCenter) ||
55125530 (location==CGNS_ENUMV(FaceCenter) && Cdim==2) ||
55135531 (location==CGNS_ENUMV(EdgeCenter) && Cdim==1)) {
5514 for (j=0; j<Idim; j++)
5515 DataSize[j] = CurrentDim[j+Idim] + rind_planes[2*j] + rind_planes[2*j+1];
5532 for (j=0; j<ndim; j++)
5533 DataSize[j] = dims[j+ndim] + rind_planes[2*j] + rind_planes[2*j+1];
55165534
55175535 } else if (location == CGNS_ENUMV( IFaceCenter ) ||
55185536 location == CGNS_ENUMV( JFaceCenter ) ||
55195537 location == CGNS_ENUMV( KFaceCenter )) {
5520 for (j=0; j<Idim; j++) {
5521 DataSize[j] = CurrentDim[j] + rind_planes[2*j] + rind_planes[2*j+1];
5538 for (j=0; j<ndim; j++) {
5539 DataSize[j] = dims[j] + rind_planes[2*j] + rind_planes[2*j+1];
55225540 if ((location == CGNS_ENUMV( IFaceCenter ) && j!=0) ||
55235541 (location == CGNS_ENUMV( JFaceCenter ) && j!=1) ||
55245542 (location == CGNS_ENUMV( KFaceCenter ) && j!=2)) DataSize[j]--;
56185636 return CG_OK;
56195637 }
56205638
5639 int cgi_read_offset_data_type(double id, char const *data_type, cgsize_t start, cgsize_t end, char const *m_type, void* data)
5640 {
5641 cgsize_t cnt = end - start + 1;
5642 cgsize_t s_start[1], s_end[1], s_stride[1];
5643 cgsize_t m_start[1], m_end[1], m_stride[1], m_dim[1];
5644 int ier = CG_OK;
5645 s_start[0] = start;
5646 s_end[0] = end;
5647 s_stride[0] = 1;
5648 m_start[0] = 1;
5649 m_end[0] = cnt;
5650 m_stride[0] = 1;
5651 m_dim[0] = cnt;
5652
5653 if (0 == strcmp(data_type, "I4") && 0 == strcmp(m_type, "I4")) {
5654 if (cgio_read_data_type(cg->cgio, id,
5655 s_start, s_end, s_stride, "I4", 1, m_dim,
5656 m_start, m_end, m_stride, data)) {
5657 cg_io_error("cgio_read_data");
5658 return CG_ERROR;
5659 }
5660 }
5661 else if (0 == strcmp(data_type, "I8") && 0 == strcmp(m_type, "I8")) {
5662 if (cgio_read_data_type(cg->cgio, id,
5663 s_start, s_end, s_stride, "I8", 1, m_dim,
5664 m_start, m_end, m_stride, data)) {
5665 cg_io_error("cgio_read_data");
5666 return CG_ERROR;
5667 }
5668 }
5669 else {
5670 if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
5671 void* conv_data = NULL;
5672 conv_data = malloc((size_t)(cnt * size_of(data_type)));
5673 if (conv_data == NULL) {
5674 cgi_error("Error allocating conv_data");
5675 return CG_ERROR;
5676 }
5677 if (cgio_read_data_type(cg->cgio, id,
5678 s_start, s_end, s_stride,
5679 data_type,
5680 1, m_dim, m_start, m_end, m_stride, conv_data)) {
5681 free(conv_data);
5682 cg_io_error("cgio_read_data_type");
5683 return CG_ERROR;
5684 }
5685
5686 ier = cgi_convert_data(cnt, cgi_datatype(data_type),
5687 conv_data, cgi_datatype(m_type), data);
5688 free(conv_data);
5689 if (ier) return CG_ERROR;
5690 }
5691 else {
5692 /* in situ conversion */
5693 if (cgio_read_data_type(cg->cgio, id,
5694 s_start, s_end, s_stride, m_type, 1, m_dim,
5695 m_start, m_end, m_stride, data)) {
5696 cg_io_error("cgio_read_data_type");
5697 return CG_ERROR;
5698 }
5699 }
5700 }
5701 return CG_OK;
5702 }
5703
56215704 int cgi_convert_data(cgsize_t cnt,
56225705 CGNS_ENUMT(DataType_t) from_type, const void *from_data,
56235706 CGNS_ENUMT(DataType_t) to_type, void *to_data)
58095892 ierr = 1;
58105893 }
58115894 }
5812
5895 #if CG_BUILD_COMPLEX_C99_EXT
5896 else if (from_type == CGNS_ENUMV(ComplexSingle)) {
5897 const cg_complex_float *src = (const cg_complex_float *)from_data;
5898 /* X4 -> X4 */
5899 if (to_type == CGNS_ENUMV(ComplexSingle)) {
5900 cg_complex_float *dest = (cg_complex_float *)to_data;
5901 for (n = 0; n < cnt; n++)
5902 dest[n] = src[n];
5903 }
5904 /* X4 -> X8 */
5905 else if (to_type == CGNS_ENUMV(ComplexDouble)) {
5906 cg_complex_double *dest = (cg_complex_double *)to_data;
5907 for (n = 0; n < cnt; n++) {
5908 __real__(dest[n]) = (double)crealf(src[n]);
5909 __imag__(dest[n]) = (double)cimagf(src[n]);
5910 }
5911 }
5912 else {
5913 ierr = 1;
5914 }
5915 }
5916 else if (from_type == CGNS_ENUMV(ComplexDouble)) {
5917 const cg_complex_double *src = (const cg_complex_double *)from_data;
5918 /* X8 -> X8 */
5919 if (to_type == CGNS_ENUMV(ComplexDouble)) {
5920 cg_complex_double *dest = (cg_complex_double *)to_data;
5921 for (n = 0; n < cnt; n++)
5922 dest[n] = src[n];
5923 }
5924 /* X8 -> X4 */
5925 else if (to_type == CGNS_ENUMV(ComplexSingle)) {
5926 cg_complex_float *dest = (cg_complex_float *)to_data;
5927 for (n = 0; n < cnt; n++) {
5928 __real__(dest[n]) = (float)creal(src[n]);
5929 __imag__(dest[n]) = (float)cimag(src[n]);
5930 }
5931 }
5932 else {
5933 ierr = 1;
5934 }
5935 }
5936 #endif
58135937 else {
58145938 ierr = 1;
58155939 }
69167040 }
69177041
69187042 int cgi_write_ptset(double parent_id, char_33 name, cgns_ptset *ptset,
6919 int Idim, void *ptset_ptr)
7043 int ndim, void *ptset_ptr)
69207044 {
69217045 cgsize_t dim_vals[12];
6922 int ndim;
7046 int num_dim;
69237047 char_33 label;
69247048
69257049 if (ptset->link) {
69347058 else strcpy(label,"IndexArray_t");
69357059
69367060 /* Dimension vector */
6937 dim_vals[0]=Idim;
7061 dim_vals[0]=ndim;
69387062 dim_vals[1]=ptset->npts;
6939 ndim = 2;
7063 num_dim = 2;
69407064
69417065 /* Create the node */
69427066 if (cgi_new_node(parent_id, name, label, &ptset->id,
6943 ptset->data_type, ndim, dim_vals, ptset_ptr)) return CG_ERROR;
7067 ptset->data_type, num_dim, dim_vals, ptset_ptr)) return CG_ERROR;
69447068
69457069 return CG_OK;
69467070 }
80998223 /* both the file hyperslab and memory hyperslab must have same number of
81008224 * points */
81018225 if (s_numpt != m_numpt) {
8102 cgi_error("Number of locations in range of memory array (%d) do not "
8103 "match number of locations requested in range of file (%d)",
8226 cgi_error("Number of locations in range of memory array (%ld) do not "
8227 "match number of locations requested in range of file (%ld)",
81048228 m_numpt, s_numpt);
81058229 return CG_ERROR;
81068230 }
84448568 }
84458569
84468570 /***********************************************************************\
8447 * Alphanumerical sorting routine *
8571 * Alphanumerical sorting routine *
8572 * Warning: This is an insert sort that leads to performance issues *
84488573 \***********************************************************************/
84498574
84508575 int cgi_sort_names(int nnam, double *ids)
84518576 {
8452 int i,j,k;
8453 int leni, lenj;
8577 int i,j;
84548578 char_33 temp;
84558579 double temp_id;
84568580 char_33 *names;
84648588 }
84658589 }
84668590
8467 for (i=0; i<nnam; i++) {
8468 leni=(int)strlen(names[i]);
8469
8470 for (j=i+1; j<nnam; j++) {
8471 lenj=(int)strlen(names[j]);
8472
8473 for (k=0; k<leni && k<lenj; k++) {
8474
8475 if ((int)names[j][k] < (int)names[i][k]) {
8476 strcpy(temp, names[i]);
8477 strcpy(names[i], names[j]);
8478 strcpy(names[j], temp);
8479 leni=(int)strlen(names[i]);
8480 temp_id = ids[i];
8481 ids[i]=ids[j];
8482 ids[j]=temp_id;
8483
8484 break;
8485 } else if ((int)names[j][k]>(int)names[i][k]) {
8486 break;
8487 }
8488 if (k==(int)(strlen(names[j])-1)) {
8489 strcpy(temp, names[i]);
8490 strcpy(names[i], names[j]);
8491 strcpy(names[j], temp);
8492 leni=(int)strlen(names[i]);
8493 temp_id = ids[i];
8494 ids[i]=ids[j];
8495 ids[j]=temp_id;
8496 }
8497 }
8498 }
8591 for (i=1; i<nnam; i++) {
8592 memcpy(temp, names[i], 33);
8593 temp_id = ids[i];
8594 j = i - 1;
8595
8596 while (j >= 0 && strcmp(names[j], temp) > 0)
8597 {
8598 memcpy(names[j+1], names[j], 33);
8599 ids[j+1] = ids[j];
8600 j = j - 1;
8601 }
8602 if (j + 1 == i) continue;
8603 memcpy(names[j + 1], temp, 33);
8604 ids[j + 1] = temp_id;
84998605 }
85008606
85018607 CGNS_FREE(names);
85768682 if (strcmp(data_type, "R4") == 0) return sizeof(float);
85778683 if (strcmp(data_type, "R8") == 0) return sizeof(double);
85788684 if (strcmp(data_type, "C1") == 0) return sizeof(char);
8685 if (strcmp(data_type, "X4") == 0) return 2*sizeof(float);
8686 if (strcmp(data_type, "X8") == 0) return 2*sizeof(double);
85798687
85808688 cgi_error("data_type '%s' not supported by function 'size_of'",data_type);
85818689 return CG_OK;
85898697 if (type == CGNS_ENUMV(RealSingle)) return "R4";
85908698 if (type == CGNS_ENUMV(RealDouble)) return "R8";
85918699 if (type == CGNS_ENUMV(Character)) return "C1";
8700 if (type == CGNS_ENUMV(ComplexSingle)) return "X4";
8701 if (type == CGNS_ENUMV(ComplexDouble)) return "X8";
85928702 return "NULL";
85938703 }
85948704
85998709 if (strcmp(adf_type, "R4") == 0) return CGNS_ENUMV(RealSingle);
86008710 if (strcmp(adf_type, "R8") == 0) return CGNS_ENUMV(RealDouble);
86018711 if (strcmp(adf_type, "C1") == 0) return CGNS_ENUMV(Character);
8712 if (strcmp(adf_type, "X4") == 0) return CGNS_ENUMV(ComplexSingle);
8713 if (strcmp(adf_type, "X8") == 0) return CGNS_ENUMV(ComplexDouble);
86028714 return CGNS_ENUMV(DataTypeNull);
86038715 }
86048716
90819193 return zone->zconn;
90829194 }
90839195
9084 cgns_cprop *cgi_get_cprop(cgns_file *cg, int B, int Z, int I)
9196 cgns_cprop *cgi_get_cprop(cgns_file *cg, int B, int Z, int J)
90859197 {
90869198 cgns_conn *conn;
90879199
9088 conn = cgi_get_conn(cg, B, Z, I);
9200 conn = cgi_get_conn(cg, B, Z, J);
90899201 if (conn==0) return CG_OK;
90909202
90919203 if (conn->cprop == 0)
9092 cgi_error("GridConnectivityProperty_t node doesn't exist under GridConnectivity_t %d",I);
9204 cgi_error("GridConnectivityProperty_t node doesn't exist under GridConnectivity_t %d",J);
90939205
90949206 return conn->cprop;
90959207 }
90969208
9097 cgns_hole *cgi_get_hole(cgns_file *cg, int B, int Z, int I)
9209 cgns_hole *cgi_get_hole(cgns_file *cg, int B, int Z, int J)
90989210 {
90999211 cgns_zconn *zconn;
91009212
91019213 zconn = cgi_get_zconn(cg, B, Z);
91029214 if (zconn==0) return CG_OK;
91039215
9104 if (I>zconn->nholes || I<=0) {
9105 cgi_error("OversetHoles node number %d invalid",I);
9106 return CG_OK;
9107 }
9108 return &(zconn->hole[I-1]);
9109 }
9110
9111 cgns_conn *cgi_get_conn(cgns_file *cg, int B, int Z, int I)
9216 if (J>zconn->nholes || J<=0) {
9217 cgi_error("OversetHoles node number %d invalid",J);
9218 return CG_OK;
9219 }
9220 return &(zconn->hole[J-1]);
9221 }
9222
9223 cgns_conn *cgi_get_conn(cgns_file *cg, int B, int Z, int J)
91129224 {
91139225 cgns_zconn *zconn;
91149226
91159227 zconn = cgi_get_zconn(cg, B, Z);
91169228 if (zconn==0) return CG_OK;
91179229
9118 if (I>zconn->nconns || I<=0) {
9119 cgi_error("GridConnectivity_t node number %d invalid",I);
9120 return CG_OK;
9121 }
9122 return &(zconn->conn[I-1]);
9123 }
9124
9125 cgns_1to1 *cgi_get_1to1(cgns_file *cg, int B, int Z, int I)
9230 if (J>zconn->nconns || J<=0) {
9231 cgi_error("GridConnectivity_t node number %d invalid",J);
9232 return CG_OK;
9233 }
9234 return &(zconn->conn[J-1]);
9235 }
9236
9237 cgns_1to1 *cgi_get_1to1(cgns_file *cg, int B, int Z, int J)
91269238 {
91279239 cgns_zconn *zconn;
91289240
91299241 zconn = cgi_get_zconn(cg, B, Z);
91309242 if (zconn==0) return CG_OK;
91319243
9132 if (I>zconn->n1to1 || I<=0) {
9133 cgi_error("GridConnectivity1to1_t node number %d invalid",I);
9134 return CG_OK;
9135 }
9136 return &(zconn->one21[I-1]);
9244 if (J>zconn->n1to1 || J<=0) {
9245 cgi_error("GridConnectivity1to1_t node number %d invalid",J);
9246 return CG_OK;
9247 }
9248 return &(zconn->one21[J-1]);
91379249 }
91389250
91399251 cgns_zboco *cgi_get_zboco(cgns_file *cg, int B, int Z)
1230412416 } else if (strcmp(posit->label,"Elements_t")==0) {
1230512417 cgns_section *section= (cgns_section *)posit->posit;
1230612418 if (local_mode==CG_MODE_WRITE) {
12307 if (strcmp(given_name,"ElementConnectivity") &&
12419 if (strcmp(given_name,"ElementStartOffset") &&
12420 strcmp(given_name,"ElementConnectivity") &&
1230812421 strcmp(given_name,"ParentElements") &&
1230912422 strcmp(given_name,"ParentElementsPosition") &&
1231012423 strcmp(given_name,"ParentData")) {
1298213095 cgi_free_zone(&base->zone[n]);
1298313096 CGNS_FREE(base->zone);
1298413097 }
13098 if (base->zonemap) {
13099 cgi_hashmap_clear(base->zonemap);
13100 CGNS_FREE(base->zonemap);
13101 }
1298513102 if (base->ndescr) {
1298613103 for (n=0; n<base->ndescr; n++)
1298713104 cgi_free_descr(&base->descr[n]);
1417814295 cgi_free_ptset(subreg->ptset);
1417914296 CGNS_FREE(subreg->ptset);
1418014297 }
14181 if (subreg->bcname) cgi_free_descr(subreg->bcname);
14182 if (subreg->gcname) cgi_free_descr(subreg->gcname);
14298 if (subreg->bcname){
14299 cgi_free_descr(subreg->bcname);
14300 CGNS_FREE(subreg->bcname);
14301 }
14302 if (subreg->gcname){
14303 cgi_free_descr(subreg->gcname);
14304 CGNS_FREE(subreg->gcname);
14305 }
1418314306 if (subreg->units) {
1418414307 cgi_free_units(subreg->units);
1418514308 CGNS_FREE(subreg->units);
12691269 if (data_size) {
12701270 data = malloc((size_t)data_size);
12711271 if (data == NULL) return set_error(CGIO_ERR_MALLOC);
1272 ADFH_Read_All_Data(id_inp, NULL, (char *)data, &ierr);
1272 ADFH_Read_All_Data(id_inp, data_type, (char *)data, &ierr);
12731273 if (ierr > 0) {
12741274 free(data);
12751275 return set_error(ierr);
5050 #include "cgnslib.h"
5151 #include "cgns_header.h"
5252 #include "cgns_io.h"
53 #include "cg_hashmap.h"
5354
5455 /* to determine default file type */
5556 #if CG_BUILD_HDF5
196197 };
197198 const char * DataTypeName[NofValidDataTypes] =
198199 {"Null", "UserDefined",
199 "Integer", "RealSingle", "RealDouble", "Character", "LongInteger"
200 "Integer", "RealSingle", "RealDouble", "Character", "LongInteger",
201 "ComplexSingle", "ComplexDouble"
200202 };
201203 const char * ElementTypeName[NofValidElementTypes] =
202204 {"Null", "UserDefined",
256258 int n_open = 0;
257259 int cgns_file_size = 0;
258260 int file_number_offset = 0;
259 int VersionList[] = {3210, 3200,
261 int VersionList[] = {4200,
262 4110, 4100, 4000,
263 3210, 3200,
260264 3140, 3130, 3110, 3100,
261265 3080, 3000,
262266 2550, 2540, 2530, 2520, 2510, 2500,
529533 if (cgi_get_nodes(cg->rootid, "CGNSLibraryVersion_t", &nnod, &id))
530534 return CG_ERROR;
531535 if (nnod==0) {
532 cg->version=1050;
533 *FileVersion= (float) 1.05;
536 cg->version=3200;
537 *FileVersion= (float) 3.20;
534538 } else if (nnod!=1) {
535539 cgi_error("More then one CGNSLibraryVersion_t node found under ROOT.");
536540 return CG_ERROR;
769773 {
770774 /* cgio options */
771775 if (what > 100) {
772 if (cgio_configure(what, value)) {
773 cg_io_error("cgio_configure");
774 return CG_ERROR;
775 }
776 if( cgio_configure(what, value) != CG_OK) {
777 cg_io_error("cgio_configure");
778 return CG_ERROR;
779 }
776780 }
777781 /* error message handler */
778782 else if (what == CG_CONFIG_ERROR) {
12161220
12171221 for (i=0; i<index_dim; i++) {
12181222 if (nijk[i]<=0) {
1219 cgi_error("Invalid input: nijk[%d]=%d", i, nijk[i]);
1223 cgi_error("Invalid input: nijk[%d]=%ld", i, nijk[i]);
12201224 return CG_ERROR;
12211225 }
12221226 if (type == CGNS_ENUMV( Structured ) && nijk[i]!=nijk[i+index_dim]+1) {
1223 cgi_error("Invalid input: VertexSize[%d]=%d and CellSize[%d]=%d",
1227 cgi_error("Invalid input: VertexSize[%d]=%ld and CellSize[%d]=%ld",
12241228 i, nijk[i], i, nijk[i+index_dim]);
12251229 return CG_ERROR;
12261230 }
12271231 }
12281232
12291233 /* Overwrite a Zone_t Node: */
1230 for (index=0; index<base->nzones; index++) {
1231 if (strcmp(zonename, base->zone[index].name)==0) {
1232
1233 /* in CG_MODE_WRITE, children names must be unique */
1234 if (cg->mode==CG_MODE_WRITE) {
1235 cgi_error("Duplicate child name found: %s",zonename);
1234 if (base->zonemap == 0) {
1235 base->zonemap = cgi_new_presized_hashmap(base->nzones);
1236 if (base->zonemap == NULL) {
1237 cgi_error("Could not allocate zonemap");
1238 return CG_ERROR;
1239 }
1240 for (index = 0; index < base->nzones; index++) {
1241 if (cgi_map_set_item(base->zonemap, base->zone[index].name, index) != 0) {
1242 cgi_error("Can not set zone %s into hashmap", base->zone[index].name);
12361243 return CG_ERROR;
12371244 }
1238
1239 /* overwrite an existing zone */
1240 /* delete the existing zone from file */
1241 if (cgi_delete_node(base->id, base->zone[index].id))
1242 return CG_ERROR;
1243 /* save the old in-memory address to overwrite */
1244 zone = &(base->zone[index]);
1245 /* free memory */
1246 cgi_free_zone(zone);
1247 break;
1248 }
1249 }
1250 /* ... or add a Zone_t Node: */
1251 if (index==base->nzones) {
1245 }
1246 }
1247
1248 index = (int) cgi_map_get_item(base->zonemap, zonename);
1249 /* */
1250 if (index != -1) {
1251 zone = &(base->zone[index]);
1252 /* in CG_MODE_WRITE, children names must be unique */
1253 if (cg->mode == CG_MODE_WRITE) {
1254 cgi_error("Duplicate child name found: %s", zone->name);
1255 return CG_ERROR;
1256 }
1257
1258 /* overwrite an existing zone */
1259 /* delete the existing zone from file */
1260 if (cgi_delete_node(base->id, zone->id))
1261 return CG_ERROR;
1262 cgi_free_zone(zone);
1263 } else {
1264 /* ... or add a Zone_t Node: */
1265 // This breaks everything
12521266 if (base->nzones == 0) {
1253 base->zone = CGNS_NEW(cgns_zone, base->nzones+1);
1254 } else {
1255 base->zone = CGNS_RENEW(cgns_zone, base->nzones+1, base->zone);
1267 base->zone = CGNS_NEW(cgns_zone, base->nzones + 1);
1268 }
1269 else {
1270 base->zone = CGNS_RENEW(cgns_zone, base->nzones + 1, base->zone);
12561271 }
12571272 zone = &(base->zone[base->nzones]);
1273 index = base->nzones;
1274
1275 if (cgi_map_set_item(base->zonemap, zonename, index) != 0) {
1276 cgi_error("Error while adding zonename %s to zonemap hashtable", zonename);
1277 return CG_ERROR;
1278 }
12581279 base->nzones++;
12591280 }
1260 (*Z) = index+1;
1261
1262 /* save data to zone */
1281 (*Z) = index + 1;
1282
1283 /* save data to zone */
12631284 memset(zone, 0, sizeof(cgns_zone));
1264 strcpy(zone->name,zonename);
1285 strcpy(zone->name, zonename);
12651286 if ((zone->nijk = (cgsize_t *)malloc((size_t)(index_dim*3*sizeof(cgsize_t))))==NULL) {
12661287 cgi_error("Error allocating zone->nijk");
12671288 return CG_ERROR;
13651386 return CG_ERROR;
13661387 }
13671388
1368 /* Check that specified base's name matches begining of family tree path */
1389 /* Check that specified base's name matches beginning of family tree path */
13691390 pch = strstr( family_name, base->name );
13701391 if( pch != family_name+1 ) {
13711392 cgi_error( "Incompatible basename (%s) and family tree (%s)", base->name, family_name );
29002921 zcoor = cgi_get_zcoor(cg, B, Z, G);
29012922 if (zcoor==0) return CG_ERROR;
29022923
2903 if (zcoor->id == 0){
2904 cgi_error("Impossible to write coordinates bounding box to unwritten node");
2905 return CG_ERROR;
2906 }
2924 if ((cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) && zcoor->id == 0) {
2925 cgi_error("Impossible to write coordinates bounding box to unwritten node");
2926 return CG_ERROR;
2927 }
2928 #if CG_BUILD_HDF5
2929 else if (cg->filetype == CGIO_FILE_HDF5) {
2930 hid_t hid;
2931 to_HDF_ID(zcoor->id, hid);
2932 if (hid == 0) {
2933 cgi_error("Impossible to write coordinates bounding box to unwritten node HDF5");
2934 return CG_ERROR;
2935 }
2936 }
2937 #endif
29072938 base = cgi_get_base(cg, B);
29082939 if (base==0) return CG_ERROR;
29092940 dim_vals[0] = base->phys_dim;
32963327 static int read_element_data(cgns_section *section)
32973328 {
32983329 if (section->connect->data == NULL) {
3299 cgsize_t cnt = section->connect->dim_vals[0];
3330 cgsize_t cnt = section->connect->dim_vals[0];
33003331
33013332 section->connect->data = malloc(cnt * sizeof(cgsize_t));
33023333 if (section->connect->data == NULL) {
33233354 static int read_offset_data(cgns_section *section)
33243355 {
33253356 if (section->connect_offset->data == NULL) {
3326 cgsize_t cnt = section->connect_offset->dim_vals[0];
3357 cgsize_t cnt = section->connect_offset->dim_vals[0];
33273358
33283359 section->connect_offset->data = malloc(cnt * sizeof(cgsize_t));
33293360 if (section->connect_offset->data == NULL) {
34573488 {
34583489 cgns_zone *zone;
34593490 cgns_section *section = NULL;
3460 int index;
3461 cgsize_t num, ElementDataSize=0;
3462
3463 /* verify input */
3464 if (cgi_check_strlen(SectionName)) return CG_ERROR;
3465
3466 if (INVALID_ENUM(type,NofValidElementTypes)) {
3467 cgi_error("Invalid element type defined for section '%s'",SectionName);
3468 return CG_ERROR;
3469 }
34703491
34713492 if (!IS_FIXED_SIZE(type)) {
34723493 cgi_error("Element must be a fixed size");
34733494 return CG_ERROR;
34743495 }
3496
3497 if (cg_section_general_write(file_number, B, Z, SectionName, type,
3498 cgi_datatype(CG_SIZE_DATATYPE), start,
3499 end, 0, nbndry, S)){
3500 return CG_ERROR;
3501 }
3502
3503 zone = cgi_get_zone(cg, B, Z);
3504 if (zone==0) return CG_ERROR;
3505 section = &(zone->section[*S-1]);
3506
3507 if (cgio_write_all_data(cg->cgio, section->connect->id,
3508 elements)) {
3509 cg_io_error("cgio_write_all_data");
3510 return CG_ERROR;
3511 }
3512
3513 return CG_OK;
3514 }
3515
3516 int cg_poly_section_write(int file_number, int B, int Z, const char * SectionName,
3517 CGNS_ENUMT(ElementType_t)type, cgsize_t start, cgsize_t end,
3518 int nbndry, const cgsize_t * elements, const cgsize_t * connect_offset,
3519 int *S)
3520 {
3521 cgns_zone *zone;
3522 cgns_section *section = NULL;
3523 cgsize_t num, ElementDataSize=0;
3524
3525 /* get file and check mode */
3526 cg = cgi_get_file(file_number);
3527 if (cg == 0) return CG_ERROR;
34753528
34763529 num = end - start + 1;
34773530 if (num <= 0) {
34783531 cgi_error("Invalid element range defined for section '%s'",SectionName);
34793532 return CG_ERROR;
34803533 }
3534
3535 if (cg->filetype == CG_FILE_ADF2 &&
3536 adf2_check_elems(type, num, elements)) return CG_ERROR;
3537
3538 /* Compute ElementDataSize */
3539 ElementDataSize = cgi_element_data_size(type, num, elements, connect_offset);
3540 if (ElementDataSize < 0) return CG_ERROR;
3541
3542 /* Create empty section */
3543 if (cg_section_general_write(file_number, B, Z, SectionName, type,
3544 cgi_datatype(CG_SIZE_DATATYPE), start,
3545 end, ElementDataSize, nbndry, S)){
3546 return CG_ERROR;
3547 }
3548
3549 /* Now fill the section connectivity */
3550 zone = cgi_get_zone(cg, B, Z);
3551 if (zone==0) return CG_ERROR;
3552
3553 section = &(zone->section[*S-1]);
3554
3555 if (connect_offset && ! IS_FIXED_SIZE(type)) {
3556 /* Write element start offset connectivity */
3557 if (cgio_write_all_data(cg->cgio, section->connect_offset->id,
3558 connect_offset)) {
3559 cg_io_error("cgio_write_all_data");
3560 return CG_ERROR;
3561 }
3562 }
3563 /* Write element connectivity */
3564 if (cgio_write_all_data(cg->cgio, section->connect->id,
3565 elements)) {
3566 cg_io_error("cgio_write_all_data");
3567 return CG_ERROR;
3568 }
3569
3570 return CG_OK;
3571 }
3572
3573 int cg_section_partial_write(int file_number, int B, int Z, const char * SectionName,
3574 CGNS_ENUMT(ElementType_t) type, cgsize_t start,
3575 cgsize_t end, int nbndry, int *S)
3576 {
3577 int elemsize;
3578 cgsize_t num, ElementDataSize=0;
3579
3580 num = end - start + 1;
3581 if (cg_npe(type, &elemsize)) return CG_ERROR;
3582 if (elemsize <= 0) elemsize=2;
3583 ElementDataSize = num * elemsize;
3584
3585 /* create empty section */
3586 if (cg_section_general_write(file_number, B, Z, SectionName, type,
3587 cgi_datatype(CG_SIZE_DATATYPE), start,
3588 end, ElementDataSize, nbndry, S)){
3589 return CG_ERROR;
3590 }
3591
3592 /* if not fixed element size, need to create valid data for sizing */
3593 if (cg_section_initialize(file_number, B, Z, *S)) {
3594 return CG_ERROR;
3595 }
3596 return CG_OK;
3597 }
3598
3599 int cg_section_general_write(int file_number, int B, int Z, const char * SectionName,
3600 const CGNS_ENUMT(ElementType_t) type, const CGNS_ENUMT(DataType_t) elementDataType,
3601 cgsize_t start, cgsize_t end, cgsize_t elementDataSize,
3602 int nbndry, int *S)
3603 {
3604 cgns_zone *zone;
3605 cgns_section *section = NULL;
3606 int data[2];
3607 int index, elemsize;
3608 cgsize_t num;
3609 cgsize_t dim_vals;
3610 const char * data_type;
3611 double dummy_id;
3612 void *prange;
3613
3614 /* verify input */
3615 if (cgi_check_strlen(SectionName)) return CG_ERROR;
3616
3617 if (INVALID_ENUM(type,NofValidElementTypes)) {
3618 cgi_error("Invalid element type defined for section '%s'",SectionName);
3619 return CG_ERROR;
3620 }
3621
3622 /* If elementDataType provided is not correct fallback to default CG_SIZE_DATATYPE */
3623 if (elementDataType != CGNS_ENUMV(Integer) &&
3624 elementDataType != CGNS_ENUMV(LongInteger)) {
3625 cgi_warning("Invalid datatype for Elements array in section %s: %d",
3626 SectionName, elementDataType);
3627 data_type = CG_SIZE_DATATYPE;
3628 } else {
3629 data_type = cgi_adf_datatype(elementDataType);
3630 }
3631
3632 num = end - start + 1;
3633 if (num <= 0) {
3634 cgi_error("Invalid element range defined for section '%s'",SectionName);
3635 return CG_ERROR;
3636 }
34813637 if (nbndry > num) {
34823638 cgi_error("Invalid boundary element number for section '%s'",SectionName);
34833639 return CG_ERROR;
3640 }
3641
3642 /* Compute ElementDataSize */
3643 if (IS_FIXED_SIZE(type)) {
3644 if (cg_npe(type, &elemsize)) return CG_ERROR;
3645 if (elemsize <= 0) return CG_ERROR;
3646 elementDataSize = num * elemsize;
3647 }
3648 else {
3649 if (elementDataSize < 2*num) {
3650 cgi_error("Invalid elementDataSize for section '%s'",SectionName);
3651 return CG_ERROR;
3652 }
34843653 }
34853654
34863655 /* get file and check mode */
34873656 cg = cgi_get_file(file_number);
34883657 if (cg == 0) return CG_ERROR;
34893658
3490 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
3659 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE))
3660 return CG_ERROR;
34913661
34923662 if (cg->filetype == CG_FILE_ADF2 &&
3493 adf2_check_elems(type, num, elements)) return CG_ERROR;
3663 (type < CGNS_ENUMV(NODE) || type > CGNS_ENUMV(MIXED))) {
3664 /* Jiao: Changed to use older compatible version */
3665 cgi_error("Element type %s not supported in ADF2.",
3666 cg_ElementTypeName(type));
3667 return CG_ERROR;
3668 }
34943669
34953670 zone = cgi_get_zone(cg, B, Z);
34963671 if (zone==0) return CG_ERROR;
35283703 }
35293704 (*S) = index+1;
35303705
3531 /* save data in memory */
3532 memset(section, 0, sizeof(cgns_section));
3533 strcpy(section->name, SectionName);
3534 section->el_type = type;
3535 section->range[0] = start;
3536 section->range[1] = end;
3537 section->el_bound = nbndry;
3538
3539 /* Compute ElementDataSize */
3540 ElementDataSize = cgi_element_data_size(type, num, elements, NULL);
3541 if (ElementDataSize < 0) return CG_ERROR;
3542
3543 /* Write element connectivity in internal data structure */
3544 section->connect = CGNS_NEW(cgns_array, 1);
3545 strcpy(section->connect->name,"ElementConnectivity");
3546 strcpy(section->connect->data_type, CG_SIZE_DATATYPE);
3547 section->connect->data_dim=1;
3548 section->connect->dim_vals[0]=ElementDataSize;
3549
3550 if (cgi_write_section(zone->id, section))
3551 return CG_ERROR;
3552 if (cgio_write_all_data(cg->cgio, section->connect->id, elements)) {
3553 cg_io_error("cgio_write_all_data");
3554 return CG_ERROR;
3555 }
3556
3557 return CG_OK;
3558 }
3559
3560 int cg_poly_section_write(int file_number, int B, int Z, const char * SectionName,
3561 CGNS_ENUMT(ElementType_t)type, cgsize_t start, cgsize_t end,
3562 int nbndry, const cgsize_t * elements, const cgsize_t * connect_offset,
3563 int *S)
3564 {
3565 cgns_zone *zone;
3566 cgns_section *section = NULL;
3567 int index;
3568 cgsize_t num, ElementDataSize=0;
3569
3570 /* verify input */
3571 if (cgi_check_strlen(SectionName)) return CG_ERROR;
3572
3573 if (INVALID_ENUM(type,NofValidElementTypes)) {
3574 cgi_error("Invalid element type defined for section '%s'",SectionName);
3575 return CG_ERROR;
3576 }
3577 num = end - start + 1;
3578 if (num <= 0) {
3579 cgi_error("Invalid element range defined for section '%s'",SectionName);
3580 return CG_ERROR;
3581 }
3582 if (nbndry > num) {
3583 cgi_error("Invalid boundary element number for section '%s'",SectionName);
3584 return CG_ERROR;
3585 }
3586
3587 /* get file and check mode */
3588 cg = cgi_get_file(file_number);
3589 if (cg == 0) return CG_ERROR;
3590
3591 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
3592
3593 if (cg->filetype == CG_FILE_ADF2 &&
3594 adf2_check_elems(type, num, elements)) return CG_ERROR;
3595
3596 zone = cgi_get_zone(cg, B, Z);
3597 if (zone==0) return CG_ERROR;
3598
3599 /* Overwrite a Elements_t Node: */
3600 for (index=0; index<zone->nsections; index++) {
3601 if (strcmp(SectionName, zone->section[index].name)==0) {
3602
3603 /* in CG_MODE_WRITE, children names must be unique */
3604 if (cg->mode==CG_MODE_WRITE) {
3605 cgi_error("Duplicate child name found: %s",SectionName);
3606 return CG_ERROR;
3607 }
3608
3609 /* overwrite an existing section */
3610 /* delete the existing section from file */
3611 if (cgi_delete_node(zone->id, zone->section[index].id))
3612 return CG_ERROR;
3613 /* save the old in-memory address to overwrite */
3614 section = &(zone->section[index]);
3615 /* free memory */
3616 cgi_free_section(section);
3617 break;
3618 }
3619 }
3620 /* ... or add a Elements_t Node: */
3621 if (index==zone->nsections) {
3622 if (zone->nsections == 0) {
3623 zone->section = CGNS_NEW(cgns_section, zone->nsections+1);
3624 } else {
3625 zone->section = CGNS_RENEW(cgns_section, zone->nsections+1, zone->section);
3626 }
3627 section = &(zone->section[zone->nsections]);
3628 zone->nsections++;
3629 }
3630 (*S) = index+1;
3631
3632 /* save data in memory */
3633 memset(section, 0, sizeof(cgns_section));
3634 strcpy(section->name, SectionName);
3635 section->el_type = type;
3636 section->range[0] = start;
3637 section->range[1] = end;
3638 section->el_bound = nbndry;
3639
3640 /* Compute ElementDataSize */
3641 ElementDataSize = cgi_element_data_size(type, num, elements, connect_offset);
3642 if (ElementDataSize < 0) return CG_ERROR;
3643
3644 /* Write element connectivity in internal data structure */
3645 section->connect = CGNS_NEW(cgns_array, 1);
3646 strcpy(section->connect->name,"ElementConnectivity");
3647 strcpy(section->connect->data_type, CG_SIZE_DATATYPE);
3648 section->connect->data_dim=1;
3649 section->connect->dim_vals[0]=ElementDataSize;
3650
3651 if (connect_offset && ! IS_FIXED_SIZE(type)) {
3652 /* Write element start offset connectivity in internal data structure */
3653 section->connect_offset = CGNS_NEW(cgns_array, 1);
3654 strcpy(section->connect_offset->name,"ElementStartOffset");
3655 strcpy(section->connect_offset->data_type, CG_SIZE_DATATYPE);
3656 section->connect_offset->data_dim=1;
3657 section->connect_offset->dim_vals[0] = end-start+2;
3658 }
3659
3660 if (cgi_write_section(zone->id, section))
3661 return CG_ERROR;
3662 if (cgio_write_all_data(cg->cgio, section->connect->id, elements)) {
3663 cg_io_error("cgio_write_all_data");
3664 return CG_ERROR;
3665 }
3666 if (section->connect_offset) {
3667 if (cgio_write_all_data(cg->cgio, section->connect_offset->id, connect_offset)) {
3668 cg_io_error("cgio_write_all_data");
3669 return CG_ERROR;
3670 }
3671 }
3672
3673 return CG_OK;
3674 }
3675
3676 int cg_section_partial_write(int file_number, int B, int Z, const char * SectionName,
3677 CGNS_ENUMT(ElementType_t) type, cgsize_t start,
3678 cgsize_t end, int nbndry, int *S)
3679 {
3680 cgns_zone *zone;
3681 cgns_section *section = NULL;
3682 int index, elemsize;
3683 cgsize_t num, ElementDataSize=0;
3684
3685 /* verify input */
3686 if (cgi_check_strlen(SectionName)) return CG_ERROR;
3687
3688 if (INVALID_ENUM(type,NofValidElementTypes)) {
3689 cgi_error("Invalid element type defined for section '%s'",SectionName);
3690 return CG_ERROR;
3691 }
3692 num = end - start + 1;
3693 if (num <= 0) {
3694 cgi_error("Invalid element range defined for section '%s'",SectionName);
3695 return CG_ERROR;
3696 }
3697 if (nbndry > num) {
3698 cgi_error("Invalid boundary element number for section '%s'",SectionName);
3699 return CG_ERROR;
3700 }
3701
3702 /* Compute ElementDataSize */
3703 if (cg_npe(type, &elemsize)) return CG_ERROR;
3704 if (elemsize <= 0) elemsize = 2;
3705 ElementDataSize = num * elemsize;
3706
3707 /* get file and check mode */
3708 cg = cgi_get_file(file_number);
3709 if (cg == 0) return CG_ERROR;
3710
3711 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE))
3712 return CG_ERROR;
3713
3714 if (cg->filetype == CG_FILE_ADF2 && type > CGNS_ENUMV(MIXED)) {
3715 /* Jiao: Changed to use older compatible version */
3716 cgi_error("Element type %s not supported in ADF2.",
3717 cg_ElementTypeName(type));
3718 return CG_ERROR;
3719 }
3720
3721 zone = cgi_get_zone(cg, B, Z);
3722 if (zone==0) return CG_ERROR;
3723
3724 /* Overwrite a Elements_t Node: */
3725 for (index=0; index<zone->nsections; index++) {
3726 if (strcmp(SectionName, zone->section[index].name)==0) {
3727
3728 /* in CG_MODE_WRITE, children names must be unique */
3729 if (cg->mode==CG_MODE_WRITE) {
3730 cgi_error("Duplicate child name found: %s",SectionName);
3731 return CG_ERROR;
3732 }
3733
3734 /* overwrite an existing section */
3735 /* delete the existing section from file */
3736 if (cgi_delete_node(zone->id, zone->section[index].id))
3737 return CG_ERROR;
3738 /* save the old in-memory address to overwrite */
3739 section = &(zone->section[index]);
3740 /* free memory */
3741 cgi_free_section(section);
3742 break;
3743 }
3744 }
3745 /* ... or add a Elements_t Node: */
3746 if (index==zone->nsections) {
3747 if (zone->nsections == 0) {
3748 zone->section = CGNS_NEW(cgns_section, zone->nsections+1);
3749 } else {
3750 zone->section = CGNS_RENEW(cgns_section, zone->nsections+1, zone->section);
3751 }
3752 section = &(zone->section[zone->nsections]);
3753 zone->nsections++;
3754 }
3755 (*S) = index+1;
3756
37573706 /* initialize ... */
37583707 strcpy(section->name, SectionName);
37593708 section->el_type = type;
37643713 section->connect = CGNS_NEW(cgns_array, 1);
37653714 section->connect->data = 0;
37663715 strcpy(section->connect->name,"ElementConnectivity");
3767 strcpy(section->connect->data_type,CG_SIZE_DATATYPE);
3716 strcpy(section->connect->data_type, data_type);
37683717 section->connect->data_dim=1;
3769 section->connect->dim_vals[0]=ElementDataSize;
3718 section->connect->dim_vals[0]=elementDataSize;
37703719
37713720 section->id=0;
37723721 section->link=0;
37873736
37883737 /* if not fixed element size, need to create valid data for sizing */
37893738 if (!IS_FIXED_SIZE(type)) {
3790 cgsize_t n, nn, *data = CGNS_NEW(cgsize_t, ElementDataSize);
3791 cgsize_t *data_connect = CGNS_NEW(cgsize_t, (size_t)(num+1));
3792 cgsize_t val = (type == CGNS_ENUMV(MIXED) ? (cgsize_t)CGNS_ENUMV(NODE) : 0);
3793 for (nn = 0, n = 0; n < num; n++) {
3794 data[nn++] = val;
3795 data[nn++] = 0;
3796 }
3797 section->connect->data = (void *)data;
3798
37993739 section->connect_offset = CGNS_NEW(cgns_array, 1);
38003740 section->connect_offset->data = 0;
38013741 strcpy(section->connect_offset->name,"ElementStartOffset");
3802 strcpy(section->connect_offset->data_type,CG_SIZE_DATATYPE);
3742 strcpy(section->connect_offset->data_type, data_type);
38033743 section->connect_offset->data_dim=1;
38043744 section->connect_offset->dim_vals[0]=(num+1);
38053745
38103750 section->connect_offset->units=0;
38113751 section->connect_offset->exponents=0;
38123752 section->connect_offset->convert=0;
3813
3814 data_connect[0] = 0;
3815 for (n = 0; n < num; n++) {
3816 data_connect[n+1] = data_connect[n]+2;
3817 }
3818 section->connect_offset->data = (void *) data_connect;
3819 }
3820
3821 if (cgi_write_section(zone->id, section))
3822 return CG_ERROR;
3823
3824 return CG_OK;
3825 }
3753 }
3754
3755 HDF5storage_type = CG_CONTIGUOUS;
3756
3757 /* Elements_t */
3758 dim_vals = 2;
3759 data[0]=section->el_type;
3760 data[1]=section->el_bound;
3761 if (cgi_new_node(zone->id, section->name, "Elements_t",
3762 &section->id, "I4", 1, &dim_vals, data)) return CG_ERROR;
3763
3764 /* Check node for 32/64bit elements and write */
3765 if (data_type[1] == CG_SIZE_DATATYPE[1]) {
3766 /* Same type as cgsize_t */
3767 prange = (void *) section->range;
3768 }
3769 else if (data_type[1] == '4') {
3770 /* Element type is 32bit in 64bit library */
3771 data[0] = (int) section->range[0];
3772 data[1] = (int) section->range[1];
3773 prange = (void *) data;
3774 }
3775 else {
3776 /* Do not write I8 in library that is not 64bit */
3777 return CG_ERROR;
3778 }
3779 /* ElementRange */
3780 if (cgi_new_node(section->id, "ElementRange", "IndexRange_t",
3781 &dummy_id, data_type, 1, &dim_vals, prange)) return CG_ERROR;
3782
3783 /* ElementStartOffset */
3784 if (section->connect_offset &&
3785 cgi_new_node(section->id, section->connect_offset->name, "DataArray_t",
3786 &section->connect_offset->id, section->connect_offset->data_type,
3787 section->connect_offset->data_dim, section->connect_offset->dim_vals, NULL)) return CG_ERROR;
3788
3789 /* ElementConnectivity */
3790 if (cgi_new_node(section->id, section->connect->name, "DataArray_t",
3791 &section->connect->id, section->connect->data_type,
3792 section->connect->data_dim, section->connect->dim_vals, NULL)) return CG_ERROR;
3793
3794 HDF5storage_type = CG_COMPACT;
3795
3796 return CG_OK;
3797 }
3798
3799 /* This function is a kind of helper to be used after a cg_section_general_write
3800 * cg_section_general_write reserve enough space while this function put
3801 * coherent init data. Then cg_poly_elements_partial_write would run safely.
3802 */
3803 int cg_section_initialize(int file_number, int B, int Z, int S)
3804 {
3805 cgsize_t nm, nn, num, val;
3806 cgsize_t s_start, s_end, s_stride;
3807 cgsize_t m_start, m_end, m_stride, m_dim;
3808 cgsize_t *data;
3809 cgsize_t *data_offset;
3810 cgns_section *section = NULL;
3811
3812 /* get file and check mode */
3813 cg = cgi_get_file(file_number);
3814 if (cg == 0) return CG_ERROR;
3815
3816 /* verify input */
3817 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
3818
3819 section = cgi_get_section(cg, B, Z, S);
3820 if (section == 0) return CG_ERROR;
3821
3822 /* only initialize not fixed size type */
3823 if (IS_FIXED_SIZE(section->el_type)) return CG_OK;
3824
3825 num = section->range[1] - section->range[0] + 1;
3826 if (num <= 0) {
3827 return CG_OK;
3828 }
3829 /* check that connectivity and offset are here */
3830 if (section->connect == 0 ||
3831 section->connect_offset == 0) return CG_ERROR;
3832
3833 /* check if enough space is reserved to initialize */
3834 if (section->connect->dim_vals[0]<2*num) return CG_ERROR;
3835
3836 data = CGNS_NEW(cgsize_t, num*2);
3837 data_offset = CGNS_NEW(cgsize_t, (size_t)(num+1));
3838 val = (section->el_type == CGNS_ENUMV(MIXED) ? (cgsize_t)CGNS_ENUMV(NODE) : 0);
3839
3840 for (nn = 0, nm = 0; nm < num; nm++) {
3841 data[nn++] = val;
3842 data[nn++] = 0;
3843 }
3844 data_offset[0] = 0;
3845 for (nm = 0; nm < num; nm++) {
3846 data_offset[nm+1] = data_offset[nm]+2;
3847 }
3848
3849 /* transfer ownership */
3850 section->connect_offset->data = data_offset;
3851
3852 /* write to disk */
3853 if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
3854 /* need to do convert in memory for ADF */
3855 #if CG_SIZEOF_SIZE == 64
3856 if (0 == strcmp(section->connect_offset->data_type, "I4")) {
3857 int *tmp = CGNS_NEW(int, 2*num);
3858
3859 for (nm = 0; nm < num+1; nm++){
3860 tmp[nm] = (int) data_offset[nm];
3861 }
3862 s_start = 1;
3863 s_end = num + 1;
3864 s_stride = 1;
3865 m_start = 1;
3866 m_end = num + 1;
3867 m_dim = num + 1;
3868 m_stride = 1;
3869 if (cgio_write_data(cg->cgio, section->connect_offset->id,
3870 &s_start, &s_end, &s_stride,
3871 1, &m_dim, &m_start, &m_end, &m_stride,
3872 tmp)) {
3873 CGNS_FREE(data);
3874 CGNS_FREE(tmp);
3875 cg_io_error("cgio_write_data");
3876 return CG_ERROR;
3877 }
3878 for (nm = 0; nm < 2*num; nm++){
3879 tmp[nm] = (int) data[nm];
3880 }
3881 s_start = 1;
3882 s_end = 2*num;
3883 s_stride = 1;
3884 m_start = 1;
3885 m_end = 2*num;
3886 m_dim = 2*num;
3887 m_stride = 1;
3888 if (cgio_write_data(cg->cgio, section->connect->id,
3889 &s_start, &s_end, &s_stride,
3890 1, &m_dim, &m_start, &m_end, &m_stride,
3891 tmp)) {
3892 CGNS_FREE(data);
3893 CGNS_FREE(tmp);
3894 cg_io_error("cgio_write_data");
3895 return CG_ERROR;
3896 }
3897 CGNS_FREE(tmp);
3898 }
3899 #else
3900 if (0 == strcmp(section->connect_offset->data_type, "I8")) {
3901 cglong_t *tmp = CGNS_NEW(cglong_t, 2*num);
3902
3903 for (nm = 0; nm < num+1; nm++){
3904 tmp[nm] = (cglong_t) data_offset[nm];
3905 }
3906 s_start = 1;
3907 s_end = num + 1;
3908 s_stride = 1;
3909 m_start = 1;
3910 m_end = num + 1;
3911 m_dim = num + 1;
3912 m_stride = 1;
3913 if (cgio_write_data(cg->cgio, section->connect_offset->id,
3914 &s_start, &s_end, &s_stride,
3915 1, &m_dim, &m_start, &m_end, &m_stride,
3916 tmp)) {
3917 CGNS_FREE(data);
3918 CGNS_FREE(tmp);
3919 cg_io_error("cgio_write_data");
3920 return CG_ERROR;
3921 }
3922 for (nm = 0; nm < 2*num; nm++){
3923 tmp[nm] = (cglong_t) data[nm];
3924 }
3925 s_start = 1;
3926 s_end = 2*num;
3927 s_stride = 1;
3928 m_start = 1;
3929 m_end = 2*num;
3930 m_dim = 2*num;
3931 m_stride = 1;
3932 if (cgio_write_data(cg->cgio, section->connect->id,
3933 &s_start, &s_end, &s_stride,
3934 1, &m_dim, &m_start, &m_end, &m_stride,
3935 tmp)) {
3936 CGNS_FREE(data);
3937 CGNS_FREE(tmp);
3938 cg_io_error("cgio_write_data");
3939 return CG_ERROR;
3940 }
3941 CGNS_FREE(tmp);
3942 }
3943 #endif
3944 else {
3945 s_start = 1;
3946 s_end = num + 1;
3947 s_stride = 1;
3948 m_start = 1;
3949 m_end = num + 1;
3950 m_dim = num + 1;
3951 m_stride = 1;
3952 if (cgio_write_data(cg->cgio, section->connect_offset->id,
3953 &s_start, &s_end, &s_stride,
3954 1, &m_dim, &m_start, &m_end, &m_stride,
3955 data_offset)) {
3956 CGNS_FREE(data);
3957 cg_io_error("cgio_write_data");
3958 return CG_ERROR;
3959 }
3960 s_start = 1;
3961 s_end = 2*num;
3962 s_stride = 1;
3963 m_start = 1;
3964 m_end = 2*num;
3965 m_dim = 2*num;
3966 m_stride = 1;
3967 if (cgio_write_data(cg->cgio, section->connect->id,
3968 &s_start, &s_end, &s_stride,
3969 1, &m_dim, &m_start, &m_end, &m_stride,
3970 data)) {
3971 CGNS_FREE(data);
3972 cg_io_error("cgio_write_data");
3973 return CG_ERROR;
3974 }
3975 }
3976 }
3977 else if (cg->filetype == CGIO_FILE_HDF5) {
3978 /* in-situ conversion */
3979 s_start = 1;
3980 s_end = num + 1;
3981 s_stride = 1;
3982 m_start = 1;
3983 m_end = num + 1;
3984 m_dim = num + 1;
3985 m_stride = 1;
3986 if (cgio_write_data_type(cg->cgio, section->connect_offset->id,
3987 &s_start, &s_end, &s_stride,
3988 CG_SIZE_DATATYPE,
3989 1, &m_dim, &m_start, &m_end, &m_stride,
3990 data_offset)) {
3991 CGNS_FREE(data);
3992 cg_io_error("cgio_write_all_data_type");
3993 return CG_ERROR;
3994 }
3995 s_start = 1;
3996 s_end = 2*num;
3997 s_stride = 1;
3998 m_start = 1;
3999 m_end = 2*num;
4000 m_dim = 2*num;
4001 m_stride = 1;
4002 if (cgio_write_data_type(cg->cgio, section->connect->id,
4003 &s_start, &s_end, &s_stride,
4004 CG_SIZE_DATATYPE,
4005 1, &m_dim, &m_start, &m_end, &m_stride,
4006 data)) {
4007 CGNS_FREE(data);
4008 cg_io_error("cgio_write_all_data_type");
4009 return CG_ERROR;
4010 }
4011 }
4012 CGNS_FREE(data);
4013 return CG_OK;
4014 }
4015
38264016
38274017 /*----------------------------------------------------------------------*/
38284018 /* This function was created for revision 1.2 to return the size of the
3829 connectivity vector, which can't be known without it when type=MIXED */
4019 connectivity vector, which can't be known without it *when type=MIXED */
38304020
38314021 int cg_ElementDataSize(int file_number, int B, int Z, int S,
38324022 cgsize_t *ElementDataSize)
38334023 {
4024 cgns_section *section;
4025
4026 cg = cgi_get_file(file_number);
4027 if (cg == 0) return CG_ERROR;
4028
4029 /* verify input */
4030 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
4031
4032 section = cgi_get_section(cg, B, Z, S);
4033 if (section == 0) return CG_ERROR;
4034
4035 *ElementDataSize = section->connect->dim_vals[0];
4036 return CG_OK;
4037 }
4038
4039 int cg_ElementPartialSize(int file_number, int B, int Z, int S,
4040 cgsize_t start, cgsize_t end, cgsize_t *ElementDataSize)
4041 {
4042 cgns_section *section;
4043 cgsize_t size, cnt, *offset_data;
4044
4045 cg = cgi_get_file(file_number);
4046 if (cg == 0) return CG_ERROR;
4047
4048 /* verify input */
4049 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
4050
4051 section = cgi_get_section(cg, B, Z, S);
4052 if (section == 0) return CG_ERROR;
4053
4054 if (start > end || start < section->range[0] ||
4055 end > section->range[1]) {
4056 cgi_error("Invalid range for section '%s'", section->name);
4057 return CG_ERROR;
4058 }
4059 if (start == section->range[0] && end == section->range[1]) {
4060 *ElementDataSize = section->connect->dim_vals[0];
4061 return CG_OK;
4062 }
4063
4064 if (IS_FIXED_SIZE(section->el_type)) {
4065 size = cgi_element_data_size(section->el_type, end - start + 1, NULL, NULL);
4066 if (size < 0) return CG_ERROR;
4067 *ElementDataSize = size;
4068 return CG_OK;
4069 }
4070
4071 if (section->connect_offset->data == NULL) {
4072 // Only read a slice of the ElementStartOffset array
4073 cnt = end - start + 2;
4074 // Handle different compilation configuration for cgsize_t
4075 #if CG_SIZEOF_SIZE == 64
4076 if (0 == strcmp(section->connect_offset->data_type, "I4")) {
4077 int* offsets = (int*)malloc((size_t)(cnt * sizeof(int)));
4078 if (NULL == offsets) {
4079 cgi_error("Error allocating I4->I8 data array...");
4080 return CG_ERROR;
4081 }
4082 if (cgi_read_offset_data_type(section->connect_offset->id, "I4",
4083 start - section->range[0] + 1, end - section->range[0] + 2, "I4", offsets))
4084 {
4085 CGNS_FREE(offsets);
4086 return CG_ERROR;
4087 }
4088 size = (cgsize_t)(offsets[cnt - 1] - offsets[0]);
4089 CGNS_FREE(offsets);
4090 }
4091 #else
4092 if (0 == strcmp(section->connect_offset->data_type, "I8")) {
4093 cglong_t* offsets = (cglong_t*)malloc((size_t)(cnt * sizeof(cglong_t)));
4094 if (NULL == offsets) {
4095 cgi_error("Error allocating I8->I4 data array...");
4096 return CG_ERROR;
4097 }
4098 if (cgi_read_offset_data_type(section->connect_offset->id, "I8",
4099 start - section->range[0] + 1, end - section->range[0] + 2, "I8", offsets))
4100 {
4101 CGNS_FREE(offsets);
4102 return CG_ERROR;
4103 }
4104 size = (cgsize_t)(offsets[cnt - 1] - offsets[0]);
4105 CGNS_FREE(offsets);
4106 }
4107 #endif
4108 else {
4109 cgsize_t* offsets = malloc(cnt * sizeof(cgsize_t));
4110 if (NULL == offsets) {
4111 cgi_error("Error allocating data array...");
4112 return CG_ERROR;
4113 }
4114 if (cgi_read_offset_data_type(section->connect_offset->id, CG_SIZE_DATATYPE,
4115 start - section->range[0] + 1, end - section->range[0] + 2, CG_SIZE_DATATYPE, offsets))
4116 {
4117 CGNS_FREE(offsets);
4118 return CG_ERROR;
4119 }
4120 size = (cgsize_t)(offsets[cnt - 1] - offsets[0]);
4121 CGNS_FREE(offsets);
4122 }
4123 }
4124 else {
4125 // if ElementStartOffset is already fully loaded
4126 offset_data = (cgsize_t*)section->connect_offset->data;
4127 if (offset_data == 0) return CG_ERROR;
4128 size = offset_data[end - section->range[0] + 1] - offset_data[start - section->range[0]];
4129 }
4130
4131 if (size < 0) return CG_ERROR;
4132 *ElementDataSize = size;
4133 return CG_OK;
4134 }
4135
4136 /*----------------------------------------------------------------------*/
4137
4138 int cg_elements_read(int file_number, int B, int Z, int S, cgsize_t *elements,
4139 cgsize_t *parent_data)
4140 {
38344141 cgns_section *section;
4142 cgsize_t count, num, ElementDataSize=0;
38354143
38364144 cg = cgi_get_file(file_number);
38374145 if (cg == 0) return CG_ERROR;
38384146
3839 /* verify input */
4147 /* verify input */
38404148 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
38414149
38424150 section = cgi_get_section(cg, B, Z, S);
38434151 if (section == 0) return CG_ERROR;
38444152
3845 *ElementDataSize = section->connect->dim_vals[0];
3846 return CG_OK;
3847 }
3848
3849 int cg_ElementPartialSize(int file_number, int B, int Z, int S,
3850 cgsize_t start, cgsize_t end, cgsize_t *ElementDataSize)
3851 {
3852 cgns_section *section;
3853 cgsize_t size, *offset_data;
3854
3855 cg = cgi_get_file(file_number);
3856 if (cg == 0) return CG_ERROR;
3857
3858 /* verify input */
3859 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
3860
3861 section = cgi_get_section(cg, B, Z, S);
3862 if (section == 0) return CG_ERROR;
3863
3864 if (start > end || start < section->range[0] ||
3865 end > section->range[1]) {
3866 cgi_error("Invalid range for section '%s'", section->name);
3867 return CG_ERROR;
3868 }
3869 if (start == section->range[0] && end == section->range[1]) {
3870 *ElementDataSize = section->connect->dim_vals[0];
3871 return CG_OK;
3872 }
3873
3874 if (IS_FIXED_SIZE(section->el_type)) {
3875 size = cgi_element_data_size(section->el_type, end - start + 1, NULL, NULL);
3876 if (size < 0) return CG_ERROR;
3877 *ElementDataSize = size;
3878 return CG_OK;
3879 }
3880
3881 if (read_offset_data(section)) return CG_ERROR;
3882 offset_data = (cgsize_t *)section->connect_offset->data;
3883 if (offset_data == 0) return CG_ERROR;
3884
3885 size = offset_data[end-section->range[0]+1] - offset_data[start-section->range[0]];
3886 if (size < 0) return CG_ERROR;
3887 *ElementDataSize = size;
3888 return CG_OK;
3889 }
3890
3891 /*----------------------------------------------------------------------*/
3892
3893 int cg_elements_read(int file_number, int B, int Z, int S, cgsize_t *elements,
3894 cgsize_t *parent_data)
3895 {
3896 cgns_section *section;
3897 cgsize_t count, num, ElementDataSize=0;
3898
3899 cg = cgi_get_file(file_number);
3900 if (cg == 0) return CG_ERROR;
3901
3902 /* verify input */
3903 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
3904
3905 section = cgi_get_section(cg, B, Z, S);
3906 if (section == 0) return CG_ERROR;
3907
39084153 if (!IS_FIXED_SIZE(section->el_type)) {
3909 cgi_error("element must be a fixed size");
3910 return CG_ERROR;
3911 }
3912
3913 /* cgns_internals takes care of adjusting for version */
4154 cgi_error("element must be a fixed size");
4155 return CG_ERROR;
4156 }
4157
4158 /* cgns_internals takes care of adjusting for version */
39144159 ElementDataSize = section->connect->dim_vals[0];
39154160
39164161 num = section->range[1] - section->range[0] +1;
39704215 ElementDataSize = section->connect->dim_vals[0];
39714216
39724217 /* Double check ElementDataSize (not necessary) */
3973 if (section->connect_offset) {
4218 if (section->connect_offset && section->connect_offset->data &&
4219 0 == strcmp(CG_SIZE_DATATYPE, section->connect_offset->data_type)) {
39744220 offset_data = section->connect_offset->data;
39754221 }
4222
39764223 num = section->range[1] - section->range[0] +1;
39774224 count = cgi_element_data_size(section->el_type, num,
39784225 section->connect->data, offset_data);
40194266 return CG_OK;
40204267 }
40214268
4269 /*----------------------------------------------------------------------*/
40224270 int cg_elements_partial_read(int file_number, int B, int Z, int S,
40234271 cgsize_t start, cgsize_t end, cgsize_t *elements,
40244272 cgsize_t *parent_data)
41924440 return CG_OK;
41934441 }
41944442
4443
4444 /*----------------------------------------------------------------------*/
4445 int cg_elements_general_read(int file_number, int B, int Z, int S,
4446 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* elements)
4447 {
4448 cgns_section* section;
4449 cgsize_t size;
4450 cgsize_t s_start[1], s_end[1], s_stride[1];
4451 cgsize_t m_start[1], m_end[1], m_stride[1], m_dim[1];
4452 CGNS_ENUMT(DataType_t) s_type;
4453 int ier = CG_OK;
4454
4455 cg = cgi_get_file(file_number);
4456 if (cg == 0) return CG_ERROR;
4457
4458 /* verify input */
4459 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
4460
4461 section = cgi_get_section(cg, B, Z, S);
4462 if (section == 0) return CG_ERROR;
4463
4464 if (!IS_FIXED_SIZE(section->el_type)) {
4465 cgi_error("Element must be a fixed size");
4466 return CG_ERROR;
4467 }
4468
4469 /* If elementDataType provided is not correct fallback to default CG_SIZE_DATATYPE */
4470 if (m_type != CGNS_ENUMV(Integer) &&
4471 m_type != CGNS_ENUMV(LongInteger)) {
4472 cgi_error("Invalid datatype requested for Elements array in section %s: %d",
4473 section->name, m_type);
4474 return CG_ERROR;
4475 }
4476
4477 /* check the requested element range against the stored element range,
4478 * and the validity of the requested range
4479 */
4480 if (start > end || start < section->range[0] || end > section->range[1]) {
4481 cgi_error("Error in requested element data range.");
4482 return CG_ERROR;
4483 }
4484
4485 s_type = cgi_datatype(section->connect->data_type);
4486 size = cgi_element_data_size(section->el_type, end - start + 1, NULL, NULL);
4487 if (size < 0) return CG_ERROR;
4488
4489 s_start[0] = cgi_element_data_size(section->el_type,
4490 start - section->range[0], NULL, NULL) + 1;
4491 s_end[0] = cgi_element_data_size(section->el_type,
4492 end - section->range[0] + 1, NULL, NULL);
4493 s_stride[0] = 1;
4494 m_start[0] = 1;
4495 m_end[0] = size;
4496 m_stride[0] = 1;
4497 m_dim[0] = size;
4498
4499 if (m_type == s_type) {
4500 /* quick transfer of data if same data types */
4501 if (section->connect->dim_vals[0] == size) {
4502 if (cgio_read_all_data_type(cg->cgio, section->connect->id,
4503 cgi_adf_datatype(m_type), elements)) {
4504 cg_io_error("cgio_read_all_data_type");
4505 return CG_ERROR;
4506 }
4507 }
4508 else {
4509 if (cgio_read_data_type(cg->cgio, section->connect->id,
4510 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 1, m_dim,
4511 m_start, m_end, m_stride, elements)) {
4512 cg_io_error("cgio_read_data_type");
4513 return CG_ERROR;
4514 }
4515 }
4516 }
4517 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
4518 void* conv_data = NULL;
4519 conv_data = malloc((size_t)(size * size_of(cgi_adf_datatype(s_type))));
4520 if (conv_data == NULL) {
4521 cgi_error("Error allocating conv_data");
4522 return CG_ERROR;
4523 }
4524 if (section->connect->dim_vals[0] == size) {
4525 if (cgio_read_all_data_type(cg->cgio, section->connect->id,
4526 section->connect->data_type, conv_data)) {
4527 free(conv_data);
4528 cg_io_error("cgio_read_all_data_type");
4529 return CG_ERROR;
4530 }
4531 }
4532 else {
4533 if (cgio_read_data_type(cg->cgio, section->connect->id,
4534 s_start, s_end, s_stride,
4535 section->connect->data_type,
4536 1, m_dim, m_start, m_end, m_stride, conv_data)) {
4537 free(conv_data);
4538 cg_io_error("cgio_read_data_type");
4539 return CG_ERROR;
4540 }
4541 }
4542 ier = cgi_convert_data(size, s_type, conv_data, m_type, elements);
4543 free(conv_data);
4544 if (ier) return CG_ERROR;
4545 }
4546 else {
4547 /* in-situ conversion */
4548 if (section->connect->dim_vals[0] == size) {
4549 if (cgio_read_all_data_type(cg->cgio, section->connect->id,
4550 cgi_adf_datatype(m_type), elements)) {
4551 cg_io_error("cgio_read_all_data_type");
4552 return CG_ERROR;
4553 }
4554 }
4555 else {
4556 if (cgio_read_data_type(cg->cgio, section->connect->id,
4557 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 1, m_dim,
4558 m_start, m_end, m_stride, elements)) {
4559 cg_io_error("cgio_read_data_type");
4560 return CG_ERROR;
4561 }
4562 }
4563 }
4564 return CG_OK;
4565 }
4566
4567 /*----------------------------------------------------------------------*/
4568
4569 int cg_parent_elements_general_read(int file_number, int B, int Z, int S,
4570 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* parelem)
4571 {
4572 cgns_section* section;
4573 cgsize_t s_start[2], s_end[2], s_stride[2];
4574 cgsize_t m_start[2], m_end[2], m_stride[2], m_dim[2];
4575 CGNS_ENUMT(DataType_t) s_type;
4576 int ier = CG_OK;
4577
4578 cg = cgi_get_file(file_number);
4579 if (cg == 0) return CG_ERROR;
4580
4581 /* verify input */
4582 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
4583
4584 section = cgi_get_section(cg, B, Z, S);
4585 if (section == 0) return CG_ERROR;
4586
4587 if (m_type != CGNS_ENUMV(Integer) &&
4588 m_type != CGNS_ENUMV(LongInteger)) {
4589 cgi_error("Invalid datatype requested for ParentElements array in section %s: %d",
4590 section->name, m_type);
4591 return CG_ERROR;
4592 }
4593
4594 /* check the requested element range against the stored element range,
4595 * and the validity of the requested range
4596 */
4597 if (start > end || start < section->range[0] || end > section->range[1]) {
4598 cgi_error("Error in requested element data range.");
4599 return CG_ERROR;
4600 }
4601
4602 if (parelem == NULL || section->parelem == NULL) {
4603 cgi_error("Error reading ParentElementsPosition.");
4604 return CG_ERROR;
4605 }
4606
4607 s_type = cgi_datatype(section->parelem->data_type);
4608
4609 s_start[0] = start - section->range[0] + 1;
4610 s_end[0] = end - section->range[0] + 1;
4611 s_stride[0] = 1;
4612 s_start[1] = 1;
4613 s_end[1] = 2;
4614 s_stride[1] = 1;
4615 m_start[0] = 1;
4616 m_end[0] = end - start + 1;
4617 m_stride[0] = 1;
4618 m_start[1] = 1;
4619 m_end[1] = 2;
4620 m_stride[1] = 1;
4621 m_dim[0] = m_end[0];
4622 m_dim[1] = 2;
4623
4624 if (m_type == s_type) {
4625 /* quick transfer of data if same data types */
4626 if (section->connect->dim_vals[0] == m_end[0] &&
4627 section->connect->dim_vals[1] == 2) {
4628 if (cgio_read_all_data_type(cg->cgio, section->parelem->id,
4629 cgi_adf_datatype(m_type), parelem)) {
4630 cg_io_error("cgio_read_all_data_type");
4631 return CG_ERROR;
4632 }
4633 }
4634 else {
4635 if (cgio_read_data_type(cg->cgio, section->parelem->id,
4636 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 2, m_dim,
4637 m_start, m_end, m_stride, parelem)) {
4638 cg_io_error("cgio_read_data_type");
4639 return CG_ERROR;
4640 }
4641 }
4642 }
4643 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
4644 void* conv_data = NULL;
4645 conv_data = malloc((size_t)(m_dim[0] * 2 * size_of(cgi_adf_datatype(s_type))));
4646 if (conv_data == NULL) {
4647 cgi_error("Error allocating conv_data");
4648 return CG_ERROR;
4649 }
4650 if (section->parelem->dim_vals[0] == m_dim[0] &&
4651 section->parelem->dim_vals[1] == 2) {
4652 if (cgio_read_all_data_type(cg->cgio, section->parelem->id,
4653 section->connect->data_type, conv_data)) {
4654 free(conv_data);
4655 cg_io_error("cgio_read_all_data_type");
4656 return CG_ERROR;
4657 }
4658 }
4659 else {
4660 if (cgio_read_data_type(cg->cgio, section->parelem->id,
4661 s_start, s_end, s_stride,
4662 section->connect->data_type,
4663 2, m_dim, m_start, m_end, m_stride, conv_data)) {
4664 free(conv_data);
4665 cg_io_error("cgio_read_data_type");
4666 return CG_ERROR;
4667 }
4668 }
4669 ier = cgi_convert_data(2*m_dim[0], s_type, conv_data, m_type, parelem);
4670 free(conv_data);
4671 if (ier) return CG_ERROR;
4672 }
4673 else {
4674 /* in-situ conversion */
4675 if (section->parelem->dim_vals[0] == m_dim[0] &&
4676 section->parelem->dim_vals[1] == 2) {
4677 if (cgio_read_all_data_type(cg->cgio, section->parelem->id,
4678 cgi_adf_datatype(m_type), parelem)) {
4679 cg_io_error("cgio_read_all_data_type");
4680 return CG_ERROR;
4681 }
4682 }
4683 else {
4684 if (cgio_read_data_type(cg->cgio, section->parelem->id,
4685 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 2, m_dim,
4686 m_start, m_end, m_stride, parelem)) {
4687 cg_io_error("cgio_read_data_type");
4688 return CG_ERROR;
4689 }
4690 }
4691 }
4692 return CG_OK;
4693 }
4694
4695 /*----------------------------------------------------------------------*/
4696 int cg_parent_elements_position_general_read(int file_number, int B, int Z, int S,
4697 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* parface)
4698 {
4699 cgns_section* section;
4700 cgsize_t s_start[2], s_end[2], s_stride[2];
4701 cgsize_t m_start[2], m_end[2], m_stride[2], m_dim[2];
4702 CGNS_ENUMT(DataType_t) s_type;
4703 int ier = CG_OK;
4704
4705 cg = cgi_get_file(file_number);
4706 if (cg == 0) return CG_ERROR;
4707
4708 /* verify input */
4709 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
4710
4711 section = cgi_get_section(cg, B, Z, S);
4712 if (section == 0) return CG_ERROR;
4713
4714 if (m_type != CGNS_ENUMV(Integer) &&
4715 m_type != CGNS_ENUMV(LongInteger)) {
4716 cgi_error("Invalid datatype requested for ParentElementsPosition array in section %s: %d",
4717 section->name, m_type);
4718 return CG_ERROR;
4719 }
4720
4721 /* check the requested element range against the stored element range,
4722 * and the validity of the requested range
4723 */
4724 if (start > end || start < section->range[0] || end > section->range[1]) {
4725 cgi_error("Error in requested element data range.");
4726 return CG_ERROR;
4727 }
4728
4729 if (parface == NULL || section->parface == NULL) {
4730 cgi_error("Error reading ParentElementsPosition.");
4731 return CG_ERROR;
4732 }
4733
4734 s_type = cgi_datatype(section->parface->data_type);
4735
4736 s_start[0] = start - section->range[0] + 1;
4737 s_end[0] = end - section->range[0] + 1;
4738 s_stride[0] = 1;
4739 s_start[1] = 1;
4740 s_end[1] = 2;
4741 s_stride[1] = 1;
4742 m_start[0] = 1;
4743 m_end[0] = end - start + 1;
4744 m_stride[0] = 1;
4745 m_start[1] = 1;
4746 m_end[1] = 2;
4747 m_stride[1] = 1;
4748 m_dim[0] = m_end[0];
4749 m_dim[1] = 2;
4750
4751 if (m_type == s_type) {
4752 /* quick transfer of data if same data types */
4753 if (section->connect->dim_vals[0] == m_end[0] &&
4754 section->connect->dim_vals[1] == 2) {
4755 if (cgio_read_all_data_type(cg->cgio, section->parface->id,
4756 cgi_adf_datatype(m_type), parface)) {
4757 cg_io_error("cgio_read_all_data_type");
4758 return CG_ERROR;
4759 }
4760 }
4761 else {
4762 if (cgio_read_data_type(cg->cgio, section->parface->id,
4763 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 2, m_dim,
4764 m_start, m_end, m_stride, parface)) {
4765 cg_io_error("cgio_read_data_type");
4766 return CG_ERROR;
4767 }
4768 }
4769 }
4770 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
4771 void* conv_data = NULL;
4772 conv_data = malloc((size_t)(m_dim[0] * 2 * size_of(cgi_adf_datatype(s_type))));
4773 if (conv_data == NULL) {
4774 cgi_error("Error allocating conv_data");
4775 return CG_ERROR;
4776 }
4777 if (section->connect->dim_vals[0] == m_dim[0] &&
4778 section->connect->dim_vals[1] == 2) {
4779 if (cgio_read_all_data_type(cg->cgio, section->parface->id,
4780 section->connect->data_type, conv_data)) {
4781 free(conv_data);
4782 cg_io_error("cgio_read_all_data_type");
4783 return CG_ERROR;
4784 }
4785 }
4786 else {
4787 if (cgio_read_data_type(cg->cgio, section->parface->id,
4788 s_start, s_end, s_stride,
4789 section->connect->data_type,
4790 2, m_dim, m_start, m_end, m_stride, conv_data)) {
4791 free(conv_data);
4792 cg_io_error("cgio_read_data_type");
4793 return CG_ERROR;
4794 }
4795 }
4796 ier = cgi_convert_data(m_dim[0]*2, s_type, conv_data, m_type, parface);
4797 free(conv_data);
4798 if (ier) return CG_ERROR;
4799 }
4800 else {
4801 /* in-situ conversion */
4802 if (section->connect->dim_vals[0] == m_dim[0] &&
4803 section->connect->dim_vals[1] == 2) {
4804 if (cgio_read_all_data_type(cg->cgio, section->parface->id,
4805 cgi_adf_datatype(m_type), parface)) {
4806 cg_io_error("cgio_read_all_data_type");
4807 return CG_ERROR;
4808 }
4809 }
4810 else {
4811 if (cgio_read_data_type(cg->cgio, section->parface->id,
4812 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 2, m_dim,
4813 m_start, m_end, m_stride, parface)) {
4814 cg_io_error("cgio_read_data_type");
4815 return CG_ERROR;
4816 }
4817 }
4818 }
4819 return CG_OK;
4820 }
4821
4822 /*----------------------------------------------------------------------*/
41954823 int cg_poly_elements_partial_read(int file_number, int B, int Z, int S,
41964824 cgsize_t start, cgsize_t end, cgsize_t *elements,
41974825 cgsize_t *connect_offset, cgsize_t *parent_data)
42194847 return CG_ERROR;
42204848 }
42214849
4222 /* if the elements are fixed size, read directly into user memory */
4223 if (IS_FIXED_SIZE(section->el_type)) {
4224 if (section->connect->data == 0 &&
4225 0 == strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
4226
4227 size = cgi_element_data_size(section->el_type, end - start + 1, NULL, NULL);
4228 if (size < 0) return CG_ERROR;
4229 s_start[0] = cgi_element_data_size(section->el_type,
4230 start - section->range[0], NULL, NULL) + 1;
4231 s_end[0] = cgi_element_data_size(section->el_type,
4232 end - section->range[0] + 1, NULL, NULL);
4233 s_stride[0] = 1;
4234 m_start[0] = 1;
4235 m_end[0] = size;
4236 m_stride[0] = 1;
4237 m_dim[0] = size;
4238
4239 if (cgio_read_data_type(cg->cgio, section->connect->id,
4240 s_start, s_end, s_stride, CG_SIZE_DATATYPE, 1, m_dim,
4241 m_start, m_end, m_stride, elements)) {
4242 cg_io_error("cgio_read_data_type");
4243 return CG_ERROR;
4244 }
4245 } else {
4246 /* need to get the elements to compute locations */
4247 if (read_element_data(section)) return CG_ERROR;
4248 data = (cgsize_t *)section->connect->data;
4249 offset = cgi_element_data_size(section->el_type,
4250 start - section->range[0], data, NULL);
4251 size = cgi_element_data_size(section->el_type,
4252 end - start + 1, &data[offset], NULL);
4253 memcpy(elements, &data[offset], (size_t)(size*sizeof(cgsize_t)));
4254 }
4255 }
4256 else {
4257 /* need to get the connectivity offset to compute locations */
4258 if (read_offset_data(section)) return CG_ERROR;
4259
4260 cgsize_t *tmp_connect_offset = (cgsize_t *) section->connect_offset->data;
4261 offset = tmp_connect_offset[start - section->range[0]];
4262 size = tmp_connect_offset[end-section->range[0]+1] - offset;
4263
4264 if (section->connect->data == 0 &&
4265 0 == strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
4850 /* need to get the connectivity offset to compute locations */
4851 if (read_offset_data(section)) return CG_ERROR;
4852
4853 cgsize_t *tmp_connect_offset = (cgsize_t *) section->connect_offset->data;
4854 offset = tmp_connect_offset[start - section->range[0]];
4855 size = tmp_connect_offset[end-section->range[0]+1] - offset;
4856
4857 if (section->connect->data == 0 &&
4858 0 == strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
42664859 s_start[0] = offset+1;
42674860 s_end[0] = tmp_connect_offset[end-section->range[0]+1];
42684861 s_stride[0] = 1;
42714864 m_stride[0] = 1;
42724865 m_dim[0] = size;
42734866
4274 if (cgio_read_data_type(cg->cgio, section->connect->id,
4275 s_start, s_end, s_stride, CG_SIZE_DATATYPE, 1, m_dim,
4276 m_start, m_end, m_stride, elements)) {
4277 cg_io_error("cgio_read_data_type");
4278 return CG_ERROR;
4279 }
4280 } else {
4281 /* need to get the elements */
4282 if (read_element_data(section)) return CG_ERROR;
4283 data = (cgsize_t *)section->connect->data;
4284 memcpy(elements, &data[offset], (size_t)(size*sizeof(cgsize_t)));
4285 }
4286
4287 if (connect_offset == 0) {
4288 cgi_error("missing connectivity offset for reading");
4867 if (cgio_read_data_type(cg->cgio, section->connect->id,
4868 s_start, s_end, s_stride, CG_SIZE_DATATYPE, 1, m_dim,
4869 m_start, m_end, m_stride, elements)) {
4870 cg_io_error("cgio_read_data_type");
42894871 return CG_ERROR;
42904872 }
4291
4292 memcpy(connect_offset, &tmp_connect_offset[start-section->range[0]],(size_t)((end-start+2)*sizeof(cgsize_t)));
4293 offset = connect_offset[0];
4294 for (n=0; n< (end-start+2); n++)
4295 {
4296 connect_offset[n] -= offset;
4297 }
4298 }
4299
4300 if (parent_data && section->parelem && (section->parface ||
4873 } else {
4874 /* need to get the elements */
4875 if (read_element_data(section)) return CG_ERROR;
4876 data = (cgsize_t *)section->connect->data;
4877 memcpy(elements, &data[offset], (size_t)(size*sizeof(cgsize_t)));
4878 }
4879
4880 if (connect_offset == 0) {
4881 cgi_error("missing connectivity offset for reading");
4882 return CG_ERROR;
4883 }
4884
4885 memcpy(connect_offset, &tmp_connect_offset[start-section->range[0]],(size_t)((end-start+2)*sizeof(cgsize_t)));
4886 offset = connect_offset[0];
4887 for (n=0; n< (end-start+2); n++)
4888 {
4889 connect_offset[n] -= offset;
4890 }
4891
4892
4893 if (parent_data && section->parelem && (section->parface ||
43014894 0 == strcmp(section->parelem->name, "ParentData"))) {
43024895 offset = start - section->range[0];
43034896 size = section->range[1] - section->range[0] + 1;
44054998 return CG_OK;
44064999 }
44075000
5001 /*----------------------------------------------------------------------*/
5002 int cg_poly_elements_general_read(int file_number, int B, int Z, int S,
5003 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type,
5004 void* elements, void* connect_offset)
5005 {
5006 cgns_section* section;
5007 cgsize_t size, n;
5008 cgsize_t s_start[1], s_end[1], s_stride[1];
5009 cgsize_t m_start[1], m_end[2], m_stride[1], m_dim[1];
5010 CGNS_ENUMT(DataType_t) s_type;
5011 int ier = CG_OK;
5012
5013 cg = cgi_get_file(file_number);
5014 if (cg == 0) return CG_ERROR;
5015
5016 /* verify input */
5017 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
5018
5019 section = cgi_get_section(cg, B, Z, S);
5020 if (section == 0) return CG_ERROR;
5021
5022 /* If elementDataType provided is not correct fallback to default CG_SIZE_DATATYPE */
5023 if (m_type != CGNS_ENUMV(Integer) &&
5024 m_type != CGNS_ENUMV(LongInteger)) {
5025 cgi_error("Invalid datatype requested for Elements array in section %s: %d",
5026 section->name, m_type);
5027 return CG_ERROR;
5028 }
5029
5030 /* check the requested element range against the stored element range,
5031 * and the validity of the requested range
5032 */
5033 if (start > end || start < section->range[0] || end > section->range[1]) {
5034 cgi_error("Error in requested element data range.");
5035 return CG_ERROR;
5036 }
5037
5038 if (connect_offset == 0) {
5039 cgi_error("missing connectivity offset for reading");
5040 return CG_ERROR;
5041 }
5042
5043 /* need to get the connectivity offset to compute locations */
5044 if (cgi_read_offset_data_type(section->connect_offset->id,
5045 section->connect_offset->data_type,
5046 start - section->range[0] + 1, end - section->range[0] + 2,
5047 cgi_adf_datatype(m_type), connect_offset))
5048 {
5049 return CG_ERROR;
5050 }
5051
5052 if (m_type == CGNS_ENUMV(Integer)) {
5053 int* tmp_connect_offset = (int*)connect_offset;
5054 int offset = tmp_connect_offset[0];
5055 size = tmp_connect_offset[end - start + 1] - offset;
5056 if (size < 1) return CG_ERROR;
5057 s_start[0] = (cgsize_t)(offset + 1);
5058 s_end[0] = (cgsize_t)(tmp_connect_offset[end - start + 1]);
5059 m_end[0] = (cgsize_t)size;
5060 m_dim[0] = (cgsize_t)size;
5061 for (n = 0; n < (end - start + 2); n++)
5062 {
5063 tmp_connect_offset[n] -= offset;
5064 }
5065 }
5066 else if (m_type == CGNS_ENUMV(LongInteger)) {
5067 cglong_t* tmp_connect_offset = (cglong_t*)connect_offset;
5068 cglong_t offset = tmp_connect_offset[0];
5069 cglong_t size_long = tmp_connect_offset[end - start + 1] - offset;
5070 if (size_long < 1) return CG_ERROR;
5071 size = (cgsize_t)size_long;
5072 s_start[0] = (cgsize_t)(offset + 1);
5073 s_end[0] = (cgsize_t)(tmp_connect_offset[end - start + 1]);
5074 m_end[0] = size;
5075 m_dim[0] = size;
5076 for (n = 0; n < (end - start + 2); n++)
5077 {
5078 tmp_connect_offset[n] -= offset;
5079 }
5080 }
5081 s_stride[0] = 1;
5082 m_start[0] = 1;
5083 m_stride[0] = 1;
5084 s_type = cgi_datatype(section->connect->data_type);
5085
5086 if (m_type == s_type) {
5087 /* quick transfer of data if same data types */
5088 if (section->connect->dim_vals[0] == size) {
5089 if (cgio_read_all_data_type(cg->cgio, section->connect->id,
5090 cgi_adf_datatype(m_type), elements)) {
5091 cg_io_error("cgio_read_all_data_type");
5092 return CG_ERROR;
5093 }
5094 }
5095 else {
5096 if (cgio_read_data_type(cg->cgio, section->connect->id,
5097 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 1, m_dim,
5098 m_start, m_end, m_stride, elements)) {
5099 cg_io_error("cgio_read_data_type");
5100 return CG_ERROR;
5101 }
5102 }
5103 }
5104 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
5105 void* conv_data = NULL;
5106 conv_data = malloc((size_t)(size * size_of(cgi_adf_datatype(s_type))));
5107 if (conv_data == NULL) {
5108 cgi_error("Error allocating conv_data");
5109 return CG_ERROR;
5110 }
5111 if (cgio_read_data_type(cg->cgio, section->connect->id,
5112 s_start, s_end, s_stride,
5113 section->connect->data_type,
5114 1, m_dim, m_start, m_end, m_stride, conv_data)) {
5115 free(conv_data);
5116 cg_io_error("cgio_read_data_type");
5117 return CG_ERROR;
5118 }
5119 ier = cgi_convert_data(size, s_type, conv_data, m_type, elements);
5120 free(conv_data);
5121 if (ier) return CG_ERROR;
5122 }
5123 else {
5124 /* in-situ conversion */
5125 if (cgio_read_data_type(cg->cgio, section->connect->id,
5126 s_start, s_end, s_stride, cgi_adf_datatype(m_type), 1, m_dim,
5127 m_start, m_end, m_stride, elements)) {
5128 cg_io_error("cgio_read_data_type");
5129 return CG_ERROR;
5130 }
5131 }
5132 return CG_OK;
5133 }
5134
5135 /*----------------------------------------------------------------------*/
5136
44085137 int cg_elements_partial_write(int file_number, int B, int Z, int S,
4409 cgsize_t start, cgsize_t end,
4410 const cgsize_t *elements)
5138 cgsize_t start, cgsize_t end,
5139 const cgsize_t *elements)
5140 {
5141 if (cg_elements_general_write(file_number, B, Z, S,
5142 start, end, cgi_datatype(CG_SIZE_DATATYPE), elements)) {
5143 return CG_ERROR;
5144 }
5145 return CG_OK;
5146 }
5147
5148 /*---------------------*
5149 * Helper write MACROs
5150 *---------------------*/
5151 #define WRITE_1D_INT_DATA(ARRAY, DATA, STATUS) \
5152 STATUS = CG_OK; \
5153 if (0 == strcmp(ARRAY->data_type, CG_SIZE_DATATYPE)) { \
5154 if (cgio_write_data(cg->cgio, ARRAY->id, \
5155 &s_start, &s_end, &s_stride, 1, &m_dim, \
5156 &m_start, &m_end, &m_stride, DATA)) { \
5157 cg_io_error("cgio_write_data"); \
5158 STATUS = CG_ERROR; \
5159 } \
5160 } \
5161 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2){ \
5162 void *conv_data=NULL; \
5163 conv_data = malloc((size_t)((m_end-m_start+1) \
5164 *size_of(ARRAY->data_type))); \
5165 if (conv_data == NULL) { \
5166 cgi_error("Error allocating conv_data"); \
5167 STATUS = CG_ERROR; \
5168 } \
5169 if ((STATUS == CG_OK) && cgi_convert_data((m_end-m_start+1), \
5170 cgi_datatype(CG_SIZE_DATATYPE), DATA, \
5171 cgi_datatype(ARRAY->data_type), conv_data)) { \
5172 STATUS = CG_ERROR; \
5173 } \
5174 if ((STATUS == CG_OK) && cgio_write_data(cg->cgio, ARRAY->id, \
5175 &s_start, &s_end, &s_stride, 1, &m_dim, \
5176 &m_start, &m_end, &m_stride, conv_data)) { \
5177 cg_io_error("cgio_write_data"); \
5178 STATUS = CG_ERROR; \
5179 } \
5180 if (conv_data) free(conv_data); \
5181 } \
5182 else { \
5183 if (cgio_write_data_type(cg->cgio, ARRAY->id, \
5184 &s_start, &s_end, &s_stride, \
5185 CG_SIZE_DATATYPE, 1, &m_dim, \
5186 &m_start, &m_end, &m_stride, DATA)) { \
5187 cg_io_error("cgio_write_all_data_type"); \
5188 STATUS = CG_ERROR; \
5189 } \
5190 }
5191
5192 #define WRITE_2D_INT_DATA(ARRAY, DATA) \
5193 if (0 == strcmp(ARRAY->data_type, CG_SIZE_DATATYPE)) { \
5194 if (cgio_write_data(cg->cgio, ARRAY->id, \
5195 s_start, s_end, s_stride, 2, m_dim, \
5196 m_start, m_end, m_stride, DATA)) { \
5197 cg_io_error("cgio_write_data"); \
5198 return CG_ERROR; \
5199 } \
5200 } \
5201 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2){ \
5202 void *conv_data; \
5203 conv_data = malloc((size_t)((m_end[0]-m_start[0]+1)*(m_end[1]-m_start[1]+1) \
5204 *size_of(ARRAY->data_type))); \
5205 if (conv_data == NULL) { \
5206 cgi_error("Error allocating conv_data"); \
5207 return CG_ERROR; \
5208 } \
5209 if (cgi_convert_data((m_end[0]-m_start[0]+1)*(m_end[1]-m_start[1]+1), \
5210 cgi_datatype(CG_SIZE_DATATYPE), DATA, \
5211 cgi_datatype(ARRAY->data_type), conv_data)) { \
5212 free(conv_data); \
5213 return CG_ERROR; \
5214 } \
5215 if (cgio_write_data(cg->cgio, ARRAY->id, \
5216 s_start, s_end, s_stride, 2, m_dim, \
5217 m_start, m_end, m_stride, conv_data)) { \
5218 free(conv_data); \
5219 cg_io_error("cgio_write_data"); \
5220 return CG_ERROR; \
5221 } \
5222 free(conv_data); \
5223 } \
5224 else { \
5225 if (cgio_write_data_type(cg->cgio, ARRAY->id, \
5226 s_start, s_end, s_stride, CG_SIZE_DATATYPE, 2, m_dim, \
5227 m_start, m_end, m_stride, DATA)) { \
5228 cg_io_error("cgio_write_all_data_type"); \
5229 return CG_ERROR; \
5230 } \
5231 }
5232
5233 #define WRITE_ALL_INT_DATA(S_DIM, ARRAY, DATA) \
5234 if (ARRAY->data_dim != S_DIM) return CG_ERROR; \
5235 if (0 == strcmp(ARRAY->data_type, CG_SIZE_DATATYPE)) { \
5236 if (cgio_write_all_data(cg->cgio, ARRAY->id, DATA)) { \
5237 cg_io_error("cgio_write_data"); \
5238 return CG_ERROR; \
5239 } \
5240 } \
5241 else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2){ \
5242 void *conv_data; \
5243 cgsize_t conv_size=1; \
5244 for (int ii=0; ii<S_DIM; ii++){ conv_size *= ARRAY->dim_vals[ii]; } \
5245 conv_data = malloc((size_t)(conv_size \
5246 *size_of(ARRAY->data_type))); \
5247 if (conv_data == NULL) { \
5248 cgi_error("Error allocating conv_data"); \
5249 return CG_ERROR; \
5250 } \
5251 if (cgi_convert_data(conv_size, \
5252 cgi_datatype(CG_SIZE_DATATYPE), DATA, \
5253 cgi_datatype(ARRAY->data_type), conv_data)) { \
5254 free(conv_data); \
5255 return CG_ERROR; \
5256 } \
5257 if (cgio_write_all_data(cg->cgio, ARRAY->id, conv_data)) { \
5258 free(conv_data); \
5259 cg_io_error("cgio_write_data"); \
5260 return CG_ERROR; \
5261 } \
5262 free(conv_data); \
5263 } \
5264 else { \
5265 if (cgio_write_all_data_type(cg->cgio, ARRAY->id, \
5266 CG_SIZE_DATATYPE, DATA)) { \
5267 cg_io_error("cgio_write_all_data_type"); \
5268 return CG_ERROR; \
5269 } \
5270 }
5271
5272 #define WRITE_PART_1D_DATA(ID, SIZE, M_TYPE, S_TYPE, DATA, STATUS) \
5273 STATUS = CG_OK; \
5274 if (M_TYPE == S_TYPE) { \
5275 if (cgio_write_data(cg->cgio, ID, \
5276 &s_start, &s_end, &s_stride, 1, &m_dim, \
5277 &m_start, &m_end, &m_stride, DATA)) { \
5278 cg_io_error("cgio_write_data"); \
5279 ier = CG_ERROR; \
5280 } \
5281 } else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) { \
5282 void *conv_data = NULL; \
5283 conv_data = malloc((size_t)(SIZE*size_of(cgi_adf_datatype(S_TYPE)))); \
5284 if (conv_data==NULL){ \
5285 cgi_error("Error allocating conv_data"); \
5286 STATUS = CG_ERROR; \
5287 } \
5288 if ((STATUS == CG_OK) && cgi_convert_data(SIZE, M_TYPE, DATA, S_TYPE, conv_data)) { \
5289 STATUS = CG_ERROR; \
5290 } \
5291 if ((STATUS == CG_OK) && cgio_write_data(cg->cgio, ID, \
5292 &s_start, &s_end, &s_stride, 1, &m_dim, \
5293 &m_start, &m_end, &m_stride, conv_data)) { \
5294 if (STATUS == CG_OK) cg_io_error("cgio_write_data"); \
5295 STATUS = CG_ERROR; \
5296 } \
5297 if (conv_data) free(conv_data); \
5298 } else { \
5299 if (cgio_write_data_type(cg->cgio, ID, \
5300 &s_start, &s_end, &s_stride, \
5301 cgi_adf_datatype(M_TYPE), 1, &m_dim, \
5302 &m_start, &m_end, &m_stride, DATA)) { \
5303 cg_io_error("cgio_write_data"); \
5304 STATUS = CG_ERROR; \
5305 } \
5306 }
5307
5308 int cg_elements_general_write(int file_number, int B, int Z, int S,
5309 cgsize_t start, cgsize_t end, const CGNS_ENUMT(DataType_t) m_type,
5310 const void *elements)
44115311 {
44125312 cgns_section *section;
44135313 CGNS_ENUMT(ElementType_t) type;
44165316 cgsize_t num, size, offset;
44175317 cgsize_t n, j, newsize, ElementDataSize;
44185318 cgsize_t *oldelems, *newelems;
4419 double id;
5319 CGNS_ENUMT(DataType_t) s_type;
5320 cgns_array tmp_range; /* temporary interface for section range */
5321 int ier = CG_OK;
44205322
44215323 /* get file and check mode */
44225324 cg = cgi_get_file(file_number);
44285330 section = cgi_get_section(cg, B, Z, S);
44295331 if (section == 0 || section->connect == 0) return CG_ERROR;
44305332
5333 /* If elementDataType provided is not correct fallback to default CG_SIZE_DATATYPE */
5334 if (m_type != CGNS_ENUMV(Integer) &&
5335 m_type != CGNS_ENUMV(LongInteger)) {
5336 cgi_error("Invalid datatype for Elements array in section %s: %d",
5337 section->name, m_type);
5338 return CG_ERROR;
5339 }
5340 s_type = cgi_datatype(section->connect->data_type);
5341
44315342 num = end - start + 1;
44325343 type = section->el_type;
44335344
44375348 }
44385349
44395350 /* check input range */
4440
44415351 if (num <= 0) {
44425352 cgi_error("Invalid element range for section '%s' elements",
44435353 section->name);
44445354 return CG_ERROR;
44455355 }
4446 if (strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
4447 cgi_error("element data type %s does not match stored value %s",
4448 CG_SIZE_DATATYPE, section->connect->data_type);
4449 return CG_ERROR;
4450 }
44515356
44525357 if (cg->filetype == CG_FILE_ADF2 &&
4453 adf2_check_elems(type, num, elements)) return CG_ERROR;
4454
5358 (type < CGNS_ENUMV(NODE) || type > CGNS_ENUMV(MIXED))) {
5359 cgi_error("Element type %s not supported in ADF2.",
5360 cg_ElementTypeName(type));
5361 return CG_ERROR;
5362 }
44555363
44565364 /* get fill-in element type */
44575365 if (cg_npe(type, &elemsize)) return CG_ERROR;
4458 if (elemsize <= 0) elemsize = 2;
5366 if (elemsize <= 0) return CG_ERROR;
44595367
44605368 offset = start < section->range[0] ? section->range[0] - start : 0;
44615369 oldsize = section->range[1] - section->range[0] + 1;
44625370
4463 ElementDataSize = cgi_element_data_size(type, end - start + 1,
4464 elements, NULL);
5371 ElementDataSize = elemsize *(end - start + 1);
44655372 if (ElementDataSize < 0) return CG_ERROR;
4466
44675373
44685374 /* can we just use the user's data ? */
44695375 if (start >= section->range[0] && end <= section->range[1] &&
44785384 m_end = ElementDataSize;
44795385 m_dim = ElementDataSize;
44805386 m_stride = 1;
4481
4482 if (cgio_write_data(cg->cgio, section->connect->id,
4483 &s_start, &s_end, &s_stride, 1, &m_dim,
4484 &m_start, &m_end, &m_stride, elements)) {
4485 cg_io_error("cgio_write_data");
5387 /* take care of data conversion */
5388 WRITE_PART_1D_DATA(section->connect->id, ElementDataSize, m_type, s_type, elements, ier)
5389 if (ier) {
44865390 return CG_ERROR;
44875391 }
44885392 }
45975501 if (end > section->range[1]) section->range[1] = end;
45985502
45995503 /* update ElementRange */
4600
4601 if (cgio_get_node_id(cg->cgio, section->id, "ElementRange", &id)) {
5504 cgns_array *sec_range = &tmp_range;
5505 sec_range->data_dim = 1;
5506 sec_range->dim_vals[0] = 2;
5507 if (cgio_get_node_id(cg->cgio, section->id, "ElementRange", &(sec_range->id))) {
46025508 cg_io_error("cgio_get_node_id");
46035509 return CG_ERROR;
46045510 }
4605 if (cgio_write_all_data(cg->cgio, id, section->range)) {
4606 cg_io_error("cgio_write_all_data");
5511 if (cgio_get_data_type(cg->cgio, sec_range->id, sec_range->data_type)){
5512 cg_io_error("cgio_get_data_type");
46075513 return CG_ERROR;
46085514 }
5515 WRITE_ALL_INT_DATA(1, sec_range, section->range);
46095516
46105517 /* update ElementConnectivity */
46115518
46155522 cg_io_error("cgio_set_dimensions");
46165523 return CG_ERROR;
46175524 }
4618
4619 if (cgio_write_all_data(cg->cgio, section->connect->id, newelems)) {
4620 cg_io_error("cgio_write_all_data");
4621 return CG_ERROR;
4622 }
5525 WRITE_ALL_INT_DATA(1, section->connect, newelems);
46235526 }
46245527
46255528 /* update the parent data array if it exists */
46265529
46275530 newsize = section->range[1] - section->range[0] + 1;
46285531
4629 if (section->parelem && (section->parface ||
4630 0 == strcmp(section->parelem->name, "ParentData")) &&
5532 if (section->parelem && 0 == strcmp(section->parelem->name, "ParentData")) {
5533 cgi_error("Deprecated ParentData node, impossible to do partial writing");
5534 return CG_ERROR;
5535 }
5536
5537 if (section->parelem && section->parface &&
46315538 newsize != section->parelem->dim_vals[0]) {
46325539 int cnt = section->parelem->dim_vals[1];
46335540
46645571 cg_io_error("cgio_set_dimensions");
46655572 return CG_ERROR;
46665573 }
4667 if (cgio_write_all_data(cg->cgio, section->parelem->id, newelems)) {
4668 cg_io_error("cgio_write_all_data");
4669 return CG_ERROR;
4670 }
4671
4672 if (0 == strcmp(section->parelem->name, "ParentData"))
4673 return CG_OK;
5574 WRITE_ALL_INT_DATA(2, section->parelem, newelems)
46745575
46755576 for (n = 0; n < 2*newsize; n++)
46765577 newelems[n] = 0;
46895590 free(section->parface->data);
46905591 section->parface->data = newelems;
46915592 section->parface->dim_vals[0] = newsize;
5593 section->parelem->data = NULL;
46925594
46935595 if (cgio_set_dimensions(cg->cgio, section->parface->id,
4694 section->parface->data_type, 2,
4695 section->parface->dim_vals)) {
5596 section->parface->data_type, 2,
5597 section->parface->dim_vals)) {
46965598 cg_io_error("cgio_set_dimensions");
46975599 return CG_ERROR;
46985600 }
4699 if (cgio_write_all_data(cg->cgio, section->parface->id, newelems)) {
4700 cg_io_error("cgio_write_all_data");
4701 return CG_ERROR;
4702 }
4703 }
4704
5601 WRITE_ALL_INT_DATA(2, section->parface, newelems)
5602 free_parent_data(section);
5603 }
47055604 return CG_OK;
47065605 }
47075606
47085607 int cg_poly_elements_partial_write(int file_number, int B, int Z, int S,
4709 cgsize_t start, cgsize_t end,
4710 const cgsize_t *elements, const cgsize_t *connect_offset)
5608 cgsize_t start, cgsize_t end,
5609 const cgsize_t *elements, const cgsize_t *connect_offset)
5610 {
5611 if (cg_poly_elements_general_write(file_number, B, Z, S,
5612 start, end, cgi_datatype(CG_SIZE_DATATYPE),
5613 elements, connect_offset)) {
5614 return CG_ERROR;
5615 }
5616 return CG_OK;
5617 }
5618
5619 int cg_poly_elements_general_write(int file_number, int B, int Z, int S,
5620 cgsize_t start, cgsize_t end, const CGNS_ENUMT(DataType_t) m_type,
5621 const void *elements, const void *input_connect_offset)
47115622 {
47125623 cgns_section *section;
47135624 CGNS_ENUMT(ElementType_t) type;
4714 int i, elemsize;
4715 cgsize_t oldsize;
5625 int i, elemsize=2;
5626 cgsize_t s_range_size;
47165627 cgsize_t num, size, offset;
47175628 cgsize_t n, j, newsize, ElementDataSize;
47185629 cgsize_t *oldelems, *newelems;
4719 double id;
5630 cgsize_t * alloc_offset=0; /* handle offset datatype conversion */
5631 const cgsize_t *connect_offset; /* read only to a fake input mapping to alloc_offset or actual input */
5632 cgns_array tmp_range;
5633 cgsize_t s_conn_size, m_conn_size;
5634 cgsize_t *section_offset;
5635 int ier;
5636 int do_it_in_memory = 1;
5637 CGNS_ENUMT(DataType_t) s_type;
47205638
47215639 /* get file and check mode */
47225640 cg = cgi_get_file(file_number);
47285646 section = cgi_get_section(cg, B, Z, S);
47295647 if (section == 0 || section->connect == 0) return CG_ERROR;
47305648
5649 /* elementDataType provided is not correct */
5650 if (m_type != CGNS_ENUMV(Integer) &&
5651 m_type != CGNS_ENUMV(LongInteger)) {
5652 cgi_error("Invalid datatype for Elements array in section %s: %d",
5653 section->name, m_type);
5654 return CG_ERROR;
5655 }
5656 s_type = cgi_datatype(section->connect->data_type);
5657
47315658 num = end - start + 1;
47325659 type = section->el_type;
47335660
47435670 section->name);
47445671 return CG_ERROR;
47455672 }
4746 if (strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
4747 cgi_error("element data type %s does not match stored value %s",
4748 CG_SIZE_DATATYPE, section->connect->data_type);
4749 return CG_ERROR;
4750 }
4751
4752 if (cg->filetype == CG_FILE_ADF2 &&
4753 adf2_check_elems(type, num, elements)) return CG_ERROR;
4754
4755
4756 /* get fill-in element type */
4757 if (cg_npe(type, &elemsize)) return CG_ERROR;
4758 if (elemsize <= 0) elemsize = 2;
4759
4760 offset = start < section->range[0] ? section->range[0] - start : 0;
4761 oldsize = section->range[1] - section->range[0] + 1;
4762
4763 ElementDataSize = cgi_element_data_size(type, end - start + 1,
4764 elements, connect_offset);
4765 if (ElementDataSize < 0) return CG_ERROR;
5673
5674 if (cg->filetype == CG_FILE_ADF2) {
5675 if (m_type != cgi_datatype(CG_SIZE_DATATYPE)) return CG_ERROR;
5676 if (adf2_check_elems(type, num, elements)) return CG_ERROR;
5677 }
47665678
47675679 /* NOT FIXED SIZE: NGON_n, NFACE_n, MIXED */
4768 if (connect_offset == NULL){
5680 if (input_connect_offset == NULL){
47695681 cgi_error("element offsets not provided for partial write\n");
47705682 return CG_ERROR;
47715683 }
47745686 cgi_error("missing offsets in section\n");
47755687 return CG_ERROR;
47765688 }
4777
4778 if (strcmp(CG_SIZE_DATATYPE, section->connect_offset->data_type)) {
4779 cgi_error("element offsets data type %s does not match stored value %s",
4780 CG_SIZE_DATATYPE, section->connect_offset->data_type);
4781 return CG_ERROR;
4782 }
4783
4784 if (read_offset_data(section)) return CG_ERROR;
4785
4786 cgsize_t s_conn_size, m_conn_size;
4787 cgsize_t *section_offset = section->connect_offset->data;
4788 int do_it_in_memory = 1;
4789 if (start >= section->range[0] && end <= section->range[1]) {
4790 s_conn_size = section_offset[end - section->range[0] + 1] - section_offset[start - section->range[0]];
5689 /* check data type coherency */
5690 if (strcmp(section->connect->data_type, section->connect_offset->data_type)) {
5691 cgi_error("stored element offsets data type %s does not match elements value %s",
5692 section->connect_offset->data_type, section->connect->data_type);
5693 return CG_ERROR;
5694 }
5695
5696 elemsize = 2;
5697 offset = start < section->range[0] ? section->range[0] - start : 0;
5698 /* current range size in file system */
5699 s_range_size = section->range[1] - section->range[0] + 1;
5700
5701 /* Handle type of input_connect_offset to get a cgsize_t offset array
5702 * The input connect offset is assumed to be of same type as elements
5703 */
5704 if (m_type != cgi_datatype(CG_SIZE_DATATYPE)) {
5705 alloc_offset = (cgsize_t *) malloc((size_t)(num+1)*sizeof(cgsize_t));
5706 if (alloc_offset == NULL){
5707 return CG_ERROR;
5708 }
5709 cgi_convert_data(num+1, m_type, input_connect_offset, cgi_datatype(CG_SIZE_DATATYPE), alloc_offset);
5710 connect_offset = (const cgsize_t *)alloc_offset;
5711 } else {
5712 connect_offset = (const cgsize_t *)input_connect_offset;
5713 }
5714 ElementDataSize = connect_offset[end - start + 1] - connect_offset[0];
5715 if (ElementDataSize < 0){
5716 if (alloc_offset) free(alloc_offset);
5717 return CG_ERROR;
5718 }
5719
5720 if (read_offset_data(section)) {
5721 if (alloc_offset) free(alloc_offset);
5722 return CG_ERROR;
5723 }
5724
5725
5726 section_offset = section->connect_offset->data;
5727 do_it_in_memory = 1;
5728
5729 if (start >= section->range[0] && end <= section->range[1] &&
5730 section->connect->data == 0) {
5731 /* determine connectivity size in memory to compare with file system */
47915732 m_conn_size = connect_offset[end - start + 1] - connect_offset[0];
4792
4793 /* use user data */
4794 if (section->connect->data == 0 && (s_conn_size == m_conn_size)){
5733 if (section_offset) {
5734 s_conn_size = section_offset[end - section->range[0] + 1] - section_offset[start - section->range[0]];
5735 } else {
5736 s_conn_size = -1;
5737 }
5738
5739 /* cases when to directly use user data */
5740 if (s_conn_size == m_conn_size){
47955741 /* connectivity is of same size */
47965742 cgsize_t s_start, s_end, s_stride;
47975743 cgsize_t m_start, m_end, m_stride, m_dim;
47985744 cgsize_t ii;
47995745
4800 s_start = section_offset[start - section->range[0]];
4801 s_end = section_offset[end - section->range[0] + 1] - 1;
5746 s_start = section_offset[start - section->range[0]] + 1;
5747 s_end = section_offset[end - section->range[0] + 1];
48025748 s_stride = 1;
48035749 m_start = 1;
48045750 m_end = m_conn_size;
48055751 m_dim = m_conn_size;
48065752 m_stride = 1;
4807
4808 if (cgio_write_data(cg->cgio, section->connect->id,
4809 &s_start, &s_end, &s_stride, 1, &m_dim,
4810 &m_start, &m_end, &m_stride, elements)) {
4811 cg_io_error("cgio_write_data");
5753 WRITE_PART_1D_DATA(section->connect->id, ElementDataSize, m_type, s_type, elements, ier)
5754 if (ier) {
5755 if (alloc_offset) free(alloc_offset);
48125756 return CG_ERROR;
48135757 }
4814
48155758 /* update offset */
4816 /* memcpy(&section_offset[start-section->range[0]], connect_offset, (size_t)(end-start+1)*sizeof(cgsize_t)); */
48175759 j = start-section->range[0];
48185760 for (ii=0; ii<end-start+1; ii++) {
48195761 section_offset[j+1] = (connect_offset[ii+1] - connect_offset[ii]) + section_offset[j];
48205762 j++;
48215763 }
4822
4823 if (cgio_write_all_data(cg->cgio, section->connect_offset->id, section->connect_offset)) {
4824 cg_io_error("cgio_write_all_data");
5764 if (alloc_offset) free(alloc_offset);
5765 /* write new offset, handle data conversion */
5766 WRITE_ALL_INT_DATA(1, section->connect_offset, section_offset);
5767 do_it_in_memory = 0;
5768 }
5769 else if ((section_offset[s_range_size]-section_offset[0]) + m_conn_size - s_conn_size <= section->connect->dim_vals[0]){
5770 /* connectivity size can fit in the reserved file size */
5771 cgsize_t start_trail_reading;
5772 cgsize_t s_start, s_end, s_stride;
5773 cgsize_t m_start, m_end, m_stride, m_dim;
5774 cgsize_t ii;
5775 cgsize_t m_trail_size = 0;
5776 cgsize_t *trail_elements = NULL;
5777
5778 /* Reading trailing elements location */
5779 start_trail_reading = end-section->range[0]+1;
5780 m_trail_size = section_offset[s_range_size] - section_offset[start_trail_reading];
5781
5782 if (m_trail_size > 0){
5783 /* partial load trailing elements that will be relocated */
5784 trail_elements = (cgsize_t *) malloc((size_t)m_trail_size * sizeof(cgsize_t));
5785 if (trail_elements == NULL) {
5786 if (alloc_offset) free(alloc_offset);
5787 cgi_error("Error allocating trail_elements");
5788 return CG_ERROR;
5789 }
5790 /* read them ... */
5791 s_start = section_offset[start_trail_reading]+1;
5792 s_end = section_offset[s_range_size];
5793 s_stride = 1;
5794 m_start = 1;
5795 m_end = m_trail_size;
5796 m_stride = 1;
5797 m_dim = m_trail_size;
5798 ier = CG_OK;
5799 if (0 == strcmp(CG_SIZE_DATATYPE, section->connect->data_type)) {
5800 if (cgio_read_data_type(cg->cgio, section->connect->id,
5801 &s_start, &s_end, &s_stride, CG_SIZE_DATATYPE, 1, &m_dim,
5802 &m_start, &m_end, &m_stride, trail_elements)) {
5803 cg_io_error("cgio_read_data_type");
5804 ier = CG_ERROR;
5805 }
5806 } else if (cg->filetype == CGIO_FILE_ADF || cg->filetype == CGIO_FILE_ADF2) {
5807 void *conv_data = NULL;
5808 conv_data = malloc((size_t)(m_trail_size*size_of(section->connect->data_type)));
5809 if (conv_data == NULL) {
5810 cgi_error("Error allocating conv_data");
5811 ier = CG_ERROR;
5812 }
5813 if ((ier == CG_OK) && cgio_read_data_type(cg->cgio, section->connect->id,
5814 &s_start, &s_end, &s_stride, section->connect->data_type, 1, &m_dim,
5815 &m_start, &m_end, &m_stride, conv_data)){
5816
5817 cg_io_error("cgio_read_data_type");
5818 ier = CG_ERROR;
5819 }
5820 if ((ier == CG_OK) && cgi_convert_data(m_trail_size, cgi_datatype(section->connect->data_type), conv_data,
5821 cgi_datatype(CG_SIZE_DATATYPE), trail_elements)) {
5822 ier = CG_ERROR;
5823 }
5824 if (conv_data) free(conv_data);
5825 } else {
5826 if (cgio_read_data_type(cg->cgio, section->connect->id,
5827 &s_start, &s_end, &s_stride, CG_SIZE_DATATYPE, 1, &m_dim,
5828 &m_start, &m_end, &m_stride, trail_elements)) {
5829 ier = CG_ERROR;
5830 }
5831 }
5832 if (ier){
5833 if (alloc_offset) free(alloc_offset);
5834 free(trail_elements);
5835 return CG_ERROR;
5836 }
5837 }
5838 /* now write new data */
5839 s_start = section_offset[start - section->range[0]]+1;
5840 s_end = section_offset[start - section->range[0]]+m_conn_size;
5841 s_stride = 1;
5842 m_start = 1;
5843 m_end = m_conn_size;
5844 m_dim = m_conn_size;
5845 m_stride = 1;
5846 /* handle different data_type in files */
5847 WRITE_PART_1D_DATA(section->connect->id, m_conn_size, m_type, s_type, elements, ier)
5848 if (ier){
5849 if (alloc_offset) free(alloc_offset);
5850 if (trail_elements) free(trail_elements);
48255851 return CG_ERROR;
48265852 }
5853 /* append the trailing elements */
5854 if (m_trail_size > 0){
5855 s_start = section_offset[start - section->range[0]]+ m_conn_size + 1;
5856 s_end = section_offset[start - section->range[0]]+ m_conn_size + m_trail_size;
5857 s_stride = 1;
5858 m_start = 1;
5859 m_end = m_trail_size;
5860 m_dim = m_trail_size;
5861 m_stride = 1;
5862
5863 /* writing, handle different data_type in files */
5864 WRITE_1D_INT_DATA(section->connect, trail_elements, ier)
5865 free(trail_elements);
5866 if (ier) {
5867 if (alloc_offset) free(alloc_offset);
5868 return CG_ERROR;
5869 }
5870 }
5871 /* update offset */
5872 j = start-section->range[0];
5873 for (ii=0; ii<end-start+1; ii++) {
5874 section_offset[j+1] = (connect_offset[ii+1] - connect_offset[ii]) + section_offset[j];
5875 j++;
5876 }
5877 for (ii=0; ii< (s_range_size-start_trail_reading); ii++) {
5878 section_offset[j+1] += (m_conn_size-s_conn_size);
5879 j++;
5880 }
5881 if (alloc_offset) free(alloc_offset);
5882 /* handle writing of different file data type */
5883 WRITE_ALL_INT_DATA(1, section->connect_offset, section_offset);
48275884 do_it_in_memory = 0;
48285885 }
48295886 }
48325889 cgsize_t *newoffsets;
48335890 cgsize_t elemcount;
48345891 cgsize_t ii;
5892 cgsize_t s_conn_size;
5893 if (section_offset) {
5894 s_conn_size = section_offset[s_range_size] - section_offset[0];
5895 } else {
5896 s_conn_size = 0;
5897 }
48355898
48365899 /* got to do it in memory */
4837 if (read_element_data(section)) return CG_ERROR;
5900 if (read_element_data(section)){
5901 if (alloc_offset) free(alloc_offset);
5902 return CG_ERROR;
5903 }
48385904
48395905 oldelems = (cgsize_t *)section->connect->data;
4840 oldsize = section->connect->dim_vals[0];
48415906 newsize = ElementDataSize;
48425907 elemcount = end-start+1;
48435908
48445909 if (end < section->range[0]) {
4845 newsize += oldsize;
5910 newsize += s_conn_size;
48465911 elemcount += (section->range[1]-section->range[0]+1);
48475912 num = section->range[0] - end - 1;
48485913 if (num > 0){
48505915 elemcount += num;
48515916 }
48525917 } else if (start > section->range[1]) {
4853 newsize += oldsize;
5918 newsize += s_conn_size;
48545919 elemcount += (section->range[1]-section->range[0]+1);
48555920 num = start - section->range[1] - 1;
48565921 if (num > 0){
48765941 }
48775942 /* create new element connectivity array and offsets*/
48785943
4879 newelems = (cgsize_t *) malloc ((size_t)(newsize * sizeof(cgsize_t)));
5944 newelems = (cgsize_t *) malloc (((size_t)newsize) * sizeof(cgsize_t));
48805945 if (NULL == newelems) {
5946 if (alloc_offset) free(alloc_offset);
48815947 cgi_error("Error allocating new connectivity data");
48825948 return CG_ERROR;
48835949 }
4884 newoffsets = (cgsize_t *) malloc((size_t)((elemcount+1) * sizeof(cgsize_t)));
5950 newoffsets = (cgsize_t *) malloc(((size_t)(elemcount+1)) * sizeof(cgsize_t));
48855951 if (NULL == newoffsets) {
48865952 cgi_error("Error allocating new connectivity offset data");
5953 if (alloc_offset) free(alloc_offset);
48875954 free(newelems);
48885955 return CG_ERROR;
48895956 }
48915958 newoffsets[0] = 0;
48925959 n = 0; j = 0;
48935960 if (start <= section->range[0]) {
4894 memcpy(newelems, elements, (size_t)(ElementDataSize*sizeof(cgsize_t)));
4895 memcpy(newoffsets, connect_offset, (size_t)((end-start+2)*sizeof(cgsize_t)));
5961 if (m_type == cgi_datatype(CG_SIZE_DATATYPE)){
5962 memcpy(newelems, elements, ((size_t)ElementDataSize)*sizeof(cgsize_t));
5963 }
5964 else {
5965 cgi_convert_data(ElementDataSize, m_type, elements, cgi_datatype(CG_SIZE_DATATYPE), newelems);
5966 }
5967 memcpy(newoffsets, connect_offset, ((size_t)(end-start+2))*sizeof(cgsize_t));
48965968 j += (end-start+1);
48975969 n += ElementDataSize;
48985970 if (end < section->range[0]) {
49045976 newelems[n++] = 0;
49055977 newoffsets[j+1] = newoffsets[j] + 2;
49065978 j++;
4907 n++;
49085979 }
4909
4910 memcpy(&newelems[n], oldelems, (size_t)(oldsize*sizeof(cgsize_t)));
4911 n += oldsize;
5980 memcpy(&newelems[n], oldelems, ((size_t)s_conn_size)*sizeof(cgsize_t));
5981 n += s_conn_size;
49125982 for (ii=0; ii<(section->range[1]-section->range[0]+1); ii++) {
49135983 newoffsets[j+1] = (section_offset[ii+1] - section_offset[ii]) + newoffsets[j];
49145984 j++;
49195989 if (offset < 0) {
49205990 free(newelems);
49215991 free(newoffsets);
5992 if (alloc_offset) free(alloc_offset);
49225993 return CG_ERROR;
49235994 }
49245995 size = section_offset[section->range[1]-section->range[0]+1] - section_offset[num];
4925 memcpy(&newelems[n], &oldelems[offset], (size_t)(size*sizeof(cgsize_t)));
5996 memcpy(&newelems[n], &oldelems[offset], ((size_t)size)*sizeof(cgsize_t));
49265997 n += size;
49275998 for (ii=num; ii<(section->range[1]-section->range[0]+1); ii++) {
49285999 newoffsets[j+1] = (section_offset[ii+1] - section_offset[ii]) + newoffsets[j];
49306001 }
49316002 }
49326003 } else if (start > section->range[1]) {
4933 memcpy(newelems, oldelems, (size_t)(oldsize*sizeof(cgsize_t)));
4934 memcpy(newoffsets, section_offset, (size_t)((section->range[1]-section->range[0]+2)*sizeof(cgsize_t)));
4935 n += oldsize;
6004 memcpy(newelems, oldelems, ((size_t)s_conn_size)*sizeof(cgsize_t));
6005 memcpy(newoffsets, section_offset, ((size_t)(section->range[1]-section->range[0]+2))*sizeof(cgsize_t));
6006 n += s_conn_size;
49366007 j += section->range[1]-section->range[0]+1;
49376008 num = start - section->range[1] - 1;
49386009
49426013 newelems[n++] = 0;
49436014 newoffsets[j+1] = newoffsets[j] + 2;
49446015 j++;
4945 n++;
49466016 }
4947 memcpy(&newelems[n], elements, (size_t)(ElementDataSize*sizeof(cgsize_t)));
6017 if (m_type == cgi_datatype(CG_SIZE_DATATYPE)){
6018 memcpy(&newelems[n], elements, ((size_t)ElementDataSize)*sizeof(cgsize_t));
6019 }
6020 else {
6021 cgi_convert_data(ElementDataSize, m_type, elements, cgi_datatype(CG_SIZE_DATATYPE), &newelems[n]);
6022 }
6023 memcpy(&newelems[n], elements, ((size_t)ElementDataSize)*sizeof(cgsize_t));
6024
49486025 n += ElementDataSize;
49496026 for (ii=0; ii<(end-start+1); ii++) {
49506027 newoffsets[j+1] = (connect_offset[ii+1] - connect_offset[ii]) + newoffsets[j];
49536030 } else {
49546031 num = start - section->range[0];
49556032 size = section_offset[num];
4956 memcpy(newelems, oldelems, (size_t)(size*sizeof(cgsize_t)));
6033 memcpy(newelems, oldelems, ((size_t)size)*sizeof(cgsize_t));
49576034 memcpy(newoffsets, section_offset, (size_t)(num+1)*sizeof(cgsize_t));
49586035 n += size;
49596036 j += num;
4960 memcpy(&newelems[n], elements, (size_t)(ElementDataSize*sizeof(cgsize_t)));
6037 if (m_type == cgi_datatype(CG_SIZE_DATATYPE)){
6038 memcpy(&newelems[n], elements, ((size_t)ElementDataSize)*sizeof(cgsize_t));
6039 }
6040 else {
6041 cgi_convert_data(ElementDataSize, m_type, elements, cgi_datatype(CG_SIZE_DATATYPE), &newelems[n]);
6042 }
49616043 for (ii=0; ii<(end-start+1); ii++) {
49626044 newoffsets[j+1] = (connect_offset[ii+1] - connect_offset[ii]) + newoffsets[j];
49636045 j++;
49696051 if (offset < 0) {
49706052 free(newelems);
49716053 free(newoffsets);
6054 if (alloc_offset) free(alloc_offset);
49726055 return CG_ERROR;
49736056 }
4974 size = oldsize - offset;
4975 memcpy(&newelems[n], &oldelems[offset], (size_t)(size*sizeof(cgsize_t)));
6057 size = s_conn_size - offset;
6058 memcpy(&newelems[n], &oldelems[offset], ((size_t)size)*sizeof(cgsize_t));
49766059 n += size;
49776060 for (ii=num; ii<(section->range[1]-section->range[0]+1); ii++) {
49786061 newoffsets[j+1] = (section_offset[ii+1] - section_offset[ii]) + newoffsets[j];
49806063 }
49816064 }
49826065 }
6066 if (alloc_offset) free(alloc_offset);
49836067 if (n != newsize) {
49846068 free(newelems);
49856069 free(newoffsets);
50006084 if (end > section->range[1]) section->range[1] = end;
50016085
50026086 /* update ElementRange */
5003
5004 if (cgio_get_node_id(cg->cgio, section->id, "ElementRange", &id)) {
6087 cgns_array *sec_range = &tmp_range;
6088 sec_range->data_dim = 1;
6089 sec_range->dim_vals[0] = 2;
6090 sec_range->data = section->range;
6091 if (cgio_get_node_id(cg->cgio, section->id, "ElementRange", &(sec_range->id))) {
50056092 cg_io_error("cgio_get_node_id");
50066093 return CG_ERROR;
50076094 }
5008 if (cgio_write_all_data(cg->cgio, id, section->range)) {
5009 cg_io_error("cgio_write_all_data");
6095 if (cgio_get_data_type(cg->cgio, sec_range->id, sec_range->data_type)){
6096 cg_io_error("cgio_get_data_type");
50106097 return CG_ERROR;
50116098 }
6099 WRITE_ALL_INT_DATA(1, sec_range, section->range);
50126100
50136101 /* update Offsets */
5014
50156102 if (cgio_set_dimensions(cg->cgio, section->connect_offset->id,
50166103 section->connect_offset->data_type, 1,
50176104 section->connect_offset->dim_vals)) {
50186105 cg_io_error("cgio_set_dimensions");
50196106 return CG_ERROR;
50206107 }
5021
5022 if (cgio_write_all_data(cg->cgio, section->connect_offset->id, newoffsets)) {
5023 cg_io_error("cgio_write_all_data");
5024 return CG_ERROR;
5025 }
6108 /* take care of data conversion */
6109 WRITE_ALL_INT_DATA(1, section->connect_offset, newoffsets);
50266110
50276111 /* update ElementConnectivity */
50286112
50326116 cg_io_error("cgio_set_dimensions");
50336117 return CG_ERROR;
50346118 }
5035
5036 if (cgio_write_all_data(cg->cgio, section->connect->id, newelems)) {
5037 cg_io_error("cgio_write_all_data");
5038 return CG_ERROR;
5039 }
5040 }
5041
5042 /* update the parent data array if it exists */
6119 /* take care of data conversion */
6120 WRITE_ALL_INT_DATA(1, section->connect, newelems);
6121 }
6122
6123 /* update the parent element/face data array if it exists */
50436124
50446125 newsize = section->range[1] - section->range[0] + 1;
50456126
5046 if (section->parelem && (section->parface ||
5047 0 == strcmp(section->parelem->name, "ParentData")) &&
6127 if (section->parelem && 0 == strcmp(section->parelem->name, "ParentData")) {
6128 cgi_error("Deprecated ParentData node, impossible to do partial writing");
6129 return CG_ERROR;
6130 }
6131
6132 if (section->parelem && section->parface &&
50486133 newsize != section->parelem->dim_vals[0]) {
50496134 int cnt = section->parelem->dim_vals[1];
50506135
50516136 if (read_parent_data(section)) return CG_ERROR;
50526137
5053 newelems = (cgsize_t *)malloc((size_t)(cnt * newsize * sizeof(cgsize_t)));
6138 newelems = (cgsize_t *)malloc((size_t)(cnt * newsize) * sizeof(cgsize_t));
50546139 if (NULL == newelems) {
50556140 cgi_error("Error allocating new ParentElements data");
50566141 return CG_ERROR;
50626147 oldelems = (cgsize_t *)section->parelem->data;
50636148 for (num = 0, i = 0; i < cnt; i++) {
50646149 j = i * newsize + offset;
5065 for (n = 0; n < oldsize; n++)
6150 for (n = 0; n < s_range_size; n++)
50666151 newelems[j++] = oldelems[num++];
50676152 }
50686153 for (i = 0; i < cnt; i++) {
50816166 cg_io_error("cgio_set_dimensions");
50826167 return CG_ERROR;
50836168 }
5084 if (cgio_write_all_data(cg->cgio, section->parelem->id, newelems)) {
5085 cg_io_error("cgio_write_all_data");
5086 return CG_ERROR;
5087 }
5088
5089 if (0 == strcmp(section->parelem->name, "ParentData"))
5090 return CG_OK;
5091
5092 for (n = 0; n < 2*newsize; n++)
5093 newelems[n] = 0;
6169 WRITE_ALL_INT_DATA(2, section->parelem, newelems)
6170
6171 for (n = 0; n < 2*newsize; n++)
6172 newelems[n] = 0;
50946173 oldelems = (cgsize_t *)section->parface->data;
50956174 for (num = 0, i = 0; i < 2; i++) {
50966175 j = i * newsize + offset;
5097 for (n = 0; n < oldsize; n++)
6176 for (n = 0; n < s_range_size; n++)
50986177 newelems[j++] = oldelems[num++];
50996178 }
51006179 for (i = 0; i < 2; i++) {
51066185 free(section->parface->data);
51076186 section->parface->data = newelems;
51086187 section->parface->dim_vals[0] = newsize;
6188 section->parelem->data = NULL;
51096189
51106190 if (cgio_set_dimensions(cg->cgio, section->parface->id,
5111 section->parface->data_type, 2,
5112 section->parface->dim_vals)) {
6191 section->parface->data_type, 2,
6192 section->parface->dim_vals)) {
51136193 cg_io_error("cgio_set_dimensions");
51146194 return CG_ERROR;
51156195 }
5116 if (cgio_write_all_data(cg->cgio, section->parface->id, newelems)) {
5117 cg_io_error("cgio_write_all_data");
5118 return CG_ERROR;
5119 }
6196 WRITE_ALL_INT_DATA(2, section->parface, newelems)
6197 free_parent_data(section);
51206198 }
51216199
51226200 return CG_OK;
51556233 section->parelem = CGNS_NEW(cgns_array, 1);
51566234 }
51576235
5158 strcpy(section->parelem->data_type, CG_SIZE_DATATYPE);
6236 if (section->connect) {
6237 strcpy(section->parelem->data_type, section->connect->data_type);
6238 }
6239 else {
6240 strcpy(section->parelem->data_type, CG_SIZE_DATATYPE);
6241 }
6242
51596243 section->parelem->data_dim =2;
51606244 section->parelem->dim_vals[0]=num;
51616245 if (cg->filetype == CG_FILE_ADF2) {
51676251 }
51686252
51696253 if (cgi_write_array(section->id, section->parelem)) return CG_ERROR;
5170 if (cgio_write_all_data(cg->cgio, section->parelem->id, parent_data)) {
5171 cg_io_error("cgio_write_all_data");
5172 return CG_ERROR;
5173 }
6254
6255 WRITE_ALL_INT_DATA(2, section->parelem, parent_data)
51746256
51756257 if (cg->filetype == CG_FILE_ADF2) {
51766258 if (section->parface) {
51976279 section->parface = CGNS_NEW(cgns_array, 1);
51986280 }
51996281
5200 strcpy(section->parface->data_type, CG_SIZE_DATATYPE);
6282 strcpy(section->parface->data_type, section->parelem->data_type);
52016283 strcpy(section->parface->name, "ParentElementsPosition");
52026284 section->parface->data_dim =2;
52036285 section->parface->dim_vals[0]=num;
52046286 section->parface->dim_vals[1]=2;
52056287
52066288 if (cgi_write_array(section->id, section->parface)) return CG_ERROR;
5207 if (cgio_write_all_data(cg->cgio, section->parface->id, &parent_data[num<<1])) {
5208 cg_io_error("cgio_write_all_data");
5209 return CG_ERROR;
5210 }
5211 return CG_OK;
5212 }
6289
6290 WRITE_ALL_INT_DATA(2, section->parface, &parent_data[num<<1])
6291
6292 return CG_OK;
6293 }
6294
6295
52136296
52146297 int cg_parent_data_partial_write(int file_number, int B, int Z, int S,
52156298 cgsize_t start, cgsize_t end,
52166299 const cgsize_t *parent_data)
52176300 {
52186301 cgns_section *section;
5219 cgsize_t *data, i, j, n;
5220 cgsize_t num, size, offset;
6302 cgsize_t size;
52216303
52226304 /* get file and check mode */
52236305 cg = cgi_get_file(file_number);
52376319 }
52386320
52396321 size = section->range[1] - section->range[0] + 1;
5240 offset = start - section->range[0];
52416322
52426323 /* create the parent data if it doesn't exist already */
52436324
52446325 if (section->parelem == 0) {
52456326 section->parelem = CGNS_NEW(cgns_array, 1);
5246 strcpy(section->parelem->data_type, CG_SIZE_DATATYPE);
6327 if (section->connect) {
6328 strcpy(section->parelem->data_type, section->connect->data_type);
6329 }
6330 else {
6331 strcpy(section->parelem->data_type, CG_SIZE_DATATYPE);
6332 }
52476333 section->parelem->data_dim =2;
52486334 section->parelem->dim_vals[0]=size;
52496335 if (cg->filetype == CG_FILE_ADF2) {
52566342
52576343 if (cgi_write_array(section->id, section->parelem)) return CG_ERROR;
52586344 }
5259 else if (strcmp(CG_SIZE_DATATYPE, section->parelem->data_type)) {
5260 cgi_error("ParentElements data type %s does not match stored value %s",
5261 CG_SIZE_DATATYPE, section->parelem->data_type);
6345 else if (strcmp("I4", section->parelem->data_type) &&
6346 strcmp("I8", section->parelem->data_type)) {
6347 cgi_error("ParentElements stored value %s is not valid",
6348 section->parelem->data_type);
52626349 return CG_ERROR;
52636350 }
52646351 if (size != section->parelem->dim_vals[0]) {
52696356 if (strcmp(section->parelem->name, "ParentData")) {
52706357 if (section->parface == 0) {
52716358 section->parface = CGNS_NEW(cgns_array, 1);
5272 strcpy(section->parface->data_type, CG_SIZE_DATATYPE);
6359 strcpy(section->parface->data_type, section->parelem->data_type);
52736360 strcpy(section->parface->name, "ParentElementsPosition");
52746361 section->parface->data_dim =2;
52756362 section->parface->dim_vals[0]=size;
52786365 if (cgi_write_array(section->id, section->parface))
52796366 return CG_ERROR;
52806367 }
5281 else if (strcmp(CG_SIZE_DATATYPE, section->parface->data_type)) {
5282 cgi_error("ParentElementsPosition data type %s does not match stored value %s",
5283 CG_SIZE_DATATYPE, section->parface->data_type);
6368 else if (strcmp("I4", section->parface->data_type) &&
6369 strcmp("I8", section->parface->data_type)) {
6370 cgi_error("ParentElements stored value %s is not valid",
6371 section->parface->data_type);
52846372 return CG_ERROR;
52856373 }
52866374 if (size != section->parface->dim_vals[0]) {
52896377 }
52906378 }
52916379
6380 /* The following test should always be true ... */
52926381 if (start >= section->range[0] && end <= section->range[1]) {
52936382 cgsize_t s_start[2], s_end[2], s_stride[2];
52946383 cgsize_t m_start[2], m_end[2], m_stride[2], m_dim[2];
53086397 m_dim[0] = m_end[0];
53096398 m_dim[1] = 4;
53106399
5311 if (cgio_write_data(cg->cgio, section->parelem->id,
5312 s_start, s_end, s_stride, 2, m_dim,
5313 m_start, m_end, m_stride, parent_data)) {
5314 cg_io_error("cgio_write_data");
5315 return CG_ERROR;
5316 }
6400 WRITE_2D_INT_DATA(section->parelem, parent_data)
53176401
53186402 if (strcmp(section->parelem->name, "ParentData")) {
5319 m_start[1] = 3;
5320 m_end[1] = 4;
5321
5322 if (cgio_write_data(cg->cgio, section->parface->id,
5323 s_start, s_end, s_stride, 2, m_dim,
5324 m_start, m_end, m_stride, parent_data)) {
5325 cg_io_error("cgio_write_data");
5326 return CG_ERROR;
5327 }
6403 m_start[1] = 1;
6404 m_end[1] = 2;
6405 WRITE_2D_INT_DATA(section->parface, &parent_data[(end-start+1)<<1])
53286406 }
53296407 free_parent_data(section);
53306408 }
53316409 else {
5332 int cnt = section->parelem->dim_vals[1];
5333
5334 if (read_parent_data(section)) return CG_ERROR;
5335
5336 data = (cgsize_t *)section->parelem->data;
5337 for (i = 0, num = 0; num < cnt; num++) {
5338 j = num * size + offset;
5339 for (n = start; n <= end; n++)
5340 data[j++] = parent_data[i++];
5341 }
5342 if (cgio_write_all_data(cg->cgio, section->parelem->id, data)) {
5343 cg_io_error("cgio_write_all_data");
5344 return CG_ERROR;
5345 }
5346
5347 if (strcmp(section->parelem->name, "ParentData")) {
5348 data = (cgsize_t *)section->parface->data;
5349 for (i = 0, num = 2; num < 4; num++) {
5350 j = num * size + offset;
5351 for (n = start; n <= end; n++)
5352 data[j++] = parent_data[i++];
5353 }
5354 if (cgio_write_all_data(cg->cgio, section->parface->id, data)) {
5355 cg_io_error("cgio_write_all_data");
5356 return CG_ERROR;
5357 }
5358 }
6410 cgi_error("Unhandled case during parent data partial writing");
6411 return CG_ERROR;
53596412 }
53606413 return CG_OK;
53616414 }
58056858 /* verify input */
58066859 if (cgi_check_strlen(fieldname)) return CG_ERROR;
58076860 if (type != CGNS_ENUMV(RealSingle) && type != CGNS_ENUMV(RealDouble) &&
6861 type != CGNS_ENUMV(ComplexSingle) && type != CGNS_ENUMV(ComplexDouble) &&
58086862 type != CGNS_ENUMV(Integer) && type != CGNS_ENUMV(LongInteger)) {
58096863 cgi_error("Invalid datatype for solution array %s: %d",fieldname, type);
58106864 return CG_ERROR;
59266980 /* verify input */
59276981 if (cgi_check_strlen(fieldname)) return CG_ERROR;
59286982 if (s_type != CGNS_ENUMV(RealSingle) && s_type != CGNS_ENUMV(RealDouble) &&
6983 s_type != CGNS_ENUMV(ComplexSingle) && s_type != CGNS_ENUMV(ComplexDouble) &&
59296984 s_type != CGNS_ENUMV(Integer) && s_type != CGNS_ENUMV(LongInteger)) {
59306985 cgi_error("Invalid file data type for solution array %s: %d",
59316986 fieldname, s_type);
59326987 return CG_ERROR;
59336988 }
59346989 if (m_type != CGNS_ENUMV(RealSingle) && m_type != CGNS_ENUMV(RealDouble) &&
6990 m_type != CGNS_ENUMV(ComplexSingle) && m_type != CGNS_ENUMV(ComplexDouble) &&
59356991 m_type != CGNS_ENUMV(Integer) && m_type != CGNS_ENUMV(LongInteger)) {
59366992 cgi_error("Invalid input data type for solution array %s: %d",
59376993 fieldname, m_type);
59687024 s_type, s_numdim, s_dimvals, s_rmin, s_rmax,
59697025 m_type, m_numdim, m_dimvals, m_rmin, m_rmax,
59707026 field_ptr, F);
5971
7027
59727028 HDF5storage_type = CG_COMPACT;
59737029 return status;
59747030 }
64377493 return CG_OK;
64387494 }
64397495
6440 int cg_hole_info(int file_number, int B, int Z, int I, char *holename,
7496 int cg_hole_info(int file_number, int B, int Z, int J, char *holename,
64417497 CGNS_ENUMT(GridLocation_t) *location,
64427498 CGNS_ENUMT(PointSetType_t) *ptset_type, int *nptsets,
64437499 cgsize_t *npnts)
64497505
64507506 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
64517507
6452 hole = cgi_get_hole(cg, B, Z, I);
7508 hole = cgi_get_hole(cg, B, Z, J);
64537509 if (hole==0) return CG_ERROR;
64547510
64557511 strcpy(holename, hole->name);
64627518 return CG_OK;
64637519 }
64647520
6465 int cg_hole_read(int file_number, int B, int Z, int I, cgsize_t *pnts)
7521 int cg_hole_read(int file_number, int B, int Z, int J, cgsize_t *pnts)
64667522 {
64677523 cgns_hole *hole;
64687524 int set, index_dim;
64727528
64737529 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
64747530
6475 hole = cgi_get_hole(cg, B, Z, I);
7531 hole = cgi_get_hole(cg, B, Z, J);
64767532 if (hole==0) return CG_ERROR;
64777533
64787534 index_dim = cg->base[B-1].zone[Z-1].index_dim;
64867542 &pnts[2*index_dim*set])) return CG_ERROR;
64877543 } else {
64887544 cgi_warning("Overset hole #%d set %d, of zone #%d, base #%d, contains no points",
6489 I, set, Z, B);
7545 J, set, Z, B);
64907546 }
64917547 }
64927548 }
64977553 pnts)) return CG_ERROR;
64987554 } else {
64997555 cgi_warning("Overset hole #%d, of zone #%d, base #%d, contains no points",
6500 I, Z, B);
7556 J, Z, B);
65017557 }
65027558 }
65037559 else {
65047560 cgi_warning("Overset hole #%d, of zone #%d, base #%d, contains no data",
6505 I, Z, B);
6506 }
6507
6508 return CG_OK;
6509 }
6510
6511 int cg_hole_id(int file_number, int B, int Z, int I, double *hole_id)
7561 J, Z, B);
7562 }
7563
7564 return CG_OK;
7565 }
7566
7567 int cg_hole_id(int file_number, int B, int Z, int J, double *hole_id)
65127568 {
65137569 cgns_hole *hole;
65147570
65177573
65187574 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
65197575
6520 hole = cgi_get_hole(cg, B, Z, I);
7576 hole = cgi_get_hole(cg, B, Z, J);
65217577 if (hole==0) return CG_ERROR;
65227578
65237579 *hole_id = hole->id;
65277583 int cg_hole_write(int file_number, int B, int Z, const char * holename,
65287584 CGNS_ENUMT(GridLocation_t) location,
65297585 CGNS_ENUMT(PointSetType_t) ptset_type,
6530 int nptsets, cgsize_t npnts, const cgsize_t * pnts, int *I)
7586 int nptsets, cgsize_t npnts, const cgsize_t * pnts, int *J)
65317587 {
65327588 cgns_zone *zone;
65337589 cgns_zconn *zconn;
65537609 npnts == 2*nptsets && nptsets > 0) &&
65547610 !(ptset_type == CGNS_ENUMV(PointList) &&
65557611 npnts >= 0 && nptsets == 1)) {
6556 cgi_error("Invalid input: nptsets=%d, npoint=%d, point set type=%s",
7612 cgi_error("Invalid input: nptsets=%d, npoint=%ld, point set type=%s",
65577613 nptsets, npnts, PointSetTypeName[ptset_type]);
65587614 return CG_ERROR;
65597615 }
66087664 hole = &(zconn->hole[zconn->nholes]);
66097665 zconn->nholes++;
66107666 }
6611 (*I) = index+1;
7667 (*J) = index+1;
66127668
66137669 /* write hole info to internal memory */
66147670 memset(hole, 0, sizeof(cgns_hole));
67057761 /* in cg_conn_info, donor_datatype is useless starting with version 1.27, because
67067762 it's always I4. However this arg. is left for backward compatibility of API
67077763 and to be able to read old files */
6708 int cg_conn_info(int file_number, int B, int Z, int I, char *connectname,
7764 int cg_conn_info(int file_number, int B, int Z, int J, char *connectname,
67097765 CGNS_ENUMT(GridLocation_t) *location,
67107766 CGNS_ENUMT(GridConnectivityType_t) *type,
67117767 CGNS_ENUMT(PointSetType_t) *ptset_type, cgsize_t *npnts,
67217777
67227778 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
67237779
6724 conn = cgi_get_conn(cg, B, Z, I);
7780 conn = cgi_get_conn(cg, B, Z, J);
67257781 if (conn==0) return CG_ERROR;
67267782
67277783 strcpy(connectname, conn->name);
67557811 /* in cg_conn_read, donor_datatype is useless starting with version 1.27, because
67567812 it's always I4. However this arg. is left for backward compatibility of API
67577813 and to be able to read old files */
6758 int cg_conn_read(int file_number, int B, int Z, int I, cgsize_t *pnts,
7814 int cg_conn_read(int file_number, int B, int Z, int J, cgsize_t *pnts,
67597815 CGNS_ENUMT(DataType_t) donor_datatype, cgsize_t *donor_data)
67607816 {
67617817 cgns_conn *conn;
67767832
67777833 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
67787834
6779 conn = cgi_get_conn(cg, B, Z, I);
7835 conn = cgi_get_conn(cg, B, Z, J);
67807836 if (conn==0) return CG_ERROR;
67817837
67827838 cell_dim = cg->base[B-1].cell_dim;
67897845 return CG_ERROR;
67907846 } else {
67917847 cgi_warning("Interface receiver patch #%d of zone #%d, base #%d, contains no points",
6792 I, Z, B);
7848 J, Z, B);
67937849 }
67947850
67957851 if (donor_data == NULL) return CG_OK;
68137869 return CG_ERROR;
68147870 } else {
68157871 cgi_warning("Interface donor patch #%d of zone #%d, base #%d, contains no points",
6816 I, Z, B);
6817 }
6818
6819 return CG_OK;
6820 }
6821
6822 int cg_conn_read_short(int file_number, int B, int Z, int I, cgsize_t *pnts)
6823 {
6824 return cg_conn_read(file_number, B, Z, I, pnts, CGNS_ENUMV(DataTypeNull), NULL);
6825 }
6826
6827 int cg_conn_id(int file_number, int B, int Z, int I, double *conn_id)
7872 J, Z, B);
7873 }
7874
7875 return CG_OK;
7876 }
7877
7878 int cg_conn_read_short(int file_number, int B, int Z, int J, cgsize_t *pnts)
7879 {
7880 return cg_conn_read(file_number, B, Z, J, pnts, CGNS_ENUMV(DataTypeNull), NULL);
7881 }
7882
7883 int cg_conn_id(int file_number, int B, int Z, int J, double *conn_id)
68287884 {
68297885 cgns_conn *conn;
68307886
68337889
68347890 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
68357891
6836 conn = cgi_get_conn(cg, B, Z, I);
7892 conn = cgi_get_conn(cg, B, Z, J);
68377893 if (conn==0) return CG_ERROR;
68387894
68397895 *conn_id = conn->id;
68477903 cgsize_t npnts, const cgsize_t * pnts, const char * donorname,
68487904 CGNS_ENUMT(ZoneType_t) donor_zonetype,
68497905 CGNS_ENUMT(PointSetType_t) donor_ptset_type,
6850 CGNS_ENUMT(DataType_t) donor_datatype,
6851 cgsize_t ndata_donor, const cgsize_t * donor_data, int *I)
7906 CGNS_ENUMT(DataType_t) donor_datatype,
7907 cgsize_t ndata_donor, const cgsize_t * donor_data, int *J)
68527908 {
68537909 cgns_zone *zone;
68547910 cgns_zconn *zconn;
68907946 }
68917947 if (!(ptset_type==CGNS_ENUMV(PointRange) && npnts==2) &&
68927948 !(ptset_type==CGNS_ENUMV(PointList) && npnts>0)) {
6893 cgi_error("Invalid input: npoint=%d, point set type=%s",
7949 cgi_error("Invalid input: npoint=%ld, point set type=%s",
68947950 npnts, PointSetTypeName[ptset_type]);
68957951 return CG_ERROR;
68967952 }
69648020 cell_dim=cg->base[B-1].cell_dim;
69658021
69668022 /* verify input */
6967 size_of_zone = 1;
6968 for (i=0; i<index_dim; i++) size_of_zone*=zone->nijk[i];
6969 if (npnts<0 || npnts>size_of_zone) {
6970 cgi_error("Inconsistent number of points in point set");
6971 return CG_ERROR;
8023 if (location == CGNS_ENUMV( Vertex )) {
8024 size_of_zone = 1;
8025 for (i=0; i<index_dim; i++) size_of_zone*=zone->nijk[i];
8026 if (npnts<0 || npnts>size_of_zone) {
8027 cgi_error("Inconsistent number of points in point set");
8028 return CG_ERROR;
8029 }
8030 } else if (location == CGNS_ENUMV( CellCenter )) {
8031 size_of_zone = 1;
8032 for (i=0; i<index_dim; i++) size_of_zone*=zone->nijk[i+index_dim];
8033 if (npnts<0 || npnts>size_of_zone) {
8034 cgi_error("Inconsistent number of cells in cell set");
8035 return CG_ERROR;
8036 }
69728037 }
69738038 #if 0 /* causes problems when grid is unstructured */
69748039 if (ptset_type==CGNS_ENUMV( PointRange )) {
70338098 conn = &(zconn->conn[zconn->nconns]);
70348099 zconn->nconns++;
70358100 }
7036 (*I) = index+1;
8101 (*J) = index+1;
70378102
70388103 /* write conn info to internal memory */
70398104 memset(conn, 0, sizeof(cgns_conn));
71238188 CGNS_ENUMT(GridConnectivityType_t) type,
71248189 CGNS_ENUMT(PointSetType_t) ptset_type,
71258190 cgsize_t npnts, const cgsize_t * pnts,
7126 const char * donorname, int *I)
8191 const char * donorname, int *J)
71278192 {
71288193 return cg_conn_write (file_number, B, Z, connectname, location,
71298194 type, ptset_type, npnts, pnts, donorname,
71308195 CGNS_ENUMV(ZoneTypeNull), CGNS_ENUMV(PointSetTypeNull),
7131 CGNS_ENUMV(DataTypeNull), 0, NULL, I);
8196 CGNS_ENUMV(DataTypeNull), 0, NULL, J);
71328197 }
71338198
71348199 /*****************************************************************************\
71558220 cgns_base *base;
71568221 cgns_zone *zone;
71578222 cgns_zconn *zconn;
7158 int Z, I, D;
8223 int Z, J, D;
71598224 cgint3_t transform;
71608225 cgsize_t donor_range[6], range[6];
71618226 char_33 connectname, donorname;
71818246 zconn = cgi_get_zconn(cg, B, Z);
71828247 if (zconn==0) continue; /* if ZoneGridConnectivity_t is undefined */
71838248 if (zconn->n1to1 ==0) continue;
7184 for (I=1; I<=zconn->n1to1; I++) {
7185 if (cg_1to1_read(file_number, B, Z, I, connectname, donorname,
8249 for (J=1; J<=zconn->n1to1; J++) {
8250 if (cg_1to1_read(file_number, B, Z, J, connectname, donorname,
71868251 range, donor_range, transform)) return CG_ERROR;
71878252 if (cgi_zone_no(base, donorname, &D)) return CG_ERROR;
71888253
72068271 return CG_OK;
72078272 }
72088273
7209 int cg_1to1_read(int file_number, int B, int Z, int I, char *connectname,
8274 int cg_1to1_read(int file_number, int B, int Z, int J, char *connectname,
72108275 char *donorname, cgsize_t *range, cgsize_t *donor_range,
72118276 int *transform)
72128277 {
72238288
72248289 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
72258290
7226 one21 = cgi_get_1to1(cg, B, Z, I);
8291 one21 = cgi_get_1to1(cg, B, Z, J);
72278292 if (one21==0) return CG_ERROR;
72288293 index_dim = cg->base[B-1].zone[Z-1].index_dim;
72298294
72338298 one21->ptset.npts * index_dim, range)) return CG_ERROR;
72348299 } else {
72358300 cgi_warning("1to1 interface %d (receiver side) for zone %d base % is undefined",
7236 I,Z,B);
8301 J,Z,B);
72378302 }
72388303
72398304 /* read donor pointset from ADF file */
72428307 one21->dptset.npts * index_dim, donor_range)) return CG_ERROR;
72438308 } else {
72448309 cgi_warning("1to1 interface %d (donor side) for zone %d base % is undefined",
7245 I,Z,B);
8310 J,Z,B);
72468311 }
72478312
72488313 /* read transform from internal database */
72608325 cgns_base *base;
72618326 cgns_zone *zone;
72628327 cgns_zconn *zconn;
7263 int Z, I, D, n=0, j, index_dim;
8328 int Z, J, D, n=0, k, index_dim;
72648329 char connect[33], donor[33];
72658330 cgsize_t rang[6], drang[6];
72668331 int trans[3];
72878352 zconn = cgi_get_zconn(cg, B, Z);
72888353 if (zconn==0) continue; /* if ZoneGridConnectivity_t is undefined */
72898354 if (zconn->n1to1 ==0) continue;
7290 for (I=1; I<=zconn->n1to1; I++) {
7291 if (cg_1to1_read(file_number, B, Z, I, connect, donor, rang,
8355 for (J=1; J<=zconn->n1to1; J++) {
8356 if (cg_1to1_read(file_number, B, Z, J, connect, donor, rang,
72928357 drang, trans)) return CG_ERROR;
72938358 if (cgi_zone_no(base, donor, &D)) return CG_ERROR;
72948359 /* count each interface only once */
72978362 strcpy(connectname[n], connect);
72988363 strcpy(zonename[n],zone->name);
72998364 strcpy(donorname[n], donor);
7300 for (j=0; j<index_dim; j++) {
7301 range[n][j]= rang[j];
7302 range[n][j+index_dim]= rang[j+index_dim];
7303 donor_range[n][j]= drang[j];
7304 donor_range[n][j+index_dim]= drang[j+index_dim];
7305 transform[n][j] = trans[j];
8365 for (k=0; k<index_dim; k++) {
8366 range[n][k]= rang[k];
8367 range[n][k+index_dim]= rang[k+index_dim];
8368 donor_range[n][k]= drang[k];
8369 donor_range[n][k+index_dim]= drang[k+index_dim];
8370 transform[n][k] = trans[k];
73068371 }
73078372 n++;
73088373 }
73148379 return CG_OK;
73158380 }
73168381
7317 int cg_1to1_id(int file_number, int B, int Z, int I, double *one21_id)
8382 int cg_1to1_id(int file_number, int B, int Z, int J, double *one21_id)
73188383 {
73198384 cgns_1to1 *one21;
73208385
73238388
73248389 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
73258390
7326 one21 = cgi_get_1to1(cg, B, Z, I);
8391 one21 = cgi_get_1to1(cg, B, Z, J);
73278392 if (one21==0) return CG_ERROR;
73288393
73298394 *one21_id = one21->id;
73328397
73338398 int cg_1to1_write(int file_number, int B, int Z, const char * connectname,
73348399 const char * donorname, const cgsize_t * range,
7335 const cgsize_t * donor_range, const int * transform, int *I)
8400 const cgsize_t * donor_range, const int * transform, int *J)
73368401 {
73378402 cgns_zone *zone;
73388403 cgns_zconn *zconn;
73728437 index_dim = zone->index_dim;
73738438 for (i=0; i<index_dim; i++) { /* can't check donorrange because it may not yet be written */
73748439 if (range[i]<=0 || range[i+index_dim]>zone->nijk[i]) {
7375 cgi_error("Invalid input range: %d->%d",range[i], range[i+index_dim]);
8440 cgi_error("Invalid input range: %ld->%ld",range[i], range[i+index_dim]);
73768441 return CG_ERROR;
73778442 }
7378 if (abs(transform[i])<0 || abs(transform[i])>index_dim) {
7379 cgi_error("Invalid transformation index: %d. The indices must all be between 1 and %d",i, index_dim);
8443 if (abs(transform[i])>index_dim) {
8444 cgi_error("Invalid transformation index: %d. The indices must all be between 1 and %ld",i, index_dim);
73808445 return CG_ERROR;
73818446 }
7382 if (abs(transform[i])>0) {
8447 if (transform[i] != 0) {
73838448 cgsize_t dr, ddr;
73848449 j = abs(transform[i])-1;
73858450 dr = range[i+index_dim] - range[i];
73868451 ddr = donor_range[j+index_dim] - donor_range[j];
73878452 if (dr != ddr && dr != -ddr) {
7388 cgi_error("Invalid input: range = %d->%d and donor_range = %d->%d",
8453 cgi_error("Invalid input: range = %ld->%ld and donor_range = %ld->%ld",
73898454 range[i], range[i+index_dim], donor_range[j], donor_range[j+index_dim]);
73908455 return CG_ERROR;
73918456 }
74238488 one21 = &(zconn->one21[zconn->n1to1]);
74248489 zconn->n1to1++;
74258490 }
7426 (*I) = index+1;
8491 (*J) = index+1;
74278492
74288493 memset(one21, 0, sizeof(cgns_1to1));
74298494 /* allocate memory */
76778742 ptype == CGNS_ENUMV(ElementList)) && npnts <= 0) ||
76788743 ((ptype == CGNS_ENUMV(PointRange) ||
76798744 ptype == CGNS_ENUMV(ElementRange)) && npnts != 2)) {
7680 cgi_error("Invalid input: npoint=%d, point set type=%s",
8745 cgi_error("Invalid input: npoint=%ld, point set type=%s",
76818746 npnts, PointSetTypeName[ptype]);
76828747 return CG_ERROR;
76838748 }
895710022 * read and write GridConnectivityProperty_t Node
895810023 \*****************************************************************************/
895910024
8960 int cg_conn_periodic_read(int file_number, int B, int Z, int I,
10025 int cg_conn_periodic_read(int file_number, int B, int Z, int J,
896110026 float *RotationCenter, float *RotationAngle, float *Translation)
896210027 {
896310028
897710042 if (base==0) return CG_ERROR;
897810043
897910044 /* get memory address for cprop */
8980 cprop = cgi_get_cprop(cg, B, Z, I);
10045 cprop = cgi_get_cprop(cg, B, Z, J);
898110046 if (cprop==0) return CG_NODE_NOT_FOUND;
898210047
898310048 if (cprop->cperio == 0) {
8984 cgi_error("GridConnectivityProperty_t/Periodic_t node doesn't exist under GridConnectivity_t %d",I);
10049 cgi_error("GridConnectivityProperty_t/Periodic_t node doesn't exist under GridConnectivity_t %d",J);
898510050 return CG_NODE_NOT_FOUND;
898610051 }
898710052 cperio = cprop->cperio;
899910064 return CG_OK;
900010065 }
900110066
9002 int cg_conn_periodic_write(int file_number, int B, int Z, int I,
10067 int cg_conn_periodic_write(int file_number, int B, int Z, int J,
900310068 float const *RotationCenter, float const *RotationAngle,
900410069 float const *Translation)
900510070 {
902010085 if (base==0) return CG_ERROR;
902110086
902210087 /* get memory address of GridConnectivity_t node */
9023 conn = cgi_get_conn(cg, B, Z, I);
10088 conn = cgi_get_conn(cg, B, Z, J);
902410089 if (conn==0) return CG_ERROR;
902510090
902610091 /* Allocate GridConnectivityProperty_t data struct. if not already created */
910510170
910610171 /*----------------------------------------------------------------------*/
910710172
9108 int cg_conn_average_read(int file_number, int B, int Z, int I,
10173 int cg_conn_average_read(int file_number, int B, int Z, int J,
910910174 CGNS_ENUMT(AverageInterfaceType_t) *AverageInterfaceType)
911010175 {
911110176 cgns_cprop *cprop;
911710182 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
911810183
911910184 /* get memory address for cprop */
9120 cprop = cgi_get_cprop(cg, B, Z, I);
10185 cprop = cgi_get_cprop(cg, B, Z, J);
912110186 if (cprop==0) return CG_NODE_NOT_FOUND;
912210187
912310188 if (cprop->caverage == 0) {
9124 cgi_error("GridConnectivityProperty_t/AverageInterface_t node doesn't exist under GridConnectivity_t %d",I);
10189 cgi_error("GridConnectivityProperty_t/AverageInterface_t node doesn't exist under GridConnectivity_t %d",J);
912510190 return CG_NODE_NOT_FOUND;
912610191 }
912710192 *AverageInterfaceType = cprop->caverage->type;
912910194 return CG_OK;
913010195 }
913110196
9132 int cg_conn_average_write(int file_number, int B, int Z, int I,
10197 int cg_conn_average_write(int file_number, int B, int Z, int J,
913310198 CGNS_ENUMT(AverageInterfaceType_t) AverageInterfaceType)
913410199 {
913510200 cgns_cprop *cprop;
915110216 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
915210217
915310218 /* get memory address of GridConnectivity_t node */
9154 conn = cgi_get_conn(cg, B, Z, I);
10219 conn = cgi_get_conn(cg, B, Z, J);
915510220 if (conn==0) return CG_ERROR;
915610221
915710222 /* Allocate GridConnectivityProperty_t data struct. if not already created */
921710282
921810283 /*----------------------------------------------------------------------*/
921910284
9220 int cg_1to1_periodic_read(int file_number, int B, int Z, int I,
10285 int cg_1to1_periodic_read(int file_number, int B, int Z, int J,
922110286 float *RotationCenter, float *RotationAngle,
922210287 float *Translation)
922310288 {
923810303 if (base==0) return CG_ERROR;
923910304
924010305 /* get memory address for cprop from one21->cprop */
9241 one21 = cgi_get_1to1(cg, B, Z, I);
10306 one21 = cgi_get_1to1(cg, B, Z, J);
924210307 if (one21==0) return CG_ERROR;
924310308
924410309 cprop = one21->cprop;
924510310
924610311 if (cprop == 0 || cprop->cperio == 0) {
9247 cgi_error("GridConnectivityProperty_t/Periodic_t node doesn't exist under GridConnectivity1to1_t %d",I);
10312 cgi_error("GridConnectivityProperty_t/Periodic_t node doesn't exist under GridConnectivity1to1_t %d",J);
924810313 return CG_NODE_NOT_FOUND;
924910314 }
925010315 cperio = cprop->cperio;
926210327 return CG_OK;
926310328 }
926410329
9265 int cg_1to1_periodic_write(int file_number, int B, int Z, int I,
10330 int cg_1to1_periodic_write(int file_number, int B, int Z, int J,
926610331 float const *RotationCenter,
926710332 float const *RotationAngle,
926810333 float const *Translation)
928410349 if (base==0) return CG_ERROR;
928510350
928610351 /* get memory address of GridConnectivity1to1_t node */
9287 one21 = cgi_get_1to1(cg, B, Z, I);
10352 one21 = cgi_get_1to1(cg, B, Z, J);
928810353 if (one21 == 0) return CG_ERROR;
928910354
929010355 /* Allocate GridConnectivityProperty_t data struct. if not already created */
937110436
937210437 /*----------------------------------------------------------------------*/
937310438
9374 int cg_1to1_average_read(int file_number, int B, int Z, int I,
10439 int cg_1to1_average_read(int file_number, int B, int Z, int J,
937510440 CGNS_ENUMT(AverageInterfaceType_t) *AverageInterfaceType)
937610441 {
937710442 cgns_cprop *cprop;
938410449 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_READ)) return CG_ERROR;
938510450
938610451 /* get memory address for cprop from one21->cprop */
9387 one21 = cgi_get_1to1(cg, B, Z, I);
10452 one21 = cgi_get_1to1(cg, B, Z, J);
938810453 if (one21==0) return CG_ERROR;
938910454
939010455 cprop = one21->cprop;
939110456
939210457 if (cprop == 0 || cprop->caverage == 0) {
9393 cgi_error("GridConnectivityProperty_t/AverageInterface_t node doesn't exist under GridConnectivity1to1_t %d",I);
10458 cgi_error("GridConnectivityProperty_t/AverageInterface_t node doesn't exist under GridConnectivity1to1_t %d",J);
939410459 return CG_NODE_NOT_FOUND;
939510460 }
939610461 *AverageInterfaceType = cprop->caverage->type;
939810463 return CG_OK;
939910464 }
940010465
9401 int cg_1to1_average_write(int file_number, int B, int Z, int I,
10466 int cg_1to1_average_write(int file_number, int B, int Z, int J,
940210467 CGNS_ENUMT(AverageInterfaceType_t) AverageInterfaceType)
940310468 {
940410469 cgns_cprop *cprop;
942010485 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
942110486
942210487 /* get memory address of GridConnectivity_t node */
9423 one21 = cgi_get_1to1(cg, B, Z, I);
10488 one21 = cgi_get_1to1(cg, B, Z, J);
942410489 if (one21 == 0) return CG_ERROR;
942510490
942610491 /* Allocate GridConnectivityProperty_t data struct. if not already created */
1084011905 DataType != CGNS_ENUMV(RealDouble) &&
1084111906 DataType != CGNS_ENUMV(Integer) &&
1084211907 DataType != CGNS_ENUMV(LongInteger) &&
10843 DataType != CGNS_ENUMV(Character)) {
11908 DataType != CGNS_ENUMV(Character) &&
11909 DataType != CGNS_ENUMV(ComplexSingle) &&
11910 DataType != CGNS_ENUMV(ComplexDouble)) {
1084411911 cgi_error("Invalid datatype for data array: %d", DataType);
1084511912 return CG_ERROR;
1084611913 }
1085011917 }
1085111918 for (n=0; n<DataDimension; n++) {
1085211919 if (DimensionVector[n]<=0) {
10853 cgi_error("Invalid array size: %d",DimensionVector[n]);
11920 cgi_error("Invalid array size: %ld",DimensionVector[n]);
1085411921 return CG_ERROR;
1085511922 }
1085611923 }
1090311970 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE)) return CG_ERROR;
1090411971 if (s_type != CGNS_ENUMV(RealSingle) && s_type != CGNS_ENUMV(RealDouble) &&
1090511972 s_type != CGNS_ENUMV(Integer) && s_type != CGNS_ENUMV(LongInteger) &&
11973 s_type != CGNS_ENUMV(ComplexSingle) && s_type != CGNS_ENUMV(ComplexDouble) &&
1090611974 s_type != CGNS_ENUMV(Character)) {
1090711975 cgi_error("Invalid file data type for data array: %d", s_type);
1090811976 return CG_ERROR;
1090911977 }
1091011978 if (m_type != CGNS_ENUMV(RealSingle) && m_type != CGNS_ENUMV(RealDouble) &&
1091111979 m_type != CGNS_ENUMV(Integer) && m_type != CGNS_ENUMV(LongInteger) &&
11980 m_type != CGNS_ENUMV(ComplexSingle) && m_type != CGNS_ENUMV(ComplexDouble) &&
1091211981 m_type != CGNS_ENUMV(Character)) {
1091311982 cgi_error("Invalid input data type for data array: %d", m_type);
1091411983 return CG_ERROR;
1092911998
1093011999 for (n=0; n<s_numdim; n++) {
1093112000 if (s_dimvals[n] < 1) {
10932 cgi_error("Invalid array dimension for file: %d", s_dimvals[n]);
12001 cgi_error("Invalid array dimension for file: %ld", s_dimvals[n]);
1093312002 return CG_ERROR;
1093412003 }
1093512004 }
1246213531
1246313532 /* verify input */
1246413533 if(npnts == 0 || pnts == NULL) {
12465 cgi_error("Invalid input: npoint=%d, point set type=%s",
13534 cgi_error("Invalid input: npoint=%ld, point set type=%s",
1246613535 npnts, PointSetTypeName[ptset_type]);
1246713536 return CG_ERROR;
1246813537 }
1246913538
1247013539 if (ptset_type == CGNS_ENUMV(PointList)) {
1247113540 if (npnts <= 0) {
12472 cgi_error("Invalid input: npoint=%d, point set type=%s",
13541 cgi_error("Invalid input: npoint=%ld, point set type=%s",
1247313542 npnts, PointSetTypeName[ptset_type]);
1247413543 return CG_ERROR;
1247513544 }
1247613545 } else if (ptset_type == CGNS_ENUMV(PointRange)) {
1247713546 if (npnts != 2) {
12478 cgi_error("Invalid input: npoint=%d, point set type=%s",
13547 cgi_error("Invalid input: npoint=%ld, point set type=%s",
1247913548 npnts, PointSetTypeName[ptset_type]);
1248013549 return CG_ERROR;
1248113550 }
1294714016 cgns_base *parent = (cgns_base *)posit->posit;
1294814017
1294914018 /* Case 1: node_label = can have multiple occurrence: */
12950 if (strcmp(node_label,"Zone_t")==0)
14019 if (strcmp(node_label, "Zone_t") == 0) {
1295114020 CGNS_DELETE_SHIFT(nzones, zone, cgi_free_zone)
14021 if (parent->zonemap) {
14022 /* It is costly since indexing is recomputed */
14023 if (cgi_map_contains(parent->zonemap, node_name) == 1) {
14024 cgi_map_del_shift_item(parent->zonemap, node_name);
14025 }
14026 }
14027 }
1295214028 else if (strcmp(node_label,"Family_t")==0)
1295314029 CGNS_DELETE_SHIFT(nfamilies, family, cgi_free_family)
1295414030 else if (strcmp(node_label,"IntegralData_t")==0)
2323
2424 3. This notice may not be removed or altered from any source distribution.
2525
26 * -------------------------------------------------------------------------
27 *
28 * DEVELOPER'S NOTE:
29 * When adding a defined constant to this file, also add the same defined
26 * _____ __ __ _____ ____ _____ _______ _ _ _______
27 * |_ _| \/ | __ \ / __ \| __ \__ __|/\ | \ | |__ __|
28 * | | | \ / | |__) | | | | |__) | | | / \ | \| | | |
29 * | | | |\/| | ___/| | | | _ / | | / /\ \ | . ` | | |
30 * _| |_| | | | | | |__| | | \ \ | |/ ____ \| |\ | | |
31 * |_____|_| |_|_| \____/|_| \_\ |_/_/ \_\_| \_| |_|
32 *
33 * ------------------- DEVELOPER'S NOTES ---------------------------
34 * (1) When adding a defined constant to this file, also add the same defined
3035 * constant to cgns_f.F90
3136 *
3237 * ------------------------------------------------------------------------- */
3439 #ifndef CGNSLIB_H
3540 #define CGNSLIB_H
3641
37 #define CGNS_VERSION 4100
38 #define CGNS_DOTVERS 4.10
42 #define CGNS_VERSION 4200
43 #define CGNS_DOTVERS 4.20
3944
4045 #define CGNS_COMPATVERSION 2540
4146 #define CGNS_COMPATDOTVERS 2.54
8994 #define CG_MODE_READ 0
9095 #define CG_MODE_WRITE 1
9196 #define CG_MODE_MODIFY 2
92 #define CG_MODE_CLOSED 3
9397
9498 /* file types */
9599
124128 #define CG_CONFIG_FILE_TYPE 5
125129 #define CG_CONFIG_RIND_INDEX 6
126130
127 #define CG_CONFIG_HDF5_COMPRESS 201
128 #define CG_CONFIG_HDF5_MPI_COMM 202
131 #define CG_CONFIG_HDF5_COMPRESS 201
132 #define CG_CONFIG_HDF5_MPI_COMM 202
133 #define CG_CONFIG_HDF5_DISKLESS 203
134 #define CG_CONFIG_HDF5_DISKLESS_INCR 204
135 #define CG_CONFIG_HDF5_DISKLESS_WRITE 205
129136
130137 /* HDF5 dataset storage layout */
131138
472479 CGNS_ENUMV( RealSingle ) =3,
473480 CGNS_ENUMV( RealDouble ) =4,
474481 CGNS_ENUMV( Character ) =5,
475 CGNS_ENUMV( LongInteger ) =6
482 CGNS_ENUMV( LongInteger ) =6,
483 CGNS_ENUMV( ComplexSingle ) =7,
484 CGNS_ENUMV( ComplexDouble ) =8
476485 } CGNS_ENUMT( DataType_t );
477486
478 #define NofValidDataTypes 7
487 #define NofValidDataTypes 9
479488
480489 extern CGNSDLL const char * DataTypeName[NofValidDataTypes];
481490
9941003 const char * SectionName, CGNS_ENUMT(ElementType_t) type,
9951004 cgsize_t start, cgsize_t end, int nbndry, const cgsize_t * elements,
9961005 const cgsize_t * connect_offset, int *S);
1006 CGNSDLL int cg_section_general_write(int file_number, int B, int Z,
1007 const char * SectionName, const CGNS_ENUMT(ElementType_t) type,
1008 const CGNS_ENUMT(DataType_t) elementDataType, cgsize_t start,
1009 cgsize_t end, cgsize_t elementDataSize, int nbndry, int *S);
1010 CGNSDLL int cg_section_initialize(int file_number, int B, int Z, int S);
1011
9971012 CGNSDLL int cg_parent_data_write(int file_number, int B, int Z, int S,
9981013 const cgsize_t * parent_data);
9991014 CGNSDLL int cg_npe( CGNS_ENUMT(ElementType_t) type, int *npe);
10061021
10071022 CGNSDLL int cg_elements_partial_write(int fn, int B, int Z, int S,
10081023 cgsize_t start, cgsize_t end, const cgsize_t *elements);
1024 CGNSDLL int cg_elements_general_write(int fn, int B, int Z, int S,
1025 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type,
1026 const void *elements);
1027
10091028 CGNSDLL int cg_poly_elements_partial_write(int fn, int B, int Z, int S,
10101029 cgsize_t start, cgsize_t end, const cgsize_t *elements, const cgsize_t *connect_offset);
1030 CGNSDLL int cg_poly_elements_general_write(int fn, int B, int Z, int S,
1031 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type,
1032 const void *elements, const void *connect_offset);
10111033
10121034 CGNSDLL int cg_parent_data_partial_write(int fn, int B, int Z, int S,
10131035 cgsize_t start, cgsize_t end, const cgsize_t *ParentData);
10161038 cgsize_t start, cgsize_t end, cgsize_t *elements, cgsize_t *parent_data);
10171039 CGNSDLL int cg_poly_elements_partial_read(int file_number, int B, int Z, int S,
10181040 cgsize_t start, cgsize_t end, cgsize_t *elements, cgsize_t *connect_offset, cgsize_t *parent_data);
1041
1042 /* For reading with a datatype different from cgsize_t. Use at your own risk */
1043 CGNSDLL int cg_elements_general_read(int file_number, int B, int Z, int S,
1044 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* elements);
1045 CGNSDLL int cg_poly_elements_general_read(int file_number, int B, int Z, int S,
1046 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* elements, void* connect_offset);
1047 CGNSDLL int cg_parent_elements_general_read(int file_number, int B, int Z, int S,
1048 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* parelem);
1049 CGNSDLL int cg_parent_elements_position_general_read(int file_number, int B, int Z, int S,
1050 cgsize_t start, cgsize_t end, CGNS_ENUMT(DataType_t) m_type, void* parface);
1051
10191052
10201053 CGNSDLL int cg_ElementPartialSize(int file_number, int B, int Z, int S,
10211054 cgsize_t start, cgsize_t end, cgsize_t *ElementDataSize);
7777 DESTINATION bin
7878 RENAME cgnscalc)
7979 install(PROGRAMS
80 cgnscalc.desktop
81 DESTINATION bin)
82 install(PROGRAMS
8083 unitconv.sh
8184 DESTINATION bin
8285 RENAME unitconv)
86 install(PROGRAMS
87 unitconv.desktop
88 DESTINATION bin)
8389 install(FILES
8490 cgnscalc.tcl
8591 unitconv.tcl
4343 install-prog :
4444 @echo "installing cgnscalc shell scripts to $(BIN_INSTALL_DIR)"
4545 @$(INSTALL_PROG) cgnscalc.sh $(BIN_INSTALL_DIR)/cgnscalc
46 @chmod +x $(BIN_INSTALL_DIR)/cgnscalc
46 @$(INSTALL_PROG) cgnscalc.desktop $(BIN_INSTALL_DIR)/
47 @chmod +x $(BIN_INSTALL_DIR)/cgnscalc $(BIN_INSTALL_DIR)/cgnscalc.desktop
4748 @$(INSTALL_PROG) unitconv.sh $(BIN_INSTALL_DIR)/unitconv
48 @chmod +x $(BIN_INSTALL_DIR)/unitconv
49 @$(INSTALL_PROG) unitconv.desktop $(BIN_INSTALL_DIR)/
50 @chmod +x $(BIN_INSTALL_DIR)/unitconv $(BIN_INSTALL_DIR)/unitconv.desktop
4951 @if [ ! -f $(EXE_INSTALL_DIR)/cgconfig ] ; then \
5052 echo "installing configuration file to $(EXE_INSTALL_DIR)"; \
5153 $(INSTALL_DATA) ../cgconfig $(EXE_INSTALL_DIR)/cgconfig; \
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Type=Application
4 Name=CGNScalc
5 GenericName=CGNS calculator
6 Terminal=false
7 Categories=Development;
8 Exec="./cgnscalc"
9 Icon=../share/cgnstools/cgnscalc.png
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Type=Application
4 Name=CGNSunitconv
5 GenericName=Unit conversions tool
6 Terminal=false
7 Categories=Development;
8 Exec="./unitconv"
9 Icon=../share/cgnstools/unitconv.png
3636
3737 unitconv=""
3838 for d in $CG_LIB_DIR $dir $dir/cgnstools $dir/cgnscalc \
39 $dir/../share/cgnstools \
3940 /usr/local/share /usr/local/share/cgnstools ; do
4041 if test -f $d/unitconv.tcl ; then
4142 unitconv=$d/unitconv.tcl
1010 *
1111 */
1212
13 #include <tk.h>
14 #include "tkWinInt.h"
1513 #define WIN32_LEAN_AND_MEAN
1614 #include <windows.h>
1715 #undef WIN32_LEAN_AND_MEAN
16 #include <tk.h>
17 #include "tkWinInt.h"
1818 #include <malloc.h>
1919 #include <locale.h>
2020
8282 cgnsplot.sh
8383 DESTINATION bin
8484 RENAME cgnsplot)
85 install(PROGRAMS
86 cgnsplot.desktop
87 DESTINATION bin)
8588 install(FILES
8689 cgnsplot.tcl
8790 cgnsplot.ico
4040 install-prog :
4141 @echo "installing cgnsplot shell scripts to $(BIN_INSTALL_DIR)"
4242 @$(INSTALL_PROG) cgnsplot.sh $(BIN_INSTALL_DIR)/cgnsplot
43 @chmod +x $(BIN_INSTALL_DIR)/cgnsplot
43 @$(INSTALL_PROG) cgnsplot.desktop $(BIN_INSTALL_DIR)/
44 @chmod +x $(BIN_INSTALL_DIR)/cgnsplot $(BIN_INSTALL_DIR)/cgnsplot.desktop
4445 @if [ ! -f $(EXE_INSTALL_DIR)/cgconfig ] ; then \
4546 echo "installing configuration file to $(EXE_INSTALL_DIR)"; \
4647 $(INSTALL_DATA) ../cgconfig $(EXE_INSTALL_DIR)/cgconfig; \
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Type=Application
4 Name=CGNSplot
5 GenericName=CGNS plot
6 Terminal=false
7 Categories=Development;
8 Exec="./cgnsplot"
9 Icon=../share/cgnstools/cgnsplot.png
3535
3636 cgnsplot=""
3737 for d in $CG_LIB_DIR $dir $dir/cgnstools $dir/cgnsplot \
38 $dir/../share/cgnstools \
3839 /usr/local/share /usr/local/share/cgnstools ; do
3940 if test -f $d/cgnsplot.tcl ; then
4041 cgnsplot=$d/cgnsplot.tcl
1010 *
1111 */
1212
13 #include <tk.h>
14 #include "tkWinInt.h"
1513 #define WIN32_LEAN_AND_MEAN
1614 #include <windows.h>
1715 #undef WIN32_LEAN_AND_MEAN
16 #include <tk.h>
17 #include "tkWinInt.h"
1818 #include <malloc.h>
1919 #include <locale.h>
2020
7575 DESTINATION bin
7676 RENAME cgnsview)
7777 install(PROGRAMS
78 cgnsview.desktop
79 DESTINATION bin)
80 install(PROGRAMS
7881 cgnsnodes.sh
7982 DESTINATION bin
8083 RENAME cgnsnodes)
84 install(PROGRAMS
85 cgnsnodes.desktop
86 DESTINATION bin)
8187 install(FILES
8288 cgnsview.tcl
8389 cgns.tcl
5959 install-prog : $(ALL)
6060 @echo "installing shell scripts to $(BIN_INSTALL_DIR)"
6161 @$(INSTALL_PROG) cgnsview.sh $(BIN_INSTALL_DIR)/cgnsview
62 @chmod +x $(BIN_INSTALL_DIR)/cgnsview
62 @$(INSTALL_PROG) cgnsview.desktop $(BIN_INSTALL_DIR)/
63 @chmod +x $(BIN_INSTALL_DIR)/cgnsview $(BIN_INSTALL_DIR)/cgnsview.desktop
6364 @$(INSTALL_PROG) cgnsnodes.sh $(BIN_INSTALL_DIR)/cgnsnodes
64 @chmod +x $(BIN_INSTALL_DIR)/cgnsnodes
65 @$(INSTALL_PROG) cgnsnodes.desktop $(BIN_INSTALL_DIR)/
66 @chmod +x $(BIN_INSTALL_DIR)/cgnsnodes $(BIN_INSTALL_DIR)/cgnsnodes.desktop
6567 @if [ ! -f $(EXE_INSTALL_DIR)/cgconfig ] ; then \
6668 echo "installing configuration file to $(EXE_INSTALL_DIR)"; \
6769 $(INSTALL_DATA) ../cgconfig $(EXE_INSTALL_DIR)/cgconfig; \
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Type=Application
4 Name=CGNSnodes
5 GenericName=CGNS node reference
6 Terminal=false
7 Categories=Development;
8 Exec="./cgnsnodes"
9 Icon=../share/cgnstools/cgns.png
3636
3737 cgnsnodes=""
3838 for d in $CG_LIB_DIR $dir $dir/cgnstools $dir/cgnsview \
39 $dir/../share/cgnstools \
3940 /usr/local/share /usr/local/share/cgnstools ; do
4041 if test -f $d/cgnsnodes.tcl ; then
4142 cgnsnodes=$d/cgnsnodes.tcl
00 @echo off
11 setlocal
22
3 set HDF5_USE_FILE_LOCKING="FALSE"
34 set dir=%~dps0
45 if exist "%dir%cgconfig.bat" (
56 call %dir%cgconfig.bat
0 [Desktop Entry]
1 Version=1.0
2 Encoding=UTF-8
3 Type=Application
4 Name=CGNSview
5 GenericName=CGNS file structure viewer
6 Terminal=false
7 Categories=Development;
8 Exec="./cgnsview"
9 Icon=../share/cgnstools/cgns.png
22 # sh script to launch CGNS File viewer/editor
33
44 dir=`dirname $0`
5
6 # To let other tools access the file while cgnsview is running
7 export HDF5_USE_FILE_LOCKING="FALSE"
58
69 # source the setup script
710
3538
3639 cgnsview=""
3740 for d in $CG_LIB_DIR $dir $dir/cgnstools $dir/cgnsview \
41 $dir/../share/cgnstools \
3842 /usr/local/share /usr/local/share/cgnstools ; do
3943 if test -f $d/cgnsview.tcl ; then
4044 cgnsview=$d/cgnsview.tcl
1010 *
1111 */
1212
13 #include <tk.h>
14 #include "tkWinInt.h"
1513 #define WIN32_LEAN_AND_MEAN
1614 #include <windows.h>
1715 #undef WIN32_LEAN_AND_MEAN
16 #include <tk.h>
17 #include "tkWinInt.h"
1818 #include <malloc.h>
1919 #include <locale.h>
2020
0 #include <tk.h>
10 #if defined(__WIN32__) || defined(_WIN32)
21 # define WIN32_LEAN_AND_MEAN
32 # include <windows.h>
43 # undef WIN32_LEAN_AND_MEAN
54 #endif
5 #include <tk.h>
66 #include <math.h>
77 #include <assert.h>
88 #include <string.h>
0 #include <string.h>
1 #include <tk.h>
20 #if defined(__WIN32__) || defined(_WIN32)
31 # define WIN32_LEAN_AND_MEAN
42 # include <windows.h>
53 # undef WIN32_LEAN_AND_MEAN
64 #endif
5 #include <string.h>
6 #include <tk.h>
77 #include "gl_config.h"
88
99 typedef enum {
0 #include <tk.h>
10 #if defined(__WIN32__) || defined(_WIN32)
21 # define WIN32_LEAN_AND_MEAN
32 # include <windows.h>
43 # undef WIN32_LEAN_AND_MEAN
54 #endif
5 #include <tk.h>
66 #include <math.h>
77 #include <string.h>
88 #include <stdlib.h>
0 #include <tk.h>
10 #if defined(__WIN32__) || defined(_WIN32)
21 # define WIN32_LEAN_AND_MEAN
32 # include <windows.h>
43 # undef WIN32_LEAN_AND_MEAN
54 #endif
5 #include <tk.h>
66 #include <math.h>
77 #include <assert.h>
88 #include <string.h>
0 #include <tk.h>
10 #if defined(__WIN32__) || defined(_WIN32)
21 # define WIN32_LEAN_AND_MEAN
32 # include <windows.h>
43 # undef WIN32_LEAN_AND_MEAN
54 #endif
5 #include <tk.h>
66 #include <string.h>
77 #include "printstr.h"
88 #include "tkogl.h"
00 #ifndef _TK_OGL
11 #define _TK_OGL
22
3 #include <tk.h>
43 #if defined(__WIN32__) || defined(_WIN32)
54 # define WIN32_LEAN_AND_MEAN
65 # include <windows.h>
76 # undef WIN32_LEAN_AND_MEAN
87 #endif
8 #include <tk.h>
99 #include "gl_config.h"
1010 #include <assert.h>
1111 #if defined(__WIN32__) || defined(_WIN32)
1313 #include "cgnslib.h"
1414 #include "getargs.h"
1515 #include "hash.h"
16
17 #include "cgns_header.h"
18 extern cgns_posit* posit;
1619
1720 #ifndef CGNS_ENUMV
1821 # define CGNS_ENUMV(V) V
7780 typedef struct {
7881 CGNS_ENUMT(BCType_t) type;
7982 char name[33];
83 char family[CG_MAX_GOTO_DEPTH * 33 + 1];
8084 } BOCO;
8185
8286 static int nBocos = 0;
925929 &datatype, &ib))
926930 err_exit("cg_boco_info", NULL);
927931 Bocos[nb-1].type = bctype;
932 Bocos[nb - 1].family[0] = '\0';
928933 strcpy(Bocos[nb-1].name, name);
929934 if (cg_boco_gridlocation_read(cgFile, cgBase, cgZone,
930935 nb, &location))
934939 err_exit(NULL, "malloc failed for boco ptset");
935940 if (cg_boco_read(cgFile, cgBase, cgZone, nb, ptset, 0))
936941 err_exit("cg_boco_read", NULL);
937
942 if (bctype == CGNS_ENUMV(FamilySpecified)) {
943 cg_goto(cgFile, cgBase, "Zone_t", cgZone, "ZoneBC_t", 1 , "BC_t", nb, NULL);
944 cg_famname_read(Bocos[nb - 1].family);
945 }
938946 if (is_structured)
939947 structured_boundary(nb, ptype, location, np, ptset);
940948 else
941949 unstructured_boundary(nb, ptype, location, np, ptset);
942950 free(ptset);
951 }
952
953 /* correction for FamilySpecified */
954 for (nb = 0; nb < nBocos; nb++) {
955 if (Bocos[nb].type != CGNS_ENUMV(FamilySpecified)) {
956 continue;
957 }
958 if (strlen(Bocos[nb].family) > 0 && Bocos[nb].family[0] == '/') {
959 if (cg_gopath(cgFile, Bocos[nb].family) != CG_OK) {
960 continue;
961 }
962 }
963 else {
964 if (cg_goto(cgFile, cgBase, Bocos[nb].family, 0, NULL) != CG_OK) {
965 continue;
966 }
967 }
968 if (cg_gorel(cgFile, "FamilyBC_t", 1, NULL) != CG_OK) {
969 continue;
970 }
971 cgns_fambc* f = (cgns_fambc*)posit->posit;
972 Bocos[nb].type = f->type;
943973 }
944974 }
945975
13401370 else
13411371 unstructured_elements();
13421372 boundary_conditions();
1343
1373
13441374 /* open output file */
13451375
13461376 if (argind < argc - 1) {
500500 }
501501
502502
503 void update_cgns_version(double cgio_num, double root_id)
503 void update_cgns_version(int cgio_num, double root_id)
504504 {
505505 double node_id;
506506 float cgns_version = 4.00;
3434 #define CG_BUILD_SCOPE @BUILDSCOPE@
3535 #define CG_BUILD_BASESCOPE @BUILDBASESCOPE@
3636 #define CG_BUILD_PARALLEL @BUILDPARALLEL@
37 #define CG_BUILD_COMPLEX_C99_EXT @HAVE_COMPLEX_C99_EXT@
3738
3839 #define CG_MAX_INT32 0x7FFFFFFF
3940 #ifdef _WIN32
4041 # define CG_LONG_T __int64
4142 #ifdef _MSC_VER
42 # ifdef CG_BUILD_64BIT
43 # if CG_BUILD_64BIT
4344 # define stat _stat32i64
4445 # endif
4546 #endif
3535 #define HAVE_FORTRAN_2008TS @HAVE_FORTRAN_2008TS@
3636 #define HDF5_HAVE_MULTI_DATASETS @HDF5_HAVE_MULTI_DATASETS@
3737
38 #define CG_BUILD_HDF5 @BUILDHDF5@
39
3840 #define CG_BUILD_SCOPE @BUILDSCOPE@
3941
4042 #define CGNS_BASESCOPE @BUILDBASESCOPE@
+0
-260
src/changes_from_2.5.txt less more
0 1) handles hdf5 and adf transparently through new cgns_io interface
1
2 2) added PYRA_13 and NFACE_n element types
3
4 3) element data is no longer read into memory when the file is opened,
5 only when requested. John Bussoletti fix (also in 2.5 under CVS)
6
7 4) Robert Magnum correction for cg_model_read(). (also in 2.5 under CVS)
8
9 5) added to cgnslib:
10
11 /* file_type defines */
12 #define CG_FILE_NONE 0
13 #define CG_FILE_ADF 1
14 #define CG_FILE_HDF5 2
15 #define CG_FILE_XML 3
16
17 int cg_save_as(int fn, const char *filename, int file_type, int follow_links);
18 cg_save_as_f(fn, filename, file_type, follow_links, ier)
19
20 int cg_set_file_type(int file_type);
21 int cg_get_file_type(int fn, int *file_type);
22 cg_set_file_type_f(file_type, ier)
23 cg_get_file_type_f(fn, file_type, ier)
24
25 /* these are wrappers on cg_configure() */
26
27 int cg_error_handler(void (*)(int, char *));
28
29 int cg_set_compress(int compress);
30 int cg_get_compress(int *compress);
31 cg_set_compress_f(compress, ier);
32 cg_get_compress_f(compress, ier);
33
34 int cg_set_path(const char *path);
35 int cg_add_path(const char *path);
36 cg_set_path_f(path, ier);
37 cg_add_path_f(path, ier);
38
39
40 6) changed in cgnslib
41
42 int cg_is_cgns(const char *filename);
43 cg_is_cgns_f(filename, ier)
44
45 to
46
47 int cg_is_cgns(const char *filename, int *file_type);
48 cg_is_cgns_f(filename, file_type, ier)
49
50
51 7) removed from cgnslib:
52
53 MODE_READ, MODE_WRITE, MODE_MODIFY, Null, UserDefined and Celsius defines
54
55
56 8) low-level file access should now be made through the cgio interface
57 rather than ADF (or ADFH) directly. Include cgns_io.h for the function
58 prototypes. The ADF and ADFH functions are still available by including
59 the appropriate ADF.h header file.
60
61 These are some of the defines, the CGIO_MODE_xxx and CGIO_FILE_xxx are the
62 same as the cgns counterparts. The CGIO_MAX_xxx defines are the same as
63 for the ADF library. There are also some configure defines, and error
64 code returns for the cgio routines. The specific implementation (ADF, HDF5)
65 can return additional error codes not defined there.
66
67 #define CGIO_MODE_READ 0
68 #define CGIO_MODE_WRITE 1
69 #define CGIO_MODE_MODIFY 2
70
71 #define CGIO_FILE_NONE 0
72 #define CGIO_FILE_ADF 1
73 #define CGIO_FILE_HDF5 2
74 #define CGIO_FILE_XML 3
75
76 #define CGIO_MAX_DATATYPE_LENGTH 2
77 #define CGIO_MAX_DIMENSIONS 12
78 #define CGIO_MAX_NAME_LENGTH 32
79 #define CGIO_MAX_LABEL_LENGTH 32
80 #define CGIO_MAX_VERSION_LENGTH 32
81 #define CGIO_MAX_ERROR_LENGTH 80
82 #define CGIO_MAX_LINK_DEPTH 100
83 #define CGIO_MAX_FILE_LENGTH 1024
84 #define CGIO_MAX_LINK_LENGTH 4096
85
86 The following lists the cgio functions. They are similar to the ADF routines
87 in terms of srgument list. Maybe I'll find some time to document them.
88
89 int cgio_path_add(const char *path);
90 cgio_path_add_f(ier, path)
91
92 int cgio_path_delete(const char *path);
93 cgio_path_delete_f(ier, path)
94
95 int cgio_find_file(const char *filename, int file_type,
96 int max_path_len, char *pathname);
97 cgio_find_file_f(ier, filename, file_type, pathname)
98
99 int cgio_is_supported(int file_type);
100 cgio_is_supported_f(ier, file_type);
101
102 int cgio_configure(int what, void *value);
103
104 void cgio_cleanup();
105 cgio_cleanup_f(ier)
106
107 int cgio_check_file(const char *filename, int *file_type);
108 cgio_check_file_f(ier, filename, file_type)
109
110 int cgio_compute_data_size(const char *data_type, int num_dims,
111 const int *dim_vals, unsigned long *count);
112 cgio_compute_data_size_f(ier, data_type, num_dims, dim_vals, count, size)
113
114 int cgio_open_file(const char *filename, int file_mode,
115 int file_type, int *cgio_num);
116 cgio_open_file_f(ier, filename, file_mode, file_type, cgio_num)
117
118 int cgio_close_file(int cgio_num);
119 cgio_close_file_f(ier, cgio_num);
120
121 int cgio_compress_file(int cgio_num, const char *filename);
122
123 int cgio_copy_file(int cgio_num_inp, int cgio_num_out, int follow_links);
124
125 int cgio_flush_to_disk(int cgio_num);
126 cgio_flush_to_disk_f(ier, cgio_num)
127
128 int cgio_library_version(int cgio_num, char *version);
129 cgio_library_version_f(ier, cgio_num, version)
130
131 int cgio_file_version(int cgio_num, char *file_version,
132 char *creation_date, char *modified_date);
133 cgio_file_version_f(ier, cgio_num, file_version, creation_date, modified_date)
134
135 int cgio_get_root_id(int cgio_num, double *rootid);
136 cgio_get_root_id_f(ier, cgio_num, rootid)
137
138 int cgio_get_file_type(int cgio_num, int *file_type);
139 cgio_get_file_type_f(ier, cgio_num, file_type)
140
141 void cgio_error_code(int *errcode, int *file_type);
142 cgio_error_code_f(errcode, file_type)
143
144 int cgio_error_message(int max_len, char *error_msg);
145 cgio_error_message_f(ier, error_msg)
146
147 void cgio_error_exit(const char *msg);
148 cgio_error_exit_f(msg)
149
150 int cgio_create_node(int cgio_num, double pid, const char *name, double *id);
151 cgio_create_node_f(ier, cgio_num, pid, name, id)
152
153 int cgio_new_node(int cgio_num, double pid, const char *name,
154 const char *label, const char *data_type, int ndims,
155 const int *dims, const void *data, double *id);
156
157 int cgio_delete_node(int cgio_num, double pid, double id);
158 cgio_delete_node_f(ier, cgio_num, pid, id)
159
160 int cgio_move_node(int cgio_num, double pid, double id, double new_pid);
161 cgio_move_node_f(ier, cgio_num, pid, id, new_pid)
162
163 int cgio_copy_node(int cgio_num_inp, double id_inp, int cgio_num_out,
164 double id_out);
165
166 int cgio_release_id(int cgio_num, double id);
167 cgio_release_id_f(ier, cgio_num, id)
168
169 int cgio_is_link(int cgio_num, double id, int *link_len);
170 cgio_is_link_f(ier, cgio_num, id, link_len)
171
172 int cgio_link_size(int cgio_num, double id, int *file_len, int *name_len);
173 cgio_link_size_f(ier, cgio_num, id, file_len, name_len)
174
175 int cgio_create_link(int cgio_num, double pid, const char *name,
176 const char *filename, const char *name_in_file,
177 double *id);
178 cgio_create_link_f(ier, cgio_num, pid, name, filename, name_in_file, id)
179
180 int cgio_get_link(int cgio_num, double id, char *filename,
181 char *name_in_file);
182 cgio_get_link_f(ier, cgio_num, id, filename, name_in_file)
183
184 int cgio_number_children(int cgio_num, double id, int *num_children);
185 cgio_number_children_f(ier, cgio_num, id, num_children)
186
187 int cgio_children_ids(int cgio_num, double pid, int start, int max_ret,
188 int *num_ret, double *ids);
189 cgio_children_ids_f(ier, cgio_num, pid, start, max_ret, num_ret, ids)
190
191 int cgio_children_names(int cgio_num, double pid, int start, int max_ret,
192 int name_len, int *num_ret, char *names);
193 cgio_children_names_f(ier, cgio_num, pid, start, max_ret, name_len,
194 num_ret, names)
195
196 int cgio_get_node_id(int cgio_num, double pid, const char *name, double *id);
197 cgio_get_node_id_f(ier, cgio_num, pid, name, id)
198
199 int cgio_get_name(int cgio_num, double id, char *name);
200 cgio_get_name_f(ier, cgio_num, id, name)
201
202 int cgio_get_label(int cgio_num, double id, char *label);
203 cgio_get_label_f(ier, cgio_num, id, label)
204
205 int cgio_get_data_type(int cgio_num, double id, char *data_type);
206 cgio_get_data_type_f(ier, cgio_num, id, data_type)
207
208 int cgio_get_data_size(int cgio_num, double id, unsigned long *data_size);
209 cgio_get_data_size_f(ier, cgio_num, id, data_size)
210
211 int cgio_get_dimensions(int cgio_num, double id, int *num_dims, int *dims);
212 cgio_get_dimensions_f(ier, cgio_num, id, num_dims, dims)
213
214 int cgio_read_all_data(int cgio_num, double id, void *data);
215 cgio_read_all_data_f(ier, cgio_num, id, data)
216
217 int cgio_read_data(int cgio_num, double id, const int *s_start,
218 const int *s_end, const int *s_stride, int m_num_dims,
219 const int *m_dims, const int *m_start, const int *m_end,
220 const int *m_stride, void *data);
221 cgio_read_data_f(ier, cgio_num, id, s_start, s_end, s_stride, m_num_dims,
222 m_dims, m_start, m_end, m_stride, data)
223
224 int cgio_set_name(int cgio_num, double pid, double id, const char *name);
225 cgio_set_name_f(ier, cgio_num, pid, id, name)
226
227 int cgio_set_label(int cgio_num, double id, const char *label);
228 cgio_set_label_f(ier, cgio_num, id, label)
229
230 int cgio_set_dimensions(int cgio_num, double id, const char *data_type,
231 int num_dims, const int *dims);
232 cgio_set_dimensions_f(ier, cgio_num, id, data_type, num_dims, dims)
233
234 int cgio_write_all_data(int cgio_num, double id, const void *data);
235 cgio_write_all_data_f(ier, cgio_num, id, data)
236
237 int cgio_write_data(int cgio_num, double id, const int *s_start,
238 const int *s_end, const int *s_stride, int m_num_dims,
239 const int *m_dims, const int *m_start, const int *m_end,
240 const int *m_stride, const void *data);
241 cgio_write_data_f(ier, cgio_num, id, s_start, s_end, s_stride, m_num_dims,
242 m_dims, m_start, m_end, m_stride, data)
243
244
245 9) changes to ADF
246
247 removed ADF_Search_Add() and ADF_Search_Delete() (now handled in cgio)
248 added ADF_Link_Size()
249 implemented Paul Edwards fix for reading blocks (also in 2.5 under CVS)
250
251
252 10) changes to ADFH
253
254 removed ADFH_Search_Add() and ADFH_Search_Delete() (now handled in cgio)
255 added ADFH_Link_Size()
256
257 updated with Marc's link file changes. The index swapping from Fortran to C
258 is implemented. (also in 2.5 under CVS)
259
+0
-489
src/changes_from_3.0.html less more
0 <html><head><title>Changes in CGNS 3.1</title></head><body>
1
2 <h2>Changes in CGNS 3.1</h2>
3
4 <ul>
5 <li> <a href="#cpex0027">Time-dependent Connectivity</a>
6 <li> <a href="#cpex0030">Zone Subregions</a>
7 <li> <a href="#cpex0031">General SIDS Improvements</a>
8 <li> <a href="#64-bit">64-bit Implementation</a>
9 <ul>
10 <li> <a href="#c_interface">C Interface</a>
11 <li> <a href="#c_portability">C Portability</a>
12 <li> <a href="#fortran_interface">FORTRAN Interface</a>
13 <li> <a href="#fortran_issues">FORTRAN Issues and Portability</a>
14 <li> <a href="#examples">Examples</a>
15 </ul>
16 </ul>
17
18 <a name="cpex0027"></a>
19 <h2>Time-dependent Connectivity</h2>
20
21 <a href="http://cgns.sourceforge.net/ProposedExtensions/Timedepconn.pdf">CPEX0027</a>
22 has been implemented. The added functions to support this extension are described
23 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/timedep.html#zconn">Zone Grid Connectivity</a>
24 in the Mid-Level Library.
25
26 <a name="cpex0030"></a>
27 <h2>Zone Subregions</h2>
28
29 <a href="http://cgns.sourceforge.net/ProposedExtensions/RegionsIX.pdf">CPEX0030</a>
30 has been implemented. The added functions to support this extension are described
31 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#subregion">Zone Subregions</a>
32 in the Mid-Level Library.
33
34 <a name="cpex0031"></a>
35 <h2>General SIDS Improvements</h2>
36
37 <a href="http://cgns.sourceforge.net/ProposedExtensions/intro_parts_of_sids2.pdf">CPEX0031</a>
38 has been implemented. The added functions to support this extension are described
39 in <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#flowsolution">Flow Solution</a>
40 and <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/solution.html#discretedata">Discrete Data</a> in
41 the Mid-Level Library. There are also changes to
42 <a href="http://www.grc.nasa.gov/WWW/cgns/CGNS_docs_current/midlevel/bc.html#bc">Boundary Conditions</a>
43 and numerous places in the SIDS.
44
45 <a name="64-bit"></a>
46 <h2>64-bit Implementation</h2>
47
48 You only need to read the following if you have a 64-bit computer and need to
49 work with problems that exceed 2 billion coordinates and/or elements.
50 Or, if you are bored.
51
52 <a name="c_interface"></a>
53 <h3>C Interface</h3>
54
55 The major change in 3.1 is the introduction of the data type <tt><b>cgsize_t</b></tt>,
56 which will be a 64-bit integer when building 64-bit code, and a 32-bit integer
57 otherwise. This is defined in a new header file, <tt><i>cgnstypes.h</i></tt>, which is
58 included in <tt><i>cgnslib.h</i></tt>. Some additional data types have also been
59 introduced, <tt><b>cglong_t</b></tt> which is always 64-bits, <tt><b>cgint_t</b></tt> and
60 <tt><b>cgerr_t</b></tt> which are 32-bit integers, and <tt><b>cgid_t</b></tt> which is a
61 64-bit floating point number (<tt>double</tt>). With the exception of <tt><b>cglong_t</b></tt>
62 these other data types are currently not used.
63 The <tt><b>cglong_t</b></tt> data type is used internally,
64 and may be used by application code in conjunction with
65 <tt><b><i>DataType_t</i> LongInteger</b></tt> to write 64-bit data
66 to the CGNS file, regardless of the compilation mode. The <tt><i>cgnstypes.h</i></tt>
67 header file also defines 3 flags, which describe the current build mode,
68 <tt><b>CG_BUILD_LEGACY</b></tt>, <tt><b>CG_BUILD_64BIT</b></tt>,
69 and <tt><b>CG_BUILD_SCOPE</b></tt>,
70 which are set to 0 or 1, depending on the build mode.
71 <p>
72 When the <tt><i>--enable-legacy</i></tt> option is given to <tt><i>configure</i></tt>,
73 <tt><b>cgsize_t</b></tt> is defined as an <tt><b>int</b></tt> (<tt><b>integer*4</b></tt>),
74 <tt><b>CG_BUILD_LEGACY</b></tt> is set to 1, and <tt><b>CG_BUILD_64BIT</b></tt> and
75 <tt><b>CG_BUILD_SCOPE</b></tt> are set to 0. The <tt><i>--enable-scope</i></tt> and
76 <tt><i>--enable-64bit</i></tt> options to <tt><i>configure</i></tt> are ignored.
77 This will generate the same code as for the versions prior to 3.1.
78 <p>
79 When the <tt><i>--enable-64bit</i></tt> option is given to <tt><i>configure</i></tt>,
80 <tt><b>cgsize_t</b></tt> is typedef'd as <tt><b>long</b></tt>, <tt><b>long long</b></tt> or
81 <tt><b>__int64</b></tt> (depending on the machine) and the equivalent FORTRAN
82 data type is <tt><b>integer*8</b></tt>. All other values are unchanged. This will
83 set <tt><b>CG_BUILD_64BIT</b></tt> to 1, and <tt><b>CG_BUILD_LEGACY</b></tt> to 0 in
84 <tt><i>cgnstypes.h</i></tt>. The value of <tt><b>CG_BUILD_SCOPE</b></tt> depends on
85 the <tt><i>configure</i></tt> option below.
86 <br>
87 If this option is not given, then <tt><b>cgsize_t</b></tt> is typedef'd as <tt><b>int</b></tt>,
88 and the equivalent FORTRAN data type is <tt><b>integer*4</b></tt>. The value of
89 <tt><b>CG_BUILD_64BIT</b></tt> is set to 0.
90 <p>
91 When the <tt><i>--enable-scope</i></tt> option is given to <tt><i>configure</i></tt>,
92 scoping of the enumeration values in cgnslib are enabled. This will
93 prefix all the enums with <tt><b>CG_</b></tt>. This is disabled by default and
94 when <tt><i>--enable-legacy</i></tt> is enabled. If enabled, this will set the
95 value of <tt><b>CG_BUILD_SCOPE</b></tt> in <tt><i>cgnstypes.h</i></tt> to 1.
96 <p>
97 These options are also available for <i>cmake</i> users, and have the same behavior.
98 <p>
99 When building 64-bit code, the ADF file format changes, and thus will not be
100 readable by prior versions of the library. All dimensions are stored as
101 64-bit integers, and the modifications to the ADF interface allow addressing
102 and storage up to 1,000 terabytes of data. The HDF5 interface
103 is also effected due to the the dimension sizes. I'm not sure of the HDF5
104 limitations to file size, but I expect it to be as large as that
105 addressable by a 64-bit integer.
106 <p>
107 Thus, when writing a CGNS file
108 in 64-bit mode it will only be readable by the version 3.1 software. A 32-bit
109 compilation of version 3.1 will be able to read the 64-bit CGNS file, but will fail
110 gracefully if the dimensions exceed those that can be handled by a 32-bit
111 integer. With a 32-bit mode compilation, the ADF version and HDF5 interfaces
112 are unchanged, and thus the CGNS files will be readable by earlier version
113 software.
114 <p>
115 Regardless of how the version 3.1 software is compiled, it is backwards
116 compatible with earlier version CGNS files.
117 <p>
118 A new data type has also been added to the CGNS MLL, <tt><b>LongInteger</b></tt>, which
119 is defined in the <tt><i>DataType_t</i></tt> enumeration. This refers to a true 64-bit
120 integer. Previous versions of the MLL did not explicitly allow for 64-bit integer data.
121 This data type is automatically used for dimensions, connectivity, boundary condition
122 points, holes and elements when compiled in 64-bit mode. It may also be used by an
123 application to define array data as 64-bit, regardless of the compilation mode. In this
124 case, the data should be defined as <tt><b>cglong_t</b></tt> in the code in order to
125 guarantee 64-bit data being passed to the array read or write routines.
126 <p>
127 The following routines have been modified to use the <tt><b>cgsize_t</b></tt> data type.
128 <br><pre>
129 cg_zone_read(int fn, int B, int Z, char *zonename, <i><font color="red">cgsize_t</font></i> *size);
130 cg_zone_write(int fn, int B, const char * zonename,
131 const <i><font color="red">cgsize_t</font></i> * size, CGNS_ENUMT(ZoneType_t) type, int *Z);
132
133 cg_coord_read(int fn, int B, int Z, const char * coordname,
134 CGNS_ENUMT(DataType_t) type, const <i><font color="red">cgsize_t</font></i> * rmin,
135 const <i><font color="red">cgsize_t</font></i> * rmax, void *coord);
136 cg_coord_partial_write(int fn, int B, int Z,
137 CGNS_ENUMT(DataType_t) type, const char * coordname,
138 const <i><font color="red">cgsize_t</font></i> *rmin, const <i><font color="red">cgsize_t</font></i> *rmax,
139 const void * coord_ptr, int *C);
140
141 cg_section_read(int file_number, int B, int Z, int S,
142 char *SectionName, CGNS_ENUMT(ElementType_t) *type,
143 <i><font color="red">cgsize_t</font></i> *start, <i><font color="red">cgsize_t</font></i> *end, int *nbndry, int *parent_flag);
144 cg_section_write(int file_number, int B, int Z,
145 const char * SectionName, CGNS_ENUMT(ElementType_t) type,
146 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, int nbndry, const <i><font color="red">cgsize_t</font></i> * elements,
147 int *S);
148 cg_section_partial_write(int file_number, int B, int Z,
149 const char * SectionName, CGNS_ENUMT(ElementType_t) type,
150 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, int nbndry, int *S);
151
152 cg_elements_read(int file_number, int B, int Z, int S,
153 <i><font color="red">cgsize_t</font></i> *elements, <i><font color="red">cgsize_t</font></i> *parent_data);
154 cg_elements_partial_write(int fn, int B, int Z, int S,
155 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, const <i><font color="red">cgsize_t</font></i> *elements);
156 cg_elements_partial_read(int file_number, int B, int Z, int S,
157 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, <i><font color="red">cgsize_t</font></i> *elements, <i><font color="red">cgsize_t</font></i> *parent_data);
158
159 cg_parent_data_write(int file_number, int B, int Z, int S,
160 const <i><font color="red">cgsize_t</font></i> * parent_data);
161 cg_parent_data_partial_write(int fn, int B, int Z, int S,
162 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, const <i><font color="red">cgsize_t</font></i> *ParentData);
163
164 cg_ElementDataSize(int file_number, int B, int Z, int S,
165 <i><font color="red">cgsize_t</font></i> *ElementDataSize);
166 cg_ElementPartialSize(int file_number, int B, int Z, int S,
167 <i><font color="red">cgsize_t</font></i> start, <i><font color="red">cgsize_t</font></i> end, <i><font color="red">cgsize_t</font></i> *ElementDataSize);
168
169 cg_field_read(int fn, int B, int Z, int S, const char *fieldname,
170 CGNS_ENUMT(DataType_t) type, const <i><font color="red">cgsize_t</font></i> *rmin,
171 const <i><font color="red">cgsize_t</font></i> *rmax, void *field_ptr);
172 cg_field_partial_write(int fn, int B, int Z, int S,
173 CGNS_ENUMT(DataType_t) type, const char * fieldname,
174 const <i><font color="red">cgsize_t</font></i> *rmin, const <i><font color="red">cgsize_t</font></i> *rmax,
175 const void * field_ptr, int *F);
176
177 cg_hole_info(int fn, int B, int Z, int I, char *holename,
178 CGNS_ENUMT(GridLocation_t) *location, CGNS_ENUMT(PointSetType_t) *ptset_type,
179 int *nptsets, <i><font color="red">cgsize_t</font></i> *npnts);
180 cg_hole_read(int fn, int B, int Z, int I, <i><font color="red">cgsize_t</font></i> *pnts);
181 cg_hole_write(int fn, int B, int Z, const char * holename,
182 CGNS_ENUMT(GridLocation_t) location, CGNS_ENUMT(PointSetType_t) ptset_type,
183 int nptsets, <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, int *I);
184
185 cg_conn_info(int file_number, int B, int Z, int I,
186 char *connectname, CGNS_ENUMT(GridLocation_t) *location,
187 CGNS_ENUMT(GridConnectivityType_t) *type,
188 CGNS_ENUMT(PointSetType_t) *ptset_type,
189 <i><font color="red">cgsize_t</font></i> *npnts, char *donorname,
190 CGNS_ENUMT(ZoneType_t) *donor_zonetype,
191 CGNS_ENUMT(PointSetType_t) *donor_ptset_type,
192 CGNS_ENUMT(DataType_t) *donor_datatype,
193 <i><font color="red">cgsize_t</font></i> *ndata_donor);
194 cg_conn_read(int file_number, int B, int Z, int I, <i><font color="red">cgsize_t</font></i> *pnts,
195 CGNS_ENUMT(DataType_t) donor_datatype,
196 <i><font color="red">cgsize_t</font></i> *donor_data);
197 cg_conn_write(int file_number, int B, int Z,
198 const char * connectname, CGNS_ENUMT(GridLocation_t) location,
199 CGNS_ENUMT(GridConnectivityType_t) type,
200 CGNS_ENUMT(PointSetType_t) ptset_type,
201 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, const char * donorname,
202 CGNS_ENUMT(ZoneType_t) donor_zonetype,
203 CGNS_ENUMT(PointSetType_t) donor_ptset_type,
204 CGNS_ENUMT(DataType_t) donor_datatype,
205 <i><font color="red">cgsize_t</font></i> ndata_donor, const <i><font color="red">cgsize_t</font></i> *donor_data, int *I);
206 cg_conn_write_short(int file_number, int B, int Z,
207 const char * connectname, CGNS_ENUMT(GridLocation_t) location,
208 CGNS_ENUMT(GridConnectivityType_t) type,
209 CGNS_ENUMT(PointSetType_t) ptset_type,
210 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, const char * donorname, int *I);
211 cg_conn_read_short(int file_number, int B, int Z, int I,
212 <i><font color="red">cgsize_t</font></i> *pnts);
213
214 cg_1to1_read(int fn, int B, int Z, int I, char *connectname,
215 char *donorname, <i><font color="red">cgsize_t</font></i> *range, <i><font color="red">cgsize_t</font></i> *donor_range, int *transform);
216 cg_1to1_write(int fn, int B, int Z, const char * connectname,
217 const char * donorname, const <i><font color="red">cgsize_t</font></i> * range,
218 const <i><font color="red">cgsize_t</font></i> * donor_range, const int * transform, int *I);
219 cg_1to1_read_global(int fn, int B, char **connectname,
220 char **zonename, char **donorname, <i><font color="red">cgsize_t</font></i> **range,
221 <i><font color="red">cgsize_t</font></i> **donor_range, int **transform);
222
223 cg_boco_info(int fn, int B, int Z, int BC, char *boconame,
224 CGNS_ENUMT(BCType_t) *bocotype, CGNS_ENUMT(PointSetType_t) *ptset_type,
225 <i><font color="red">cgsize_t</font></i> *npnts, int *NormalIndex, <i><font color="red">cgsize_t</font></i> *NormalListFlag,
226 CGNS_ENUMT(DataType_t) *NormalDataType, int *ndataset);
227 cg_boco_read(int fn, int B, int Z, int BC, <i><font color="red">cgsize_t</font></i> *pnts,
228 void *NormalList);
229 cg_boco_write(int file_number, int B, int Z, const char * boconame,
230 CGNS_ENUMT(BCType_t) bocotype, CGNS_ENUMT(PointSetType_t) ptset_type,
231 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> * pnts, int *BC);
232
233 cg_array_info(int A, char *ArrayName,
234 CGNS_ENUMT(DataType_t) *DataType,
235 int *DataDimension, <i><font color="red">cgsize_t</font></i> *DimensionVector);
236 cg_array_write(const char * ArrayName,
237 CGNS_ENUMT(DataType_t) DataType, int DataDimension,
238 const <i><font color="red">cgsize_t</font></i> * DimensionVector, const void * Data);
239
240 cg_ptset_info(CGNS_ENUMT(PointSetType_t) *ptset_type,
241 <i><font color="red">cgsize_t</font></i> *npnts);
242 cg_ptset_write(CGNS_ENUMT(PointSetType_t) ptset_type,
243 <i><font color="red">cgsize_t</font></i> npnts, const <i><font color="red">cgsize_t</font></i> *pnts);
244 cg_ptset_read(<i><font color="red">cgsize_t</font></i> *pnts);
245 </pre><p>
246 Note that, as in earlier versions of the library, the <tt><i>donor_datatype</i></tt>
247 argument to <tt><i>cg_conn_write</i></tt> and <tt><i>cg_conn_read</i></tt> are redundant. Earlier versions
248 required this value to be <tt><b>Integer</b></tt>. In 3.1 this is ignored altogether,
249 and is taken to <tt><b>Integer</b></tt> in 32-bit mode and
250 <tt><b>LongInteger</b></tt> in 64-bit mode. The corresponding <tt><i>donor_data</i></tt>
251 is always of type <tt><b>cgsize_t</b></tt>.
252 <p>
253 A new convenience function has been added to the MLL:
254 <pre>
255 cg_index_dim(int file_number, int B, int Z, int *index_dim)
256 </pre>
257 which gets the index dimension for the specified base and zone. The return value
258 will be the Cell Dimension for a structured grid, and 1 for an unstructured grid.
259
260 <a name="c_portability"></a>
261 <h3>C Portability</h3>
262
263 If you use the <tt><b>cgsize_t</b></tt> data type in new code, it will work in
264 both 32 and 64-bit compilation modes. In order to support CGNS versions prior
265 to 3.1, you may also want to add something like this to your code:
266 <pre>
267 #if CGNS_VERSION < 3100
268 #define cgsize_t int
269 #endif
270 </pre>
271 Existing code that uses <tt><b>int</b></tt> will not work with a CGNS 3.1 library
272 compiled with the <tt><i>enable-64bit</i></tt> option turned on. You may want
273 to add something like this to your code:
274 <pre>
275 #if CGNS_VERSION >= 3100 && CG_BUILD_64BIT
276 #error does not work in 64 bit mode
277 #endif
278 </pre>
279 or modify your code to use <tt><b>cgsize_t</b></tt>.
280
281 <a name="fortran_interface"></a>
282 <h3>FORTRAN Interface</h3>
283
284 All integer arguments in the FORTRAN interface are taken to be
285 <tt><b>integer*4</b></tt> in 32-bit mode and <tt><b>integer*8</b></tt>
286 in 64-bit mode. If you have used default or implicit integers in your FORTRAN
287 code, it should port to 64-bit mode in most cases by simply turning on your
288 compiler option that promotes implicit integers to <tt><b>integer*8</b></tt>.
289 However, be sure that you read the next section about issues.
290 For example, all the FORTRAN code in the User's Guide examples ported
291 unmodified when using the <tt><i>-fdefault-integer-8</i></tt> compiler option
292 with <tt><i>gfortran</i></tt>. If you have explicitly defined your integers
293 as <tt><b>integer*4</b></tt>, your code will not work in 64-bit mode.
294 In that case, you will either need to change them to <tt><b>integer</b></tt>
295 (recommended for portability) or <tt><b>integer*8</b></tt>.
296 <p>
297 The <tt><i>cgnslib_f.h</i></tt> header file has been modified to explicitly
298 define all integer values based on the CGNS library compilation mode,
299 <tt><b>integer*8</b></tt> when compiled in 64-bit mode and
300 <tt><b>integer*4</b></tt> otherwise. A new integer parameter has also
301 been added to the header, <tt><b>CG_BUILD_64BIT</b></tt>, which will be set
302 to 1 in 64-bit mode and 0 otherwise. You may use this parameter to check
303 if the CGNS library has been compiled in 64-bit mode or not, as in:
304 <pre>
305 if (CG_BUILD_64BIT .ne. 0) then
306 print *,'will not work in 64-bit mode'
307 stop
308 endif
309 </pre>
310 If you are using a CGNS library prior to version 3.1, this parameter will
311 not be defined and you will need to rely on your compiler initializing all
312 undefined values to 0 (not always the case) for this test to work.
313
314 <a name="fortran_issues"></a>
315 <h3>FORTRAN Issues and Portability</h3>
316
317 If your compiler supports automatic promotion of integers, and you use
318 implicit integers, your code should port to 64-bit with the following exception.
319 <p>
320 If you use an <tt><b>Integer</b></tt> data type in any routine that takes
321 a data type specification, and an implicit integer for the data, the code
322 will fail when compiled in 64-bit mode with automatic integer promotion.
323 An example of this would be:
324 <pre>
325 integer dim
326 integer data(dim)
327 call cg_array_write_f('array',Integer,1,dim,data)
328 </pre>
329 This is because the MLL interprets the <tt><b>Integer</b></tt> data type
330 as <tt><b>integer*4</b></tt> regardless of the compilation mode. The compiler,
331 however, has automatically promoted <tt><i>data</i></tt> to be
332 <tt><b>integer*8</b></tt>. What you will need to do to prevent this problem,
333 is to either explicitly define <tt><i>data</i></tt> as in:
334 <pre>
335 integer dim
336 integer*4 data(dim)
337 call cg_array_write_f('array',Integer,1,dim,data)
338 </pre>
339 or
340 <pre>
341 integer dim
342 integer*8 data(dim)
343 call cg_array_write_f('array',LongInteger,1,dim,data)
344 </pre>
345 or test on <tt><b>CG_BUILD_64BIT</b></tt> as in:
346 <pre>
347 integer dim
348 integer data(dim)
349 if (CG_BUILD_64BIT .eq. 0) then
350 call cg_array_write_f('array',Integer,1,dim,data)
351 else
352 call cg_array_write_f('array',LongInteger,1,dim,data)
353 endif
354 </pre>
355 The last 2 options will only work with CGNS Version 3.1, since
356 <tt><b>LongInteger</b></tt> and <tt><b>CG_BUILD_64BIT</b></tt> are
357 not defined in previous versions. Note also, that this does not
358 apply to the <tt><i>donor_datatype</i></tt>
359 argument to <tt><i>cg_conn_write</i></tt> and
360 <tt><i>cg_conn_read</i></tt> as discussed above.
361 <p>
362 You may also need to be careful when using integer constants as arguments
363 in 64-bit mode. If your compiler automatically promotes integer constants
364 to <tt><b>integer*8</b></tt>, then there is no problem. This is probably
365 the case if your compiler supports implicit integer promotion. If not,
366 then the constants will be <tt><b>integer*4</b></tt>, and your code
367 will not work in 64-bit mode. In that case you will need to do something like:
368 <pre>
369 integer*8 one,dim
370 integer*4 data(dim)
371 one = 1
372 call cg_array_write_f('array',Integer,one,dim,data)
373 </pre>
374 If you can't or don't want to use automatic integer promotion, but still want
375 to be able to port to 64-bit code, you may include the preprocessor header file,
376 <tt><i>cgnstypes_f.h</i></tt> in your code. In 64-bit mode, the <tt><b>CG_BUILD_64BIT</b></tt> define
377 in the header will be set to 1, and <tt><b>cgsize_t</b></tt> and <tt><b>CGSIZE_T</b></tt>
378 will be defined as <tt><b>integer*8</b></tt>, otherwise <tt><b>CG_BUILD_64BIT</b></tt> will
379 be 0 and <tt><b>cgsize_t</b></tt> and <tt><b>CGSIZE_T</b></tt> will be defined
380 as <tt><b>integer*4</b></tt>. By including this header file as a preprocessor
381 include (i.e. <tt><i>#include "cgnstypes_f.h"</i></tt>) you may then use
382 <tt><b>cgsize_t</b></tt> as variable type name. for example:
383 <pre>
384 #include "cgnstypes_f.h"
385 cgsize_t cgfile,cgbase,celldim,physdim
386 cgsize_t one,dim,ierr
387 cgsize_t data(dim)
388
389 call cg_open_f('file.cgns',CG_MODE_WRITE,cgfile,ierr)
390 celldim = 3
391 physdim = 3
392 call cg_base_write_f(cgfile,'base',celldim,physdim,cgbase,ierr)
393 ...
394 one = 1
395 #if CG_BUILD_64
396 call cg_array_write_f('array',Integer,one,dim,data)
397 #else
398 call cg_array_write_f('array',LongInteger,one,dim,data)
399 #endif
400 </pre>
401 Notice, that you will not be able to use integer constants, but your
402 FORTRAN code will be portable to 64-bit mode.
403 <p>
404 Lastly, you may use the header to simply limit the code to 32
405 or 64-bit modes, such as:
406 <pre>
407 #include "cgnstypes_f.h"
408 #if CG_BUILD_64BIT
409 # error can only be built in 32-bit mode
410 #endif
411 </pre>
412
413 <a name="examples"></a>
414 <h3>Examples</h3>
415
416 All the distributed C examples have been modified to use
417 <tt><b>cgsize_t</b></tt>. and will work in both 32 and 64-bit modes. They
418 are also fully compatible with previous CGNS versions.
419
420 <h4>C Test Program</h4>
421
422 There is a new C example in the <tt><i>tests</i></tt> subdirectory,
423 <tt><i>test64c.c</i></tt>, that you may use for simple 64-bit mode testing.
424 To compile it, do <tt>make test64</tt> from within the <tt><i>tests</i></tt>
425 subdirectory. The program allows you to write any number of coordinates or
426 tetrahedral elements using whatever amount of memory you specify. To
427 get the list of available options, enter:
428 <pre>
429 test64c -help
430 or
431 test64c --
432 </pre>
433 Without any options, the program will try to use 16 billion bytes of memory,
434 and write 4 billion float coordinates and 500 million tetrahedra. The number
435 of coordinates and tetrahedra default to the number that will fit within
436 the available memory, in this case (16b / 4) and (16b / 32). To specify the
437 amount of memory, use the <tt><i>-m</i></tt> option. For example, to
438 use 4 billion bytes, run as
439 <pre>
440 test64c -m4b
441 </pre>
442 In this case, the program will write 1 billion coordinates and 125 million
443 tetrahedra, by default. I recommend that you use less than the full amount
444 of available memory, otherwise swapping will result in your elapsed run
445 time going from minutes to hours (or even a day).
446 <p>
447 To specify the number of coordinates or elements to write, use the
448 <tt><i>-c</i></tt> and <tt><i>-e</i></tt> options. The number may be followed
449 by a qualifier (<tt><i>b</i></tt> for billion, <tt><i>m</i></tt> for million,
450 or <tt><i>k</i></tt> for thousand). For example, to write 10 billion
451 coordinates and 400 million tetrahedra using 2 billion bytes of memory, use:
452 <pre>
453 test64c -m2b -c10b -e400m
454 </pre>
455 If the memory required for either the coordinate or element data exceeds the
456 memory available, the program will use partial writes to write the data.
457 In the case above, the coordinates will be written 500m and the elements 62.5m
458 at a time. A value of 0 may also be used for the number of coordinates or
459 elements, in which case they are not written. Be aware, that 1 billion
460 coordinates and elements require a liitle over 4 Gb and 32Gb of disk space,
461 respectively.
462 <p>
463 To control the output file format, use <tt><i>-adf</i></tt> to force ADF
464 and <tt><i>-hdf5</i></tt> for HDF5 output. The last option is
465 <tt><i>-test</i></tt>, which will cause the file to be reopened in read-only
466 mode and the data read and checked for accuracy.
467
468 <h4>FORTRAN</h4>
469
470 The examples <tt><i>cgread.F</i></tt> and <tt><i>cgwrite.F</i></tt>
471 in the <tt><i>tests</i></tt> subdirectory have been modified to support
472 64-bit compilation. The <tt><i>cgnstype_f.h</i></tt> header was included
473 in these, and the <tt><b>cgsize_t</b></tt> definition for variables was used
474 as described above. This makes the code portable to 64-bit without requiring
475 any additional compiler options.
476 <p>
477 Another example, <tt><i>test64f.F</i></tt> has been created in this
478 directory. This program explicitly defines
479 the integer variables as <tt><b>integer*8</b></tt> and then tests
480 on the <tt><b>CG_BUILD_64BIT</b></tt> variable in order to prevent
481 the program from running (and failing) unless built in 64-bit mode.
482 <p>
483 These FORTRAN examples do not really require 64 bits to run, they are
484 provided to help with porting of your code. To build these,
485 do <tt>make fortran</tt> from within the <tt><i>tests</i></tt>
486 subdirectory.
487 </body>
488 </html>
620620
621621 ac_subst_vars='LTLIBOBJS
622622 LIBOBJS
623 SIZEOF_VOID_P
624 SIZEOF_LONG
623625 LIBRARY_PATH_SPEC
624626 TK_LIBRARY_SPEC
625627 TCL_LIBRARY_SPEC
690692 SYSTEM
691693 CGLONGT
692694 CGNSTOOLS
695 HAVE_COMPLEX_C99_EXT
693696 BUILDBASESCOPE
694697 BUILDPARALLEL
695698 FC_D_PRE
775778 enable_64bit
776779 enable_legacy
777780 enable_scope
781 enable_basescope
778782 with_fortran
779783 enable_shared
780784 with_hdf5
14181422 --enable-64bit enable 64bit support (where applicable)
14191423 --enable-legacy build legacy code default=no
14201424 --enable-scope scope enumerations values default=no
1421 --enable-scope base scope for family/zone ref-to default=no
1425 --enable-basescope base scope for family/zone ref-to default=no
14221426 --enable-shared=all build a shared library default=no
14231427 --enable-parallel enable parallel IO support default=no
14241428 --enable-lfs enable large file support default=no
36293633 done
36303634
36313635 else
3632 if test $use_gcc = yes; then
3633 for ac_prog in g77 f77 f90 f95 f2c
3636 for ac_prog in f90 f95 f2c
36343637 do
36353638 # Extract the first word of "$ac_prog", so it can be a program name with args.
36363639 set dummy $ac_prog; ac_word=$2
36723675 test -n "$F77" && break
36733676 done
36743677
3675 else
3676 for ac_prog in f77 f90 f95 g77 f2c
3677 do
3678 # Extract the first word of "$ac_prog", so it can be a program name with args.
3679 set dummy $ac_prog; ac_word=$2
3680 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3681 $as_echo_n "checking for $ac_word... " >&6; }
3682 if ${ac_cv_prog_F77+:} false; then :
3683 $as_echo_n "(cached) " >&6
3684 else
3685 if test -n "$F77"; then
3686 ac_cv_prog_F77="$F77" # Let the user override the test.
3687 else
3688 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3689 for as_dir in $PATH
3690 do
3691 IFS=$as_save_IFS
3692 test -z "$as_dir" && as_dir=.
3693 for ac_exec_ext in '' $ac_executable_extensions; do
3694 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3695 ac_cv_prog_F77="$ac_prog"
3696 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
3697 break 2
3698 fi
3699 done
3700 done
3701 IFS=$as_save_IFS
3702
3703 fi
3704 fi
3705 F77=$ac_cv_prog_F77
3706 if test -n "$F77"; then
3707 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $F77" >&5
3708 $as_echo "$F77" >&6; }
3709 else
3710 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
3711 $as_echo "no" >&6; }
3712 fi
3713
3714
3715 test -n "$F77" && break
3716 done
3717
3718 fi
37193678 fi
37203679 fi
37213680 if test -z "$F77"; then
37223681 has_f77=no
3723 F77=f77
3682 F77=f90
37243683 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no Fortran compiler was found" >&5
37253684 $as_echo "$as_me: WARNING: no Fortran compiler was found" >&2;}
37263685 else
45754534
45764535 test "$ac_cv_type_size_t" = "no" && \
45774536 CFGFLAGS="$CFGFLAGS -Dsize_t=unsigned"
4537
4538 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
4539 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
4540 if ${ac_cv_prog_cc_c99+:} false; then :
4541 $as_echo_n "(cached) " >&6
4542 else
4543 ac_cv_prog_cc_c99=no
4544 ac_save_CC=$CC
4545 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4546 /* end confdefs.h. */
4547 #include <stdarg.h>
4548 #include <stdbool.h>
4549 #include <stdlib.h>
4550 #include <wchar.h>
4551 #include <stdio.h>
4552
4553 // Check varargs macros. These examples are taken from C99 6.10.3.5.
4554 #define debug(...) fprintf (stderr, __VA_ARGS__)
4555 #define showlist(...) puts (#__VA_ARGS__)
4556 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
4557 static void
4558 test_varargs_macros (void)
4559 {
4560 int x = 1234;
4561 int y = 5678;
4562 debug ("Flag");
4563 debug ("X = %d\n", x);
4564 showlist (The first, second, and third items.);
4565 report (x>y, "x is %d but y is %d", x, y);
4566 }
4567
4568 // Check long long types.
4569 #define BIG64 18446744073709551615ull
4570 #define BIG32 4294967295ul
4571 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
4572 #if !BIG_OK
4573 your preprocessor is broken;
4574 #endif
4575 #if BIG_OK
4576 #else
4577 your preprocessor is broken;
4578 #endif
4579 static long long int bignum = -9223372036854775807LL;
4580 static unsigned long long int ubignum = BIG64;
4581
4582 struct incomplete_array
4583 {
4584 int datasize;
4585 double data[];
4586 };
4587
4588 struct named_init {
4589 int number;
4590 const wchar_t *name;
4591 double average;
4592 };
4593
4594 typedef const char *ccp;
4595
4596 static inline int
4597 test_restrict (ccp restrict text)
4598 {
4599 // See if C++-style comments work.
4600 // Iterate through items via the restricted pointer.
4601 // Also check for declarations in for loops.
4602 for (unsigned int i = 0; *(text+i) != '\0'; ++i)
4603 continue;
4604 return 0;
4605 }
4606
4607 // Check varargs and va_copy.
4608 static void
4609 test_varargs (const char *format, ...)
4610 {
4611 va_list args;
4612 va_start (args, format);
4613 va_list args_copy;
4614 va_copy (args_copy, args);
4615
4616 const char *str;
4617 int number;
4618 float fnumber;
4619
4620 while (*format)
4621 {
4622 switch (*format++)
4623 {
4624 case 's': // string
4625 str = va_arg (args_copy, const char *);
4626 break;
4627 case 'd': // int
4628 number = va_arg (args_copy, int);
4629 break;
4630 case 'f': // float
4631 fnumber = va_arg (args_copy, double);
4632 break;
4633 default:
4634 break;
4635 }
4636 }
4637 va_end (args_copy);
4638 va_end (args);
4639 }
4640
4641 int
4642 main ()
4643 {
4644
4645 // Check bool.
4646 _Bool success = false;
4647
4648 // Check restrict.
4649 if (test_restrict ("String literal") == 0)
4650 success = true;
4651 char *restrict newvar = "Another string";
4652
4653 // Check varargs.
4654 test_varargs ("s, d' f .", "string", 65, 34.234);
4655 test_varargs_macros ();
4656
4657 // Check flexible array members.
4658 struct incomplete_array *ia =
4659 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
4660 ia->datasize = 10;
4661 for (int i = 0; i < ia->datasize; ++i)
4662 ia->data[i] = i * 1.234;
4663
4664 // Check named initializers.
4665 struct named_init ni = {
4666 .number = 34,
4667 .name = L"Test wide string",
4668 .average = 543.34343,
4669 };
4670
4671 ni.number = 58;
4672
4673 int dynamic_array[ni.number];
4674 dynamic_array[ni.number - 1] = 543;
4675
4676 // work around unused variable warnings
4677 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
4678 || dynamic_array[ni.number - 1] != 543);
4679
4680 ;
4681 return 0;
4682 }
4683 _ACEOF
4684 for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
4685 do
4686 CC="$ac_save_CC $ac_arg"
4687 if ac_fn_c_try_compile "$LINENO"; then :
4688 ac_cv_prog_cc_c99=$ac_arg
4689 fi
4690 rm -f core conftest.err conftest.$ac_objext
4691 test "x$ac_cv_prog_cc_c99" != "xno" && break
4692 done
4693 rm -f conftest.$ac_ext
4694 CC=$ac_save_CC
4695
4696 fi
4697 # AC_CACHE_VAL
4698 case "x$ac_cv_prog_cc_c99" in
4699 x)
4700 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
4701 $as_echo "none needed" >&6; } ;;
4702 xno)
4703 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
4704 $as_echo "unsupported" >&6; } ;;
4705 *)
4706 CC="$CC $ac_cv_prog_cc_c99"
4707 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
4708 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
4709 esac
4710 if test "x$ac_cv_prog_cc_c99" != xno; then :
4711
4712 fi
4713
4714
4715 if test "$ac_cv_prog_cc_c99" = "no"; then :
4716 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcgns requires a C99-compliant compiler" >&5
4717 $as_echo "$as_me: WARNING: libcgns requires a C99-compliant compiler" >&2;}
4718 as_fn_error $? "Cannot continue" "$LINENO" 5
4719 fi
4720 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Complex Gnu Extension" >&5
4721 $as_echo_n "checking for Complex Gnu Extension... " >&6; }
4722 ac_ext=c
4723 ac_cpp='$CPP $CPPFLAGS'
4724 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4725 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4726 ac_compiler_gnu=$ac_cv_c_compiler_gnu
4727
4728 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4729 /* end confdefs.h. */
4730
4731 #include <complex.h>
4732
4733 int
4734 main ()
4735 {
4736
4737 #if !defined(_MSC_VER)
4738 float _Complex a[2];
4739 __real__(a[1]) = (float) 1.0;
4740 __imag__(a[1]) = (float) 0.0;
4741 #endif
4742
4743 ;
4744 return 0;
4745 }
4746 _ACEOF
4747 if ac_fn_c_try_compile "$LINENO"; then :
4748 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4749 $as_echo "yes" >&6; }
4750 HAVE_COMPLEX_C99_EXT=1
4751 else
4752 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4753 $as_echo "no" >&6; }
4754 HAVE_COMPLEX_C99_EXT=0
4755 fi
4756 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
45784757
45794758 #--------------------------------------------------------------------------
45804759 # installation program and directory
47664945 if test "${enable_64bit+set}" = set; then :
47674946 enableval=$enable_64bit;
47684947 else
4769 enableval=no
4948 enableval=yes
47704949 fi
47714950
47724951 test ! "$enableval" = "no" && enableval=yes
47814960 $as_echo "$SYSTEM" >&6; }
47824961 if test $do64bit = yes; then
47834962 BUILD64BIT=1
4784 is64bit=`echo $SYSTEM | grep 64`
4785 test -z "$is64bit" && \
4963 # The cast to long int works around a bug in the HP C Compiler
4964 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
4965 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
4966 # This bug is HP SR number 8606223364.
4967 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
4968 $as_echo_n "checking size of void *... " >&6; }
4969 if ${ac_cv_sizeof_void_p+:} false; then :
4970 $as_echo_n "(cached) " >&6
4971 else
4972 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
4973
4974 else
4975 if test "$ac_cv_type_void_p" = yes; then
4976 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
4977 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
4978 as_fn_error 77 "cannot compute sizeof (void *)
4979 See \`config.log' for more details" "$LINENO" 5; }
4980 else
4981 ac_cv_sizeof_void_p=0
4982 fi
4983 fi
4984
4985 fi
4986 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
4987 $as_echo "$ac_cv_sizeof_void_p" >&6; }
4988
4989
4990
4991 cat >>confdefs.h <<_ACEOF
4992 #define SIZEOF_VOID_P $ac_cv_sizeof_void_p
4993 _ACEOF
4994
4995
4996 if test $ac_cv_sizeof_void_p -lt 8; then
47864997 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support not found for your machine" >&5
47874998 $as_echo "$as_me: WARNING: 64bit support not found for your machine" >&2;}
4999 is64bit=no
5000 else
5001 is64bit=yes
5002 fi
47885003 fi
47895004 else
47905005 SYSTEM=$withsys
47915006 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSTEM" >&5
47925007 $as_echo "$SYSTEM" >&6; }
4793 fi
4794
4795 is64bit=`echo $SYSTEM | grep 64`
4796 if test -z "$is64bit"; then
4797 is64bit=no
4798 else
4799 is64bit=yes
5008 is64bit=`echo $SYSTEM | grep 64`
5009 if test -z "$is64bit"; then
5010 is64bit=no
5011 else
5012 is64bit=yes
5013 fi
48005014 fi
48015015
48025016 if test "$ac_cv_c_compiler_gnu" = "no"; then
49385152
49395153 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if base scope for family/zone ref-to enabled" >&5
49405154 $as_echo_n "checking if base scope for family/zone ref-to enabled... " >&6; }
4941 # Check whether --enable-scope was given.
4942 if test "${enable_scope+set}" = set; then :
4943 enableval=$enable_scope;
5155 # Check whether --enable-basescope was given.
5156 if test "${enable_basescope+set}" = set; then :
5157 enableval=$enable_basescope;
49445158 else
49455159 enableval=no
49465160 fi
59136127 fi
59146128
59156129
6130 if test "x$withval" != xno; then
6131 # Was HDF5 built with zlib ?
6132 ac_ext=c
6133 ac_cpp='$CPP $CPPFLAGS'
6134 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
6135 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
6136 ac_compiler_gnu=$ac_cv_c_compiler_gnu
6137
6138 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6139 /* end confdefs.h. */
6140 #include "H5pubconf.h"
6141 int
6142 main ()
6143 {
6144 #if !H5_HAVE_ZLIB_H
6145 # error
6146 #endif
6147
6148 ;
6149 return 0;
6150 }
6151 _ACEOF
6152 if ac_fn_c_try_compile "$LINENO"; then :
6153
6154 else
6155 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib requested but hdf5 does not seems to be built with it." >&5
6156 $as_echo "$as_me: WARNING: zlib requested but hdf5 does not seems to be built with it." >&2;}
6157 fi
6158 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6159 fi
6160
59166161 case $withval in
59176162 yes)
59186163 H5NEEDZLIB=1
59196164 HAVE_ZLIB="yes"
5920 for ac_header in zlib.h
5921 do :
5922 ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
5923 if test "x$ac_cv_header_zlib_h" = xyes; then :
5924 cat >>confdefs.h <<_ACEOF
5925 #define HAVE_ZLIB_H 1
5926 _ACEOF
5927 HAVE_ZLIB_H="yes"
5928 else
5929 unset HAVE_ZLIB
5930 fi
5931
5932 done
5933
5934 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
5935 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
6165 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
59366166 $as_echo_n "checking for compress2 in -lz... " >&6; }
59376167 if ${ac_cv_lib_z_compress2+:} false; then :
59386168 $as_echo_n "(cached) " >&6
59796209 unset HAVE_ZLIB
59806210 fi
59816211
5982 fi
59836212 if test -z "$HAVE_ZLIB"; then
59846213 as_fn_error $? "couldn't find zlib library: specify the zlib directory with --with-zlib=DIR" "$LINENO" 5
59856214 fi
60096238 ;;
60106239 esac
60116240
6012 if test -n "$zlib_inc"; then
6013 CPPFLAGS="$CPPFLAGS -I$zlib_inc"
6241 # Check if provided libdir exists
6242 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $zlib_lib" >&5
6243 $as_echo_n "checking for $zlib_lib... " >&6; }
6244 if test -d "$zlib_lib"; then
6245 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6246 $as_echo "yes" >&6; }
6247 HAVE_ZLIB="yes"
6248 else
6249 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6250 $as_echo "no" >&6; }
6251 unset HAVE_ZLIB
60146252 fi
60156253
6016 for ac_header in zlib.h
6017 do :
6018 ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
6019 if test "x$ac_cv_header_zlib_h" = xyes; then :
6020 cat >>confdefs.h <<_ACEOF
6021 #define HAVE_ZLIB_H 1
6022 _ACEOF
6023 HAVE_ZLIB_H="yes"
6024 else
6025 CPPFLAGS="$saved_CPPFLAGS" unset HAVE_ZLIB
6026 fi
6027
6028 done
6029
6030
6031
60326254 if test $shared = yes; then
6033 ZLIBLIB="-L$zlib_lib"
6255 ZLIBLIB="-L$zlib_lib -lz"
60346256 else
60356257 if test -n "$zlib_lib"; then
6258 unset HAVE_ZLIB
60366259 for a in $exts ; do
60376260 if test -f $zlib_lib/libz.$a; then
60386261 ZLIBLIB=$zlib_lib/libz.$a
6262 HAVE_ZLIB="yes"
60396263 break
60406264 fi
60416265 done
60426266 fi
60436267 fi
60446268
6045 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
6046 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress2 in -lz" >&5
6047 $as_echo_n "checking for compress2 in -lz... " >&6; }
6048 if ${ac_cv_lib_z_compress2+:} false; then :
6049 $as_echo_n "(cached) " >&6
6050 else
6051 ac_check_lib_save_LIBS=$LIBS
6052 LIBS="-lz $LIBS"
6053 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6054 /* end confdefs.h. */
6055
6056 /* Override any GCC internal prototype to avoid an error.
6057 Use char because int might match the return type of a GCC
6058 builtin and then its argument prototype would still apply. */
6059 #ifdef __cplusplus
6060 extern "C"
6061 #endif
6062 char compress2 ();
6063 int
6064 main ()
6065 {
6066 return compress2 ();
6067 ;
6068 return 0;
6069 }
6070 _ACEOF
6071 if ac_fn_c_try_link "$LINENO"; then :
6072 ac_cv_lib_z_compress2=yes
6073 else
6074 ac_cv_lib_z_compress2=no
6075 fi
6076 rm -f core conftest.err conftest.$ac_objext \
6077 conftest$ac_exeext conftest.$ac_ext
6078 LIBS=$ac_check_lib_save_LIBS
6079 fi
6080 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress2" >&5
6081 $as_echo "$ac_cv_lib_z_compress2" >&6; }
6082 if test "x$ac_cv_lib_z_compress2" = xyes; then :
6083 cat >>confdefs.h <<_ACEOF
6084 #define HAVE_LIBZ 1
6085 _ACEOF
6086
6087 LIBS="-lz $LIBS"
6088
6089 else
6090 unset HAVE_ZLIB
6091 fi
6092
6093 fi
6094
60956269 if test -z "$HAVE_ZLIB"; then
60966270 as_fn_error $? "couldn't find zlib library" "$LINENO" 5
6097 else
6098 ac_fn_c_check_func "$LINENO" "compress2" "ac_cv_func_compress2"
6099 if test "x$ac_cv_func_compress2" = xyes; then :
6100 HAVE_COMPRESS2="yes"
6101 fi
6102
61036271 fi
61046272 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib library path" >&5
61056273 $as_echo_n "checking for zlib library path... " >&6; }
61066274 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $zlib_lib" >&5
61076275 $as_echo "$zlib_lib" >&6; }
6108 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib include path" >&5
6109 $as_echo_n "checking for zlib include path... " >&6; }
6110 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $zlib_inc" >&5
6111 $as_echo "$zlib_inc" >&6; }
61126276 ;;
61136277 esac
61146278
61256289 yes)
61266290 H5NEEDSZIP=1
61276291 HAVE_SZIP="yes"
6128 for ac_header in szlib.h
6129 do :
6130 ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default"
6131 if test "x$ac_cv_header_szlib_h" = xyes; then :
6132 cat >>confdefs.h <<_ACEOF
6133 #define HAVE_SZLIB_H 1
6134 _ACEOF
6135 HAVE_SZIP_H="yes"
6136 else
6137 unset HAVE_SZIP
6138 fi
6139
6140 done
6141
6142 if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZIP_H" = "xyes"; then
6143 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
6292 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
61446293 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; }
61456294 if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then :
61466295 $as_echo_n "(cached) " >&6
61876336 unset HAVE_SZIP
61886337 fi
61896338
6190 fi
61916339 if test -z "$HAVE_SZIP"; then
61926340 as_fn_error $? "couldn't find szip library: specify the szip directory with --with-szip=DIR" "$LINENO" 5
61936341 fi
62176365 ;;
62186366 esac
62196367
6220 if test -n "$szip_inc"; then
6221 CPPFLAGS="$CPPFLAGS -I$szip_inc"
6368 # Check if provided libdir exists
6369 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $szip_lib" >&5
6370 $as_echo_n "checking for $szip_lib... " >&6; }
6371 if test -d "$szip_lib"; then
6372 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6373 $as_echo "yes" >&6; }
6374 HAVE_SZIP="yes"
6375 else
6376 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6377 $as_echo "no" >&6; }
6378 unset HAVE_SZIP
62226379 fi
62236380
6224 for ac_header in szlib.h
6225 do :
6226 ac_fn_c_check_header_mongrel "$LINENO" "szlib.h" "ac_cv_header_szlib_h" "$ac_includes_default"
6227 if test "x$ac_cv_header_szlib_h" = xyes; then :
6228 cat >>confdefs.h <<_ACEOF
6229 #define HAVE_SZLIB_H 1
6230 _ACEOF
6231 HAVE_SZIP_H="yes"
6232 else
6233 CPPFLAGS="$saved_CPPFLAGS" unset HAVE_SZIP
6234 fi
6235
6236 done
6237
6238
6239
62406381 if test $shared = yes; then
6241 SZIPLIB="-L$szip_lib"
6382 SZIPLIB="-L$szip_lib -lsz"
62426383 else
62436384 if test -n "$szip_lib"; then
6385 unset HAVE_SZIP
62446386 for a in $exts ; do
62456387 if test -f $szip_lib/libsz.$a; then
62466388 SZIPLIB=$szip_lib/libsz.$a
6389 HAVE_SZIP="yes"
62476390 break
62486391 fi
62496392 done
62506393 fi
62516394 fi
62526395
6253 if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZIP_H" = "xyes"; then
6254 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SZ_BufftoBuffCompress in -lsz" >&5
6255 $as_echo_n "checking for SZ_BufftoBuffCompress in -lsz... " >&6; }
6256 if ${ac_cv_lib_sz_SZ_BufftoBuffCompress+:} false; then :
6257 $as_echo_n "(cached) " >&6
6258 else
6259 ac_check_lib_save_LIBS=$LIBS
6260 LIBS="-lsz $LIBS"
6261 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6262 /* end confdefs.h. */
6263
6264 /* Override any GCC internal prototype to avoid an error.
6265 Use char because int might match the return type of a GCC
6266 builtin and then its argument prototype would still apply. */
6267 #ifdef __cplusplus
6268 extern "C"
6269 #endif
6270 char SZ_BufftoBuffCompress ();
6271 int
6272 main ()
6273 {
6274 return SZ_BufftoBuffCompress ();
6275 ;
6276 return 0;
6277 }
6278 _ACEOF
6279 if ac_fn_c_try_link "$LINENO"; then :
6280 ac_cv_lib_sz_SZ_BufftoBuffCompress=yes
6281 else
6282 ac_cv_lib_sz_SZ_BufftoBuffCompress=no
6283 fi
6284 rm -f core conftest.err conftest.$ac_objext \
6285 conftest$ac_exeext conftest.$ac_ext
6286 LIBS=$ac_check_lib_save_LIBS
6287 fi
6288 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sz_SZ_BufftoBuffCompress" >&5
6289 $as_echo "$ac_cv_lib_sz_SZ_BufftoBuffCompress" >&6; }
6290 if test "x$ac_cv_lib_sz_SZ_BufftoBuffCompress" = xyes; then :
6291 cat >>confdefs.h <<_ACEOF
6292 #define HAVE_LIBSZ 1
6293 _ACEOF
6294
6295 LIBS="-lsz $LIBS"
6296
6297 else
6298 unset HAVE_SZIP
6299 fi
6300
6301 fi
6302
63036396 if test -z "$HAVE_SZIP"; then
63046397 as_fn_error $? "couldn't find szip library" "$LINENO" 5
6305 else
6306 ac_fn_c_check_func "$LINENO" "SZ_BufftoBuffCompress" "ac_cv_func_SZ_BufftoBuffCompress"
6307 if test "x$ac_cv_func_SZ_BufftoBuffCompress" = xyes; then :
6308 HAVE_BufftoBuffCompress="yes"
6309 fi
6310
63116398 fi
63126399 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szip library path" >&5
63136400 $as_echo_n "checking for szip library path... " >&6; }
63146401 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $szip_lib" >&5
63156402 $as_echo "$szip_lib" >&6; }
6316 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for szip include path" >&5
6317 $as_echo_n "checking for szip include path... " >&6; }
6318 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $szip_inc" >&5
6319 $as_echo "$szip_inc" >&6; }
63206403 ;;
63216404 esac
63226405
68526935 /usr/athena/include
68536936 /usr/local/x11r5/include
68546937 /usr/lpp/Xamples/include
6855 /opt/X11/include
68566938
68576939 /usr/openwin/include
68586940 /usr/openwin/share/include'
74067488 fi
74077489 #----------- Determine if the Fortran compiler gfortran -------------------
74087490 # Turn off warnings for passing non-ANSI types to BIND().
7491 # Allow for argument mismatch (gfortran >= 10)
74097492 #--------------------------------------------------------------------------
7410 fc_vendor="`$FC --version 2>&1 |grep -i 'gcc'`"
7493 fc_vendor="`$FC --version 2>&1 | grep -i 'gnu'`"
74117494 if test X != "X$fc_vendor"; then
74127495 FFLAGS="$FFLAGS -Wno-c-binding-type"
7413 fi
7496
7497 # Get the compiler version for GNU fortran
7498 #
7499 # f9x_version: Version number: x.x.x
7500 #
7501 f9x_version="`$FC -v 2>&1 | grep 'gcc version' | cut -d' ' -f3`"
7502 if test X != "X$f9x_version"; then
7503 # Get the compiler version numbers
7504 f9x_vers_major=`echo $f9x_version | cut -f1 -d.`
7505 f9x_vers_minor=`echo $f9x_version | cut -f2 -d.`
7506 f9x_vers_patch=`echo $f9x_version | cut -f3 -d.`
7507 test -n "$f9x_vers_major" || f9x_vers_major=0
7508 test -n "$f9x_vers_minor" || f9x_vers_minor=0
7509 test -n "$f9x_vers_patch" || f9x_vers_patch=0
7510 fi
7511 if test $f9x_vers_major -ge 10; then
7512 FFLAGS="$FFLAGS -fallow-argument-mismatch"
7513 fi
7514 # Warn about a gfortran 10.2.0 bug (GCC Bug 100149) which
7515 # causes cg_goto_f to segfault, other versions are fine.
7516 if test $f9x_vers_major = 10 && test $f9x_vers_minor = 2; then
7517 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Fortran mapping (cg_goto_f) is broken for the specified gfortran version.
7518 !!! IT'S ADVISABLE TO AVOID VERSION 10.2 !!!" >&5
7519 $as_echo "$as_me: WARNING: Fortran mapping (cg_goto_f) is broken for the specified gfortran version.
7520 !!! IT'S ADVISABLE TO AVOID VERSION 10.2 !!!" >&2;}
7521 fi
7522 fi
74147523 #----------- Determine if the Fortran compiler NAG -------------------
74157524 # Add compiler flag for C API calls.
74167525 #--------------------------------------------------------------------------
75867695
75877696
75887697
7698
75897699 BIN_INSTALL_DIR=$BINDIR
75907700 EXE_INSTALL_DIR=$BINDIR/cgnstools
75917701
76297739
76307740
76317741
7632 ac_config_files="$ac_config_files cgnstypes.h cgnstypes_f.h cgnstypes_f03.h cgnsconfig.h Makefile make.defs cgnsBuild.defs tests/Makefile tools/Makefile ptests/Makefile cgnstools/Makefile cgnstools/make.defs cgnstools/cgconfig"
7742 SIZEOF_LONG="$ac_cv_sizeof_long"
7743 # The cast to long int works around a bug in the HP C Compiler
7744 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
7745 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
7746 # This bug is HP SR number 8606223364.
7747 { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
7748 $as_echo_n "checking size of void *... " >&6; }
7749 if ${ac_cv_sizeof_void_p+:} false; then :
7750 $as_echo_n "(cached) " >&6
7751 else
7752 if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
7753
7754 else
7755 if test "$ac_cv_type_void_p" = yes; then
7756 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
7757 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
7758 as_fn_error 77 "cannot compute sizeof (void *)
7759 See \`config.log' for more details" "$LINENO" 5; }
7760 else
7761 ac_cv_sizeof_void_p=0
7762 fi
7763 fi
7764
7765 fi
7766 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
7767 $as_echo "$ac_cv_sizeof_void_p" >&6; }
7768
7769
7770
7771 cat >>confdefs.h <<_ACEOF
7772 #define SIZEOF_VOID_P $ac_cv_sizeof_void_p
7773 _ACEOF
7774
7775
7776 SIZEOF_VOID_P="$ac_cv_sizeof_void_p"
7777
7778
7779
7780 ac_config_files="$ac_config_files cgnstypes.h cgnstypes_f.h cgnstypes_f03.h cgnsconfig.h cg_hash_types.h Makefile make.defs cgnsBuild.defs tests/Makefile tools/Makefile ptests/Makefile cgnstools/Makefile cgnstools/make.defs cgnstools/cgconfig"
76337781
76347782
76357783
82578405 "cgnstypes_f.h") CONFIG_FILES="$CONFIG_FILES cgnstypes_f.h" ;;
82588406 "cgnstypes_f03.h") CONFIG_FILES="$CONFIG_FILES cgnstypes_f03.h" ;;
82598407 "cgnsconfig.h") CONFIG_FILES="$CONFIG_FILES cgnsconfig.h" ;;
8408 "cg_hash_types.h") CONFIG_FILES="$CONFIG_FILES cg_hash_types.h" ;;
82608409 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
82618410 "make.defs") CONFIG_FILES="$CONFIG_FILES make.defs" ;;
82628411 "cgnsBuild.defs") CONFIG_FILES="$CONFIG_FILES cgnsBuild.defs" ;;
135135 if test "$ac_cv_cygwin" = "yes"; then
136136 AC_CHECK_PROGS(F77, g77 f2c)
137137 else
138 if test $use_gcc = yes; then
139 AC_CHECK_PROGS(F77, g77 f77 f90 f95 f2c)
140 else
141 AC_CHECK_PROGS(F77, f77 f90 f95 g77 f2c)
142 fi
138 AC_CHECK_PROGS(F77, f90 f95 f2c)
143139 fi
144140 fi
145141 if test -z "$F77"; then
146142 has_f77=no
147 F77=f77
143 F77=f90
148144 AC_MSG_WARN(no Fortran compiler was found)
149145 else
150146 has_f77=yes
222218 test "$ac_cv_type_size_t" = "no" && \
223219 CFGFLAGS="$CFGFLAGS -Dsize_t=unsigned"
224220
221 AC_PROG_CC_C99
222 AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
223 [AC_MSG_WARN([libcgns requires a C99-compliant compiler])
224 AC_MSG_ERROR([Cannot continue])])
225 AC_MSG_CHECKING([for Complex Gnu Extension])
226 AC_LANG_PUSH(C)
227 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
228 #include <complex.h>
229 ]],[[
230 #if !defined(_MSC_VER)
231 float _Complex a[2];
232 __real__(a[1]) = (float) 1.0;
233 __imag__(a[1]) = (float) 0.0;
234 #endif
235 ]])],[ AC_MSG_RESULT([yes])
236 HAVE_COMPLEX_C99_EXT=1],
237 [ AC_MSG_RESULT([no])
238 HAVE_COMPLEX_C99_EXT=0])
239
225240 #--------------------------------------------------------------------------
226241 # installation program and directory
227242 #--------------------------------------------------------------------------
274289 AC_MSG_CHECKING([if 64bit support is requested])
275290 AC_ARG_ENABLE(64bit,
276291 [ --enable-64bit enable 64bit support (where applicable)],,
277 enableval=no)
292 enableval=yes)
278293 test ! "$enableval" = "no" && enableval=yes
279294 do64bit=$enableval
280295 AC_MSG_RESULT($do64bit)
284299 AC_MSG_RESULT($SYSTEM)
285300 if test $do64bit = yes; then
286301 BUILD64BIT=1
287 is64bit=`echo $SYSTEM | grep 64`
288 test -z "$is64bit" && \
302 AC_CHECK_SIZEOF([void *])
303 if test $ac_cv_sizeof_void_p -lt 8; then
289304 AC_MSG_WARN(64bit support not found for your machine)
305 is64bit=no
306 else
307 is64bit=yes
308 fi
290309 fi
291310 else
292311 SYSTEM=$withsys
293312 AC_MSG_RESULT($SYSTEM)
294 fi
295
296 is64bit=`echo $SYSTEM | grep 64`
297 if test -z "$is64bit"; then
298 is64bit=no
299 else
300 is64bit=yes
313 is64bit=`echo $SYSTEM | grep 64`
314 if test -z "$is64bit"; then
315 is64bit=no
316 else
317 is64bit=yes
318 fi
301319 fi
302320
303321 if test "$ac_cv_prog_gcc" = "no"; then
393411 BUILDBASESCOPE=0
394412
395413 AC_MSG_CHECKING([if base scope for family/zone ref-to enabled])
396 AC_ARG_ENABLE(scope,
397 [ --enable-scope base scope for family/zone ref-to [default=no]],,
414 AC_ARG_ENABLE(basescope,
415 [ --enable-basescope base scope for family/zone ref-to [default=no]],,
398416 enableval=no)
399417 if test ! "$enableval" = "no" ; then
400418 enableval=yes
10731091 filter [default=no]])],,
10741092 [withval=no])
10751093
1094 if test "x$withval" != xno; then
1095 # Was HDF5 built with zlib ?
1096 AC_LANG_PUSH(C)
1097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "H5pubconf.h"],
1098 [[#if !H5_HAVE_ZLIB_H
1099 # error
1100 #endif]
1101 ])], [], [AC_MSG_WARN([zlib requested but hdf5 does not seems to be built with it.])])
1102 fi
1103
10761104 case $withval in
10771105 yes)
10781106 H5NEEDZLIB=1
10791107 HAVE_ZLIB="yes"
1080 AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
1081 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
1082 AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
1083 fi
1108 AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
10841109 if test -z "$HAVE_ZLIB"; then
10851110 AC_MSG_ERROR([couldn't find zlib library: specify the zlib directory with --with-zlib=DIR])
10861111 fi
11081133 ;;
11091134 esac
11101135
1111 if test -n "$zlib_inc"; then
1112 CPPFLAGS="$CPPFLAGS -I$zlib_inc"
1113 fi
1114
1115 AC_CHECK_HEADERS([zlib.h],
1116 [HAVE_ZLIB_H="yes"],
1117 [CPPFLAGS="$saved_CPPFLAGS"] [unset HAVE_ZLIB])
1118
1136 # Check if provided libdir exists
1137 AC_MSG_CHECKING(for $zlib_lib)
1138 if test -d "$zlib_lib"; then
1139 AC_MSG_RESULT(yes)
1140 HAVE_ZLIB="yes"
1141 else
1142 AC_MSG_RESULT(no)
1143 unset HAVE_ZLIB
1144 fi
11191145
11201146 if test $shared = yes; then
1121 ZLIBLIB="-L$zlib_lib"
1147 ZLIBLIB="-L$zlib_lib -lz"
11221148 else
11231149 if test -n "$zlib_lib"; then
1150 unset HAVE_ZLIB
11241151 for a in $exts ; do
11251152 if test -f $zlib_lib/libz.$a; then
11261153 ZLIBLIB=$zlib_lib/libz.$a
1154 HAVE_ZLIB="yes"
11271155 break
11281156 fi
11291157 done
11301158 fi
11311159 fi
11321160
1133 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
1134 AC_CHECK_LIB([z], [compress2],,
1135 [unset HAVE_ZLIB])
1136 fi
1137
11381161 if test -z "$HAVE_ZLIB"; then
11391162 AC_MSG_ERROR([couldn't find zlib library])
1140 else
1141 AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
11421163 fi
11431164 AC_MSG_CHECKING([for zlib library path])
11441165 AC_MSG_RESULT([$zlib_lib])
1145 AC_MSG_CHECKING([for zlib include path])
1146 AC_MSG_RESULT([$zlib_inc])
11471166 ;;
11481167 esac
11491168
11571176 yes)
11581177 H5NEEDSZIP=1
11591178 HAVE_SZIP="yes"
1160 AC_CHECK_HEADERS([szlib.h], [HAVE_SZIP_H="yes"], [unset HAVE_SZIP])
1161 if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZIP_H" = "xyes"; then
1162 AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
1163 fi
1179 AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
11641180 if test -z "$HAVE_SZIP"; then
11651181 AC_MSG_ERROR([couldn't find szip library: specify the szip directory with --with-szip=DIR])
11661182 fi
11881204 ;;
11891205 esac
11901206
1191 if test -n "$szip_inc"; then
1192 CPPFLAGS="$CPPFLAGS -I$szip_inc"
1193 fi
1194
1195 AC_CHECK_HEADERS([szlib.h],
1196 [HAVE_SZIP_H="yes"],
1197 [CPPFLAGS="$saved_CPPFLAGS"] [unset HAVE_SZIP])
1198
1207 # Check if provided libdir exists
1208 AC_MSG_CHECKING(for $szip_lib)
1209 if test -d "$szip_lib"; then
1210 AC_MSG_RESULT(yes)
1211 HAVE_SZIP="yes"
1212 else
1213 AC_MSG_RESULT(no)
1214 unset HAVE_SZIP
1215 fi
11991216
12001217 if test $shared = yes; then
1201 SZIPLIB="-L$szip_lib"
1218 SZIPLIB="-L$szip_lib -lsz"
12021219 else
12031220 if test -n "$szip_lib"; then
1221 unset HAVE_SZIP
12041222 for a in $exts ; do
12051223 if test -f $szip_lib/libsz.$a; then
12061224 SZIPLIB=$szip_lib/libsz.$a
1225 HAVE_SZIP="yes"
12071226 break
12081227 fi
12091228 done
12101229 fi
12111230 fi
12121231
1213 if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZIP_H" = "xyes"; then
1214 AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],,
1215 [unset HAVE_SZIP])
1216 fi
1217
12181232 if test -z "$HAVE_SZIP"; then
12191233 AC_MSG_ERROR([couldn't find szip library])
1220 else
1221 AC_CHECK_FUNC([SZ_BufftoBuffCompress], [HAVE_BufftoBuffCompress="yes"])
12221234 fi
12231235 AC_MSG_CHECKING([for szip library path])
12241236 AC_MSG_RESULT([$szip_lib])
1225 AC_MSG_CHECKING([for szip include path])
1226 AC_MSG_RESULT([$szip_inc])
12271237 ;;
12281238 esac
12291239
18271837 fi
18281838 #----------- Determine if the Fortran compiler gfortran -------------------
18291839 # Turn off warnings for passing non-ANSI types to BIND().
1830 #--------------------------------------------------------------------------
1831 fc_vendor="`$FC --version 2>&1 |grep -i 'gcc'`"
1840 # Allow for argument mismatch (gfortran >= 10)
1841 #--------------------------------------------------------------------------
1842 fc_vendor="`$FC --version 2>&1 | grep -i 'gnu'`"
18321843 if test X != "X$fc_vendor"; then
18331844 FFLAGS="$FFLAGS -Wno-c-binding-type"
1834 fi
1845
1846 # Get the compiler version for GNU fortran
1847 #
1848 # f9x_version: Version number: x.x.x
1849 #
1850 f9x_version="`$FC -v 2>&1 | grep 'gcc version' | cut -d' ' -f3`"
1851 if test X != "X$f9x_version"; then
1852 # Get the compiler version numbers
1853 f9x_vers_major=`echo $f9x_version | cut -f1 -d.`
1854 f9x_vers_minor=`echo $f9x_version | cut -f2 -d.`
1855 f9x_vers_patch=`echo $f9x_version | cut -f3 -d.`
1856 test -n "$f9x_vers_major" || f9x_vers_major=0
1857 test -n "$f9x_vers_minor" || f9x_vers_minor=0
1858 test -n "$f9x_vers_patch" || f9x_vers_patch=0
1859 fi
1860 if test $f9x_vers_major -ge 10; then
1861 FFLAGS="$FFLAGS -fallow-argument-mismatch"
1862 fi
1863 # Warn about a gfortran 10.2.0 bug (GCC Bug 100149) which
1864 # causes cg_goto_f to segfault, other versions are fine.
1865 if test $f9x_vers_major = 10 && test $f9x_vers_minor = 2; then
1866 AC_MSG_WARN([Fortran mapping (cg_goto_f) is broken for the specified gfortran version.
1867 !!! IT'S ADVISABLE TO AVOID VERSION 10.2 !!!])
1868 fi
1869 fi
18351870 #----------- Determine if the Fortran compiler NAG -------------------
18361871 # Add compiler flag for C API calls.
18371872 #--------------------------------------------------------------------------
19101945 AC_SUBST(FC_D_PRE)
19111946 AC_SUBST(BUILDPARALLEL)
19121947 AC_SUBST(BUILDBASESCOPE)
1948 AC_SUBST(HAVE_COMPLEX_C99_EXT)
19131949
19141950 AC_SUBST(CGNSTOOLS)
19151951 AC_SUBST(CGLONGT)
20202056 AC_SUBST(TK_LIBRARY_SPEC)
20212057 AC_SUBST(LIBRARY_PATH_SPEC)
20222058
2023 AC_OUTPUT(cgnstypes.h cgnstypes_f.h cgnstypes_f03.h cgnsconfig.h Makefile \
2024 make.defs cgnsBuild.defs tests/Makefile tools/Makefile ptests/Makefile \
2025 cgnstools/Makefile cgnstools/make.defs cgnstools/cgconfig)
2026
2059 SIZEOF_LONG="$ac_cv_sizeof_long"
2060 AC_CHECK_SIZEOF([void *])
2061 SIZEOF_VOID_P="$ac_cv_sizeof_void_p"
2062 AC_SUBST(SIZEOF_LONG)
2063 AC_SUBST(SIZEOF_VOID_P)
2064
2065 AC_OUTPUT(cgnstypes.h cgnstypes_f.h cgnstypes_f03.h cgnsconfig.h \
2066 cg_hash_types.h Makefile make.defs cgnsBuild.defs tests/Makefile \
2067 tools/Makefile ptests/Makefile cgnstools/Makefile cgnstools/make.defs \
2068 cgnstools/cgconfig)
2069
968968 echo #define CG_BUILD_HDF5 %buildhdf5% >> cgnstypes.h
969969 echo #define CG_BUILD_BASESCOPE %dobasescope% >> cgnstypes.h
970970 echo #define CG_BUILD_PARALLEL %doparallel% >> cgnstypes.h
971 echo #define CG_BUILD_COMPLEX_C99_EXT 1 >> cgnstypes.h
971972 echo.>> cgnstypes.h
972973 echo #define CG_MAX_INT32 0x7FFFFFFF>> cgnstypes.h
973974 echo #ifdef _WIN32>> cgnstypes.h
104104 /* Set the start position and size for the data write */
105105 /* fix dimensions due to Fortran indexing and ordering */
106106 if((rw_mode == CG_PAR_WRITE && data[0].u.wbuf) || (rw_mode == CG_PAR_READ && data[0].u.rbuf)) {
107 for (k = 0; k < ndims; k++) {
108 start[k] = rmin[ndims-k-1] - 1;
109 dims[k] = rmax[ndims-k-1] - start[k];
110 }
107 for (k = 0; k < ndims; k++) {
108 start[k] = rmin[ndims-k-1] - 1;
109 dims[k] = rmax[ndims-k-1] - start[k];
110 }
111111 }
112112 else { /* no data to read or write, but must still call H5Screate_simple */
113113 for (k = 0; k < ndims; k++) {
371371 MPI_Initialized(&pcg_mpi_initialized);
372372
373373 if (pcg_mpi_initialized) {
374 if( cgio_configure(CG_CONFIG_HDF5_MPI_COMM, &comm) != -1) {
375 return CG_ERROR;
374 if( cgio_configure(CG_CONFIG_HDF5_MPI_COMM, &comm) != CG_OK) {
375 cgi_error("Invalid CG_CONFIG_HDF5_MPI_COMM configure parameter");
376 return CG_ERROR;
376377 }
377378
378379 pcg_mpi_comm=comm;
432433 }
433434
434435 /* Flag this as a parallel access */
435 strcpy(hdf5_access,"PARALLEL");
436 strcpy(hdf5_access,"PARALLEL");
436437
437438 ierr = cg_set_file_type(CG_FILE_HDF5);
438439 if (ierr) return ierr;
439440 ierr = cg_open(filename, mode, fn);
440441 cgns_filetype = old_type;
441442
443 return ierr;
444 }
445
446 /*---------------------------------------------------------*/
447
448 int cgp_close(int fn)
449 {
442450 /* reset parallel access */
443451 strcpy(hdf5_access,"NATIVE");
444
445 return ierr;
446 }
447
448 /*---------------------------------------------------------*/
449
450 int cgp_close(int fn)
451 {
452452 return cg_close(fn);
453453 }
454454
495495 for (n = 0; n < zone->index_dim; n++) {
496496 dims[n] = zone->nijk[n] + zcoor->rind_planes[2*n] +
497497 zcoor->rind_planes[2*n+1];
498 if(coords) {
499 if (rmin[n] > rmax[n] || rmin[n] < 1 || rmax[n] > dims[n]) {
500 cgi_error("Invalid index ranges.");
501 return CG_ERROR;
502 }
503 }
498 if(coords) {
499 if (rmin[n] > rmax[n] || rmin[n] < 1 || rmax[n] > dims[n]) {
500 printf("%d %d %d", rmin[n]> rmax[n], rmin[n] <1, rmax[n] >dims[n]);
501 cgi_error("Invalid index ranges. cgp_coord_write_data");
502 return CG_ERROR;
503 }
504 }
504505 }
505506 type = cgi_datatype(zcoor->coord[C-1].data_type);
506507
631632 }
632633
633634 for (n = 0; n < zone->index_dim; n++) {
634 dims[n] = zone->nijk[n] + zcoor->rind_planes[2*n] +
635 zcoor->rind_planes[2*n+1];
636 if(coords) {
637 if (rmin[n] > rmax[n] || rmin[n] < 1 || rmax[n] > dims[n]) {
638 cgi_error("Invalid index ranges.");
639 return CG_ERROR;
640 }
635 dims[n] = zone->nijk[n] + zcoor->rind_planes[2*n] +
636 zcoor->rind_planes[2*n+1];
637 if(coords) {
638 if (rmin[n] > rmax[n] || rmin[n] < 1 || rmax[n] > dims[n]) {
639 cgi_error("Invalid index ranges.");
640 return CG_ERROR;
641641 }
642 }
642643 }
643644 type = cgi_datatype(zcoor->coord[C-1].data_type);
644645
756757 start, end, nbndry, S);
757758 }
758759
760 int cgp_poly_section_write(int fn, int B, int Z, const char *sectionname,
761 CGNS_ENUMT(ElementType_t) type, cgsize_t start, cgsize_t end, cgsize_t maxoffset,
762 int nbndry, int *S)
763 {
764 cgns_zone *zone;
765 cgns_section *section = NULL;
766 double dummy_id;
767 int index;
768 int data[2];
769 cgsize_t dim_vals;
770 cgsize_t num, ElementDataSize=0;
771
772 cg = cgi_get_file(fn);
773 if (check_parallel(cg)) return CG_ERROR;
774 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE))
775 return CG_ERROR;
776
777 if (IS_FIXED_SIZE(type)) {
778 cgi_error("element type must not be a fixed size for this parallel IO");
779 return CG_ERROR;
780 }
781
782 return cg_section_general_write(fn, B, Z, sectionname, type,
783 cgi_datatype(CG_SIZE_DATATYPE), start, end, maxoffset, nbndry, S);
784
785 }
786
759787 /*---------------------------------------------------------*/
760788
761789 int cgp_elements_write_data(int fn, int B, int Z, int S, cgsize_t start,
778806 if (section == 0 || section->connect == 0) return CG_ERROR;
779807
780808 if (elements) {
781 if (start > end ||
782 start < section->range[0] ||
783 end > section->range[1]) {
784 cgi_error("Error in requested element data range.");
785 return CG_ERROR;
786 }
809 if (start > end ||
810 start < section->range[0] ||
811 end > section->range[1]) {
812 cgi_error("Error in requested element data range.");
813 return CG_ERROR;
814 }
787815 }
788816 if (!IS_FIXED_SIZE(section->el_type)) {
789817 cgi_error("element must be a fixed size for parallel IO");
802830 return readwrite_data_parallel(hid, type,
803831 1, &rmin, &rmax, &Data, CG_PAR_WRITE);
804832 }
833
834 /*---------------------------------------------------------*/
835
836 int cgp_poly_elements_write_data(int fn, int B, int Z, int S, cgsize_t start,
837 cgsize_t end, const cgsize_t *elements, const cgsize_t *offsets)
838 {
839 // Very experimental function
840 // is offset the local or global offset ?
841 // Should we had another argument global_offset in case offsets is local ?
842 // The serial partial writing get the global offset from the file
843 // so it is not necessary to provide it
844 hid_t hid, hid_elem;
845 cgns_section *section;
846 cgsize_t rmin, rmax;
847 cgsize_t rmin_elem, rmax_elem;
848 CGNS_ENUMT(DataType_t) type, elem_type;
849 cg_rw_t Data;
850 cg_rw_t DataElem;
851 int status;
852
853 /* get file and check mode */
854 cg = cgi_get_file(fn);
855 if (check_parallel(cg)) return CG_ERROR;
856
857 if (cgi_check_mode(cg->filename, cg->mode, CG_MODE_WRITE))
858 return CG_ERROR;
859
860 section = cgi_get_section(cg, B, Z, S);
861 if (section == 0 || section->connect == 0) return CG_ERROR;
862
863 if (offsets)
864 {
865 if (start > end ||
866 start < section->range[0] ||
867 end > section->range[1])
868 {
869 cgi_error("Error in requested element data range.");
870 return CG_ERROR;
871 }
872 }
873
874 if (IS_FIXED_SIZE(section->el_type)) {
875 cgi_error("element must not be a fixed size for this parallel IO");
876 return CG_ERROR;
877 }
878
879 rmin = start - section->range[0] + 1;
880 rmax = end - section->range[0] + 2;
881
882 type = cgi_datatype(section->connect_offset->data_type);
883 elem_type = cgi_datatype(section->connect->data_type);
884
885 to_HDF_ID(section->connect_offset->id, hid);
886 to_HDF_ID(section->connect->id, hid_elem);
887
888 Data.u.wbuf = offsets;
889 DataElem.u.wbuf = elements;
890
891 if (offsets){
892 rmin_elem = offsets[0] + 1;
893 rmax_elem = offsets[end-start+1];
894 }
895 else
896 {
897 rmin_elem = 1;
898 rmax_elem = 1;
899 DataElem.u.wbuf = NULL;
900 }
901
902 status = readwrite_data_parallel(hid, type, 1, &rmin, &rmax, &Data, CG_PAR_WRITE);
903 if (status != CG_OK)
904 return status;
905 return readwrite_data_parallel(hid_elem, elem_type, 1, &rmin_elem, &rmax_elem, &DataElem, CG_PAR_WRITE);
906 }
907
805908
806909 /*---------------------------------------------------------*/
807910
825928 if (section == 0 || section->connect == 0) return CG_ERROR;
826929
827930 if (elements) { /* A processor may have nothing to read */
828 if (start > end ||
829 start < section->range[0] ||
830 end > section->range[1]) {
831 cgi_error("Error in requested element data range.");
832 return CG_ERROR;
833 }
931 if (start > end ||
932 start < section->range[0] ||
933 end > section->range[1]) {
934 cgi_error("Error in requested element data range.");
935 return CG_ERROR;
936 }
834937 }
835938 if (!IS_FIXED_SIZE(section->el_type)) {
836939 cgi_error("element must be a fixed size for parallel IO");
840943 if (cg_npe(section->el_type, &elemsize)) return CG_ERROR;
841944 rmin = (start - section->range[0]) * elemsize + 1;
842945 rmax = (end - section->range[0] + 1) * elemsize;
843 type = cgi_datatype(section->connect->data_type);
946 type = cgi_datatype(sizeof(cgsize_t) == 4 ? "I4" : "I8");
844947
845948 to_HDF_ID(section->connect->id, hid);
846949 cg_rw_t Data;
871974 /* check input range */
872975 if (parent_data) {
873976 if (start > end ||
874 start < section->range[0] ||
875 end > section->range[1]) {
876 cgi_error("Error in requested element data range.");
877 return CG_ERROR;
878 }
977 start < section->range[0] ||
978 end > section->range[1]) {
979 cgi_error("Error in requested element data range.");
980 return CG_ERROR;
981 }
879982 } else {
880983 start = end = 0;
881984 }
9991102 if (rmin[n] > rmax[n] ||
10001103 rmax[n] > field->dim_vals[n] ||
10011104 rmin[n] < 1) {
1002 cgi_error("Invalid range of data requested");
1003 return CG_ERROR;
1105 cgi_error("Invalid range of data requested");
1106 return CG_ERROR;
10041107 }
10051108 }
10061109 }
9292 CGNSDLL int cgp_elements_read_data(int fn, int B, int Z, int S,
9393 cgsize_t start, cgsize_t end, cgsize_t *elements);
9494
95 CGNSDLL int cgp_poly_section_write(int fn, int B, int Z,
96 const char *sectionname, CGNS_ENUMT(ElementType_t) type,
97 cgsize_t start, cgsize_t end, cgsize_t maxoffset,
98 int nbndry, int *S);
99 CGNSDLL int cgp_poly_elements_write_data(int fn, int B, int Z, int S,
100 cgsize_t start, cgsize_t end, const cgsize_t *elements, const cgsize_t *offsets);
101
95102 CGNSDLL int cgp_parent_data_write(int fn, int B, int Z, int S,
96103 cgsize_t start, cgsize_t end,
97104 const cgsize_t *parent_data);
3333 set(benchmark_hdf5_FILES benchmark_hdf5.c)
3434 add_executable(benchmark_hdf5 ${benchmark_hdf5_FILES})
3535
36 set(Metadata_Stressing_FILES Metadata_Stressing.c)
37 add_executable(Metadata_Stressing ${Metadata_Stressing_FILES})
38
3639 set(open_close_FILES open_close.c)
3740 add_executable(open_close ${open_close_FILES})
3841
5457 set(test_general_readwrite_FILES test_general_readwrite.c)
5558 add_executable(test_general_readwrite ${test_general_readwrite_FILES})
5659
60 set(test_poly_unstructured_FILES test_poly_unstructured.c)
61 add_executable(test_poly_unstructured ${test_poly_unstructured_FILES})
62
5763 set(thesis_benchmark_FILES thesis_benchmark.c)
5864 add_executable(thesis_benchmark ${thesis_benchmark_FILES})
5965
6470 add_executable(fexample ${fexample_FILES})
6571 set(benchmark_hdf5_f90_FILES benchmark_hdf5_f90.F90)
6672 add_executable(benchmark_hdf5_f90 ${benchmark_hdf5_f90_FILES})
73 set(test_mixed_par_ser_FILES test_mixed_par_ser.F90)
74 add_executable(test_mixed_par_ser ${test_mixed_par_ser_FILES})
6775 endif (CGNS_ENABLE_FORTRAN AND HAVE_FORTRAN_2003)
6876
6977 # Add the tests so that cmake can find them
7684 ${MPIEXEC_PREFLAGS} ./benchmark ${MPIEXEC_POSTFLAGS})
7785 add_test(benchmark_hdf5 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
7886 ${MPIEXEC_PREFLAGS} ./benchmark_hdf5 ${MPIEXEC_POSTFLAGS})
87 add_test(Metadata_Stressing ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
88 ${MPIEXEC_PREFLAGS} ./Metadata_Stressing ${MPIEXEC_POSTFLAGS})
7989 add_test(open_close ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
8090 ${MPIEXEC_PREFLAGS} ./open_close ${MPIEXEC_POSTFLAGS})
8191 add_test(comm_test ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
90100 ${MPIEXEC_PREFLAGS} ./test_zone ${MPIEXEC_POSTFLAGS})
91101 add_test(test_general_readwrite ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
92102 ${MPIEXEC_PREFLAGS} ./test_general_readwrite ${MPIEXEC_POSTFLAGS})
103 add_test(test_poly_unstructured ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
104 ${MPIEXEC_PREFLAGS} ./test_poly_unstructured ${MPIEXEC_POSTFLAGS})
93105 add_test(thesis_benchmark ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
94106 ${MPIEXEC_PREFLAGS} ./thesis_benchmark ${MPIEXEC_POSTFLAGS})
95107 if (CGNS_ENABLE_FORTRAN AND HAVE_FORTRAN_2003)
99111 ${MPIEXEC_PREFLAGS} ./fexample ${MPIEXEC_POSTFLAGS})
100112 add_test(benchmark_hdf5_f90 ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
101113 ${MPIEXEC_PREFLAGS} ./benchmark_hdf5_f90 ${MPIEXEC_POSTFLAGS})
114 add_test(test_mixed_par_ser ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} "2"
115 ${MPIEXEC_PREFLAGS} ./test_mixed_par_ser ${MPIEXEC_POSTFLAGS})
102116 endif (CGNS_ENABLE_FORTRAN AND HAVE_FORTRAN_2003)
103117 endif (CGNS_ENABLE_TESTS)
2323 test_unstruc_quad$(EXE) \
2424 test_zone$(EXE) \
2525 test_general_readwrite$(EXE) \
26 Metadata_Stressing$(EXE) \
27 test_poly_unstructured$(EXE) \
2628 thesis_benchmark$(EXE)
2729
28 FALL = pcgns_ftest$(EXE) ftest_zone$(EXE) fexample$(EXE) benchmark_hdf5_f90$(EXE)
30 FALL = pcgns_ftest$(EXE) ftest_zone$(EXE) fexample$(EXE) benchmark_hdf5_f90$(EXE) test_mixed_par_ser$(EXE)
2931
3032 ALL = $(CALL) @FALL@
3133 TESTS = $(ALL)
3941 status=0; \
4042 echo "=== running parallel tests ==="; \
4143 for x in $(TESTS) ; do \
42 if `$(MPIEXEC) ./$$x >/dev/null 2>&1` ; then \
43 printf "$$x ... $(OK_COLOR) PASSED $(NO_COLOR) \n"; \
44 else \
45 printf "$$x ... $(ERROR_COLOR) *** FAILED *** $(NO_COLOR) \n"; \
46 status=1; \
47 fi; \
44 args=""; \
45 if test "$$x" = "Metadata_Stressing$(EXE)" ; then \
46 for n in 1 2 ; do \
47 if `$(MPIEXEC) ./$$x $$args >/dev/null 2>&1` ; then \
48 printf "$$x $$args ... $(OK_COLOR) PASSED $(NO_COLOR) \n"; \
49 else \
50 printf "$$x $$args ... $(ERROR_COLOR) *** FAILED *** $(NO_COLOR) \n"; \
51 status=`expr $$status + 1`; \
52 fi; \
53 args="-sec2"; \
54 done;\
55 else \
56 if `$(MPIEXEC) ./$$x >/dev/null 2>&1` ; then \
57 printf "$$x ... $(OK_COLOR) PASSED $(NO_COLOR) \n"; \
58 else \
59 printf "$$x ... $(ERROR_COLOR) *** FAILED *** $(NO_COLOR) \n"; \
60 status=`expr $$status + 1`; \
61 fi; \
62 fi;\
4863 done; \
4964 echo "=== finished ==="; \
50 if test $$status == 1; then \
65 if test $$$status > 0; then \
5166 printf "$(ERROR_COLOR)"; \
67 stat=1; \
5268 else \
5369 printf "$(OK_COLOR)"; \
70 stat=0; \
5471 fi; \
5572 printf "$$status tests failed $(NO_COLOR) \n"; \
56 exit $$status;
73 exit $$stat;
5774
5875 #----------
5976
122139 $(CC) $(COPTS) $(CEOUT)$@ test_general_readwrite.c $(LDLIBS) $(CLIBS)
123140 $(STRIP) $@
124141
142
143 #----------
144
145 test_poly_unstructured$(EXE) : test_poly_unstructured.c $(CGNSLIB)
146 $(CC) $(COPTS) $(CEOUT)$@ test_poly_unstructured.c $(LDLIBS) $(CLIBS)
147 $(STRIP) $@
148
149
125150 #----------
126151
127152 thesis_benchmark$(EXE) : thesis_benchmark.c $(CGNSLIB)
136161
137162 #----------
138163
164 test_mixed_par_ser$(EXE) : test_mixed_par_ser.F90 $(CGNSLIB)
165 $(F77) $(FOPTS) $(FEOUT)$@ test_mixed_par_ser.F90 $(LDLIBS) $(FLIBS)
166 $(STRIP) $@
167
168 #----------
169
139170 ftest_zone$(EXE) : ftest_zone.F90 $(CGNSLIB)
140171 $(F77) $(FOPTS) $(FEOUT)$@ ftest_zone.F90 $(LDLIBS) $(FLIBS)
141172 $(STRIP) $@
150181
151182 benchmark_hdf5_f90$(EXE) : benchmark_hdf5_f90.F90 $(CGNSLIB)
152183 $(F77) $(FOPTS) $(FEOUT)$@ benchmark_hdf5_f90.F90 $(LDLIBS) $(FLIBS)
184 $(STRIP) $@
185
186 #----------
187
188 Metadata_Stressing$(EXE) : Metadata_Stressing.c $(CGNSLIB)
189 $(CC) $(COPTS) $(CEOUT)$@ Metadata_Stressing.c $(LDLIBS) $(CLIBS)
153190 $(STRIP) $@
154191
155192 #----------
0 /* This test is intended to monitor the
1 * parallel performance of sizeable metadata
2 * usage by a CGNS application. Its
3 * main focus is not regression functionality
4 * testing of CGNS parallel APIs.
5 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <stdint.h>
10 #include "pcgnslib.h"
11 #include "mpi.h"
12
13 // Number of cells in x, y, z
14 #define N 32
15
16 //Total number of blocks
17 uint32_t NBLOCKS = 256;
18
19 int whoami = 0;
20 int num_mpi = 0;
21 int core = 1; // Use core VFD for file creation(-sec2 uses the SEC2 VFD in HDF5)
22 int allranks = 0; // Use all ranks for file creation
23 int skipread = 0; // skip opening and reading the file parallel
24
25 int main ( int argc, char *argv[] );
26
27 // Overall domain size
28 const float L[6] = {0., 20., 0., 1., 0., 1.};
29
30 // All zones have the same size
31 const cgsize_t zoneSize[3][3] = {{N + 1, N + 1, N + 1}, {N, N, N}, {0, 0, 0}};
32
33 const int ROOT = 0;
34
35 int read_inputs(int* argc, char*** argv) {
36
37 int bcast[4] = {NBLOCKS,allranks,core,skipread};
38
39 if(whoami==0) {
40 for(int k = 1; k < *argc; k++) {
41 if(strcmp((*argv)[k],"-nblocks")==0) {
42 k++;
43 sscanf((*argv)[k],"%d",&bcast[0]);
44 continue;
45 }
46 if(strcmp((*argv)[k],"-all")==0) {
47 bcast[1] = 1;
48 continue;
49 }
50 if(strcmp((*argv)[k],"-sec2")==0) {
51 bcast[2] = 0;
52 continue;
53 }
54 if(strcmp((*argv)[k],"-skipread")==0) {
55 bcast[3] = 1;
56 continue;
57 }
58 printf("ERROR: invalid argument option %s\n", (*argv)[k]);
59 MPI_Abort(MPI_COMM_WORLD,-1);
60 }
61 if (core == 1 && allranks == 1) {
62 printf("WARNING: diskless in parallel not supported, using -sec2 instead\n");
63 core = 0;
64 }
65 }
66 MPI_Bcast(bcast, 4, MPI_INT, 0, MPI_COMM_WORLD);
67 NBLOCKS = (uint)bcast[0];
68 allranks = bcast[1];
69 core = bcast[2];
70 skipread = bcast[3];
71 return 0;
72 }
73 int initialize(int* argc, char** argv[]) {
74 MPI_Init(argc,argv);
75 MPI_Comm_size(MPI_COMM_WORLD, &num_mpi);
76 MPI_Comm_rank(MPI_COMM_WORLD, &whoami);
77
78 if(*argc > 1)
79 read_inputs(argc,argv);
80
81 return 0;
82 }
83
84 int main(int argc, char* argv[]) {
85
86 int exit = 0;
87 int* local_blocks;
88 int *zone;
89 char fname[17];
90 int index_file;
91 int index_base;
92 int index_grid;
93 int index_coordx, index_coordy, index_coordz;
94 double t0, t1;
95 char zonename[12];
96
97 initialize(&argc,&argv);
98
99 if (whoami == ROOT) {
100 printf("Number of blocks = %u\n", NBLOCKS);
101 if(core == 1)
102 printf("Diskless enabled = true\n");
103 else
104 printf("Diskless enabled = false\n");
105 if(skipread == 0)
106 printf("Skip opening and reading the file = false\n");
107 else
108 printf("Skip opening and reading the file = true\n");
109 if(allranks == 0)
110 printf("All ranks create file = false\n\n");
111 else
112 printf("All ranks create file = true\n\n");
113 }
114 // ---- Partitioning -------------------------------------------------------------------
115 if (num_mpi > NBLOCKS) {
116 if (whoami == ROOT) {
117 printf("Number of processes > NBLOCKS.\n");
118 }
119 MPI_Finalize();
120 return exit;
121 }
122
123 local_blocks = (int *)malloc(num_mpi*sizeof(int));
124 for (int i = 0; i < num_mpi; ++i) {
125 if (i == ROOT) {
126 // Remainder goes to root
127 local_blocks[i] = NBLOCKS / num_mpi + NBLOCKS % num_mpi;
128 } else {
129 local_blocks[i] = NBLOCKS / num_mpi;
130 }
131 }
132
133 if (whoami == ROOT) {
134 for (int i = 0; i < num_mpi; ++i) {
135 printf("Process %d holds %d blocks\n", i, local_blocks[i]);
136 }
137 }
138
139 // ---- Set MPI communicator for parallel operations ----------------------------------
140
141 snprintf(fname, 16, "grid_%u.cgns", NBLOCKS);
142
143 // ---- Create CGNS file ---------------------------------------------------------------
144
145 /* use the core file driver, diskless option */
146 if(core == 1) {
147 /* enable core file driver committing to disk */
148 if (cg_configure(CG_CONFIG_HDF5_DISKLESS, (void *)1))
149 cg_error_exit();
150 /* enable committing to disk */
151 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_WRITE, (void *)1))
152 cg_error_exit();
153 /* set initial/increimental memory increases to 125 MiB */
154 size_t incr = 125L*1024L*1024L;
155 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_INCR, (void *)(incr)))
156 cg_error_exit();
157 }
158 t0 = MPI_Wtime();
159 if(allranks == 0) {
160 if (whoami == ROOT) {
161 if (cg_open(fname, CG_MODE_WRITE, &index_file)) cg_error_exit();
162 }
163 } else {
164 cgp_mpi_comm(MPI_COMM_WORLD);
165 if (cgp_open(fname, CG_MODE_WRITE, &index_file)) cg_error_exit();
166 }
167 t1 = MPI_Wtime();
168 if (whoami == ROOT) {
169 printf("cg_open: %lf s \n", (t1 - t0));
170 }
171
172 // ---- Create base -------------------------------------------------------------------
173 char *basename = "Base";
174 int icelldim = 3;
175 int iphysdim = 3;
176 if(allranks == 0) {
177 if (whoami == ROOT) {
178 if(cg_base_write(index_file, basename, icelldim, iphysdim, &index_base) != CG_OK) {
179 printf("*FAILED* cg_base_write\n");
180 cg_error_exit();
181 };
182 }
183 } else {
184 if(cg_base_write(index_file, basename, icelldim, iphysdim, &index_base) != CG_OK) {
185 printf("*FAILED* cg_base_write\n");
186 cg_error_exit();
187 };
188 }
189 // ---- Create zones -------------------------------------------
190 t0 = MPI_Wtime();
191 if(allranks == 0) {
192 if (whoami == ROOT) {
193 zone = (int *)malloc(NBLOCKS*sizeof(int));
194 for (uint32_t b = 0; b < NBLOCKS; ++b) {
195 // Zone name
196 snprintf(zonename, 11, "Zone_%u", (b + 1) );
197 // Create zone
198 if (cg_zone_write(index_file, index_base, zonename, (cgsize_t *)zoneSize,
199 CGNS_ENUMV(Structured), &(zone[b])) != CG_OK)
200 cg_error_exit();
201 }
202 }
203 } else {
204 zone = (int *)malloc(NBLOCKS*sizeof(int));
205 for (uint32_t b = 0; b < NBLOCKS; ++b) {
206 // Zone name
207 snprintf(zonename, 11, "Zone_%u", (b + 1) );
208 // Create zone
209 if (cg_zone_write(index_file, index_base, zonename, (cgsize_t *)zoneSize,
210 CGNS_ENUMV(Structured), &(zone[b])) != CG_OK)
211 cg_error_exit();
212 }
213 }
214 t1 = MPI_Wtime();
215 if (whoami == ROOT) {
216 printf("cg_zone_write: %lf s\n", (t1 - t0));
217 }
218
219 t0 = MPI_Wtime();
220 if(allranks == 0) {
221 if (whoami == ROOT) {
222 for (uint32_t b = 0; b < NBLOCKS; ++b) {
223 if (cg_grid_write(index_file, index_base, zone[b], "GridCoordinates", &index_grid) != CG_OK) {
224 printf("*FAILED* cg_grid_write \n");
225 cg_error_exit();
226 }
227 }
228 }
229 } else {
230 for (uint32_t b = 0; b < NBLOCKS; ++b) {
231 if (cg_grid_write(index_file, index_base, zone[b], "GridCoordinates", &index_grid) != CG_OK) {
232 printf("*FAILED* cg_grid_write \n");
233 cg_error_exit();
234 }
235 }
236 }
237 t1 = MPI_Wtime();
238 if (whoami == ROOT) {
239 printf("cg_grid_write: %lf s \n", (t1 - t0));
240 }
241
242 t0 = MPI_Wtime();
243 if(allranks == 0) {
244 if (whoami == ROOT) {
245 for (uint32_t b = 0; b < NBLOCKS; ++b) {
246 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateX",
247 &index_coordx))
248 cg_error_exit();
249 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateY",
250 &index_coordy))
251 cg_error_exit();
252 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateZ",
253 &index_coordz))
254 cg_error_exit();
255 }
256 }
257 } else {
258 for (uint32_t b = 0; b < NBLOCKS; ++b) {
259 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateX",
260 &index_coordx))
261 cg_error_exit();
262 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateY",
263 &index_coordy))
264 cg_error_exit();
265 if (cgp_coord_write(index_file, index_base, zone[b], CGNS_ENUMV(RealSingle), "CoordinateZ",
266 &index_coordz))
267 cg_error_exit();
268 }
269 }
270
271 t1 = MPI_Wtime();
272 if (whoami == ROOT) {
273 printf("cgp_coord_write: %lf s\n", (t1 - t0));
274 }
275
276 t0 = MPI_Wtime();
277 if(allranks == 0) {
278 if (whoami == ROOT) {
279 cg_close(index_file);
280 free(zone);
281 }
282 } else {
283 cgp_close(index_file);
284 free(zone);
285 }
286 t1 = MPI_Wtime();
287 if (whoami == ROOT) {
288 printf("cg_close: %lf s\n", (t1 - t0));
289 }
290
291 MPI_Barrier(MPI_COMM_WORLD);
292
293 /* disable core file driver */
294 if (cg_configure(CG_CONFIG_HDF5_DISKLESS, (void *)0))
295 cg_error_exit();
296
297 cgp_mpi_comm(MPI_COMM_WORLD);
298
299 if( skipread == 0) {
300 t0 = MPI_Wtime();
301 if(cgp_open(fname, CG_MODE_MODIFY, &index_file) != CG_OK) {
302 printf("*FAILED* cgp_open \n");
303 cgp_error_exit();
304 }
305 MPI_Barrier(MPI_COMM_WORLD);
306 t1 = MPI_Wtime();
307 if (whoami == ROOT) {
308 printf("cgp_open: %lf s\n", (t1 - t0));
309 }
310
311 index_base = 1;
312
313 for (uint32_t b = 0; b < NBLOCKS; ++b) {
314 snprintf(zonename, 11, "Zone_%u", (b + 1) );
315 if(cg_goto(index_file, index_base, zonename, 0, "end") != CG_OK) {
316 printf("*FAILED* cg_goto\n");
317 cgp_error_exit();
318 }
319 }
320 for (uint32_t b = 0; b < NBLOCKS; ++b) {
321 char path[100];
322 snprintf(path, 99, "/Base/Zone_%u/GridCoordinates/CoordinateX", (b + 1) );
323 if(cg_gopath(index_file, path) != CG_OK) {
324 printf("*FAILED* cg_goto\n");
325 cgp_error_exit();
326 }
327 }
328
329 t0 = MPI_Wtime();
330 cgp_close(index_file);
331 MPI_Barrier(MPI_COMM_WORLD);
332 t1 = MPI_Wtime();
333 if (whoami == ROOT) {
334 printf("cgp_close: %lf s\n", (t1 - t0));
335 }
336 }
337 free(local_blocks);
338 MPI_Finalize();
339
340 return exit;
341 }
2222 int comm_size;
2323 int comm_rank;
2424 MPI_Info info;
25 MPI_Comm comm_self = MPI_COMM_SELF;
2526 int fn;
2627
2728 err = MPI_Init(&argc,&argv);
5657
5758 MPI_Barrier(MPI_COMM_WORLD);
5859
59 cgp_mpi_comm(MPI_COMM_SELF);
60 cgp_mpi_comm(comm_self);
6061
6162 if(comm_rank == 0) {
6263 if (cgp_open("open_close.cgns", CG_MODE_READ, &fn))
8485 if (cgp_close(fn))
8586 cgp_error_exit();
8687 #endif
88
89 /* test setting COMM via configure API */
90 if (cg_configure(CG_CONFIG_HDF5_MPI_COMM, &comm_self))
91 cgp_error_exit();
92
93 if (comm_rank == 0) {
94 if (cgp_open("open_close.cgns", CG_MODE_READ, &fn))
95 cg_error_exit();
96 if (cgp_close(fn))
97 cg_error_exit();
98 }
99
100 cgp_mpi_comm(MPI_COMM_WORLD);
101
87102 err = MPI_Finalize();
88103 if(err!=MPI_SUCCESS) cgp_doError;
89104 return err;
1010
1111
1212 INTEGER(cgsize_t), PARAMETER :: totcnt = 40320 * 10
13
13 INTEGER, PARAMETER :: NLOOPS = 5000
1414 INTEGER(cgsize_t) npp
1515 INTEGER(C_INT) commsize, commrank, mpi_err
1616 INTEGER i, nb, nz, nerrs
2525 CHARACTER*11 piomode(2)
2626 INTEGER :: istat
2727 INTEGER :: precision
28 INTEGER, TARGET :: value
2829
2930 DATA piomode /'independent','collective'/
3031
7475
7576 ! default is MPI_COMM_WORLD, but can set another communicator with this
7677 ! call cgp_mpi_comm_f(MPI_COMM_WORLD,ierr)
78
79 ! Check repeated opening and closing of a file to detect issues with
80 ! missed closed HDF5 objects, CGNS-109.
81 DO n = 1, NLOOPS
82 CALL cgp_open_f('pcgns_ftest.cgns',CG_MODE_WRITE,F,ierr)
83 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
84 CALL cgp_close_f(F,ierr)
85 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
86 ENDDO
7787
7888 CALL cgp_open_f('pcgns_ftest.cgns',CG_MODE_WRITE,F,ierr)
7989 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
245255 CALL cgp_close_f(F,ierr)
246256 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
247257
258 ! Disable with gfortran, GCC Bugzilla - Bug 99982
259 #ifndef __GFORTRAN__
260 ! test cg_configure_f
261 value = MPI_COMM_SELF
262 CALL cg_configure_f(CG_CONFIG_HDF5_MPI_COMM, C_LOC(value), ierr)
263 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
264
265 IF (commrank .EQ. 0) THEN
266 CALL cgp_open_f('pcgns_ftest.cgns',CG_MODE_READ,F,ierr)
267 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
268 CALL cgp_close_f(F,ierr)
269 IF (ierr .NE. CG_OK) CALL cgp_error_exit_f
270 ENDIF
271 #endif
248272 CALL MPI_FINALIZE(mpi_err)
249273 END PROGRAM pcgns_ftest
250274
0 PROGRAM test_mixed_par_ser
1
2 USE cgns
3 use mpi
4 IMPLICIT NONE
5 INTEGER :: ierr, base, i, cg, iCoor
6 INTEGER(cgsize_t) :: sizes(9)
7 INTEGER :: commsize, commrank
8 CHARACTER(LEN=11) :: FNAME1 = "fname1.cgns"
9 CHARACTER(LEN=11) :: FNAME2 = "fname2.cgns"
10 CHARACTER(LEN=11) :: FNAME3 = "fname3.cgns"
11 DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: Dxyz
12
13 CALL MPI_INIT(ierr)
14 CALL MPI_COMM_SIZE(MPI_COMM_WORLD,commsize,ierr)
15 CALL MPI_COMM_RANK(MPI_COMM_WORLD,commrank,ierr)
16
17 ! *******************************
18 ! TEST S-P-S, all different files
19 ! *******************************
20 IF(commrank.EQ.0) WRITE(*,"(A)") "TEST S-P-S, all different files"
21 IF(commrank.EQ.0) CALL test_serial(FNAME1)
22 CALL test_parallel(FNAME2)
23 IF(commrank.EQ.0) CALL test_serial(FNAME3)
24
25 ! *******************************
26 ! TEST S-P-S, all same files
27 ! *******************************
28 IF(commrank.EQ.0) WRITE(*,"(A)") "TEST S-P-S, all same files"
29 IF(commrank.EQ.0) CALL test_serial(FNAME1)
30 CALL test_parallel(FNAME1)
31 IF(commrank.EQ.0) CALL test_serial(FNAME1)
32
33 ! *******************************
34 ! TEST P-S-P, all different files
35 ! *******************************
36 IF(commrank.EQ.0) WRITE(*,"(A)") "TEST P-S-P, all different files"
37 CALL test_parallel(FNAME1)
38 IF(commrank.EQ.0) CALL test_serial(FNAME2)
39 CALL test_parallel(FNAME3)
40
41 ! *******************************
42 ! TEST P-S-P, all same files
43 ! *******************************
44 IF(commrank.EQ.0) WRITE(*,"(A)") "TEST P-S-P, all same files"
45 CALL test_parallel(FNAME1)
46 IF(commrank.EQ.0) CALL test_serial(FNAME1)
47 CALL test_parallel(FNAME1)
48
49 CALL mpi_finalize(ierr)
50
51 CONTAINS
52
53 SUBROUTINE test_serial(fname)
54
55 IMPLICIT NONE
56 CHARACTER*(*) :: fname
57 INTEGER(cgsize_t) ii,kk,jj, pos
58
59 WRITE(*,"(3X,A)", ADVANCE="NO") "SERIAL CREATE....."
60
61 ! Make a serial file:
62 CALL cg_open_f(fname, CG_MODE_WRITE, cg, ierr)
63 IF (ierr == CG_ERROR) CALL cgp_error_exit_f()
64
65 CALL cg_base_write_f(cg, "Base#1", 3, 3, base, ierr)
66 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
67
68 sizes = 0
69 sizes(1) = 10
70 sizes(2) = 10
71 sizes(3) = 10
72 sizes(4) = sizes(1) - 1
73 sizes(5) = sizes(2) - 1
74 sizes(6) = sizes(3) - 1
75
76 ALLOCATE(Dxyz(1:sizes(1)*sizes(2)*sizes(3)) )
77 DO kk=1, sizes(3)
78 DO jj=1, sizes(2)
79 DO ii=1, sizes(1)
80 pos = ii + (jj-1)*sizes(1) + (kk-1)*sizes(1)*sizes(2)
81 ! * make up some dummy coordinates just for the test:
82 Dxyz(pos) = i
83 ENDDO
84 ENDDO
85 ENDDO
86
87 CALL cg_zone_write_f(cg, base, "zone1", sizes, Structured, i, ierr)
88 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
89
90 CALL cg_coord_write_f(cg, base, i, RealDouble, "CoordinateX", Dxyz, iCoor, ierr)
91 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
92
93 CALL cg_coord_write_f(cg, base, i, RealDouble, "CoordinateY", Dxyz, iCoor, ierr)
94 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
95
96 CALL cg_coord_write_f(cg, base, i, RealDouble, "CoordinateZ", Dxyz, iCoor, ierr)
97 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
98
99 CALL cg_close_f(cg, ierr)
100 IF (ierr == CG_ERROR) CALL cgp_error_exit_f
101
102 DEALLOCATE(Dxyz)
103
104 WRITE(*,"(A)") "PASS"
105
106 END SUBROUTINE test_serial
107
108 SUBROUTINE test_parallel(fName)
109
110 IMPLICIT NONE
111 CHARACTER*(*) :: fname
112
113 IF( commrank.EQ.0) WRITE(*,"(3X,A)", ADVANCE="NO") "PARALLEL CREATE..."
114
115 CALL cgp_mpi_comm_f(MPI_COMM_WORLD, ierr)
116 IF (ierr == CG_ERROR) CALL cg_error_exit_f
117
118 CALL cgp_pio_mode_f(CGP_COLLECTIVE, ierr)
119 IF (ierr == CG_ERROR) CALL cg_error_exit_f
120
121 CALL cgp_open_f(fName, CG_MODE_WRITE, cg, ierr)
122 IF (ierr == CG_ERROR) CALL cg_error_exit_f
123
124 CALL cg_base_write_f(cg, "Base#1", 3, 3, base, ierr)
125 IF (ierr == CG_ERROR) CALL cg_error_exit_f
126
127 sizes = 0
128 sizes(1) = 10
129 sizes(2) = 10
130 sizes(3) = 10
131 sizes(4) = sizes(1) - 1
132 sizes(5) = sizes(2) - 1
133 sizes(6) = sizes(3) - 1
134 CALL cg_zone_write_f(cg, base, "zone1", sizes, Structured, i, ierr)
135 IF (ierr == CG_ERROR) CALL cg_error_exit_f
136
137 CALL cgp_coord_write_f(cg, base, i, RealDouble, "CoordinateX", iCoor, ierr)
138 IF (ierr == CG_ERROR) CALL cg_error_exit_f
139
140 CALL cgp_coord_write_f(cg, base, i, RealDouble, "CoordinateY", iCoor, ierr)
141 IF (ierr == CG_ERROR) CALL cg_error_exit_f
142
143 CALL cgp_coord_write_f(cg, base, i, RealDouble, "CoordinateZ", iCoor, ierr)
144 IF (ierr == CG_ERROR) CALL cg_error_exit_f
145
146 CALL cgp_close_f(cg, ierr)
147 IF (ierr == CG_ERROR) CALL cg_error_exit_f
148
149 IF( commrank.EQ.0) WRITE(*,"(A)") "PASS"
150
151 END SUBROUTINE test_parallel
152
153 END PROGRAM test_mixed_par_ser
0 /*
1 ! @file test_poly_unstructured.c
2 ! @version 0.1
3 !
4 ! @section DESCRIPTION
5 ! Test program for pcgns library
6 ! -- created to test cgp_poly_section_write (and cg_section_general_write)
7 ! -- created to test cgp_poly_element_write_data
8 ! -- based on a test file of David.Gutzwiller from Numeca
9 !
10 ! @section USAGE
11 ! Launch with:
12 ! mpirun -np <#> test_unstructured
13 !
14 */
15
16 #include <assert.h>
17 #include <math.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #ifdef _WIN32
22 #include <io.h>
23 #define unlink _unlink
24 #else
25 #include <unistd.h>
26 #endif
27
28 #include "mpi.h"
29 #include "pcgnslib.h"
30
31 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
32 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
33
34 void compareValuesDouble(double val1, double val2) {
35 if (abs(val1 - val2) > 1e-10) {
36 printf("ERROR - value comparison failed %f, %f\n", val1, val2);
37 MPI_Abort(MPI_COMM_WORLD, 2);
38 }
39 }
40
41 void compareValuescgSize_t(cgsize_t val1, cgsize_t val2) {
42 if (val1 != val2) {
43 printf("ERROR - value comparison failed %d, %d\n", val1, val2);
44 MPI_Abort(MPI_COMM_WORLD, 2);
45 }
46 }
47
48 void callCGNS(int error) {
49 if (error != CG_OK)
50 cgp_error_exit();
51 }
52
53 int main(int argc, char **argv) {
54 // set up MPI
55 int comm_size;
56 int comm_rank;
57 int ierr = 0;
58
59 // parallel/serial read communicators
60 MPI_Comm comm_parallel = MPI_COMM_WORLD;
61 MPI_Comm comm_serial = MPI_COMM_SELF;
62
63 MPI_Init(NULL, NULL);
64 MPI_Comm_size(comm_parallel, &comm_size);
65 MPI_Comm_rank(comm_parallel, &comm_rank);
66
67 // various CGNS handles
68 int cgfile = 0;
69 int cgbase = 0;
70 int cgzone = 0;
71 int cgcoord = 0;
72 int cgelem = 0;
73
74 // default test values
75 int cell_dim = 3;
76 int phys_dim = 3;
77 int nb_zones = 5;
78 cgsize_t nbCellSide = 20;
79
80 char fileName[] = "test_par_poly.cgns";
81 char baseName[] = "Unstructured3D";
82
83 if (comm_size != 2 && comm_rank == 0) {
84 printf("WARNING: you are supposed to run this test with two "
85 "processes\n");
86 }
87
88 if (comm_rank == 0) {
89 printf("Unstructured CGNS mesh write test with %d ranks\n", comm_size);
90 printf("nbCellSide %d\n", nbCellSide);
91 printf("nbZones %d\n", nb_zones);
92 }
93
94 // basic mesh information
95 cgsize_t nbNodeSide = nbCellSide + 1;
96 cgsize_t nbNodeSlice = nbNodeSide * nbNodeSide;
97 cgsize_t nbNodeTotal = nbNodeSide * nbNodeSlice;
98 cgsize_t nbCellSlice = nbCellSide * nbCellSide;
99 cgsize_t nbCellTotal = nbCellSide * nbCellSlice;
100 // Sizing of Section and
101 cgsize_t offsetsTotalSize = 0;
102 cgsize_t startOffset = 0;
103 // MPI arrays
104 long *offsets_sizes = NULL;
105 long local_size = 0;
106
107 ElementType_t eType = MIXED;
108
109 // distribute the elements and nodes hosted by each rank
110 cgsize_t nbNodeIdeal = (nbNodeTotal / comm_size) + 1;
111 cgsize_t nbCellIdeal = (nbCellTotal / comm_size) + 1;
112 cgsize_t cellOnProcStart = (comm_rank) * (nbCellIdeal);
113 cgsize_t cellOnProcEnd = (comm_rank + 1) * (nbCellIdeal);
114 cgsize_t nodeOnProcStart = (comm_rank) * (nbNodeIdeal);
115 cgsize_t nodeOnProcEnd = (comm_rank + 1) * (nbNodeIdeal);
116 cellOnProcEnd = MIN(cellOnProcEnd, nbCellTotal);
117 nodeOnProcEnd = MIN(nodeOnProcEnd, nbNodeTotal);
118 cgsize_t nbCellWrite = cellOnProcEnd - cellOnProcStart;
119 cgsize_t nbNodeWrite = nodeOnProcEnd - nodeOnProcStart;
120
121 printf("rank %d hosts %d cells in range [%d,%d]\n", comm_rank, nbCellWrite,
122 cellOnProcStart, cellOnProcEnd);
123 printf("rank %d hosts %d nodes in range [%d,%d]\n", comm_rank, nbNodeWrite,
124 nodeOnProcStart, nodeOnProcEnd);
125
126 // create a simple cube mesh
127 double *nodeX = (double *)malloc(sizeof(double) * nbNodeWrite);
128 double *nodeY = (double *)malloc(sizeof(double) * nbNodeWrite);
129 double *nodeZ = (double *)malloc(sizeof(double) * nbNodeWrite);
130 double spacing = 1.0 / (nbNodeSide - 1);
131 int count = 0;
132 for (cgsize_t iNode = nodeOnProcStart; iNode < nodeOnProcEnd; iNode++) {
133 cgsize_t i = floor(iNode / nbNodeSlice);
134 cgsize_t j = floor((iNode - i * nbNodeSlice) / nbNodeSide);
135 cgsize_t k = floor(iNode - i * nbNodeSlice - j * nbNodeSide);
136 nodeX[count] = (i * spacing);
137 nodeY[count] = (j * spacing);
138 nodeZ[count] = (k * spacing);
139 count++;
140 }
141
142 cgsize_t *cells = (cgsize_t *)malloc(sizeof(cgsize_t) * nbCellWrite * 9);
143 cgsize_t *offsets = (cgsize_t *)malloc(sizeof(cgsize_t) * (nbCellWrite + 1));
144 count = 0;
145 offsets[0] = 0;
146 for (cgsize_t iCell = cellOnProcStart; iCell < cellOnProcEnd; iCell++) {
147 cgsize_t i = floor(iCell / nbCellSlice);
148 cgsize_t j = floor((iCell - i * nbCellSlice) / nbCellSide);
149 cgsize_t k = floor(iCell - i * nbCellSlice - j * nbCellSide);
150 cells[count + 0] = (cgsize_t)(HEXA_8);
151 cells[count + 1] =
152 (i + 0) * nbNodeSlice + (j + 0) * nbNodeSide + (k + 0) + 1;
153 cells[count + 2] =
154 (i + 1) * nbNodeSlice + (j + 0) * nbNodeSide + (k + 0) + 1;
155 cells[count + 3] =
156 (i + 1) * nbNodeSlice + (j + 1) * nbNodeSide + (k + 0) + 1;
157 cells[count + 4] =
158 (i + 0) * nbNodeSlice + (j + 1) * nbNodeSide + (k + 0) + 1;
159 cells[count + 5] =
160 (i + 0) * nbNodeSlice + (j + 0) * nbNodeSide + (k + 1) + 1;
161 cells[count + 6] =
162 (i + 1) * nbNodeSlice + (j + 0) * nbNodeSide + (k + 1) + 1;
163 cells[count + 7] =
164 (i + 1) * nbNodeSlice + (j + 1) * nbNodeSide + (k + 1) + 1;
165 cells[count + 8] =
166 (i + 0) * nbNodeSlice + (j + 1) * nbNodeSide + (k + 1) + 1;
167 count = count + 9;
168 offsets[iCell - cellOnProcStart + 1] = count;
169 }
170
171 offsets_sizes = (long *)malloc(sizeof(long) * comm_size);
172 local_size = offsets[cellOnProcEnd - cellOnProcStart];
173
174 MPI_Allgather(&local_size, 1, MPI_LONG, offsets_sizes, 1, MPI_LONG,
175 comm_parallel);
176
177 for (int iProc = 0; iProc < comm_size; iProc++) {
178 if (iProc < comm_rank) {
179 startOffset += (cgsize_t) offsets_sizes[iProc];
180 }
181 offsetsTotalSize += (cgsize_t) offsets_sizes[iProc];
182 }
183 free(offsets_sizes);
184
185 // Update local offset to global
186 for (cgsize_t iCell = 0; iCell < cellOnProcEnd - cellOnProcStart + 1;
187 iCell++) {
188 offsets[iCell] += startOffset;
189 }
190
191 if (comm_rank == 0) {
192 unlink(fileName);
193 }
194
195 double writeTimerStart = MPI_Wtime();
196 MPI_Barrier(comm_parallel);
197
198 callCGNS(cg_configure(CG_CONFIG_COMPRESS, 0));
199 callCGNS(cgp_mpi_comm(comm_parallel));
200 callCGNS(cgp_open(fileName, CG_MODE_WRITE, &cgfile));
201 callCGNS(cg_base_write(cgfile, baseName, cell_dim, phys_dim, &cgbase));
202
203 if (comm_rank == 0)
204 printf("writing node data in parallel\n");
205 for (int iZone = 0; iZone < nb_zones; iZone++) {
206 // offset the nodes for each zone
207 for (cgsize_t iNode = 0; iZone != 0 && iNode < nbNodeWrite; iNode++) {
208 nodeX[iNode] = nodeX[iNode] + 1.0;
209 }
210
211 // create the zone
212 char zoneName[10];
213 sprintf(zoneName, "domain%d", iZone);
214 cgsize_t zoneSize[9];
215 zoneSize[0] = nbNodeTotal;
216 zoneSize[1] = nbCellTotal;
217 zoneSize[2] = 0;
218 callCGNS(cg_zone_write(cgfile, cgbase, zoneName, zoneSize, Unstructured,
219 &cgzone));
220
221 // write the nodes in parallel
222 DataType_t precision = CGNS_ENUMV(RealDouble);
223 cgsize_t start = nodeOnProcStart + 1;
224 cgsize_t end = nodeOnProcEnd;
225 callCGNS(cgp_coord_write(cgfile, cgbase, cgzone, precision, "CoordinateX",
226 &cgcoord));
227 callCGNS(cg_coord_partial_write(cgfile, cgbase, cgzone, precision,
228 "CoordinateX", &start, &end, &nodeX[0],
229 &cgcoord));
230 callCGNS(cgp_coord_write(cgfile, cgbase, cgzone, precision, "CoordinateY",
231 &cgcoord));
232 callCGNS(cg_coord_partial_write(cgfile, cgbase, cgzone, precision,
233 "CoordinateY", &start, &end, &nodeY[0],
234 &cgcoord));
235 callCGNS(cgp_coord_write(cgfile, cgbase, cgzone, precision, "CoordinateZ",
236 &cgcoord));
237 callCGNS(cg_coord_partial_write(cgfile, cgbase, cgzone, precision,
238 "CoordinateZ", &start, &end, &nodeZ[0],
239 &cgcoord));
240 }
241 MPI_Barrier(MPI_COMM_WORLD);
242
243 // write elements, mixed
244 for (int iZone = 0; iZone < nb_zones; iZone++) {
245 cgzone = iZone + 1;
246 // create element node
247 cgsize_t start = 1;
248 cgsize_t end = nbCellTotal;
249
250 callCGNS(cgp_poly_section_write(cgfile, cgbase, cgzone, "Elements 3D",
251 eType, start, end, offsetsTotalSize, 0,
252 &cgelem));
253
254 start = cellOnProcStart + 1;
255 end = cellOnProcEnd;
256 callCGNS(cgp_poly_elements_write_data(cgfile, cgbase, cgzone, cgelem, start,
257 end, cells, offsets));
258 }
259
260 callCGNS(cgp_close(cgfile));
261
262 MPI_Barrier(MPI_COMM_WORLD);
263 double elapsedTime = MPI_Wtime() - writeTimerStart;
264 if (comm_rank == 0) {
265 printf("\ndone, write time = %f\n\n", elapsedTime);
266 }
267
268 // now read the data and compare it with the expected values
269 if (comm_rank == 0) {
270 printf("reading node data in parallel\n");
271 }
272 for (int iZone = 0; iZone < nb_zones; iZone++) {
273 // zero out the node coordinates
274 for (cgsize_t iNode = 0; iNode < nbNodeWrite; iNode++) {
275 nodeX[iNode] = 0.0;
276 nodeY[iNode] = 0.0;
277 nodeZ[iNode] = 0.0;
278 }
279
280 // open the file in parallel
281 callCGNS(cgp_mpi_comm(comm_parallel));
282 callCGNS(cgp_open(fileName, CG_MODE_READ, &cgfile));
283
284 // read the nodes and compare
285 DataType_t precision = CGNS_ENUMV(RealDouble);
286 cgsize_t start = nodeOnProcStart + 1;
287 cgsize_t end = nodeOnProcEnd;
288 cgzone = iZone + 1;
289 cgcoord = 1;
290 callCGNS(cgp_coord_read_data(cgfile, cgbase, cgzone, cgcoord, &start, &end,
291 &nodeX[0]));
292 cgcoord = 2;
293 callCGNS(cgp_coord_read_data(cgfile, cgbase, cgzone, cgcoord, &start, &end,
294 &nodeY[0]));
295 cgcoord = 3;
296 callCGNS(cgp_coord_read_data(cgfile, cgbase, cgzone, cgcoord, &start, &end,
297 &nodeZ[0]));
298
299 int ipos = 0;
300 for (cgsize_t iNode = nodeOnProcStart; iNode < nodeOnProcEnd; iNode++) {
301 cgsize_t i = floor(iNode / nbNodeSlice);
302 cgsize_t j = floor((iNode - i * nbNodeSlice) / nbNodeSide);
303 cgsize_t k = floor(iNode - i * nbNodeSlice - j * nbNodeSide);
304 compareValuesDouble(nodeX[ipos], ((i * spacing) + iZone * 1.0));
305 compareValuesDouble(nodeY[ipos], (j * spacing));
306 compareValuesDouble(nodeZ[ipos], (k * spacing));
307 ipos++;
308 }
309 callCGNS(cgp_close(cgfile));
310 }
311 free(nodeX);
312 free(nodeY);
313 free(nodeZ);
314
315 for (int iZone = 0; iZone < nb_zones; iZone++) {
316 // read the elements
317 if (comm_rank == 0)
318 printf("reading mixed element data in serial\n");
319
320 // do the comparison on rank 0 only, read for all procs...
321 if (comm_rank == 0) {
322 callCGNS(cgp_mpi_comm(comm_serial));
323 callCGNS(cgp_open(fileName, CG_MODE_READ, &cgfile));
324 cgzone = iZone + 1;
325 cgelem = 1;
326 long start = (long) (cellOnProcStart + 1);
327 long end = (long) cellOnProcEnd;
328 long nbRead = (long) (cellOnProcEnd - cellOnProcStart);
329 for (int iProc = 0; iProc < comm_size; iProc++) {
330 if (iProc != comm_rank) {
331 MPI_Recv(&nbRead, 1, MPI_LONG, iProc, 1, MPI_COMM_WORLD,
332 MPI_STATUS_IGNORE);
333 MPI_Recv(&start, 1, MPI_LONG, iProc, 2, MPI_COMM_WORLD,
334 MPI_STATUS_IGNORE);
335 MPI_Recv(&end, 1, MPI_LONG, iProc, 3, MPI_COMM_WORLD,
336 MPI_STATUS_IGNORE);
337 }
338 cgsize_t sizeRead;
339 callCGNS(cg_ElementPartialSize(cgfile, cgbase, cgzone, cgelem, start,
340 end, &sizeRead));
341 cgsize_t *cellsRead = (cgsize_t *)malloc(sizeof(cgsize_t) * sizeRead);
342 cgsize_t *offsetsRead =
343 (cgsize_t *)malloc(sizeof(cgsize_t) * (nbRead + 1));
344 callCGNS(cg_poly_elements_partial_read(cgfile, cgbase, cgzone, cgelem,
345 start, end, cellsRead,
346 offsetsRead, NULL));
347
348 cgsize_t count = 0;
349 for (cgsize_t iCell = (start - 1); iCell < end; iCell++) {
350 cgsize_t i = floor(iCell / nbCellSlice);
351 cgsize_t j = floor((iCell - i * nbCellSlice) / nbCellSide);
352 cgsize_t k = floor(iCell - i * nbCellSlice - j * nbCellSide);
353 compareValuescgSize_t(cellsRead[count + 0], (cgsize_t)(HEXA_8));
354 compareValuescgSize_t(cellsRead[count + 1], (i + 0) * nbNodeSlice +
355 (j + 0) * nbNodeSide +
356 (k + 0) + 1);
357 compareValuescgSize_t(cellsRead[count + 2], (i + 1) * nbNodeSlice +
358 (j + 0) * nbNodeSide +
359 (k + 0) + 1);
360 compareValuescgSize_t(cellsRead[count + 3], (i + 1) * nbNodeSlice +
361 (j + 1) * nbNodeSide +
362 (k + 0) + 1);
363 compareValuescgSize_t(cellsRead[count + 4], (i + 0) * nbNodeSlice +
364 (j + 1) * nbNodeSide +
365 (k + 0) + 1);
366 compareValuescgSize_t(cellsRead[count + 5], (i + 0) * nbNodeSlice +
367 (j + 0) * nbNodeSide +
368 (k + 1) + 1);
369 compareValuescgSize_t(cellsRead[count + 6], (i + 1) * nbNodeSlice +
370 (j + 0) * nbNodeSide +
371 (k + 1) + 1);
372 compareValuescgSize_t(cellsRead[count + 7], (i + 1) * nbNodeSlice +
373 (j + 1) * nbNodeSide +
374 (k + 1) + 1);
375 compareValuescgSize_t(cellsRead[count + 8], (i + 0) * nbNodeSlice +
376 (j + 1) * nbNodeSide +
377 (k + 1) + 1);
378 count = count + 9;
379 }
380 free(cellsRead);
381 free(offsetsRead);
382 }
383 callCGNS(cgp_close(cgfile));
384 } else {
385 long start = (long)(cellOnProcStart + 1);
386 long end = (long) cellOnProcEnd;
387 long nbRead = (long)(cellOnProcEnd - cellOnProcStart);
388 MPI_Send(&nbRead, 1, MPI_LONG, 0, 1, MPI_COMM_WORLD);
389 MPI_Send(&start, 1, MPI_LONG, 0, 2, MPI_COMM_WORLD);
390 MPI_Send(&end, 1, MPI_LONG, 0, 3, MPI_COMM_WORLD);
391 }
392 }
393 free(cells);
394 free(offsets);
395
396 ierr = MPI_Finalize();
397 if (ierr != MPI_SUCCESS)
398 return 1;
399 return 0;
400 }
22 #########
33
44 # Link all the executables to cgns and hdf5
5 link_libraries(cgns_static)
5 if(CGNS_BUILD_SHARED)
6 link_libraries(cgns_shared)
7 else(CGNS_BUILD_SHARED)
8 link_libraries(cgns_static)
9 endif(CGNS_BUILD_SHARED)
610
711 if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY)
812 link_libraries(${HDF5_LIBRARY})
2731 set(elemtest_FILES elemtest.c)
2832 set(open_cgns_FILES open_cgns.c utils.c)
2933 set(ser_benchmark_hdf5_FILES ser_benchmark_hdf5.c)
34 set(test_core_vfd_FILES test_core_vfd.c)
3035 set(test_exts_FILES test_exts.c)
3136 set(test_goto_FILES test_goto.c)
3237 set(test_partial_FILES test_partial.c)
4247 set(write_test_FILES write_test.c)
4348 set(write_zones_FILES write_zones.c utils.c)
4449 set(test_family_tree_FILES test_family_tree.c)
50 set(test_complex_FILES test_complex.c)
51 set(test_convert_elem_FILES test_convert_elem.c)
4552 #set(cgiof_FILES cgiof.F90)
4653 #set(cgwrite_FILES cgwrite.F90)
4754 #set(cgread_FILES cgread.F90)
5562 set(test_general_rindf_FILES test_general_rindf.F90)
5663 set(test_family_treef_FILES test_family_treef.F90)
5764 set(test_bboxf_FILES test_bboxf.F90)
65 set(test_complexf_FILES test_complexf.F90)
5866
5967 # Build each test
6068 add_executable( cgioc ${cgioc_FILES} )
6270 add_executable( elemtest ${elemtest_FILES} )
6371 add_executable( open_cgns ${open_cgns_FILES} )
6472 add_executable( ser_benchmark_hdf5 ${ser_benchmark_hdf5_FILES} )
73 add_executable( test_core_vfd ${test_core_vfd_FILES} )
6574 add_executable( test_exts ${test_exts_FILES} )
6675 add_executable( test_goto ${test_goto_FILES} )
6776 add_executable( test_partial ${test_partial_FILES} )
7786 add_executable( write_zones ${write_zones_FILES} )
7887 add_executable( test_family_tree ${test_family_tree_FILES} )
7988 add_executable( test_bbox ${test_bbox_FILES} )
89 add_executable( test_complex ${test_complex_FILES} )
90 add_executable( test_convert_elem ${test_convert_elem_FILES} )
8091
8192 # Conditionally build the fortran tests
8293 if (CGNS_ENABLE_FORTRAN)
89100 add_executable( test_general_rindf ${test_general_rindf_FILES} )
90101 add_executable( test_family_treef ${test_family_treef_FILES} )
91102 add_executable( test_bboxf ${test_bboxf_FILES} )
103 add_executable( test_complexf ${test_complexf_FILES} )
92104 # if (NOT CGNS_ENABLE_64BIT)
93105 # Don't build the F77 source because they will fail if ENABLE_64BIT is used
94106 # add_executable( cgiof ${cgiof_FILES} )
104116 add_test( cgioc cgioc )
105117 add_test( elemtest elemtest )
106118 add_test( ser_benchmark_hdf5 ser_benchmark_hdf5 )
119 add_test( test_core_vfd test_core_vfd )
107120 add_test( test_exts test_exts )
108121 add_test( test_goto test_goto )
109122 add_test( test_partial test_partial )
119132 add_test( write_zones write_zones )
120133 add_test( test_family_tree test_family_tree )
121134 add_test( test_bbox test_bbox )
135 add_test( test_complex test_complex )
136 add_test( test_convert_elem test_convert_elem )
122137
123138 # Conditionally add the fortran tests
124139 if (CGNS_ENABLE_FORTRAN)
131146 add_test( test_general_rindf test_general_rindf )
132147 add_test( test_family_treef test_family_treef )
133148 add_test( test_bboxf test_bboxf )
149 add_test( test_complexf test_complexf )
134150 # if (NOT CGNS_ENABLE_64BIT)
135151 # add_test( cgiof cgiof)
136152 # add_test( cgwrite cgwrite )
1818 cgioc_hdf$(EXE) \
1919 elemtest$(EXE) \
2020 ser_benchmark_hdf5$(EXE) \
21 test_core_vfd$(EXE) \
2122 test_exts$(EXE) \
2223 test_goto$(EXE) \
2324 test_family_tree$(EXE) \
3233 write_test$(EXE) \
3334 write_zones$(EXE) \
3435 write_rind$(EXE) \
35 test_bbox$(EXE)
36 test_bbox$(EXE) \
37 test_convert_elem$(EXE) \
38 test_complex$(EXE)
3639
3740 F_TESTS = \
3841 cgiof_F03$(EXE) \
4245 cgsubreg_F03$(EXE) \
4346 test_general_rindf$(EXE)\
4447 test_family_treef$(EXE) \
45 test_bboxf$(EXE)
48 test_bboxf$(EXE) \
49 test_complexf$(EXE)
4650
4751 FALL = $(F_TESTS)
4852
131135 ser_benchmark_hdf5$(EXE) : ser_benchmark_hdf5.c $(CGNSLIB)
132136 $(CC) $(COPTS) $(CEOUT)$@ ser_benchmark_hdf5.c $(LDLIBS) $(CLIBS) -lm
133137 $(STRIP) $@
138 #----------
139
140 test_core_vfd$(EXE) : test_core_vfd.c $(CGNSLIB)
141 $(CC) $(COPTS) $(CEOUT)$@ test_core_vfd.c $(LDLIBS) $(CLIBS)
142 $(STRIP) $@
134143
135144 #----------
136145
232241
233242 #----------
234243
244 test_complex$(EXE) : test_complex.c $(CGNSLIB)
245 $(CC) $(COPTS) $(CEOUT)$@ test_complex.c $(LDLIBS) $(CLIBS)
246 $(STRIP) $@
247
248 #----------
249
250 test_convert_elem$(EXE) : test_convert_elem.c $(CGNSLIB)
251 $(CC) $(COPTS) $(CEOUT)$@ test_convert_elem.c $(LDLIBS) $(CLIBS)
252 $(STRIP) $@
253
254 #----------
255
235256 cgiof$(EXE) : cgiof.F90 $(CGNSLIB)
236257 $(F77) $(FOPTS) $(FEOUT)$@ cgiof.F90 $(LDLIBS) $(FLIBS)
237258 $(STRIP) $@
323344
324345 test_bboxf$(EXE) : test_bboxf.F90 $(CGNSLIB)
325346 $(F77) $(FOPTS) $(FEOUT)$@ test_bboxf.F90 $(LDLIBS) $(FLIBS)
347 $(STRIP) $@
348
349 #----------
350
351 test_complexf$(EXE) : test_complexf.F90 $(CGNSLIB)
352 $(F77) $(FOPTS) $(FEOUT)$@ test_complexf.F90 $(LDLIBS) $(FLIBS)
326353 $(STRIP) $@
327354
328355 #----------
88 !
99 INTEGER MAXCHR
1010 PARAMETER (MAXCHR=32)
11 !
12 CHARACTER*(MAXCHR) TSTLBL,DTYPE
13 CHARACTER*(MAXCHR) FNAM,PATH
14 !
15 REAL*8 RID,PID,CID,TMPID,RIDF2
11
12 INTEGER, PARAMETER :: dp = KIND(1.d0)
13 INTEGER, PARAMETER :: i4 = SELECTED_INT_KIND(9) ! should map to INTEGER*4 on most modern processors
14 CHARACTER(len=MAXCHR) TSTLBL,DTYPE
15 CHARACTER(len=MAXCHR) FNAM,PATH
16 !
17 REAL(KIND=dp) RID,PID,CID,TMPID,RIDF2
1618 REAL A(4,3),B(4,3)
17 INTEGER*4 IC(6),ID(6)
19 INTEGER(KIND=i4) IC(6),ID(6)
1820 INTEGER IERR,ICGIO,ICGIO2
19 INTEGER(CGSIZE_T) :: IDIM(2),IDIMA(2),IDIMC,IDIMD
21 INTEGER(KIND=CGSIZE_T) :: IDIM(2),IDIMA(2),IDIMC,IDIMD
2022 !
2123 DATA A /1.1,2.1,3.1,4.1, &
2224 & 1.2,2.2,3.2,4.2, &
115117 ! TWO NODES UNDER N10
116118 !
117119 CALL CGIO_GET_NODE_ID_F(ICGIO,RID,'/N3/N10',PID,IERR)
118 CALL CGIO_CREATE_LINK_F(ICGIO,PID,'L1',CHAR(0),'/N3/N9/N13', &
120 CALL CGIO_CREATE_LINK_F(ICGIO,PID,'L1',CHAR(0),'/N3/N9/N13', &
119121 & TMPID,IERR)
120122 CALL CGIO_CREATE_NODE_F(ICGIO,PID,'N14',TMPID,IERR)
121123 !
122124 ! TWO NODES UNDER N11
123125 !
124126 CALL CGIO_GET_NODE_ID_F(ICGIO,RID,'/N3/N11',PID,IERR)
125 CALL CGIO_CREATE_LINK_F(ICGIO,PID,'L2','','/N3/N9/N13', &
127 CALL CGIO_CREATE_LINK_F(ICGIO,PID,'L2',CHAR(0),'/N3/N9/N13', &
126128 & TMPID,IERR)
127129 CALL CGIO_CREATE_NODE_F(ICGIO,PID,'N15',TMPID,IERR)
128130 !
216218 !
217219 PARAMETER (MAXCLD=10)
218220 PARAMETER (MAXCHR=32)
219 REAL*8 PID
220 CHARACTER*(MAXCHR) NODNAM,NDNMS(MAXCLD)
221 INTEGER, PARAMETER :: dp = KIND(1.d0)
222 REAL(KIND=dp) PID
223 CHARACTER(len=MAXCHR) NODNAM,NDNMS(MAXCLD)
221224 CALL CGIO_GET_NAME_F(ICGIO,PID,NODNAM,IERR)
222225 CALL CGIO_NUMBER_CHILDREN_F(ICGIO,PID,NUMC,IERR)
223226 WRITE(*,120)NODNAM,NUMC
1010
1111 ! This program reads a 3D mesh, structured or unstructured.
1212
13
1413 INTEGER :: Ndim, Nglobal
1514 PARAMETER (Ndim = 3)
1615 PARAMETER (Nglobal = 500)
17
16 INTEGER, PARAMETER :: sp = KIND(1.0)
17 INTEGER, PARAMETER :: dp = KIND(1.d0)
18
1819 INTEGER :: i, narrays, iarray
1920 INTEGER :: nintegrals, integral
2021 INTEGER :: ndescriptors, idescr
2324 INTEGER(cgenum_t) :: ndonor_ptset_type, ndonor_data_type
2425 INTEGER :: idataset, dirichletflag, neumannflag
2526 INTEGER IndexDim, CellDim, PhysDim
26 INTEGER ier, n
27 INTEGER ier, n
2728 INTEGER(cgenum_t) :: zonetype
2829 INTEGER nbases, nzones
2930 INTEGER(cgsize_t) :: rmin(3), DataSize(Ndim)
3637 INTEGER(cgsize_t) :: npnts, pnts(100000), donor_pnts(100000)
3738 INTEGER(cgsize_t) :: npnts_donor
3839 INTEGER(cgenum_t) :: bocotype, datatype
39 CHARACTER*32 basename, zonename, solname, fieldname
40 CHARACTER*32 coordname, holename
40 CHARACTER(len=32) basename, zonename, solname, fieldname
41 CHARACTER(len=32) coordname, holename
4142 #ifndef CG_BASESCOPE
42 CHARACTER*32 connectname, donorname
43 CHARACTER(len=32) connectname, donorname
4344 #else
44 CHARACTER*65 connectname, donorname
45 CHARACTER(len=65) connectname, donorname
4546 #endif
46 CHARACTER*32 boconame
47 CHARACTER(len=32) boconame
4748 INTEGER cg, base, zone, coord, sol, field, discr
4849 INTEGER :: hole, conn, one21, boco
4950 INTEGER(cgsize_t) :: RANGE(Ndim, 2), donor_range(Ndim, 2)
5152 INTEGER(cgsize_t) :: G_range(Ndim*2, Nglobal)
5253 INTEGER(cgsize_t) :: G_donor_range(Ndim*2, Nglobal)
5354 INTEGER :: G_transform(Ndim, Nglobal)
54 CHARACTER*32 G_zonename(Nglobal)
55 CHARACTER(len=32) G_zonename(Nglobal)
5556 #ifndef CG_BASESCOPE
56 CHARACTER*32 G_connectname(Nglobal), G_donorname(Nglobal)
57 CHARACTER(len=32) G_connectname(Nglobal), G_donorname(Nglobal)
5758 #else
58 CHARACTER*65 G_connectname(Nglobal), G_donorname(Nglobal)
59 CHARACTER(len=65) G_connectname(Nglobal), G_donorname(Nglobal)
5960 #endif
60 CHARACTER*32 name, filename
61 CHARACTER*40 text, NormDefinitions, StateDescription
61 CHARACTER(len=32) name, filename
62 CHARACTER(len=40) text, NormDefinitions, StateDescription
6263 INTEGER :: equation_dimension, GoverningEquationsFlag
6364 INTEGER :: GasModelFlag, ViscosityModelFlag
6465 INTEGER :: ThermalConductivityModelFlag
7172 INTEGER(cgenum_t) :: mass, length, time, temp, deg
7273 INTEGER :: NormalIndex(3), ndataset
7374 INTEGER(cgsize_t) :: NormalListSize
74 REAL*4 data_single(100000)
75 DOUBLE PRECISION data_double(100000)
76 REAL*4 version
75 REAL(KIND=sp) data_single(100000)
76 REAL(KIND=dp) data_double(100000)
77 REAL(KIND=sp) version
7778
7879 INTEGER one, is_cgns
7980 PARAMETER (one = 1)
8081
8182 ! *** open file
82 ! write(6,*) 'Input filename'
83 ! read(5,600) filename
83 ! write(6,*) 'Input filename'
84 ! read(5,600) filename
8485 WRITE(filename,'(a)')'cgtest.cgns'
8586
8687 ! *** check if the file is CGNS
220221 IF (ier.EQ.ALL_OK)WRITE(6,103)' Diffusion model=', &
221222 (diffusion_model(i), i=1,6)
222223 ENDIF ! If Governing Equations are defined
223 ENDIF ! If FlowEquationSet_t exists under CGNSBase_t
224 ENDIF ! If FlowEquationSet_t exists under CGNSBase_t
224225
225226
226227 WRITE(6,400)' * * *'
383384 WRITE(6,600)' Datatype for exponents is ', &
384385 DataTypeName(datatype)
385386 IF (datatype .EQ. RealSingle) THEN
386 CALL cg_exponents_read_f(data_single, ier)
387 IF (ier .EQ. ERROR) CALL cg_error_exit_f
388 WRITE(6,110)' Exponents:',(data_single(n),n=1,5)
387 CALL cg_exponents_read_f(data_single, ier)
388 IF (ier .EQ. ERROR) CALL cg_error_exit_f
389 WRITE(6,110)' Exponents:',(data_single(n),n=1,5)
389390 ELSEIF (datatype .EQ. RealDouble) THEN
390391 CALL cg_exponents_read_f(data_double, ier)
391392 IF (ier .EQ. ERROR) CALL cg_error_exit_f
411412 ENDIF
412413 ENDIF
413414
414 ENDDO ! loop through DataArray_t
415 ENDDO ! loop through IntegralData_t
415 ENDDO ! loop through DataArray_t
416 ENDDO ! loop through IntegralData_t
416417
417418 WRITE(6,400)' * * *'
418419
489490 ' DescriptorText="',TRIM(text),'"'
490491 ENDDO
491492
492 ENDDO ! loop through data arrays
493 ENDDO ! loop through data arrays
493494
494495 ! *** read coordinates using coordinate arrays' specific functions:
495496
525526 IF (ier .EQ. ERROR) CALL cg_error_exit_f
526527 ENDIF
527528 ENDDO
528 ENDIF ! if GridCoordinates_t exists
529 ENDIF ! if GridCoordinates_t exists
529530
530531 WRITE(6,400)' * * *'
531532
609610 AngleUnitsName(deg)
610611 ENDIF
611612
612 ENDDO ! loop through DataArray_t
613 ENDDO ! loop through DataArray_t
613614 WRITE(6,103)' '
614615
615616 ! *** Reading solution data with solution specific functions:
650651 IF (ier .EQ. ERROR) CALL cg_error_exit_f
651652 ENDDO ! field loop
652653
653 ENDDO ! loop through FlowSolution_t
654 ENDDO ! loop through FlowSolution_t
654655
655656 WRITE(6,400)' * * *'
656657
722723 TemperatureUnitsName(temp), TimeUnitsName(time), &
723724 AngleUnitsName(deg)
724725 ENDIF
725 ENDDO ! loop through DataArray_t
726 ENDDO ! loop through DataArray_t
726727 ENDDO
727728
728729 WRITE(6,400)' * * *'
785786 WRITE(6,500) ' DescriptorName="',TRIM(name),'"', &
786787 ' DescriptorText="',TRIM(text),'"'
787788 ENDDO
788 ENDDO !hole loop
789 ENDDO !hole loop
789790
790791
791792
887888 ENDDO
888889 ENDIF
889890 ENDDO
890 ENDIF ! if ZoneGridConnectivity exists
891 ENDIF ! if ZoneGridConnectivity exists
891892
892893 WRITE(6,400)' * * *'
893894
952953 TemperatureUnitsName(temp), TimeUnitsName(time), &
953954 AngleUnitsName(deg)
954955 ENDIF
955 ENDIF !if ReferenceState exists under ZoneBC_t
956 ENDIF !if ReferenceState exists under ZoneBC_t
956957
957958 CALL cg_nbocos_f(cg, base, zone, nbocos, ier)
958959 IF (ier .EQ. ERROR) CALL cg_error_exit_f
10461047 IF (ier .EQ. ERROR) CALL cg_error_exit_f
10471048
10481049 ! ** boundary condition data attributes: DataClass_t
1049 WRITE(6,401)' Dirichlet DataSet:'
1050 CALL cg_dataclass_read_f(TYPE,ier)
1051 IF (ier .EQ. ERROR) CALL cg_error_exit_f
1050 WRITE(6,401)' Dirichlet DataSet:'
1051 CALL cg_dataclass_read_f(TYPE,ier)
1052 IF (ier .EQ. ERROR) CALL cg_error_exit_f
10521053 WRITE(6,600)' DataClass=', &
10531054 DataClassName(TYPE)
10541055
10551056 ! ** boundary condition data attributes: DataArray_t
1056 CALL cg_narrays_f(narrays, ier)
1057 CALL cg_narrays_f(narrays, ier)
10571058 IF (ier .EQ. ERROR) CALL cg_error_exit_f
10581059 WRITE(6,127) ' DirichletData', &
10591060 ' contains ', narrays,' data arrays'
10801081 WRITE(6,106)&
10811082 (data_double(n),n=1,dim_vals(1))
10821083 ENDIF
1083 ENDDO
1084 ENDDO
10841085 ENDIF
10851086
10861087 IF (NeumannFlag.EQ.1) THEN
11241125 (data_double(n),n=1,num)
11251126 ENDIF
11261127
1127 ENDDO ! loop through DataArray
1128 ENDIF ! if Neumann
1129 ENDDO ! loop through dataset
1130 ENDDO ! loop through boco
1131 ENDIF ! if ZoneBC_t exists
1132 ENDDO ! zone loop
1128 ENDDO ! loop through DataArray
1129 ENDIF ! if Neumann
1130 ENDDO ! loop through dataset
1131 ENDDO ! loop through boco
1132 ENDIF ! if ZoneBC_t exists
1133 ENDDO ! zone loop
11331134
11341135 WRITE(6,400)' * * *'
11351136
11691170 ENDIF
11701171
11711172
1172 ENDDO ! loop through bases
1173 ENDDO ! loop through bases
11731174
11741175 WRITE(6,400)' * * *'
11751176
55 USE CGNS
66 IMPLICIT NONE
77
8 INTEGER, PARAMETER :: sp = KIND(1.0)
9
810 integer ierr, cgfile, cgbase, cgzone, cgcoord
911 integer dim, csub, nsub
1012 integer(cgsize_t) i, j, k, n, size(9)
1113 integer(cgsize_t) ptrange(6), ptlist(125), npts
1214 integer(cgenum_t) loc, ptype
1315 integer bclen, gclen
14 real*4 x(125), y(125), z(125)
15 character*32 sname, cname
16 real(kind=sp) x(125), y(125), z(125)
17 character(len=32) sname, cname
1618
1719 ! open and write base
1820 dim = 3
0 program write_cgns_1
1
0 MODULE callback
1
2 CONTAINS
3
4 SUBROUTINE error_exit(iserr, msg) bind(C)
5
6 USE ISO_C_BINDING
7 IMPLICIT NONE
8 INTEGER, PARAMETER :: MSG_SIZE = 34
9 CHARACTER(LEN=MSG_SIZE), PARAMETER :: msg_correct = "file type unknown or not supported"
10 INTEGER(C_INT), VALUE :: iserr
11 CHARACTER(LEN=1), DIMENSION(*) :: msg
12 CHARACTER(LEN=MSG_SIZE) :: msg_check
13 INTEGER i
14
15 DO i=1, 34
16 msg_check(i:i) = msg(i)
17 ENDDO
18 IF(msg_check .NE. msg_correct)THEN
19 PRINT*,"ERROR: cg_configure_f failed for CG_CONFIG_ERROR"
20 STOP
21 ENDIF
22
23 END SUBROUTINE error_exit
24 END MODULE callback
25
26 PROGRAM write_cgns_1
27 #include "cgnstypes_f03.h"
228 #ifdef WINNT
3 include 'cgnswin_f.h'
29 INCLUDE 'cgnswin_f.h'
430 #endif
5 USE CGNS
6 implicit none
7
8 ! author: Diane Poirier (diane@icemcfd.com)
9 ! last revised on March 8 2000
10
11 ! This example test the complete SIDS for multi-block data.
12 ! It creates a dummy mesh composed of 2 structured blocks in 3D.
13
14 integer Ndim
15 parameter (Ndim = 3)
16 INTEGER :: one
17 parameter (one = 1)
18
19 INTEGER :: index_dim, cell_dim, phys_dim
20 integer :: base_no, zone_no, coord_no, sol_no, discr_no, conn_no
21 INTEGER :: hole_no, boco_no, field_no, dset_no
22 INTEGER :: num, NormalIndex(Ndim)
23 INTEGER :: ndims
24 INTEGER(cgsize_t) :: size(Ndim*3)
25 INTEGER(cgsize_t) :: npnts
26 INTEGER :: zone, coord, i, j, k, n, pos, sol, field
27 integer cg, ier
28 INTEGER(CGSIZE_T) :: pnts(Ndim,120), donor_pnts(Ndim,120)
29 integer transform(Ndim)
30 INTEGER :: nptsets, nrmlistflag
31 real*4 data(120), normals(360)
32 double precision Dxyz(120), values(120)
33 character*32 zonename, solname, fieldname
34 character*32 coordname(Ndim)
35 character*32 donorname
36
37 coordname(1) = 'CoordinateX'
38 coordname(2) = 'CoordinateY'
39 coordname(3) = 'CoordinateZ'
31 USE CGNS
32 USE ISO_C_BINDING
33 USE callback
34 IMPLICIT NONE
35
36 ! author: Diane Poirier (diane@icemcfd.com)
37
38 ! This example test the complete SIDS for multi-block data.
39 ! It creates a dummy mesh composed of 2 structured blocks in 3D.
40 ! It also tests the cg_configure_f API.
41
42 INTEGER Ndim
43 PARAMETER (Ndim = 3)
44 INTEGER :: one
45 PARAMETER (one = 1)
46 INTEGER, PARAMETER :: sp = KIND(1.0)
47
48 INTEGER :: index_dim, cell_dim, phys_dim
49 INTEGER :: base_no, zone_no, coord_no, sol_no, discr_no, conn_no
50 INTEGER :: hole_no, boco_no, field_no, dset_no
51 INTEGER :: num, NormalIndex(Ndim)
52 INTEGER :: ndims
53 INTEGER(CGSIZE_T) :: size(Ndim*3)
54 INTEGER(CGSIZE_T) :: npnts
55 INTEGER :: zone, coord, i, j, k, n, pos, sol, field
56 INTEGER cg, ier
57 INTEGER(CGSIZE_T) :: pnts(Ndim,120), donor_pnts(Ndim,120)
58 INTEGER transform(Ndim)
59 INTEGER :: nptsets, nrmlistflag
60 REAL(KIND=sp) DATA(120), normals(360)
61 DOUBLE PRECISION Dxyz(120), values(120)
62 CHARACTER(LEN=32) zonename, solname, fieldname
63 CHARACTER(LEN=32) coordname(Ndim)
64 CHARACTER(LEN=32) donorname
65
66 INTEGER, TARGET :: value_f
67 INTEGER(C_SIZE_T), TARGET :: value_size_t_f
68 CHARACTER(LEN=32), TARGET :: path
69
70 coordname(1) = 'CoordinateX'
71 coordname(2) = 'CoordinateY'
72 coordname(3) = 'CoordinateZ'
4073
4174 ! *** initialize
42 ier = 0
43 index_dim=Ndim
44 cell_dim=Ndim
45 phys_dim=Ndim
46
47 ! *** open CGNS file for writing
48 call cg_open_f('cgtest.cgns', CG_MODE_WRITE, cg, ier)
49 if (ier .eq. ERROR) call cg_error_exit_f
50
51 ! *** base
52 call cg_base_write_f(cg, 'Basename', cell_dim, phys_dim, &
53 & base_no, ier)
54 if (ier .eq. ERROR) call cg_error_exit_f
75 ier = 0
76 index_dim=Ndim
77 cell_dim=Ndim
78 phys_dim=Ndim
79
80 ! *** open CGNS file for writing
81 CALL cg_open_f('cgtest.cgns', CG_MODE_WRITE, cg, ier)
82 IF (ier .EQ. ERROR) CALL cg_error_exit_f
83
84 ! *** base
85 CALL cg_base_write_f(cg, 'Basename', cell_dim, phys_dim, base_no, ier)
86 IF (ier .EQ. ERROR) CALL cg_error_exit_f
5587
5688 ! *** zone
57 do zone=1, 2
58 write(zonename,'(a5,i1)') 'zone#',zone
59 num = 1
60 do i=1,index_dim ! zone#1: 3*4*5, zone#2: 4*5*6
61 size(i) = i+zone+1 ! nr of nodes in i,j,k
62 size(i+Ndim) = size(i)-1 ! nr of elements in i,j,k
63 size(i+2*Ndim) = 0 ! nr of bnd nodes if ordered
64 num = num * size(i) ! nr of nodes
65 enddo
66 !234567890!234567890!234567890!234567890!234567890!234567890!23456789012
67 call cg_zone_write_f(cg, base_no, zonename, size, &
68 & Structured, zone_no, ier)
69 if (ier .eq. ERROR) call cg_error_exit_f
70
71 ! *** coordinate
72 do coord=1, phys_dim
73 do k=1, size(3)
74 do j=1, size(2)
75 do i=1, size(1)
76 pos = i + (j-1)*size(1) + (k-1)*size(1)*size(2)
77 ! * make up some dummy coordinates just for the test:
78 if (coord.eq.1) Dxyz(pos) = i
79 if (coord.eq.2) Dxyz(pos) = j
80 if (coord.eq.3) Dxyz(pos) = k
81 enddo
82 enddo
83 enddo
84
85 call cg_coord_write_f(cg, base_no, zone_no, RealDouble, &
86 & coordname(coord), Dxyz, coord_no, ier)
87 if (ier .eq. ERROR) call cg_error_exit_f
88
89 enddo
90
91 ! *** solution
92 do sol=1, 2
93 write(solname,'(a5,i1,a5,i1)') 'Zone#',zone,' sol#',sol
94 call cg_sol_write_f(cg, base_no, zone_no, solname, &
95 & Vertex, sol_no, ier)
96 if (ier .eq. ERROR) call cg_error_exit_f
97
98 ! *** solution field
99 do field=1, 2
100 ! make up some dummy solution values
101 do i=1, num
102 values(i) = i*field*sol
103 enddo
104 write(fieldname,'(a6,i1)') 'Field#',field
105 call cg_field_write_f(cg, base_no, zone_no, sol_no, &
106 & RealDouble, fieldname, values, field_no, ier)
107 if (ier .eq. ERROR) call cg_error_exit_f
108
109 enddo ! field loop
110 enddo ! solution loop
111
112 ! *** discrete data
113 call cg_discrete_write_f(cg, base_no, zone_no, 'discrete#1',&
114 & discr_no, ier)
115 if (ier .eq. ERROR) call cg_error_exit_f
116
117 ! *** discrete data arrays, defined on vertices:
118 call cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
119 & 'DiscreteData_t', discr_no, 'end')
120 if (ier .eq. ERROR) call cg_error_exit_f
121
122 do 123 k=1, size(3)
123 do 123 j=1, size(2)
124 do 123 i=1, size(1)
125 pos = i + (j-1)*size(1) + (k-1)*size(1)*size(2)
126 data(pos) = pos ! * make up some dummy data
127 123 continue
128 call cg_array_write_f('arrayname', RealSingle, index_dim, &
129 & size, data, ier)
130 if (ier .eq. ERROR) call cg_error_exit_f
131
132 ! *** discrete data arrays attribute: GOTO DataArray node
133 call cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
134 & 'DiscreteData_t', discr_no, 'DataArray_t', 1, 'end')
135 if (ier .eq. ERROR) call cg_error_exit_f
136
137 call cg_units_write_f(Kilogram, Meter, Second, Kelvin, &
138 & Radian, ier)
139 if (ier .eq. ERROR) call cg_error_exit_f
140
141 ! *** overset holes
142 ! create dummy data
143 do i=1,3
144 ! Define 2 separate PointRange, for 2 patches in the hole
145 pnts(i,1)=1
146 pnts(i,2)=size(i)
147 ! second PointRange of hole
148 pnts(i,3)=2
149 pnts(i,4)=size(i)
150 enddo
151 ! Hole defined with 2 point set type PointRange, so 4 points:
152 nptsets = 2
153 npnts = 4
154 call cg_hole_write_f(cg, base_no, zone_no, 'hole#1', Vertex,&
155 & PointRange, nptsets, npnts, pnts, &
156 & hole_no, ier)
157 if (ier .eq. ERROR) call cg_error_exit_f
89 DO zone=1, 2
90 WRITE(zonename,'(a5,i1)') 'zone#',zone
91 num = 1
92 DO i=1,index_dim ! zone#1: 3*4*5, zone#2: 4*5*6
93 size(i) = i+zone+1 ! nr of nodes in i,j,k
94 size(i+Ndim) = size(i)-1 ! nr of elements in i,j,k
95 size(i+2*Ndim) = 0 ! nr of bnd nodes if ordered
96 num = num * size(i) ! nr of nodes
97 ENDDO
98 CALL cg_zone_write_f(cg, base_no, zonename, size, &
99 Structured, zone_no, ier)
100 IF (ier .EQ. ERROR) CALL cg_error_exit_f
101
102 ! *** coordinate
103 DO coord=1, phys_dim
104 DO k=1, SIZE(3)
105 DO j=1, SIZE(2)
106 DO i=1, SIZE(1)
107 pos = i + (j-1)*SIZE(1) + (k-1)*SIZE(1)*SIZE(2)
108 ! * make up some dummy coordinates just for the test:
109 IF (coord.EQ.1) Dxyz(pos) = i
110 IF (coord.EQ.2) Dxyz(pos) = j
111 IF (coord.EQ.3) Dxyz(pos) = k
112 ENDDO
113 ENDDO
114 ENDDO
115
116 CALL cg_coord_write_f(cg, base_no, zone_no, RealDouble, &
117 coordname(coord), Dxyz, coord_no, ier)
118 IF (ier .EQ. ERROR) CALL cg_error_exit_f
119
120 ENDDO
121
122 ! *** solution
123 DO sol=1, 2
124 WRITE(solname,'(a5,i1,a5,i1)') 'Zone#',zone,' sol#',sol
125 CALL cg_sol_write_f(cg, base_no, zone_no, solname, &
126 Vertex, sol_no, ier)
127 IF (ier .EQ. ERROR) CALL cg_error_exit_f
128
129 ! *** solution field
130 DO field=1, 2
131 ! make up some dummy solution values
132 DO i=1, num
133 values(i) = i*field*sol
134 ENDDO
135 WRITE(fieldname,'(a6,i1)') 'Field#',field
136 CALL cg_field_write_f(cg, base_no, zone_no, sol_no, &
137 RealDouble, fieldname, values, field_no, ier)
138 IF (ier .EQ. ERROR) CALL cg_error_exit_f
139
140 ENDDO ! field loop
141 ENDDO ! solution loop
142
143 ! *** discrete data
144 CALL cg_discrete_write_f(cg, base_no, zone_no, 'discrete#1', &
145 discr_no, ier)
146 IF (ier .EQ. ERROR) CALL cg_error_exit_f
147
148 ! *** discrete data arrays, defined on vertices:
149 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
150 'DiscreteData_t', discr_no, 'end')
151 IF (ier .EQ. ERROR) CALL cg_error_exit_f
152
153 DO k=1, SIZE(3)
154 DO j=1, SIZE(2)
155 DO i=1, SIZE(1)
156 pos = i + (j-1)*SIZE(1) + (k-1)*SIZE(1)*SIZE(2)
157 DATA(pos) = pos ! * make up some dummy data
158 ENDDO
159 ENDDO
160 ENDDO
161 CALL cg_array_write_f('arrayname', RealSingle, index_dim, &
162 size, DATA, ier)
163 IF (ier .EQ. ERROR) CALL cg_error_exit_f
164
165 ! *** discrete data arrays attribute: GOTO DataArray node
166 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
167 'DiscreteData_t', discr_no, 'DataArray_t', 1, 'end')
168 IF (ier .EQ. ERROR) CALL cg_error_exit_f
169
170 CALL cg_units_write_f(Kilogram, Meter, Second, Kelvin, &
171 Radian, ier)
172 IF (ier .EQ. ERROR) CALL cg_error_exit_f
173
174 ! *** overset holes
175 ! create dummy data
176 DO i=1,3
177 ! Define 2 separate PointRange, for 2 patches in the hole
178 pnts(i,1)=1
179 pnts(i,2)=SIZE(i)
180 ! second PointRange of hole
181 pnts(i,3)=2
182 pnts(i,4)=SIZE(i)
183 ENDDO
184 ! Hole defined with 2 point set type PointRange, so 4 points:
185 nptsets = 2
186 npnts = 4
187 CALL cg_hole_write_f(cg, base_no, zone_no, 'hole#1', Vertex,&
188 PointRange, nptsets, npnts, pnts, hole_no, ier)
189 IF (ier .EQ. ERROR) CALL cg_error_exit_f
158190
159191 ! *** general connectivity
160 do 100 n=1, 5
161 do 100 i=1,3
162 pnts(i,n)=i ! * dummy data
163 donor_pnts(i,n)=i*2
164 100 continue
165 ! create a point matching connectivity
166 npnts = 5
167 call cg_conn_write_f(cg, base_no, zone_no, 'Connect#1', &
168 & Vertex, Abutting1to1, PointList, npnts, pnts, 'zone#2', &
169 & Structured, PointListDonor, Integer, npnts, donor_pnts, &
170 & conn_no, ier)
171 if (ier .eq. ERROR) call cg_error_exit_f
192 DO n=1, 5
193 DO i=1,3
194 pnts(i,n)=i ! * dummy data
195 donor_pnts(i,n)=i*2
196 ENDDO
197 ENDDO
198 ! create a point matching connectivity
199 npnts = 5
200 CALL cg_conn_write_f(cg, base_no, zone_no, 'Connect#1', &
201 Vertex, Abutting1to1, PointList, npnts, pnts, 'zone#2', &
202 Structured, PointListDonor, INTEGER, npnts, donor_pnts, conn_no, ier)
203 IF (ier .EQ. ERROR) CALL cg_error_exit_f
172204
173205 ! *** connectivity 1to1
174 ! generate data
175 do i=1,3
176 !**make up some dummy data:
177 pnts(i,1)=1
178 pnts(i,2)=size(i)
179 donor_pnts(i,1)=1
180 donor_pnts(i,2)=size(i)
181 transform(i)=i*(-1)
182 enddo
183 if (zone .eq. 1) then
184 donorname='zone#2'
185 else if (zone .eq. 2) then
186 donorname='zone#1'
187 endif
188
189 call cg_1to1_write_f(cg, base_no, zone_no, '1to1_#1', &
190 & donorname, pnts, donor_pnts, transform, conn_no, ier)
191 if (ier .eq. ERROR) call cg_error_exit_f
192 ! *** ZoneGridConnectivity attributes: GOTO ZoneGridConnectivity_t node
193 call cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
194 & 'ZoneGridConnectivity_t', one, 'end')
195 if (ier .eq. ERROR) call cg_error_exit_f
196
197 ! *** ZoneGridConnectivity attributes: Descriptor_t
198 !234567890!234567890!234567890!234567890!234567890!234567890!23456789012
199 call cg_descriptor_write_f('DescriptorName', &
200 & 'Zone Connectivity', ier)
201
202 ! *** bocos
203 npnts = 2
204 call cg_boco_write_f(cg, base_no, zone_no, 'boco#1', &
205 & BCInflow, PointRange, npnts, pnts, boco_no, ier)
206 if (ier .eq. ERROR) call cg_error_exit_f
207
208 ! *** boco normal
209 npnts = 1
210 do i=1,Ndim
211 NormalIndex(i)=0
212 ! compute nr of points on bc patch:
213 npnts = npnts * (pnts(i,2)-pnts(i,1)+1)
214 enddo
215 NormalIndex(1)=1
216 do i=1,phys_dim*npnts
217 normals(i)=i
218 enddo
219
220 nrmlistflag = 1
221 call cg_boco_normal_write_f(cg, base_no, zone_no, boco_no, &
222 & NormalIndex, nrmlistflag, RealSingle, normals, ier)
223 if (ier .eq. ERROR) call cg_error_exit_f
224
225 ! ** boundary condition attributes: GOTO BC_t node
226 call cg_goto_f(cg, base_no, ier, 'Zone_t', zone, 'ZoneBC_t',&
227 & one, 'BC_t', boco_no, 'end')
228 if (ier .eq. ERROR) call cg_error_exit_f
229
230 ! ** boundary condition attributes: GridLocation_t
231 call cg_gridlocation_write_f(Vertex, ier)
232 if (ier .eq. ERROR) call cg_error_exit_f
233
234 ! ** boundary condition dataset
235 call cg_dataset_write_f(cg, base_no, zone, &
236 & boco_no, 'DataSetName', BCInflow, dset_no, ier)
237 if (ier .eq. ERROR) call cg_error_exit_f
238
239 ! ** boundary condition data:
240 call cg_bcdata_write_f(cg, base_no, zone, &
241 & boco_no, dset_no, Neumann, ier)
242 if (ier .eq. ERROR) call cg_error_exit_f
206 ! generate data
207 DO i=1,3
208 !**make up some dummy data:
209 pnts(i,1)=1
210 pnts(i,2)=SIZE(i)
211 donor_pnts(i,1)=1
212 donor_pnts(i,2)=SIZE(i)
213 transform(i)=i*(-1)
214 ENDDO
215 IF (zone .EQ. 1) THEN
216 donorname='zone#2'
217 ELSE IF (zone .EQ. 2) THEN
218 donorname='zone#1'
219 ENDIF
220
221 CALL cg_1to1_write_f(cg, base_no, zone_no, '1to1_#1', &
222 donorname, pnts, donor_pnts, transform, conn_no, ier)
223 IF (ier .EQ. ERROR) CALL cg_error_exit_f
224 ! *** ZoneGridConnectivity attributes: GOTO ZoneGridConnectivity_t node
225 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone, &
226 'ZoneGridConnectivity_t', one, 'end')
227 IF (ier .EQ. ERROR) CALL cg_error_exit_f
228
229 ! *** ZoneGridConnectivity attributes: Descriptor_t
230 CALL cg_descriptor_write_f('DescriptorName', &
231 'Zone Connectivity', ier)
232
233 ! *** bocos
234 npnts = 2
235 CALL cg_boco_write_f(cg, base_no, zone_no, 'boco#1', &
236 BCInflow, PointRange, npnts, pnts, boco_no, ier)
237 IF (ier .EQ. ERROR) CALL cg_error_exit_f
238
239 ! *** boco normal
240 npnts = 1
241 DO i=1,Ndim
242 NormalIndex(i)=0
243 ! compute nr of points on bc patch:
244 npnts = npnts * (pnts(i,2)-pnts(i,1)+1)
245 ENDDO
246 NormalIndex(1)=1
247 DO i=1,phys_dim*npnts
248 normals(i)=i
249 ENDDO
250
251 nrmlistflag = 1
252 CALL cg_boco_normal_write_f(cg, base_no, zone_no, boco_no, &
253 NormalIndex, nrmlistflag, RealSingle, normals, ier)
254 IF (ier .EQ. ERROR) CALL cg_error_exit_f
255
256 ! ** boundary condition attributes: GOTO BC_t node
257 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone, 'ZoneBC_t', &
258 one, 'BC_t', boco_no, 'end')
259 IF (ier .EQ. ERROR) CALL cg_error_exit_f
260
261 ! ** boundary condition attributes: GridLocation_t
262 CALL cg_gridlocation_write_f(Vertex, ier)
263 IF (ier .EQ. ERROR) CALL cg_error_exit_f
264
265 ! ** boundary condition dataset
266 CALL cg_dataset_write_f(cg, base_no, zone, &
267 boco_no, 'DataSetName', BCInflow, dset_no, ier)
268 IF (ier .EQ. ERROR) CALL cg_error_exit_f
269
270 ! ** boundary condition data:
271 CALL cg_bcdata_write_f(cg, base_no, zone, &
272 boco_no, dset_no, Neumann, ier)
273 IF (ier .EQ. ERROR) CALL cg_error_exit_f
243274
244275 ! ** boundary condition data arrays: GOTO BCData_t node
245 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone_no, &
246 & 'ZoneBC_t', one, 'BC_t', boco_no, 'BCDataSet_t', &
247 & dset_no, 'BCData_t', Neumann, 'end')
248 if (ier .eq. ERROR) call cg_error_exit_f
249
250 do i=1, npnts
251 data(i) = i
252 enddo
253 ndims = 1
254 call cg_array_write_f('dataset_arrayname', RealSingle, &
255 & ndims, npnts, data, ier)
256 if (ier .eq. ERROR) call cg_error_exit_f
276 CALL cg_goto_f(cg, base_no, ier, 'Zone_t', zone_no, &
277 'ZoneBC_t', one, 'BC_t', boco_no, 'BCDataSet_t', &
278 dset_no, 'BCData_t', Neumann, 'end')
279 IF (ier .EQ. ERROR) CALL cg_error_exit_f
280
281 DO i=1, npnts
282 DATA(i) = i
283 ENDDO
284 ndims = 1
285 CALL cg_array_write_f('dataset_arrayname', RealSingle, &
286 ndims, [npnts], DATA, ier)
287 IF (ier .EQ. ERROR) CALL cg_error_exit_f
257288
258289 ! ** boundary condition data attributes:
259 call cg_dataclass_write_f(NormalizedByDimensional, ier)
260 if (ier .eq. ERROR) call cg_error_exit_f
261
262 enddo ! zone loop
263
264 ! *** close CGNS file
265 call cg_close_f(cg, ier)
266 if (ier .eq. ERROR) call cg_error_exit_f
267
268 end
290 CALL cg_dataclass_write_f(NormalizedByDimensional, ier)
291 IF (ier .EQ. ERROR) CALL cg_error_exit_f
292
293 ENDDO ! zone loop
294
295 ! *** close CGNS file
296 CALL cg_close_f(cg, ier)
297 IF (ier .EQ. ERROR) CALL cg_error_exit_f
298
299 #if CG_BUILD_HDF5
300 ! Disable with gfortran, GCC Bugzilla - Bug 99982
301 #ifndef __GFORTRAN__
302 ! **************************
303 ! Test cg_configure options
304 ! **************************
305 value_f = 1
306 CALL cg_configure_f(CG_CONFIG_HDF5_DISKLESS, C_LOC(value_f), ier)
307 IF (ier .EQ. ERROR) CALL cg_error_exit_f
308
309 ! enable committing memory to disk
310 value_f = 1
311 CALL cg_configure_f(CG_CONFIG_HDF5_DISKLESS_WRITE, C_LOC(value_f), ier)
312 IF (ier .EQ. ERROR) CALL cg_error_exit_f
313 value_size_t_f = INT(20*1024*1024,C_SIZE_T)
314 CALL cg_configure_f(CG_CONFIG_HDF5_DISKLESS_INCR, C_LOC(value_size_t_f), ier)
315 IF (ier .EQ. ERROR) CALL cg_error_exit_f
316
317 CALL cg_open_f('cgtest_core.cgns', CG_MODE_WRITE, cg, ier)
318 IF (ier .EQ. ERROR) CALL cg_error_exit_f
319
320 ! *** base
321 CALL cg_base_write_f(cg, 'Basename', cell_dim, phys_dim, base_no, ier)
322 IF (ier .EQ. ERROR) CALL cg_error_exit_f
323
324 CALL cg_close_f(cg, ier)
325 IF (ier .EQ. ERROR) CALL cg_error_exit_f
326
327 value_f = 0
328 CALL cg_configure_f(CG_CONFIG_HDF5_DISKLESS, C_LOC(value_f), ier)
329 IF (ier .EQ. ERROR) CALL cg_error_exit_f
330
331 value_f = CG_FILE_ADF2
332 value_f = CG_FILE_ADF
333 CALL cg_configure_f(CG_CONFIG_FILE_TYPE, C_LOC(value_f), ier)
334 IF (ier .EQ. ERROR) CALL cg_error_exit_f
335 value_f = CG_FILE_HDF5
336 CALL cg_configure_f(CG_CONFIG_FILE_TYPE, C_LOC(value_f), ier)
337 IF (ier .EQ. ERROR) CALL cg_error_exit_f
338 value_f = -1
339 CALL cg_configure_f(CG_CONFIG_HDF5_COMPRESS, C_LOC(value_f), ier)
340 IF (ier .EQ. ERROR) CALL cg_error_exit_f
341 value_f = -1
342 CALL cg_configure_f(CG_CONFIG_COMPRESS, C_LOC(value_f), ier)
343 IF (ier .EQ. ERROR) CALL cg_error_exit_f
344 value_f = CG_CONFIG_RIND_ZERO
345
346 CALL cg_configure_f(CG_CONFIG_RIND_INDEX, C_LOC(value_f), ier)
347 IF (ier .EQ. ERROR) CALL cg_error_exit_f
348 value_f = CG_CONFIG_RIND_CORE
349 CALL cg_configure_f(CG_CONFIG_RIND_INDEX, C_LOC(value_f), ier)
350 IF (ier .EQ. ERROR) CALL cg_error_exit_f
351
352 path = "/test/a/b"//C_NULL_CHAR
353 CALL cg_configure_f(CG_CONFIG_SET_PATH, C_LOC(path(1:1)), ier)
354 IF (ier .EQ. ERROR) CALL cg_error_exit_f
355
356 path = "/test/c/d"//C_NULL_CHAR
357 CALL cg_configure_f(CG_CONFIG_ADD_PATH, C_LOC(path(1:1)), ier)
358
359 path = C_NULL_CHAR
360 CALL cg_configure_f(CG_CONFIG_SET_PATH, C_LOC(path(1:1)), ier)
361 IF (ier .EQ. ERROR) CALL cg_error_exit_f
362 CALL cg_configure_f(CG_CONFIG_ERROR, c_funloc(error_exit), ier)
363 IF (ier .EQ. ERROR) CALL cg_error_exit_f
364
365 value_f = 100 ! Trigger an error
366 CALL cg_configure_f(CG_CONFIG_FILE_TYPE, C_LOC(value_f), ier)
367 IF (ier .NE. ERROR) CALL cg_error_exit_f
368 #endif
369 #endif
370
371 END PROGRAM write_cgns_1
44 #endif
55 USE CGNS
66 IMPLICIT NONE
7
8 INTEGER, PARAMETER :: sp = KIND(1.0)
79
810 INTEGER ierr, cgfile, cgbase, cgzone, cgcoord, cgconn
911 INTEGER dim
1618 INTEGER(cgsize_t) npts
1719 INTEGER(cgenum_t) loc, type, ptype, dztype, dptype, ddtype
1820 INTEGER(cgsize_t) dnpts
19 real*4 x(125), y(125), z(125), exp(5)
20 character*32 zname, dname, cname
21 real(kind=sp) x(125), y(125), z(125), exp(5)
22 character(len=32) zname, dname, cname
2123
2224 ! open and write base
2325 dim = 3
1212 }
1313 if (argc > 2) {
1414 mode = CG_MODE_MODIFY;
15 cg_configure (CG_CONFIG_COMPRESS, (void *)1);
15 if (cg_configure (CG_CONFIG_COMPRESS, (void *)1))
16 cg_error_exit();
1617 }
1718
1819 printf ("opening cgns file <%s> ...", argv[argc-1]);
44 #endif
55 USE CGNS
66 implicit none
7
7 INTEGER, PARAMETER :: sp = KIND(1.0)
8 INTEGER, PARAMETER :: dp = KIND(1.d0)
9
810 integer, parameter :: celldim = 3, physdim = 3
911 integer, parameter :: NUM_SIDE = 5
1012
11 real*4, dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: coord
12 real*8, dimension(3, 2) :: bbox
13 real(kind=sp), dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: coord
14 real(kind=dp), dimension(3, 2) :: bbox
1315
1416 integer :: n
1517 integer :: ierr
1618 integer :: cgfile, cgbase, cgzone, cgcoord
1719 integer(cgsize_t) :: size(9)
1820
19 character*32 fname
21 character(len=32) fname
2022 fname = 'boundingbox_f90.cgns'
2123
2224 do n=1,NUM_SIDE*NUM_SIDE*NUM_SIDE
0 #include <stdio.h>
1 #include <stdlib.h>
2 #include <string.h>
3 #include <math.h>
4 #include <complex.h>
5 #undef I
6 #if defined(_MSC_VER)
7 #define cg_complex_float _Fcomplex
8 #define cg_complex_double _Dcomplex
9 #define __real__(c) c._Val[0]
10 #define __imag__(c) c._Val[1]
11 #else
12 #define cg_complex_float float _Complex
13 #define cg_complex_double double _Complex
14 #endif
15
16 #if defined(_WIN32) && !defined(__NUTC__)
17 # include <io.h>
18 # define unlink _unlink
19 #else
20 # include <unistd.h>
21 #endif
22 #include "cgnslib.h"
23
24 #ifndef CGNSTYPES_H
25 # define cgsize_t int
26 #endif
27 #ifndef CGNS_ENUMT
28 # define CGNS_ENUMT(e) e
29 # define CGNS_ENUMV(e) e
30 #endif
31
32 /* from cgns_internal: so we can reset expected error messages */
33 void cgi_error(const char *format, ...);
34
35 int CellDim = 3, PhyDim = 3;
36
37 int cgfile, cgbase, cgzone;
38 cgsize_t size[9];
39
40 #define NUM_SIDE 5
41 #define NODE_INDEX(I,J,K) ((I)+NUM_SIDE*(((J)-1)+NUM_SIDE*((K)-1)))
42 #define CELL_INDEX(I,J,K) ((I)+(NUM_SIDE-1)*(((J)-1)+(NUM_SIDE-1)*((K)-1)))
43
44 int num_coord;
45 float *xcoord, *ycoord, *zcoord;
46
47 cg_complex_float *var_fourier_1;
48 cg_complex_double *var_fourier_2;
49
50 char errmsg[256];
51
52 static float exponents[5] = {0, 1, 0, 0, 0};
53
54 void init_data();
55 void write_structured();
56 void test_complex_solution();
57 void release_data();
58
59 void error_exit (char *where)
60 {
61 fprintf (stderr, "ERROR:%s:%s\n", where, cg_get_error());
62 exit (1);
63 }
64
65 #if CG_BUILD_COMPLEX_C99_EXT
66 int main (int argc, char *argv[])
67 {
68
69 char outfile[32];
70 int nbases, nzones;
71
72 strcpy (outfile, "complex_data.cgns");
73 if (argc > 1) {
74 int type = 0;
75 int n = 0;
76 if (argv[1][n] == '-') n++;
77 if (argv[1][n] == 'a' || argv[1][n] == 'A' || argv[1][n] == '1') {
78 if (NULL != strchr(argv[1], '2'))
79 type = CG_FILE_ADF2;
80 else
81 type = CG_FILE_ADF;
82 }
83 else if (argv[1][n] == 'h' || argv[1][n] == 'H' || argv[1][n] == '2') {
84 type = CG_FILE_HDF5;
85 }
86 else if (argv[1][n] == '3') {
87 type = CG_FILE_ADF2;
88 }
89 else {
90 fprintf(stderr, "unknown option\n");
91 exit (1);
92 }
93 if (cg_set_file_type(type))
94 error_exit("cg_set_file_type");
95 }
96
97 init_data();
98 unlink(outfile);
99 if (cg_open(outfile, CG_MODE_WRITE, &cgfile)) error_exit("cg_open");
100 write_structured();
101 if (cg_close(cgfile)) error_exit("cg_close");
102
103 if (cg_open(outfile, CG_MODE_READ, &cgfile)) error_exit("cg_open");
104 if (cg_nbases(cgfile, &nbases)) error_exit("cg_nbases");
105 for (cgbase = 1; cgbase <= nbases; cgbase++) {
106 if (cg_nzones(cgfile, cgbase, &nzones)) error_exit("cg_nzones");
107 for (cgzone = 1; cgzone <= nzones; cgzone++) {
108 test_complex_solution();
109 }
110 }
111 if (cg_close(cgfile)) error_exit("cg_close");
112
113 return 0;
114 }
115
116 void init_data()
117 {
118 int n, i, j, k;
119
120 /* compute coordinates - make it twice as big for use with cylindrical */
121
122 num_coord = NUM_SIDE * NUM_SIDE * NUM_SIDE;
123 xcoord = (float *) malloc (3 * num_coord * sizeof(float));
124 if (NULL == xcoord) {
125 fprintf(stderr, "malloc failed for coordinates\n");
126 exit(1);
127 }
128 ycoord = xcoord + num_coord;
129 zcoord = ycoord + num_coord;
130 for (n = 0, k = 0; k < NUM_SIDE; k++) {
131 for (j = 0; j < NUM_SIDE; j++) {
132 for (i = 0; i < NUM_SIDE; i++, n++) {
133 xcoord[n] = (float)i;
134 ycoord[n] = (float)j;
135 zcoord[n] = (float)k;
136 }
137 }
138 }
139
140 /* compute solution values */
141 var_fourier_1 = (cg_complex_float *) malloc(num_coord * sizeof(cg_complex_float));
142 if (NULL == var_fourier_1) {
143 fprintf(stderr, "malloc failed for solution data\n");
144 exit(1);
145 }
146 var_fourier_2 = (cg_complex_double *) malloc(num_coord * sizeof(cg_complex_double));
147 if (NULL == var_fourier_2) {
148 fprintf(stderr, "malloc failed for solution data\n");
149 exit(1);
150 }
151
152 for (n = 0, k = 0; k < NUM_SIDE; k++) {
153 for (j = 0; j < NUM_SIDE; j++) {
154 for (i = 0; i < NUM_SIDE; i++, n++) {
155 __real__(var_fourier_1[n]) = ((float)i);
156 __imag__(var_fourier_1[n]) = ((float)j);
157 __real__(var_fourier_2[n]) = ((float)j);
158 __imag__(var_fourier_2[n]) = ((float)k);
159 }
160 }
161 }
162 }
163
164 void release_data(){
165 if (xcoord != NULL)
166 free(xcoord);
167 if (var_fourier_1 != NULL)
168 free(var_fourier_1);
169 if (var_fourier_2 != NULL)
170 free(var_fourier_2);
171 }
172
173 void write_coords(int nz)
174 {
175 int k, nn, n, nij, koff, cgcoord;
176
177 koff = nz == 1 ? 1 - NUM_SIDE : 0;
178 nij = NUM_SIDE * NUM_SIDE;
179 for (n = 0, k = 0; k < NUM_SIDE; k++) {
180 for (nn = 0; nn < nij; nn++)
181 zcoord[n++] = (float)(k + koff);
182 }
183
184 if (cg_coord_write(cgfile, cgbase, nz, CGNS_ENUMV(RealSingle),
185 "CoordinateX", xcoord, &cgcoord) ||
186 cg_coord_write(cgfile, cgbase, nz, CGNS_ENUMV(RealSingle),
187 "CoordinateY", ycoord, &cgcoord) ||
188 cg_coord_write(cgfile, cgbase, nz, CGNS_ENUMV(RealSingle),
189 "CoordinateZ", zcoord, &cgcoord)) {
190 sprintf (errmsg, "zone %d coordinates", nz);
191 error_exit(errmsg);
192 }
193 for (n = 1; n <= 3; n++) {
194 if (cg_goto(cgfile, cgbase, "Zone_t", nz, "GridCoordinates_t", 1,
195 "DataArray_t", n, NULL) ||
196 cg_exponents_write(CGNS_ENUMV(RealSingle), exponents))
197 error_exit("coordinate exponents");
198 }
199 }
200
201 void write_solution(int nz)
202 {
203 int cgfld, cgsol;
204 cgsize_t dims[3] = {NUM_SIDE, NUM_SIDE, NUM_SIDE};
205
206 if (cg_sol_write(cgfile, cgbase, nz, "Solution", CGNS_ENUMV(Vertex), &cgsol) ||
207 cg_field_write(cgfile, cgbase, nz, cgsol, CGNS_ENUMV(ComplexSingle), "Pressure", var_fourier_1, &cgfld) ||
208 cg_field_write(cgfile, cgbase, nz, cgsol, CGNS_ENUMV(ComplexDouble), "Velocity", var_fourier_2, &cgfld)) {
209 sprintf (errmsg, "zone %d Complex solution", nz);
210 error_exit(errmsg);
211 }
212
213 if (cg_goto(cgfile, cgbase, "Zone_t", nz, "FlowSolution_t", 1,"end") ||
214 cg_array_write("Density", CGNS_ENUMV(ComplexDouble), 3, dims, var_fourier_2)){
215 sprintf (errmsg, "Complex array write failed in zone %d", nz);
216 error_exit(errmsg);
217 }
218 }
219
220 /*------------------------------------------------------------------------
221 * structured grid
222 *------------------------------------------------------------------------*/
223
224 void write_structured()
225 {
226 int n;
227 char name[33];
228
229 if (cg_base_write(cgfile, "Structured", CellDim, PhyDim, &cgbase) ||
230 cg_goto(cgfile, cgbase, "end") ||
231 cg_descriptor_write("Descriptor", "Multi-block Structured Grid") ||
232 cg_dataclass_write(CGNS_ENUMV(Dimensional)) ||
233 cg_units_write(CGNS_ENUMV(Kilogram), CGNS_ENUMV(Meter),
234 CGNS_ENUMV(Second), CGNS_ENUMV(Kelvin), CGNS_ENUMV(Radian)))
235 error_exit("structured base");
236
237 /* write zones */
238 for (n = 0; n < 3; n++) {
239 size[n] = NUM_SIDE;
240 size[n+3] = NUM_SIDE - 1;
241 size[n+6] = 0;
242 }
243 for (n = 1; n <= 2; n++) {
244 sprintf(name, "Zone%d", n);
245 if (cg_zone_write(cgfile, cgbase, name, size,
246 CGNS_ENUMV(Structured), &cgzone)) {
247 sprintf (errmsg, "structured zone %d", n);
248 error_exit(errmsg);
249 }
250 write_coords(n);
251 write_solution(n);
252 }
253 }
254
255 void test_complex_solution()
256 {
257 int cgsol=1;
258 int i,j,k,n;
259 cgsize_t rmin[3] = {1, 1, 1};
260 cgsize_t rmax[3] = {NUM_SIDE, NUM_SIDE, NUM_SIDE};
261
262 float *fbuf;
263 double *dbuf;
264 cg_complex_float *cfbuf;
265 cg_complex_double *cdbuf;
266
267 cfbuf = (cg_complex_float *) malloc(num_coord * sizeof(cg_complex_float));
268 cdbuf = (cg_complex_double *) malloc(num_coord * sizeof(cg_complex_double));
269 fbuf = (float *) malloc(num_coord * 2 * sizeof(float));
270 dbuf = (double *) malloc(num_coord * 2 * sizeof(double));
271
272
273 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(ComplexSingle), rmin, rmax, cfbuf))
274 error_exit("Error reading ComplexSingle data");
275
276 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(ComplexDouble), rmin, rmax, cdbuf))
277 error_exit("Error reading ComplexSingle data to ComplexDouble data");
278
279 /* This case should failed because we do not want to have Out Of Bounds access on fbuf */
280 if (!cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(RealSingle), rmin, rmax, fbuf)) {
281 printf("Error reading ComplexSingle data to real single data failed to report error\n");
282 exit(1);
283 }
284 cg_error_print();
285 cgi_error("no CGNS error reported"); /* reset */
286
287 /* This aliasing should work to garantee that complex float matches float[2] */
288 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(ComplexSingle), rmin, rmax, fbuf))
289 error_exit("Error reading ComplexSingle data to real single data");
290
291 /* This case should failed because we do not want to have Out Of Bounds access on dbuf */
292 if (!cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(RealDouble), rmin, rmax, dbuf)) {
293 printf("Error reading ComplexDouble data to real double data failed to report error\n");
294 exit(1);
295 }
296 cg_error_print();
297 cgi_error("no CGNS error reported"); /* reset */
298
299 /* This aliasing should work to garantee that complex double matches double[2] */
300 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Pressure", CGNS_ENUMV(ComplexDouble), rmin, rmax, dbuf))
301 error_exit("Error reading ComplexDouble data to real double data");
302
303 // Now check some values read !
304 for (n = 0, k = 0; k < NUM_SIDE; k++) {
305 for (j = 0; j < NUM_SIDE; j++) {
306 for (i = 0; i < NUM_SIDE; i++, n++) {
307 if ((crealf(var_fourier_1[n]) != crealf(cfbuf[n])) ||
308 (cimagf(var_fourier_1[n]) != cimagf(cfbuf[n]))) {
309 printf("%f + %f I != %f + %f I", crealf(var_fourier_1[n]), cimagf(var_fourier_1[n]),
310 crealf(cfbuf[n]), cimagf(cfbuf[n]));
311 error_exit("Read of complex single data failed\n");
312 }
313 if ((creal(cdbuf[n]) != (double)i) ||
314 (cimag(cdbuf[n]) != (double)j)) {
315 printf("%lf + %lf I != %lf + %lf I", (double)i, (double)j, creal(cdbuf[n]), cimag(cdbuf[n]));
316 error_exit("Read of complex single to complex double data failed\n");
317 }
318 if ((crealf(var_fourier_1[n]) != fbuf[2*n]) ||
319 (cimagf(var_fourier_1[n]) != fbuf[2*n+1])) {
320 error_exit("Read of complex single to aliased single array failed\n");
321 }
322 if (((double)crealf(var_fourier_1[n]) != dbuf[2*n]) ||
323 ((double)cimagf(var_fourier_1[n]) != dbuf[2*n+1])) {
324 error_exit("Read of complex single to double array failed\n");
325 }
326 }
327 }
328 }
329
330 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(ComplexSingle), rmin, rmax, cfbuf))
331 error_exit("Error reading ComplexDouble data to ComplexSingle data");
332
333 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(ComplexDouble), rmin, rmax, cdbuf))
334 error_exit("Error reading ComplexDouble data");
335
336 /* This case should failed because we do not want to have Out Of Bounds access on fbuf */
337 if (!cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(RealSingle), rmin, rmax, fbuf)) {
338 printf("Error reading ComplexDouble data to real single data failed to report error\n");
339 exit(1);
340 }
341 cg_error_print();
342 cgi_error("no CGNS error reported"); /* reset */
343
344 /* This aliasing should work to garantee that complex float matches float[2] */
345 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(ComplexSingle), rmin, rmax, fbuf))
346 error_exit("Error reading ComplexDouble data to real single data");
347
348 /* This case should failed because we do not want to have Out Of Bounds access on dbuf */
349 if (!cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(RealDouble), rmin, rmax, dbuf)) {
350 printf("Error reading ComplexDouble data to real double data failed to report error\n");
351 exit(1);
352 }
353 cg_error_print();
354 cgi_error("no CGNS error reported"); /* reset */
355
356 /* This aliasing should work to garantee that complex double matches double[2] */
357 if (cg_field_read(cgfile, cgbase, cgzone, cgsol, "Velocity", CGNS_ENUMV(ComplexDouble), rmin, rmax, dbuf))
358 error_exit("Error reading ComplexDouble data to real double data");
359
360 // Now check some values read !
361 for (n = 0, k = 0; k < NUM_SIDE; k++) {
362 for (j = 0; j < NUM_SIDE; j++) {
363 for (i = 0; i < NUM_SIDE; i++, n++) {
364 if ((creal(var_fourier_2[n]) != creal(cdbuf[n])) ||
365 (cimag(var_fourier_2[n]) != cimag(cdbuf[n]))) {
366 printf("%lf + %lf I != %lf + %lf I", creal(var_fourier_2[n]), cimag(var_fourier_2[n]),
367 creal(cdbuf[n]), cimag(cdbuf[n]));
368 error_exit("Read of complex double data failed\n");
369 }
370 if ((crealf(cfbuf[n]) != ((float)j)) ||
371 (cimagf(cfbuf[n]) != ((float)k))) {
372 printf("%f + %f I != %f + %f I", (float)j, (float)k, crealf(cfbuf[n]), cimagf(cfbuf[n]));
373 error_exit("Read of complex double to complex single data failed\n");
374 }
375 if ((creal(var_fourier_2[n]) != dbuf[2*n]) ||
376 (cimag(var_fourier_2[n]) != dbuf[2*n+1])) {
377 error_exit("Read of complex double to aliased double array failed\n");
378 }
379 if (((float)creal(var_fourier_2[n]) != fbuf[2*n]) ||
380 ((float)cimag(var_fourier_2[n]) != fbuf[2*n+1])) {
381 error_exit("Read of complex double to single array failed\n");
382 }
383 }
384 }
385 }
386
387 if (cg_gopath(cgfile, "/Structured/Zone1/Solution") ||
388 cg_array_general_read(3, rmin, rmax, CGNS_ENUMV(ComplexDouble),
389 3, rmax, rmin, rmax, cdbuf))
390 error_exit("Read of complex array failed");
391
392 for (n = 0, k = 0; k < NUM_SIDE; k++) {
393 for (j = 0; j < NUM_SIDE; j++) {
394 for (i = 0; i < NUM_SIDE; i++, n++) {
395 if ((creal(var_fourier_2[n]) != creal(cdbuf[n])) ||
396 (cimag(var_fourier_2[n]) != cimag(cdbuf[n]))) {
397 printf("%lf + %lf I != %lf + %lf I", creal(var_fourier_2[n]), cimag(var_fourier_2[n]),
398 creal(cdbuf[n]), cimag(cdbuf[n]));
399 error_exit("Read of complex double data failed\n");
400 }
401 }
402 }
403 }
404
405 free(dbuf);
406 free(fbuf);
407 free(cdbuf);
408 free(cfbuf);
409 }
410 #else
411 int main (int argc, char *argv[])
412 {
413 return 0;
414 }
415 #endif
0 program testcomplexf
1 #ifdef WINNT
2 include 'cgnswin_f.h'
3 #endif
4 USE CGNS
5 IMPLICIT NONE
6 #if CG_BUILD_COMPLEX_C99_EXT
7 INTEGER, PARAMETER :: dp = KIND(1.d0)
8
9 integer, parameter :: celldim = 3, physdim = 3
10 integer(cgsize_t), parameter :: size(3,3) = &
11 & reshape((/5,5,5, 4,4,4, 0,0,0 /), (/3, 3/))
12 integer(cgsize_t), parameter :: NUM_I = &
13 & size(1,1)
14 integer(cgsize_t), parameter :: NUM_J = &
15 & size(2,1)
16 integer(cgsize_t), parameter :: NUM_K = &
17 & size(3,1)
18 integer(cgsize_t), parameter :: num_coord = NUM_I * NUM_J * NUM_K
19
20 integer :: ierr
21 integer :: cgfile, cgbase, cgzone, cggrid, cgcoord, cgsol, cgfld
22 integer :: n, np
23
24 integer(cgsize_t) :: i, j, k
25 integer(cgsize_t) :: dims(3)
26 integer(cgsize_t) :: rmin(3), rmax(3)
27 integer(cgsize_t) :: m_rmin(3), m_rmax(3)
28
29 REAL(KIND=dp), DIMENSION(NUM_I, NUM_J, NUM_K) :: xcoord, ycoord, zcoord
30 COMPLEX(KIND=dp), DIMENSION(NUM_I, NUM_J, NUM_K) :: solution, fbuf
31
32 character*32 coordname(3)
33 character*32 fieldname
34
35 coordname(1) = 'CoordinateX'
36 coordname(2) = 'CoordinateY'
37 coordname(3) = 'CoordinateZ'
38
39 fieldname = 'Pressure'
40
41 do k = 1, NUM_K
42 do j = 1, NUM_J
43 do i = 1, NUM_I
44 call compute_coord()
45 call compute_sol()
46 enddo
47 enddo
48 enddo
49
50 ! open
51
52 call cg_open_f('complex_dataf.cgns', CG_MODE_WRITE, cgfile, ierr)
53 if (ierr .ne. CG_OK) call cg_error_exit_f
54
55 !---- structured grid ----
56
57 print *,'writing structured base with complex data'
58
59 ! write base and zone
60
61 call cg_base_write_f(cgfile, 'Structured', celldim, physdim, &
62 & cgbase, ierr)
63 if (ierr .ne. CG_OK) call cg_error_exit_f
64 call cg_zone_write_f(cgfile, cgbase, 'Zone', size, &
65 & Structured, cgzone, ierr)
66 if (ierr .ne. CG_OK) call cg_error_exit_f
67
68 dims(1) = NUM_I
69 dims(2) = NUM_J
70 dims(3) = NUM_K
71
72 do n=1,3
73 rmin(n) = 1
74 rmax(n) = dims(n)
75 m_rmin(n) = 1
76 m_rmax(n) = dims(n)
77 enddo
78
79 ! write coordinates
80
81 call cg_grid_write_f(cgfile, cgbase, cgzone, 'GridCoordinates', &
82 & cggrid, ierr)
83 call cg_goto_f(cgfile, cgbase, ierr, 'Zone_t', cgzone, &
84 & 'GridCoordinates_t', cggrid, 'end')
85
86 call cg_coord_general_write_f(cgfile, cgbase, cgzone, &
87 & coordname(1), RealDouble, &
88 & rmin, rmax, RealDouble, &
89 & 3, dims, m_rmin, m_rmax, &
90 & xcoord, cgcoord, ierr)
91 if (ierr .ne. CG_OK) call cg_error_exit_f
92 call cg_coord_general_write_f(cgfile, cgbase, cgzone, &
93 & coordname(2), RealDouble, &
94 & rmin, rmax, RealDouble, &
95 & 3, dims, m_rmin, m_rmax, &
96 & ycoord, cgcoord, ierr)
97 if (ierr .ne. CG_OK) call cg_error_exit_f
98 call cg_coord_general_write_f(cgfile, cgbase, cgzone, &
99 & coordname(3), RealDouble, &
100 & rmin, rmax, RealDouble, &
101 & 3, dims, m_rmin, m_rmax, &
102 & zcoord, cgcoord, ierr)
103 if (ierr .ne. CG_OK) call cg_error_exit_f
104
105 ! write solution
106
107 call cg_sol_write_f(cgfile, cgbase, cgzone, 'Solution', &
108 & Vertex, cgsol, ierr)
109 call cg_goto_f(cgfile, cgbase, ierr, 'Zone_t', cgzone, &
110 & 'FlowSolution_t', cgsol, 'end')
111 call cg_field_general_write_f(cgfile, cgbase, cgzone, cgsol, &
112 & fieldname, ComplexSingle, &
113 & rmin, rmax, ComplexDouble, &
114 & 3, dims, m_rmin, m_rmax, &
115 & solution, cgfld, ierr)
116 if (ierr .ne. CG_OK) call cg_error_exit_f
117
118 ! close the file and reopen in read mode
119
120 call cg_close_f(cgfile, ierr)
121 if (ierr .ne. CG_OK) call cg_error_exit_f
122
123 print *,'closing and reopening in read mode '
124
125 ! read file and check the data
126
127 call cg_open_f('complex_dataf.cgns', CG_MODE_READ, cgfile, ierr)
128 if (ierr .eq. ERROR) call cg_error_exit_f
129
130 write(6,*)'checking the data '
131 cgbase = 1
132 cgzone = 1
133 cggrid = 1
134 cgsol = 1
135
136 ! check field
137
138 call cg_field_general_read_f(cgfile, cgbase, cgzone, cgsol, &
139 & 'Pressure', &
140 & rmin, rmax, ComplexDouble, &
141 & 3, dims, m_rmin, m_rmax, fbuf, ierr)
142 if (ierr .eq. ERROR) call cg_error_exit_f
143 np = 0
144 do k = 1, NUM_K
145 do j = 1, NUM_J
146 do i = 1, NUM_I
147 if (fbuf(i,j,k) .ne. solution(i,j,k)) then
148 np = np + 1
149 endif
150 enddo
151 enddo
152 enddo
153 if (np .ne. 0) then
154 print *, np, ' differences in Field'
155 endif
156
157 ! close the file
158 print *, 'closing file'
159 call cg_close_f(cgfile, ierr)
160 if (ierr .eq. ERROR) call cg_error_exit_f
161
162 if (np .ne. 0) then
163 stop
164 endif
165
166 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
167
168 contains
169
170 ! initial data
171 subroutine compute_coord()
172 xcoord(i, j, k) = i
173 ycoord(i, j, k) = j
174 zcoord(i, j, k) = k
175 end subroutine
176
177 subroutine compute_sol()
178 solution(i, j, k) = CMPLX(REAL(i,KIND=dp), REAL(j,KIND=dp), KIND=dp)
179 end subroutine
180 #endif
181 end program
0 #include <stdint.h>
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #ifdef _WIN32
5 #include <io.h>
6 #define unlink _unlink
7 #else
8 #include <unistd.h>
9 #endif
10 #include "cgnslib.h"
11
12 #ifndef CGNS_ENUMT
13 #define CGNS_ENUMT(e) e
14 #define CGNS_ENUMV(e) e
15 #endif
16
17 #define NUM_SIDE 5
18 #define NUM_RANDOM 10
19
20 float *xcoord;
21 float *ycoord;
22 float *zcoord;
23 float *fbuf;
24
25 int64_t *elements;
26 int64_t *faces;
27 int64_t *parent;
28 int64_t *ptmp;
29 int64_t *ibuf, *pbuf;
30 int64_t *offsets;
31 cgsize_t *parent_buffer;
32
33 #define NODE_INDEX(I, J, K) ((I) + NUM_SIDE * (((J)-1) + NUM_SIDE * ((K)-1)))
34 #define CELL_INDEX(I, J, K) \
35 ((I) + (NUM_SIDE - 1) * (((J)-1) + (NUM_SIDE - 1) * ((K)-1)))
36
37 void get_parent(int rmin, int rmax, int nelems, int nfaces) {
38 int i, j, k, n, nn, np;
39
40 np = rmax - rmin + 1;
41 nn = rmin - nelems - 1;
42 for (n = 0, j = 0; j < 4; j++) {
43 k = j * nfaces + nn;
44 for (i = 0; i < np; i++) {
45 parent_buffer[n++] = (cgsize_t)parent[k++];
46 }
47 }
48 }
49
50 int mixed_offset(int num, int nelems) {
51 int offset;
52 int nmixed = nelems << 1;
53
54 if (--num < nmixed) {
55 int i = num >> 1;
56 offset = 14 * i;
57 if (num != (i << 1))
58 offset += 5;
59 } else
60 offset = 14 * nelems + 5 * (num - nmixed);
61 return offset;
62 }
63
64 int main(int argc, char **argv) {
65 int n, i, j, k, l, nn, nf, np;
66 int nnodes, nelems, nfaces;
67 int cgfile, cgbase, cgzone, cgcoord, cgsol, cgfld;
68 int cgsect, cgelems, cgfaces;
69 cgsize_t size[3], rmin, rmax, nr;
70 cgsize_t is, ie;
71 char name[33];
72 CGNS_ENUMT(ElementType_t) type;
73 static char *fname = "convert_datatype_elem.cgns";
74
75 nnodes = NUM_SIDE * NUM_SIDE * NUM_SIDE;
76 xcoord = (float *)malloc(4 * nnodes * sizeof(float));
77 ycoord = xcoord + nnodes;
78 zcoord = ycoord + nnodes;
79 fbuf = zcoord + nnodes;
80
81 for (n = 0, k = 1; k <= NUM_SIDE; k++) {
82 for (j = 1; j <= NUM_SIDE; j++) {
83 for (i = 1; i <= NUM_SIDE; i++) {
84 xcoord[n] = (float)i;
85 ycoord[n] = (float)j;
86 zcoord[n] = (float)k;
87 n++;
88 }
89 }
90 }
91
92 nelems = (NUM_SIDE - 1) * (NUM_SIDE - 1) * (NUM_SIDE - 1);
93 elements = (int64_t *)malloc(16 * nelems * sizeof(int64_t));
94 ibuf = elements + 8 * nelems;
95
96 for (n = 0, k = 1; k < NUM_SIDE; k++) {
97 for (j = 1; j < NUM_SIDE; j++) {
98 for (i = 1; i < NUM_SIDE; i++) {
99 nn = NODE_INDEX(i, j, k);
100 elements[n++] = nn;
101 elements[n++] = nn + 1;
102 elements[n++] = nn + 1 + NUM_SIDE;
103 elements[n++] = nn + NUM_SIDE;
104 nn += NUM_SIDE * NUM_SIDE;
105 elements[n++] = nn;
106 elements[n++] = nn + 1;
107 elements[n++] = nn + 1 + NUM_SIDE;
108 elements[n++] = nn + NUM_SIDE;
109 }
110 }
111 }
112
113 nfaces = 6 * (NUM_SIDE - 1) * (NUM_SIDE - 1);
114 faces = (int64_t *)malloc(18 * nfaces * sizeof(int64_t));
115 parent_buffer = (cgsize_t *)malloc(4 * nfaces * sizeof(cgsize_t));
116 parent = faces + 4 * nfaces;
117 ptmp = parent + 4 * nfaces;
118 pbuf = ptmp + 4 * nfaces;
119
120 for (n = 0; n < 4 * nfaces; n++)
121 parent[n] = 0;
122 np = nf = 0;
123 n = 2 * nfaces;
124
125 i = 1;
126 for (k = 1; k < NUM_SIDE; k++) {
127 for (j = 1; j < NUM_SIDE; j++) {
128 nn = NODE_INDEX(i, j, k);
129 faces[nf++] = nn;
130 faces[nf++] = nn + NUM_SIDE * NUM_SIDE;
131 faces[nf++] = nn + NUM_SIDE * (NUM_SIDE + 1);
132 faces[nf++] = nn + NUM_SIDE;
133 parent[np] = CELL_INDEX(i, j, k);
134 parent[np + n] = 5;
135 np++;
136 }
137 }
138 i = NUM_SIDE;
139 for (k = 1; k < NUM_SIDE; k++) {
140 for (j = 1; j < NUM_SIDE; j++) {
141 nn = NODE_INDEX(i, j, k);
142 faces[nf++] = nn;
143 faces[nf++] = nn + NUM_SIDE;
144 faces[nf++] = nn + NUM_SIDE * (NUM_SIDE + 1);
145 faces[nf++] = nn + NUM_SIDE * NUM_SIDE;
146 parent[np] = CELL_INDEX(i - 1, j, k);
147 parent[np + n] = 3;
148 np++;
149 }
150 }
151 j = 1;
152 for (k = 1; k < NUM_SIDE; k++) {
153 for (i = 1; i < NUM_SIDE; i++) {
154 nn = NODE_INDEX(i, j, k);
155 faces[nf++] = nn;
156 faces[nf++] = nn + 1;
157 faces[nf++] = nn + 1 + NUM_SIDE * NUM_SIDE;
158 faces[nf++] = nn + NUM_SIDE * NUM_SIDE;
159 parent[np] = CELL_INDEX(i, j, k);
160 parent[np + n] = 2;
161 np++;
162 }
163 }
164 j = NUM_SIDE;
165 for (k = 1; k < NUM_SIDE; k++) {
166 for (i = 1; i < NUM_SIDE; i++) {
167 nn = NODE_INDEX(i, j, k);
168 faces[nf++] = nn;
169 faces[nf++] = nn + NUM_SIDE * NUM_SIDE;
170 faces[nf++] = nn + 1 + NUM_SIDE * NUM_SIDE;
171 faces[nf++] = nn + 1;
172 parent[np] = CELL_INDEX(i, j - 1, k);
173 parent[np + n] = 4;
174 np++;
175 }
176 }
177 k = 1;
178 for (j = 1; j < NUM_SIDE; j++) {
179 for (i = 1; i < NUM_SIDE; i++) {
180 nn = NODE_INDEX(i, j, k);
181 faces[nf++] = nn;
182 faces[nf++] = nn + NUM_SIDE;
183 faces[nf++] = nn + NUM_SIDE + 1;
184 faces[nf++] = nn + 1;
185 parent[np] = CELL_INDEX(i, j, k);
186 parent[np + n] = 1;
187 np++;
188 }
189 }
190 k = NUM_SIDE;
191 for (j = 1; j < NUM_SIDE; j++) {
192 for (i = 1; i < NUM_SIDE; i++) {
193 nn = NODE_INDEX(i, j, k);
194 faces[nf++] = nn;
195 faces[nf++] = nn + 1;
196 faces[nf++] = nn + NUM_SIDE + 1;
197 faces[nf++] = nn + NUM_SIDE;
198 parent[np] = CELL_INDEX(i, j, k - 1);
199 parent[np + n] = 6;
200 np++;
201 }
202 }
203
204 unlink(fname);
205 printf("creating CGNS file %s\n", fname);
206 if (cg_open(fname, CG_MODE_WRITE, &cgfile) ||
207 cg_base_write(cgfile, "Base", 3, 3, &cgbase) ||
208 cg_gopath(cgfile, "/Base") ||
209 cg_dataclass_write(CGNS_ENUMV(NormalizedByDimensional)))
210 cg_error_exit();
211
212 /* create zone and sections */
213
214 size[0] = nnodes;
215 size[1] = nelems;
216 size[2] = 0;
217
218 puts("\nwriting a 32bit section");
219
220 if (cg_zone_write(cgfile, cgbase, "Zone", size, CGNS_ENUMV(Unstructured),
221 &cgzone))
222 cg_error_exit();
223
224 /* Create section using 32-bit elements */
225
226 if (cg_section_general_write(cgfile, cgbase, cgzone, "Elements",
227 CGNS_ENUMV(HEXA_8), CGNS_ENUMV(Integer),
228 (cgsize_t)1, (cgsize_t)nelems,
229 (cgsize_t)(nelems * 8), 0, &cgelems) ||
230 cg_section_general_write(
231 cgfile, cgbase, cgzone, "Faces", CGNS_ENUMV(QUAD_4),
232 CGNS_ENUMV(Integer), (cgsize_t)(nelems + 1),
233 (cgsize_t)(nelems + nfaces), (cgsize_t)(nfaces * 4), 0, &cgfaces))
234 cg_error_exit();
235
236 /* write zone with partial write */
237
238 puts("\nwriting zone");
239
240 /* write every other coordinate plane */
241
242 np = NUM_SIDE * NUM_SIDE;
243 for (k = 0; k < NUM_SIDE; k += 2) {
244 n = k * np;
245 rmin = n + 1;
246 rmax = n + np;
247 printf("coordinates %d -> %d\n", (int)rmin, (int)rmax);
248 if (cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
249 "CoordinateX", &rmin, &rmax, &xcoord[n],
250 &cgcoord) ||
251 cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
252 "CoordinateY", &rmin, &rmax, &ycoord[n],
253 &cgcoord) ||
254 cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
255 "CoordinateZ", &rmin, &rmax, &zcoord[n],
256 &cgcoord))
257 cg_error_exit();
258 }
259
260 /* write every other cell plane */
261
262 np = (NUM_SIDE - 1) * (NUM_SIDE - 1);
263 for (k = 1; k < NUM_SIDE; k += 2) {
264 nn = (k - 1) * np;
265 n = nn << 3;
266 rmin = nn + 1;
267 rmax = nn + np;
268 printf("elements %d -> %d\n", (int)rmin, (int)rmax);
269 /* LongInteger == 64bit */
270 if (cg_elements_general_write(cgfile, cgbase, cgzone, cgelems, rmin, rmax,
271 CGNS_ENUMV(LongInteger), &elements[n]))
272 cg_error_exit();
273 }
274
275 /* write every other face */
276
277 for (k = 0; k < 6; k += 2) {
278 nn = k * np;
279 n = nn << 2;
280 rmin = nn + 1 + nelems;
281 rmax = nn + np + nelems;
282 get_parent((int)rmin, (int)rmax, nelems, nfaces);
283 printf("faces %d -> %d\n", (int)rmin, (int)rmax);
284 if (cg_elements_general_write(cgfile, cgbase, cgzone, cgfaces, rmin, rmax,
285 CGNS_ENUMV(LongInteger), &faces[n]) ||
286 cg_parent_data_partial_write(cgfile, cgbase, cgzone, cgfaces, rmin,
287 rmax, (cgsize_t *)parent_buffer))
288 cg_error_exit();
289 }
290
291 puts("closing");
292 cg_close(cgfile);
293
294 if (cg_open(fname, CG_MODE_MODIFY, &cgfile))
295 cg_error_exit();
296
297 /* fill in missing coordinate planes */
298
299 np = NUM_SIDE * NUM_SIDE;
300 for (k = 1; k < NUM_SIDE; k += 2) {
301 n = k * np;
302 rmin = n + 1;
303 rmax = n + np;
304 printf("coordinates %d -> %d\n", (int)rmin, (int)rmax);
305 if (cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
306 "CoordinateX", &rmin, &rmax, &xcoord[n],
307 &cgcoord) ||
308 cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
309 "CoordinateY", &rmin, &rmax, &ycoord[n],
310 &cgcoord) ||
311 cg_coord_partial_write(cgfile, cgbase, cgzone, CGNS_ENUMV(RealSingle),
312 "CoordinateZ", &rmin, &rmax, &zcoord[n],
313 &cgcoord))
314 cg_error_exit();
315 }
316
317 /* fill in missing cell planes */
318
319 np = (NUM_SIDE - 1) * (NUM_SIDE - 1);
320 for (k = 2; k < NUM_SIDE; k += 2) {
321 nn = (k - 1) * np;
322 n = nn << 3;
323 rmin = nn + 1;
324 rmax = nn + np;
325 printf("elements %d -> %d\n", (int)rmin, (int)rmax);
326 if (cg_elements_general_write(cgfile, cgbase, cgzone, cgelems, rmin, rmax,
327 CGNS_ENUMV(LongInteger), &elements[n]))
328 cg_error_exit();
329 }
330
331 /* fill in missing faces */
332
333 for (k = 1; k < 6; k += 2) {
334 nn = k * np;
335 n = nn << 2;
336 rmin = nn + 1 + nelems;
337 rmax = nn + np + nelems;
338 get_parent((int)rmin, (int)rmax, nelems, nfaces);
339 printf("faces %d -> %d\n", (int)rmin, (int)rmax);
340 if (cg_elements_general_write(cgfile, cgbase, cgzone, cgfaces, rmin, rmax,
341 CGNS_ENUMV(LongInteger), &faces[n]) ||
342 cg_parent_data_partial_write(cgfile, cgbase, cgzone, cgfaces, rmin,
343 rmax, (cgsize_t *)parent_buffer))
344 cg_error_exit();
345 }
346
347 /* check the data */
348
349 puts("checking the data");
350
351 nn = 0;
352 /* check coordinates */
353
354 rmin = 1;
355 rmax = nelems;
356
357 /* check elements */
358
359 if (cg_section_read(cgfile, cgbase, cgzone, 1, name, &type, &is, &ie, &k,
360 &n) ||
361 cg_elements_general_read(cgfile, cgbase, cgzone, 1, rmin, rmax,
362 CGNS_ENUMV(LongInteger), ibuf))
363 cg_error_exit();
364 if (strcmp(name, "Elements") || type != CGNS_ENUMV(HEXA_8) || is != 1 ||
365 ie != nelems || k != 0 || n != 0) {
366 nn++;
367 puts("differences in Elements");
368 }
369 for (np = 0, n = 0; n < 8 * nelems; n++) {
370 if (elements[n] != ibuf[n])
371 np++;
372 }
373 nn += np;
374 if (np)
375 printf("%d differences in Elements connectivity\n", np);
376
377 /* check faces */
378
379 if (cg_section_read(cgfile, cgbase, cgzone, 2, name, &type, &is, &ie, &k,
380 &n) ||
381 cg_elements_general_read(cgfile, cgbase, cgzone, 2, is, ie,
382 CGNS_ENUMV(LongInteger), ibuf))
383 cg_error_exit();
384 if (cg_parent_elements_general_read(cgfile, cgbase, cgzone, 2, is, ie,
385 CGNS_ENUMV(LongInteger), pbuf) ||
386 cg_parent_elements_position_general_read(cgfile, cgbase, cgzone, 2, is,
387 ie, CGNS_ENUMV(LongInteger),
388 &pbuf[(ie - is + 1) << 1])) {
389 cg_error_exit();
390 }
391
392 if (strcmp(name, "Faces") || type != CGNS_ENUMV(QUAD_4) ||
393 is != (nelems + 1) || ie != (nelems + nfaces) || k != 0 || n != 1) {
394 nn++;
395 puts("differences in Faces");
396 }
397 for (np = 0, n = 0; n < 4 * nfaces; n++) {
398 if (faces[n] != ibuf[n])
399 np++;
400 }
401 nn += np;
402 if (np)
403 printf("%d differences in Faces connectivity\n", np);
404
405 for (np = 0, n = 0; n < 4 * nfaces; n++) {
406 if (parent[n] != pbuf[n]) {
407 np++;
408 }
409 }
410 nn += np;
411 if (np)
412 printf("%d differences in Faces parent data\n", np);
413
414 if (nn == 0)
415 puts("no diferences");
416
417 free(xcoord);
418
419 puts("deleting Elements and Faces and creating Mixed 32bit section");
420 /* delete sections and create as mixed */
421
422 if (cg_goto(cgfile, cgbase, "Zone_t", 1, NULL) ||
423 cg_delete_node("Elements") || cg_delete_node("Faces"))
424 cg_error_exit();
425
426 /* create the 32bit section */
427
428 if (cg_section_general_write(cgfile, cgbase, cgzone, "Mixed",
429 CGNS_ENUMV(MIXED), CGNS_ENUMV(Integer),
430 (cgsize_t)1, (cgsize_t)(nelems + nfaces),
431 (nelems * 9 + nfaces * 5), 0, &cgsect))
432 cg_error_exit();
433
434 /* before any partial writing it is important to initialize the section or at
435 * least the StartElementOffset */
436
437 if (cg_section_initialize(cgfile, cgbase, cgzone, cgsect))
438 cg_error_exit();
439
440 /* create mixed element connectivity */
441
442 nn = (nelems << 3) + nelems + (nfaces << 2) + nfaces;
443 ptmp = (int64_t *)malloc(2 * nn * sizeof(int64_t));
444
445 offsets = (int64_t *)malloc((nelems + nfaces + 1) * sizeof(int64_t));
446 offsets[0] = 0;
447
448 i = j = n = l = 0;
449 for (nf = 0; nf < nelems; nf++) {
450 ptmp[n++] = CGNS_ENUMV(QUAD_4);
451 for (k = 0; k < 4; k++)
452 ptmp[n++] = faces[j++];
453 offsets[l + 1] = offsets[l] + 5;
454 l++;
455 ptmp[n++] = CGNS_ENUMV(HEXA_8);
456 for (k = 0; k < 8; k++)
457 ptmp[n++] = elements[i++];
458 offsets[l + 1] = offsets[l] + 9;
459 l++;
460 }
461 while (nf++ < nfaces) {
462 ptmp[n++] = CGNS_ENUMV(QUAD_4);
463 for (k = 0; k < 4; k++)
464 ptmp[n++] = faces[j++];
465 offsets[l + 1] = offsets[l] + 5;
466 l++;
467 }
468
469 free(elements);
470 free(parent_buffer);
471 elements = ptmp;
472 ibuf = elements + nn;
473
474 /* create parent data */
475
476 np = nelems + nfaces;
477 nn = np << 2;
478 ptmp = (int64_t *)malloc(3 * nn * sizeof(int64_t));
479 parent_buffer = (cgsize_t *)malloc(3 * nn * sizeof(cgsize_t));
480
481 for (n = 0; n < nfaces; n++)
482 parent[n] <<= 1;
483
484 for (n = 0; n < nn; n++) {
485 ptmp[n] = 0;
486 parent_buffer[n] = 0;
487 }
488 for (n = 0, j = 0; j < 4; j++) {
489 k = j * np;
490 for (i = 0; i < nelems; i++) {
491 ptmp[k] = parent[n++];
492 k += 2;
493 }
494 while (i++ < nfaces) {
495 ptmp[k++] = parent[n++];
496 }
497 }
498
499 free(faces);
500 parent = ptmp;
501 ptmp = parent + nn;
502 pbuf = ptmp + nn;
503
504 rmin = 2 * nelems + 1;
505 rmax = np;
506 n = mixed_offset((int)rmin, nelems);
507 get_parent((int)rmin, (int)rmax, 0, np);
508
509 printf("mixed %d -> %d\n", (int)rmin, (int)rmax);
510 if (cg_poly_elements_general_write(cgfile, cgbase, cgzone, cgsect, rmin, rmax,
511 CGNS_ENUMV(LongInteger), &elements[n],
512 &offsets[rmin - 1]) ||
513 cg_parent_data_partial_write(cgfile, cgbase, cgzone, cgsect, rmin, rmax,
514 (cgsize_t *)parent_buffer))
515 cg_error_exit();
516
517 printf("mixed %d -> %d (2 at a time)\n", 1, nelems << 1);
518 for (i = 0; i < nelems; i++) {
519 rmin = (i << 1) + 1;
520 rmax = rmin + 1;
521 n = mixed_offset((int)rmin, nelems);
522 get_parent((int)rmin, (int)rmax, 0, np);
523 if (cg_poly_elements_general_write(cgfile, cgbase, cgzone, cgsect, rmin,
524 rmax, CGNS_ENUMV(LongInteger),
525 &elements[n], &offsets[rmin - 1]))
526 cg_error_exit();
527 if (cg_parent_data_partial_write(cgfile, cgbase, cgzone, cgsect, rmin, rmax,
528 (cgsize_t *)parent_buffer))
529 cg_error_exit();
530 }
531
532 puts("checking the data");
533
534 if (cg_section_read(cgfile, cgbase, cgzone, cgsect, name, &type, &is, &ie, &k,
535 &n) ||
536 cg_poly_elements_general_read(cgfile, cgbase, cgzone, cgsect, is, ie,
537 CGNS_ENUMV(LongInteger), ibuf, offsets))
538 cg_error_exit();
539 if (cg_parent_elements_general_read(cgfile, cgbase, cgzone, cgsect, is, ie,
540 CGNS_ENUMV(LongInteger), pbuf) ||
541 cg_parent_elements_position_general_read(cgfile, cgbase, cgzone, cgsect,
542 is, ie, CGNS_ENUMV(LongInteger),
543 &pbuf[(ie - is + 1) << 1])) {
544 cg_error_exit();
545 }
546
547 if (strcmp(name, "Mixed") || type != CGNS_ENUMV(MIXED) || is != 1 ||
548 ie != np || k != 0 || n != 1) {
549 puts("differences in Mixed");
550 }
551
552 nn = mixed_offset(np, nelems);
553 for (i = 0, n = 0; n < nn; n++) {
554 if (elements[n] != ibuf[n])
555 i++;
556 }
557 if (i)
558 printf("%d differences in Mixed connectivity\n", i);
559
560 nn = (nelems + nfaces) << 2;
561 for (i = 0, n = 0; n < nn; n++) {
562 if (parent[n] != pbuf[n])
563 i++;
564 }
565 if (i)
566 printf("%d differences in Mixed parent data\n", i);
567
568 puts("closing file");
569 cg_close(cgfile);
570 free(elements);
571 free(offsets);
572 free(parent);
573
574 return 0;
575 }
0 /*
1 * Tests HDF5 core file driver use in CGNS. Valid only when CGNS is built with
2 * HDF5 support.
3 */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include "utils.h"
7
8 #define FILENAME "file_ops.cgns"
9 #define BASENAME "Base 1"
10 #define BASENAME_PATH "/Base 1"
11
12 int main (int argc, char **argv)
13 {
14 #if CG_BUILD_HDF5
15 double start, finish;
16 int cgfile;
17
18 int B;
19 int cell_dim = 3;
20 int phys_dim = 3;
21
22 int file_type;
23 int ier;
24
25 printf ("**********************************\n");
26 printf ("* TEST CGNS WITH HDF5 CORE FD *\n");
27 printf ("**********************************\n");
28 fflush (stdout);
29
30 /*
31 * INITIAL STATE: FILE DOES NOT EXIST
32 * +------+-------+--------+----------------+
33 * | CG_MODE_ | DISKLESS MODE |
34 * +------+-------+--------+----------------+
35 * | READ | WRITE | MODIFY | MEMORY TO FILE |
36 * +------+-------+--------+----------------+
37 * | N | Y | N | N |
38 * +------+-------+--------+----------------+
39 */
40
41 printf (" Testing...MODE_WRITE/MEM_ONLY...");
42 /* enable diskless mode */
43 if (cg_configure (CG_CONFIG_HDF5_DISKLESS, (void *)1))
44 cg_error_exit();
45 /* disable committing to disk */
46 if (cg_configure (CG_CONFIG_HDF5_DISKLESS_WRITE, (void *)0))
47 cg_error_exit();
48
49 if (cg_open (FILENAME, CG_MODE_WRITE, &cgfile)) cg_error_exit();
50 if (cg_close (cgfile)) cg_error_exit();
51
52 /* verify CGNS file was not created */
53 if (ACCESS(FILENAME, F_OK) == 0) cg_error_exit();
54 printf ("PASSED\n");
55
56 /*
57 * INITIAL STATE: FILE DOES NOT EXIST
58 * +------+-------+--------+----------------+
59 * | CG_MODE_ | DISKLESS MODE |
60 * +------+-------+--------+----------------+
61 * | READ | WRITE | MODIFY | MEMORY TO FILE |
62 * +------+-------+--------+----------------+
63 * | N | Y | N | Y |
64 * +------+-------+--------+----------------+
65 */
66 printf (" Testing...MODE_WRITE/MEMORY_TO_FILE...");
67 /* enable diskless mode */
68 if (cg_configure(CG_CONFIG_HDF5_DISKLESS, (void *)1))
69 cg_error_exit();
70 /* enable committing to disk */
71 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_WRITE, (void *)1))
72 cg_error_exit();
73
74 if (cg_open (FILENAME, CG_MODE_WRITE, &cgfile)) cg_error_exit();
75 if (cg_close (cgfile)) cg_error_exit();
76
77 /* verify CGNS file was created */
78 if (ACCESS(FILENAME, F_OK) != 0) cg_error_exit();
79
80 /* verify valid CGNS file
81 * - expected to fail since cg_is_cgns opens file read-only,
82 * and diskless mode is set to write */
83 ier = cg_is_cgns(FILENAME, &file_type);
84 if(ier != CG_ERROR) cg_error_exit();
85 printf ("PASSED\n");
86
87 /*
88 * INITIAL STATE: FILE EXISTS -- MODIFY DATA
89 * +------+-------+--------+----------------+
90 * | CG_MODE_ | DISKLESS MODE |
91 * +------+-------+--------+----------------+
92 * | READ | WRITE | MODIFY | MEMORY TO FILE |
93 * +------+-------+--------+----------------+
94 * | N | N | Y | N |
95 * +------+-------+--------+----------------+
96 */
97 printf (" Testing...MODE_WRITE/MEMORY_ONLY -- DATA MODIFY...");
98 /* enable diskless mode */
99 if (cg_configure(CG_CONFIG_HDF5_DISKLESS, (void *)1))
100 cg_error_exit();
101 /* disable committing to disk */
102 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_WRITE, (void *)0))
103 cg_error_exit();
104
105 ier = cg_open (FILENAME, CG_MODE_MODIFY, &cgfile);
106 if(ier == CG_ERROR) cg_error_exit();
107 /* write some data to the memory state */
108 if(cg_base_write(cgfile, BASENAME, cell_dim, phys_dim, &B) != CG_OK) {
109 printf("*FAILED* cg_base_write \n");
110 cg_error_exit();
111 }
112 if (cg_close (cgfile)) cg_error_exit();
113
114 /* verify memory state did not get written to disk */
115 if( cg_open(FILENAME, CG_MODE_MODIFY, &cgfile) == CG_ERROR)
116 cg_error_exit();
117 if(cg_gopath(cgfile, BASENAME_PATH) == CG_OK)
118 printf("*FAILED* memory state written to disk \n");
119 if( cg_close(cgfile)) cg_error_exit();
120 printf ("PASSED\n");
121 /*
122 * INITIAL STATE: FILE EXISTS -- MODIFY DATA
123 * +------+-------+--------+----------------+
124 * | CG_MODE_ | DISKLESS MODE |
125 * +------+-------+--------+----------------+
126 * | READ | WRITE | MODIFY | MEMORY TO FILE |
127 * +------+-------+--------+----------------+
128 * | N | N | Y | Y |
129 * +------+-------+--------+----------------+
130 */
131 printf (" Testing...MODE_WRITE/MEMORY_TO_FILE -- DATA MODIFY...");
132 /* enable committing to disk */
133 if (cg_configure(CG_CONFIG_HDF5_DISKLESS, (void *)1))
134 cg_error_exit();
135 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_WRITE, (void *)1))
136 cg_error_exit();
137 if (cg_configure(CG_CONFIG_HDF5_DISKLESS_INCR, (void *)(1*1024*1024)))
138 cg_error_exit();
139
140 if( cg_open (FILENAME, CG_MODE_MODIFY, &cgfile) == CG_ERROR)
141 cg_error_exit();
142
143 /* write some data to the memory state */
144 if(cg_base_write(cgfile, BASENAME, cell_dim, phys_dim, &B) != CG_OK) {
145 printf("*FAILED* cg_base_write \n");
146 cg_error_exit();
147 }
148 if (cg_close (cgfile)) cg_error_exit();
149
150 /* verify memory state was written to disk */
151 if( cg_open(FILENAME, CG_MODE_MODIFY, &cgfile) == CG_ERROR)
152 cg_error_exit();
153 if(cg_gopath(cgfile,BASENAME_PATH) != CG_OK)
154 printf("*FAILED* memory state not written to disk \n");
155 if( cg_close(cgfile)) cg_error_exit();
156 printf ("PASSED\n");
157 #endif
158 return 0;
159 }
160
55 USE CGNS
66 implicit none
77
8 INTEGER, PARAMETER :: sp = KIND(1.0)
89 integer, parameter :: NUM_SIDE = 5
910
1011 integer(cgsize_t) :: sizes(9)
1213 integer(cgsize_t) :: npts
1314 integer :: celldim, physdim
1415
15 real*4, dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: xcoord
16 real*4, dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: ycoord
17 real*4, dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: zcoord
16 real(kind=sp), dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: xcoord
17 real(kind=sp), dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: ycoord
18 real(kind=sp), dimension(NUM_SIDE*NUM_SIDE*NUM_SIDE) :: zcoord
1819
1920 integer :: ierr
2021 integer :: i, j, k, n, nfam, nb, ng, nnames
2122 integer :: cgfile, cgbase, cgtree, cgzone, cgfam, cgcoord
2223 integer :: cgbc, cgsr
2324
24 real*4, dimension(5) :: exponents
25 character*32 outfile
26 character*32 name
27 character*32 tname
25 real(kind=sp), dimension(5) :: exponents
26 character(len=32) outfile
27 character(len=32) name
28 character(len=32) tname
2829 character(len=20*33) :: family_name
2930 character(len=20*33) :: tfamily_name
3031
3132 ! ---- WRITING TESTS ----
3233
3334 outfile = "family_tree_f90.cgns"
34 call unlink( outfile )
35 !call unlink( outfile )
3536 ! write(*, *) 'Create file'
3637 call cg_open_f(outfile, CG_MODE_WRITE, cgfile, ierr)
3738 if (ierr .ne. CG_OK) call cg_error_exit_f
9091 call cg_goto_f(cgfile, cgbase, ierr, "Zone_t", cgzone, &
9192 & "GridCoordinates_t", 1, &
9293 & "CoordinateX", 0, 'end')
94 if (ierr .ne. CG_OK) call cg_error_exit_f
95 call cg_gopath_f(cgfile, &
96 & "/Structured/Zone/GridCoordinates/CoordinateX", ierr)
97 if (ierr .ne. CG_OK) call cg_error_exit_f
9398 call cg_exponents_write_f(RealSingle, exponents, ierr)
9499 if (ierr .ne. CG_OK) call cg_error_exit_f
95100 call cg_gopath_f(cgfile, "../CoordinateY", ierr)
148153
149154 ! NODE BASED FAMILY NODE CREATION
150155
151 call cg_goto_f( cgfile, cgtree, ierr, "Family2", 0, 'end')
156 call cg_gopath_f( cgfile, "/FamilyTree/Family2", ierr)
157 if (ierr .ne. CG_OK) call cg_error_exit_f
152158 call cg_node_family_write_f( "Family2.1", cgfam, ierr)
153159 if (ierr .ne. CG_OK) call cg_error_exit_f
154160
161 call cg_goto_f( cgfile, cgtree, ierr, "Family2", 0, &
162 & "Family2.1", 0, 'end')
163 if (ierr .ne. CG_OK) call cg_error_exit_f
155164 call cg_gopath_f(cgfile, &
156165 & "/FamilyTree/Family1/Family1.2/Family1.2.1", ierr)
166 if (ierr .ne. CG_OK) call cg_error_exit_f
157167 call cg_node_family_write_f( "Family1.2.1.1", cgfam, ierr)
158168 if (ierr .ne. CG_OK) call cg_error_exit_f
159169
163173 call cg_node_nfamilies_f( nfam , ierr)
164174 if (ierr .ne. CG_OK) call cg_error_exit_f
165175
166 call cg_goto_f( cgfile, cgtree, ierr, "Family2", 0, &
167 & "Family2.1", 0, 'end')
176 call cg_gopath_f( cgfile, "/FamilyTree/Family2/Family2.1", ierr)
177 if (ierr .ne. CG_OK) call cg_error_exit_f
168178 call cg_node_family_write_f( "Family2.1.1", cgfam, ierr)
169179 if (ierr .ne. CG_OK) call cg_error_exit_f
170180
185195 & "/FamilyTree/Family4/Family4.3", cgfam, ierr)
186196 if (ierr .ne. CG_OK) call cg_error_exit_f
187197
188
189 call cg_goto_f(cgfile, cgtree, ierr, 'end')
198 CALL cg_goto_f(cgfile, cgtree, ierr, 'end')
199 if (ierr .ne. CG_OK) call cg_error_exit_f
200 call cg_gopath_f(cgfile, "/FamilyTree", ierr)
201 if (ierr .ne. CG_OK) call cg_error_exit_f
190202 call cg_node_family_write_f( "FamilyN", cgfam, ierr)
191203 if (ierr .ne. CG_OK) call cg_error_exit_f
192204
193205 ! FAMILY (TREE) NAME CREATION
194206
195207 call cg_goto_f(cgfile, cgbase, ierr, "Zone", 0, 'end')
208 if (ierr .ne. CG_OK) call cg_error_exit_f
209 call cg_gopath_f(cgfile, "/Structured/Zone", ierr)
210 if (ierr .ne. CG_OK) call cg_error_exit_f
196211 call cg_famname_write_f("/FamilyTree/Family1", ierr)
197212 if (ierr .ne. CG_OK) call cg_error_exit_f
198213 do j=1,3
213228 if (ierr .ne. CG_OK) call cg_error_exit_f
214229 call cg_goto_f(cgfile, cgbase, ierr, "Zone", 0, "ZoneBC", 0, &
215230 & "Inflow", 0,'end')
231 if (ierr .ne. CG_OK) call cg_error_exit_f
232 call cg_gopath_f(cgfile, "/Structured/Zone/ZoneBC/Inflow", ierr)
233 if (ierr .ne. CG_OK) call cg_error_exit_f
216234
217235 call cg_famname_write_f("/FamilyTree/Family2", ierr)
218236 if (ierr .ne. CG_OK) call cg_error_exit_f
227245 call cg_subreg_bcname_write_f(cgfile, cgbase, cgzone, "SubRegion", &
228246 & 2, "Inflow", cgsr, ierr)
229247 if (ierr .ne. CG_OK) call cg_error_exit_f
248
230249 call cg_goto_f(cgfile, cgbase, ierr, "Zone", 0, "SubRegion", 0, 'end')
250 if (ierr .ne. CG_OK) call cg_error_exit_f
251 call cg_gopath_f(cgfile, "/Structured/Zone/SubRegion", ierr)
252 if (ierr .ne. CG_OK) call cg_error_exit_f
231253 call cg_famname_write_f("/FamilyTree/Family3", ierr)
232254 if (ierr .ne. CG_OK) call cg_error_exit_f
233255 do j = 1,3
237259 if (ierr .ne. CG_OK) call cg_error_exit_f
238260 enddo
239261
240 call cg_goto_f(cgfile, cgbase, ierr, "Zone", 0, 'end')
262 call cg_gopath_f(cgfile, "/Structured/Zone", ierr)
263 if (ierr .ne. CG_OK) call cg_error_exit_f
241264 call cg_user_data_write_f("UserData", ierr)
242265 if (ierr .ne. CG_OK) call cg_error_exit_f
243266 call cg_user_data_write_f("UserData2", ierr)
244267 if (ierr .ne. CG_OK) call cg_error_exit_f
245 call cg_goto_f(cgfile, cgbase, ierr, "Zone", 0, "UserData", 0, 'end')
268 call cg_gopath_f(cgfile, "./UserData", ierr)
269 if (ierr .ne. CG_OK) call cg_error_exit_f
246270 call cg_famname_write_f("/FamilyTree/Family4", ierr)
247271 if (ierr .ne. CG_OK) call cg_error_exit_f
248272 do j = 1,3
299323
300324 ! FAMILY NODE DELETION
301325
302 call cg_goto_f(cgfile, cgtree, ierr, "Family1", 0, "Family1.2",0, "Family1.2.1",0, 'end')
326 call cg_gopath_f(cgfile,"/FamilyTree/Family1/Family1.2/Family1.2.1", ierr)
327 if (ierr .ne. CG_OK) call cg_error_exit_f
303328
304329 call cg_gopath_f(cgfile, "/FamilyTree/Family1/Family1.2/Family1.2.1", ierr)
330 if (ierr .ne. CG_OK) call cg_error_exit_f
305331
306332 call cg_delete_node_f("Family1.2.1.1", ierr)
307333 if (ierr .ne. CG_OK) call cg_error_exit_f
311337 if (nfam .ne. 1) stop
312338
313339 call cg_gopath_f(cgfile, "/FamilyTree/Family4", ierr)
340 if (ierr .ne. CG_OK) call cg_error_exit_f
314341 call cg_delete_node_f("Family4.2", ierr)
315342 if (ierr .ne. CG_OK) call cg_error_exit_f
316343
320347
321348 ! FAMILY NODE OVERWRITING
322349 call cg_gopath_f( cgfile, "/FamilyTree/Family1/Family1.2/Family1.2.1", ierr)
350 if (ierr .ne. CG_OK) call cg_error_exit_f
323351 call cg_node_family_write_f( "Family1.2.1.2", cgfam, ierr)
324352 if (ierr .ne. CG_OK) call cg_error_exit_f
325353 call cg_node_nfamilies_f(nfam, ierr)
327355 if (nfam .ne. 1) stop
328356
329357 call cg_gopath_f( cgfile, "/FamilyTree/Family1/Family1.1", ierr)
358 if (ierr .ne. CG_OK) call cg_error_exit_f
330359 call cg_node_nfamilies_f( nfam, ierr)
331360 if (ierr .ne. CG_OK) call cg_error_exit_f
332361 if (nfam .ne. 1) stop
371400 enddo
372401
373402 call cg_gopath_f( cgfile, "/Structured/Zone/UserData", ierr)
403 if (ierr .ne. CG_OK) call cg_error_exit_f
374404
375405 call cg_nmultifam_f( nnames, ierr)
376406 if (ierr .ne. CG_OK) call cg_error_exit_f
378408 if (ierr .ne. CG_OK) call cg_error_exit_f
379409
380410 call cg_gopath_f(cgfile, "/Structured/Zone/UserData2", ierr)
411 if (ierr .ne. CG_OK) call cg_error_exit_f
381412
382413 call cg_nmultifam_f( nnames, ierr)
383414 if (ierr .ne. CG_OK) call cg_error_exit_f
44 #endif
55 USE CGNS
66 implicit none
7
8 INTEGER, PARAMETER :: sp = KIND(1.0)
79
810 integer, parameter :: celldim = 3, physdim = 3
911 integer(cgsize_t), parameter :: size(3,3) = &
2729 integer(cgsize_t) :: rmin(3), rmax(3)
2830 integer(cgsize_t) :: m_rmin(3), m_rmax(3)
2931
30 real*4, dimension(NUM_I, NUM_J, NUM_K) :: xcoord, ycoord, zcoord
31 real*4, dimension(NUM_I, NUM_J, NUM_K) :: solution, fbuf
32
33 character*32 coordname(3)
34 character*32 fieldname
32 real(kind=sp), dimension(NUM_I, NUM_J, NUM_K) :: xcoord, ycoord, zcoord
33 real(kind=sp), dimension(NUM_I, NUM_J, NUM_K) :: solution, fbuf
34
35 character(len=32) coordname(3)
36 character(len=32) fieldname
3537
3638 coordname(1) = 'CoordinateX'
3739 coordname(2) = 'CoordinateY'
6868
6969 /* errors and warnings go to error_exit */
7070
71 cg_configure(CG_CONFIG_ERROR, (void *)error_exit);
71 if( cg_configure(CG_CONFIG_ERROR, (void *)error_exit))
72 cg_error_exit();
7273
7374 if (argc > 1) {
7475 n = 0;
161162 /* this should fail since ptset not allowed as child of
162163 user data, except below a zone_t node */
163164
164 cg_configure(CG_CONFIG_ERROR, NULL);
165 if( cg_configure(CG_CONFIG_ERROR, NULL))
166 cg_error_exit();
165167 if (cg_ptset_write (CGNS_ENUMV(PointList), 1, ptlist) == CG_OK)
166168 printf ("WHAT!! - ptset should not work under base/userdata\n");
167 cg_configure(CG_CONFIG_ERROR, (void *)error_exit);
169 if( cg_configure(CG_CONFIG_ERROR, (void *)error_exit))
170 cg_error_exit();
168171
169172 /* write zone */
170173
296299
297300 /* read file and check values */
298301
299 cg_configure(CG_CONFIG_ERROR, NULL);
302 if (cg_configure(CG_CONFIG_ERROR, NULL))
303 cg_error_exit();
300304
301305 if (cg_open (fname, CG_MODE_READ, &cgfile))
302306 cg_error_exit ();
77 # define CGNS_ENUMV(e) e
88 #endif
99
10 #if defined(_WIN32) && !defined(__NUTC__)
11 # include <io.h> /* suggested by MTI */
12 # ifndef F_OK
13 # define R_OK 004 /* Test for Read permission */
14 # define W_OK 002 /* Test for Write permission */
15 # define X_OK 001 /* Test for eXecute permission */
16 # define F_OK 000 /* Test for existence of File */
17 # endif
18 # define ACCESS _access
19 # define UNLINK _unlink
20 #else
21 # include <unistd.h>
22 # define ACCESS access
23 # define UNLINK unlink
24 #endif
25
1026 double elapsed_time (void);
1127 double file_size (char *fname);
44 # Link all the executables to cgns and hdf5
55 if (CGNS_USE_SHARED)
66 link_libraries(cgns_shared)
7 if (WIN32 OR CYGWIN)
8 target_compile_definitions(cgns_shared PRIVATE -DBUILD_DLL)
9 target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL)
10 endif (WIN32 OR CYGWIN)
711 else (CGNS_USE_SHARED)
812 link_libraries(cgns_static)
913 endif (CGNS_USE_SHARED)
1919 #include "cgnslib.h"
2020 #include "cgns_header.h"
2121 #include "cgnames.h"
22 #include "cgns_io.h"
2223
2324 #if !defined(CGNS_VERSION) || CGNS_VERSION < 3100
2425 # error You need at least CGNS Version 3.1
660661 return nodes;
661662 }
662663 if (type == CGNS_ENUMV(NFACE_n)) {
663 *nnodes = offsets[ne+1] - offsets[ne];
664 *nnodes = (int)(offsets[ne+1] - offsets[ne]);
664665 nodes += (offsets[ne] - offsets[0]);
665666 *dim = 3;
666667 return nodes;
667668 }
668669 if (type == CGNS_ENUMV(MIXED)) {
669670 type = (CGNS_ENUMT(ElementType_t))*nodes++;
671 if (FileVersion < 3200 &&
672 type >= CGNS_ENUMV(NGON_n)) {
673 nn = (int)(type - CGNS_ENUMV(NGON_n));
674 }
675 else {
676 if (cg_npe (type, &nn) || nn <= 0)
677 return NULL;
678 }
670679 while (ne-- > 0) {
680 nodes += nn;
681 type = (CGNS_ENUMT(ElementType_t))*nodes++;
671682 if (FileVersion < 3200 &&
672683 type >= CGNS_ENUMV(NGON_n)) {
673684 nn = (int)(type - CGNS_ENUMV(NGON_n));
676687 if (cg_npe (type, &nn) || nn <= 0)
677688 return NULL;
678689 }
679 nodes += nn;
680 type = (CGNS_ENUMT(ElementType_t))*nodes++;
681690 }
682691 }
683692 else {
19301939 if (ndim < 1 || size < 1)
19311940 error ("invalid dimensions");
19321941 if (length < 0 && size != 1 && size != -length)
1933 error ("array size not 1 or %d", -length);
1942 error ("array size not 1 or %ld", -length);
19341943 if (length > 0 && size != length)
1935 error ("array size not %d", length);
1944 error ("array size not %ld", length);
19361945 check_quantity (na, name, dataclass, punits, isref, indent+2);
19371946 }
19381947 }
34053414 "BC Type is FamilySpecified but no family name is given");
34063415 }
34073416 else {
3417 if (bctype != CGNS_ENUMV(FamilySpecified)) {
3418 warning(2, "BC Type is not FamilySpecified but a family name is defined.\n");
3419 }
34083420 if (verbose) printf (" Family=\"%s\"\n", name);
34093421 for (n = 0; n < NumFamily; n++) {
34103422 if (0 == strcmp (name, Family[n])) break;
35613573 char name[33], *desc;
35623574 int n, nb, ierr;
35633575 int *punits, units[9], dataclass;
3576 ZONE *z = &Zones[cgnszone-1];
35643577
35653578 if (cg_nbocos (cgnsfn, cgnsbase, cgnszone, &nb))
35663579 error_exit("cg_nbocos");
3567 if (nb < 1) return;
3580 if (nb < 1) {
3581 if (z->ns > 0 && CellDim == 3) {
3582 warning(2, "Surface elements exists in the 3D zone but no ZoneBC_t is declared. If the surface elements are meant to define boundaries ZoneBC_t is required.");
3583 }
3584 return;
3585 }
35683586 puts (" checking boundary conditions");
35693587 fflush (stdout);
35703588 go_absolute ("Zone_t", cgnszone, "ZoneBC_t", 1, NULL);
51995217 z->idim = 0;
52005218 }
52015219 if (z->dims[1][n] != z->dims[0][n] - 1) {
5202 error ("number of cells in %c-direction is %d instead of %d",
5220 error ("number of cells in %c-direction is %ld instead of %ld",
52035221 indexname[n], z->dims[1][n], z->dims[0][n] - 1);
52045222 z->dims[1][n] = z->dims[0][n] - 1;
52055223 }
52715289 if (n >= NumFamily &&
52725290 (FileVersion >= 1200 || strcmp(name, "ORPHAN")))
52735291 warning (2, "zone family name \"%s\" not found", name);
5292 }
5293 else if (ierr == CG_NODE_NOT_FOUND) {
5294 warning(2, "No family name declared for zone \"%s\"."
5295 "It is a recommended practice to associate one.", z->name);
52745296 }
52755297
52765298 /*----- ReferenceState -----*/
61276149
61286150 /*=======================================================================*/
61296151
6152 void check_node_name_recursive(int cgio_num, double nodeid)
6153 {
6154
6155 int nchildren, child;
6156 int len;
6157 char_33 name;
6158 double *childids;
6159 char *slash_ptr = NULL;
6160
6161 if (cgio_get_name(cgio_num, nodeid, name) != CG_OK) {
6162 return;
6163 }
6164
6165 if (strlen(name) < 1) {
6166 return;
6167 }
6168
6169 if (name[0] == '.') {
6170 error ("Invalid CGNS node name: node should not start with a dot");
6171 }
6172 slash_ptr = strchr(name, '/');
6173 if (slash_ptr != NULL) {
6174 error("Invalid CGNS node name: node should not have a slash");
6175 }
6176
6177 cgio_number_children(cgio_num, nodeid, &nchildren);
6178 if (nchildren == 0) {
6179 return;
6180 }
6181
6182 childids = (double *) malloc(nchildren*sizeof(double));
6183 cgio_children_ids(cgio_num, nodeid, 1, nchildren, &len, childids);
6184 if (len != nchildren) {
6185 free(childids);
6186 return;
6187 }
6188
6189 for (child = 0; child < nchildren; child++) {
6190 check_node_name_recursive(cgio_num, childids[child]);
6191 }
6192 free(childids);
6193 }
6194
6195 void check_node_names(void)
6196 {
6197 int cgio_num;
6198 int nchildren, child, len;
6199 double rootid;
6200 double *childids;
6201
6202 printf ("\nchecking node names\n");
6203
6204 cg_get_cgio(cgnsfn, &cgio_num);
6205 cg_root_id(cgnsfn, &rootid);
6206
6207 cgio_number_children(cgio_num, rootid, &nchildren);
6208
6209 childids = (double *) malloc(nchildren*sizeof(double));
6210 cgio_children_ids(cgio_num, rootid, 1, nchildren, &len, childids);
6211 if (len != nchildren) {
6212 free(childids);
6213 return;
6214 }
6215
6216 for (child = 0; child < nchildren; child++) {
6217 check_node_name_recursive(cgio_num, childids[child]);
6218 }
6219 free(childids);
6220 }
6221
6222 /*=======================================================================*/
6223
61306224 int main (int argc, char *argv[])
61316225 {
61326226 char *cgnsfile;
61946288 for (cgnsbase = 1; cgnsbase <= nbases; cgnsbase++)
61956289 check_base ();
61966290
6291 /* check node name validity according to SIDS */
6292 check_node_names();
6293
61976294 /* close CGNS file and exit */
61986295
61996296 if (cg_close (cgnsfn)) error_exit("cg_close");