Mock Version: 1.4.21 Mock Version: 1.4.21 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target riscv64 --nodeps /builddir/build/SPECS/neuron.spec'], chrootPath='/var/lib/mock/f33-build-439783-63245/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8'}shell=Falselogger=timeout=432000uid=987gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target riscv64 --nodeps /builddir/build/SPECS/neuron.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8'} and shell False Building target platforms: riscv64 Building for target riscv64 setting SOURCE_DATE_EPOCH=1606694400 Wrote: /builddir/build/SRPMS/neuron-7.8.1-7.fc33.src.rpm Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target riscv64 --nodeps /builddir/build/SPECS/neuron.spec'], chrootPath='/var/lib/mock/f33-build-439783-63245/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8'}shell=Falselogger=timeout=432000uid=987gid=135user='mockbuild'nspawn_args=[]unshare_net=TrueprintOutput=False) Executing command: ['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target riscv64 --nodeps /builddir/build/SPECS/neuron.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8'} and shell False Building target platforms: riscv64 Building for target riscv64 setting SOURCE_DATE_EPOCH=1606694400 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ude2E6 + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf nrn-7.8.1 + /usr/bin/gzip -dc /builddir/build/SOURCES/neuron-7.8.1.tar.gz + /usr/bin/tar -xof - + STATUS=0 + '[' 0 -ne 0 ']' + cd nrn-7.8.1 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + /usr/bin/git init -q + /usr/bin/git config user.name rpm-build + /usr/bin/git config user.email '' + /usr/bin/git config gc.auto 0 + /usr/bin/git add --force . + /usr/bin/git commit -q --allow-empty -a --author 'rpm-build ' -m 'neuron-7.8.1 base' + /usr/bin/cat /builddir/build/SOURCES/0001-Unbundle-Random123.patch + /usr/bin/git apply --index --reject - Checking patch configure.ac... Checking patch src/Makefile.am... Applied patch configure.ac cleanly. Applied patch src/Makefile.am cleanly. + /usr/bin/git commit -q -m 0001-Unbundle-Random123.patch --author 'rpm-build ' + /usr/bin/cat /builddir/build/SOURCES/0002-Unbundle-catch.patch + /usr/bin/git apply --index --reject - Checking patch CMakeLists.txt... Applied patch CMakeLists.txt cleanly. + /usr/bin/git commit -q -m 0002-Unbundle-catch.patch --author 'rpm-build ' + /usr/bin/git apply --index --reject - + /usr/bin/cat /builddir/build/SOURCES/0003-Disable-python-build-and-install.patch Checking patch src/nrnpython/CMakeLists.txt... Applied patch src/nrnpython/CMakeLists.txt cleanly. + /usr/bin/git commit -q -m 0003-Disable-python-build-and-install.patch --author 'rpm-build ' + /usr/bin/cat /builddir/build/SOURCES/0004-Set-soversions-for-libs.patch + /usr/bin/git apply --index --reject - Checking patch CMakeLists.txt... Checking patch src/nrniv/CMakeLists.txt... Checking patch src/nrnpython/CMakeLists.txt... Applied patch CMakeLists.txt cleanly. Applied patch src/nrniv/CMakeLists.txt cleanly. Applied patch src/nrnpython/CMakeLists.txt cleanly. + /usr/bin/git commit -q -m 0004-Set-soversions-for-libs.patch --author 'rpm-build ' + /usr/bin/cat /builddir/build/SOURCES/0005-Correct-librxdmath-path-for-64bit.patch + /usr/bin/git apply --index --reject - Checking patch share/lib/python/neuron/rxd/rxd.py... Applied patch share/lib/python/neuron/rxd/rxd.py cleanly. + /usr/bin/git commit -q -m 0005-Correct-librxdmath-path-for-64bit.patch --author 'rpm-build ' + /usr/bin/cat /builddir/build/SOURCES/0006-Do-not-generate-version-info-at-buildtime.patch + /usr/bin/git apply --index --reject - Checking patch src/nrniv/CMakeLists.txt... Applied patch src/nrniv/CMakeLists.txt cleanly. + /usr/bin/git commit -q -m 0006-Do-not-generate-version-info-at-buildtime.patch --author 'rpm-build ' + find src -type f -executable '!' -name '*.sh' -exec chmod -x '{}' + + rm -rf src/Random123 + rm -rf src/readline ++ date +%Y-%m-%d + export TIMESTAMP=2021-01-12 + TIMESTAMP=2021-01-12 + cat + for f in bin/*_makefile.in + sed -r -i 's|(LIBTOOL.*=.*)\$\(pkgdatadir\)(.*)|\1$(bindir)\2|' bin/nrniv_makefile.in + for f in bin/*_makefile.in + sed -r -i 's|(LIBTOOL.*=.*)\$\(pkgdatadir\)(.*)|\1$(bindir)\2|' bin/nrnmech_makefile.in + for f in bin/*_makefile.in + sed -r -i 's|(LIBTOOL.*=.*)\$\(pkgdatadir\)(.*)|\1$(bindir)\2|' bin/nrnoc_makefile.in + sed -i '/CompilerFlagsHelpers/ d' cmake/ReleaseDebugAutoFlags.cmake + RPM_EC=0 ++ jobs -p + exit 0 Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.uw0ol8 + umask 022 + cd /builddir/build/BUILD + cd nrn-7.8.1 + export MPI_COMPILER=serial + MPI_COMPILER=serial *** BUILDING neuron-7.8.1 *** + export MPI_SUFFIX= + MPI_SUFFIX= + export MPI_HOME=/usr + MPI_HOME=/usr + export MPI_BIN=/usr/bin + MPI_BIN=/usr/bin + export MPI_INCLUDE=/usr/include + MPI_INCLUDE=/usr/include + export MPI_LIB=/usr/lib64 + MPI_LIB=/usr/lib64 + export MPI_LIBFILE= + MPI_LIBFILE= + export MPI_YES=OFF + MPI_YES=OFF + export MPI_COMPILE_TYPE= + MPI_COMPILE_TYPE= + export MPI_SITEARCH=/usr/lib64/python3.9/site-packages + MPI_SITEARCH=/usr/lib64/python3.9/site-packages + export MY_CMAKE_BUILDDIR=riscv64-redhat-linux-gnu + MY_CMAKE_BUILDDIR=riscv64-redhat-linux-gnu + echo + echo '*** BUILDING neuron-7.8.1 ***' + echo + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules' + export FCFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_SKIP_RPATH:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DBUILD_SHARED_LIBS:BOOL=ON -DNRN_ENABLE_SHARED=ON -DNRN_ENABLE_INTERVIEWS=ON -DNRN_ENABLE_PYTHON=ON -DNRN_ENABLE_PYTHON_DYNAMIC=OFF -DNRN_ENABLE_THREADS=ON -DNRN_ENABLE_MEMACS=ON -DNRN_ENABLE_RX3D=ON -DNRN_ENABLE_CORENEURON=OFF -DNRN_ENABLE_TESTS=ON -DNRN_ENABLE_REL_RPATH=ON -DNRN_ENABLE_MODULE_INSTALL=ON -DNRN_ENABLE_INTERNAL_READLINE=OFF -DNRN_ENABLE_MPI=OFF -DMPI_INCLUDE_PATH=/usr/include -DMPI_LIBRARY= -DLIB_SUFFIX=64 -B riscv64-redhat-linux-gnu -- The C compiler identification is GNU 10.2.1 -- The CXX compiler identification is GNU 10.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/gcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Setting build type to 'RelWithDebInfo' as none was specified. -- Found BISON: /usr/bin/bison (found version "3.6.4") -- Found FLEX: /usr/bin/flex (found version "2.6.4") -- Found Readline: /usr/include -- Found PythonInterp: /usr/bin/python3.9 (found version "3.9.1") -- Found Cython: /usr/bin/cython (found version "0.29.21") -- Using external Interviews from -- Found PythonInterp: /usr/bin/python3.9 (found suitable version "3.9.1", minimum required is "3") -- Found PythonLibs: /usr/lib64/libpython3.9.so -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Found pytest: /usr/lib/python3.9/site-packages/pytest (found version "6.0.2") -- -- Configured NEURON 7.8 -- -- Some things you can do now: -- --------------+-------------------------------------------------------------- -- Command | Description -- --------------+-------------------------------------------------------------- -- make install | Will install NEURON to: /usr -- | Change the install location of NEURON using: -- | cmake -DCMAKE_INSTALL_PREFIX= -- make docs | Build the API documentation -- make uninstall| Removes files installed by make install (todo) -- --------------+-------------------------------------------------------------- -- Build option | Status -- --------------+-------------------------------------------------------------- -- BUILD_TYPE | RelWithDebInfo (allowed: Custom;Debug;Release;RelWithDebInfo;Fast) -- COMPILE FLAGS | -- Shared | ON -- Binary special| OFF -- Legacy FR | ON -- MPI | OFF -- Python | ON -- EXE | /usr/bin/python3.9 -- INC | /usr/include/python3.9 -- LIB | /usr/lib64/libpython3.9.so -- MODULE | ON -- DYNAMIC | OFF -- Readline | /usr/lib64/libreadline.so -- Curses | /usr/lib64/libcurses.so;/usr/lib64/libform.so -- RX3D | ON -- OptLevel | 0 -- Interviews | ON -- PATH | -- INC | /usr/include -- X11 (INC) | /usr/include -- CoreNEURON | OFF -- --------------+-------------------------------------------------------------- -- See documentation : https://www.neuron.yale.edu/neuron/ -- --------------+-------------------------------------------------------------- -- -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_Fortran_FLAGS_RELEASE LIB_SUFFIX MPI_INCLUDE_PATH MPI_LIBRARY SHARE_INSTALL_PREFIX SYSCONF_INSTALL_DIR -- Build files have been written to: /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu + /usr/bin/make -O -j4 V=1 VERBOSE=1 -C riscv64-redhat-linux-gnu make: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/cmake -S/builddir/build/BUILD/nrn-7.8.1 -B/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu --check-build-system CMakeFiles/Makefile.cmake 0 make: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/cmake -E cmake_progress_start /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu//CMakeFiles/progress.marks make: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f CMakeFiles/Makefile2 all /usr/bin/make -f src/nrniv/CMakeFiles/nocmodl.dir/build.make src/nrniv/CMakeFiles/nocmodl.dir/depend /usr/bin/make -f CMakeFiles/hh_update.dir/build.make CMakeFiles/hh_update.dir/depend /usr/bin/make -f src/nrniv/CMakeFiles/modlunit.dir/build.make src/nrniv/CMakeFiles/modlunit.dir/depend /usr/bin/make -f src/nrnpython/CMakeFiles/rxdmath.dir/build.make src/nrnpython/CMakeFiles/rxdmath.dir/depend make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles/hh_update.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles/hh_update.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles/hh_update.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/CMakeFiles/hh_update.dir/depend.internal". Scanning dependencies of target hh_update make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f CMakeFiles/hh_update.dir/build.make CMakeFiles/hh_update.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/src/nrnpython /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython/CMakeFiles/rxdmath.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython/CMakeFiles/rxdmath.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython/CMakeFiles/rxdmath.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython/CMakeFiles/rxdmath.dir/depend.internal". Scanning dependencies of target rxdmath make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 0%] [FLEX][nocmodllexer] Building scanner with flex 2.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/flex -o/builddir/build/BUILD/nrn-7.8.1/src/nmodl/lex.c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/lex.l make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f src/nrnpython/CMakeFiles/rxdmath.dir/build.make src/nrnpython/CMakeFiles/rxdmath.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 0%] [FLEX][modlunitlexer] Building scanner with flex 2.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/flex -o/builddir/build/BUILD/nrn-7.8.1/src/modlunit/lex.c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/lex.l make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 0%] Update hh.mod for CoreNEURON compatibility sed "s/ RANGE minf/ GLOBAL minf/" /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.mod > /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.1 sed "s/ :TABLE minf/ TABLE minf/" /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.1 > /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.2 /usr/bin/cmake -E copy_if_different /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.2 /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.mod /usr/bin/cmake -E remove /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.1 /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/hh.mod.2 make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Built target hh_update make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Building C object src/nrnpython/CMakeFiles/rxdmath.dir/rxdmath.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython && /usr/bin/gcc -DHAVE_CONFIG_H -Drxdmath_EXPORTS -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/rxdmath.dir/rxdmath.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnpython/rxdmath.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] [BISON][nocmodlparser] Building parser with bison 3.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/bison --defines=/builddir/build/BUILD/nrn-7.8.1/src/nmodl/diffeq.h -o /builddir/build/BUILD/nrn-7.8.1/src/nmodl/diffeq.c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/diffeq.y make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/diffeq.y: warning: 5 shift/reduce conflicts [-Wconflicts-sr] /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/depend make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/depend.internal". Scanning dependencies of target rxd_cython_generated make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rxd_cython_generated.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Linking C shared library ../../lib/librxdmath.so cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython && /usr/bin/cmake -E cmake_link_script CMakeFiles/rxdmath.dir/link.txt --verbose=1 /usr/bin/gcc -fPIC -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -shared -Wl,-soname,librxdmath.so.0.0.0 -o ../../lib/librxdmath.so.0.0.0 CMakeFiles/rxdmath.dir/rxdmath.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython && /usr/bin/cmake -E cmake_symlink_library ../../lib/librxdmath.so.0.0.0 ../../lib/librxdmath.so.0.0.0 ../../lib/librxdmath.so make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Built target rxdmath make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] [BISON][modlunitparser] Building parser with bison 3.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/bison --defines=/builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.h -o /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.y make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 0%] [BISON][nocmodlparser] Building parser with bison 3.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/bison --defines=/builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.h -o /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.y make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr] make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/modlunit.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/modlunit.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/modlunit.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/modlunit.dir/depend.internal". Scanning dependencies of target modlunit make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f src/nrniv/CMakeFiles/modlunit.dir/build.make src/nrniv/CMakeFiles/modlunit.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nocmodl.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nocmodl.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nocmodl.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nocmodl.dir/depend.internal". Scanning dependencies of target nocmodl make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f src/nrniv/CMakeFiles/nocmodl.dir/build.make src/nrniv/CMakeFiles/nocmodl.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 2%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/parse1.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/parse1.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.y: In function 'yyparse': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.y:292:37: warning: unused variable 'd' [-Wunused-variable] 292 | {P1{Item *q; double d, unit_mag(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/parse1.y:292:27: warning: unused variable 'q' [-Wunused-variable] 292 | {P1{Item *q; double d, unit_mag(); | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 2%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/parse1.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/parse1.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.y: In function 'yyparse': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.y:1127:34: warning: unused variable 'd' [-Wunused-variable] 1127 | {Item *q; double d, unit_mag(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parse1.y:1127:24: warning: unused variable 'q' [-Wunused-variable] 1127 | {Item *q; double d, unit_mag(); | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 2%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/lex.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/lex.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/lex.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/modlunit/lex.c:1471:16: warning: 'input' defined but not used [-Wunused-function] 1471 | #else | ^ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/lex.c:1428:17: warning: 'yyunput' defined but not used [-Wunused-function] 1428 | | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/diffeq.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/diffeq.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/diffeq.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/consist.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/consist.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/consist.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Generating surfaces.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && /usr/bin/cython -2 surfaces.pyx -o /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/surfaces.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && bash /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/cy_cpp_filt.sh /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/surfaces.cpp + file=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/surfaces.cpp + mingw= + test x = x1 make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 1%] Generating ctng.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && /usr/bin/cython -2 ctng.pyx -o /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/ctng.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && bash /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/cy_cpp_filt.sh /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/ctng.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' + file=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/ctng.cpp + mingw= + test x = x1 make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/consist.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/consist.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/consist.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/declare.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/declare.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/declare.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/lex.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/lex.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/lex.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/lex.c:1433:17: warning: 'yyunput' defined but not used [-Wunused-function] 1433 | | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/init.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/init.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/init.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/modlunit/init.c:18:30: warning: missing braces around initializer [-Wmissing-braces] 18 | } keywords[] = { | ^ 19 | "VERBATIM", VERBATIM, | { } 20 | "ENDVERBATIM", END_VERBATIM, /* explicit in lex.l */ | { } 21 | "COMMENT", COMMENT, | { } 22 | "ENDCOMMENT", END_COMMENT, /* explicit in lex.l */ | { } 23 | "TITLE", TITLE, | { } 24 | "CONSTANT", CONSTANT, | { } 25 | "PARAMETER", PARAMETER, | { } 26 | "INDEPENDENT", INDEPENDENT, | { } 27 | "ASSIGNED", ASSIGNED, | { } 28 | "INITIAL", INITIAL1, | { } 29 | "TERMINAL", TERMINAL, | { } 30 | "DERIVATIVE", DERIVATIVE, | { } 31 | "EQUATION", EQUATION, | { } 32 | "BREAKPOINT", BREAKPOINT, | { } 33 | "CONDUCTANCE", CONDUCTANCE, | { } 34 | "SOLVE", SOLVE, | { } 35 | "STATE", STATE, | { } 36 | "STEPPED", STEPPED, | { } 37 | "LINEAR", LINEAR, | { } 38 | "NONLINEAR", NONLINEAR, | { } 39 | "DISCRETE", DISCRETE, | { } 40 | "FUNCTION", FUNCTION1, | { } 41 | "FUNCTION_TABLE", FUNCTION_TABLE, | { } 42 | "PROCEDURE", PROCEDURE, | { } 43 | "PARTIAL", PARTIAL, | { } 44 | "INT", INT, | { } 45 | "DEL2", DEL2, | { } 46 | "DEL", DEL, | { } 47 | "LOCAL", LOCAL, | { } 48 | "METHOD", USING, | { } 49 | "STEADYSTATE", USING, | { } 50 | "SENS", SENS, | { } 51 | "STEP", STEP, | { } 52 | "WITH", WITH, | { } 53 | "FROM", FROM, | { } 54 | "TO", TO, | { } 55 | "BY", BY, | { } 56 | "if", IF, | { } 57 | "else", ELSE, | { } 58 | "while", WHILE, | { } 59 | "IF", IF, | { } 60 | "ELSE", ELSE, | { } 61 | "WHILE", WHILE, | { } 62 | "START", START1, | { } 63 | "DEFINE", DEFINE1, | { } 64 | 65 | "KINETIC", KINETIC, | { } 66 | "CONSERVE", CONSERVE, | { } 67 | "PLOT", PLOT, | { } 68 | "VS", VS, | { } 69 | "LAG", LAG, | { } 70 | "RESET", RESET, | { } 71 | "MATCH", MATCH, | { } 72 | "MODEL_LEVEL", MODEL_LEVEL, /* inserted by merge */ | { } 73 | "SWEEP", SWEEP, | { } 74 | "FIRST", FIRST, | { } 75 | "LAST", LAST, | { } 76 | "COMPARTMENT", COMPARTMENT, | { } 77 | "LONGITUDINAL_DIFFUSION", LONGDIFUS, | { } 78 | "PUTQ", PUTQ, | { } 79 | "GETQ", GETQ, | { } 80 | "IFERROR", IFERROR, | { } 81 | "SOLVEFOR", SOLVEFOR, | { } 82 | "UNITS", UNITBLK, | { } 83 | "UNITSON", UNITSON, | { } 84 | "UNITSOFF", UNITSOFF, | { } 85 | "TABLE", TABLE, | { } 86 | "DEPEND", DEPEND, | { } 87 | "NEURON", NEURON, | { } 88 | "SUFFIX", SUFFIX, | { } 89 | "POINT_PROCESS", SUFFIX, | { } 90 | "ARTIFICIAL_CELL", SUFFIX, | { } 91 | "NONSPECIFIC_CURRENT", NONSPECIFIC, | { } 92 | "ELECTRODE_CURRENT", ELECTRODE_CURRENT, | { } 93 | "USEION", USEION, | { } 94 | "READ", READ, | { } 95 | "WRITE", WRITE, | { } 96 | "RANGE", RANGE, | { } 97 | "SECTION", SECTION, | { } 98 | "VALENCE", VALENCE, | { } 99 | "GLOBAL", GLOBAL, | { } 100 | "POINTER", POINTER, | { } 101 | "BBCOREPOINTER", POINTER, | { } 102 | "EXTERNAL", EXTERNAL, | { } 103 | "INCLUDE", INCLUDE1, | { } 104 | "CONSTRUCTOR", CONSTRUCTOR, | { } 105 | "DESTRUCTOR", DESTRUCTOR, | { } 106 | "NET_RECEIVE", NETRECEIVE, | { } 107 | "BEFORE", BEFORE, /* before NEURON sets up cy' = f(y,t) */ | { } 108 | "AFTER", AFTER, /* after NEURON solves cy' = f(y, t) */ | { } 109 | "WATCH", WATCH, | { } 110 | "FOR_NETCONS", FOR_NETCONS, | { } 111 | "THREADSAFE", THREADSAFE, | { } 112 | "PROTECT", PROTECT, | { } 113 | 0, 0 | { 114 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/modlunit/init.c:124:29: warning: missing braces around initializer [-Wmissing-braces] 124 | } special[] = { | ^ 125 | ";", SEMI, &semi, | { } 126 | "{", BEGINBLK, &beginblk, | { } 127 | "}", ENDBLK, &endblk, | { } 128 | 0, 0, 0 | { 129 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/modlunit/init.c:135:29: warning: missing braces around initializer [-Wmissing-braces] 135 | } methods[] = { | ^ 136 | "adams", DERF | KINF, 0, | { } 137 | "runge", DERF | KINF, 0, | { } 138 | "euler", DERF | KINF, 0, | { } 139 | "adeuler", DERF | KINF, 1, | { } 140 | "heun", DERF | KINF, 0, | { } 141 | "adrunge", DERF | KINF, 1, | { } 142 | "newton", NLINF, 0, | { } 143 | "simplex", NLINF, 0, | { } 144 | "simeq", LINF, 0, | { } 145 | "seidel", LINF, 0, | { } 146 | "_advance", KINF, 0, | { } 147 | "sparse", KINF, 0, | { } 148 | "derivimplicit", DERF, 0, /* name hard wired in deriv.c */ | { } 149 | "cnexp", DERF, 0, | { } 150 | "clsoda", DERF | KINF, 0, /* Tolerance built in to | { } 151 | scopgear.c */ 152 | "after_cvode", 0, 0, | { } 153 | "cvode_t", 0, 0, | { } 154 | "cvode_t_v", 0, 0, | { } 155 | 0, 0, 0 | { 156 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 4%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/discrete.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/discrete.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/discrete.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/io.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/io.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/io.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/init.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/init.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/init.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/init.c:16:30: warning: missing braces around initializer [-Wmissing-braces] 16 | } keywords[] = { | ^ 17 | "VERBATIM", VERBATIM, | { } 18 | "COMMENT", COMMENT, | { } 19 | "TITLE", MODEL, | { } 20 | "CONSTANT", CONSTANT, | { } 21 | "PARAMETER", PARAMETER, | { } 22 | "INDEPENDENT", INDEPENDENT, | { } 23 | "ASSIGNED", DEPENDENT, | { } 24 | "INITIAL", INITIAL1, | { } 25 | "TERMINAL", TERMINAL, | { } 26 | "DERIVATIVE", DERIVATIVE, | { } 27 | "EQUATION", EQUATION, | { } 28 | "BREAKPOINT", BREAKPOINT, | { } 29 | "CONDUCTANCE", CONDUCTANCE, | { } 30 | "SOLVE", SOLVE, | { } 31 | "STATE", STATE, | { } 32 | "STEPPED", STEPPED, | { } 33 | "LINEAR", LINEAR, | { } 34 | "NONLINEAR", NONLINEAR, | { } 35 | "DISCRETE", DISCRETE, | { } 36 | "FUNCTION", FUNCTION1, | { } 37 | "FUNCTION_TABLE", FUNCTION_TABLE, | { } 38 | "PROCEDURE", PROCEDURE, | { } 39 | "PARTIAL", PARTIAL, | { } 40 | "INT", INT, | { } 41 | "DEL2", DEL2, | { } 42 | "DEL", DEL, | { } 43 | "LOCAL", LOCAL, | { } 44 | "METHOD", USING, | { } 45 | "STEADYSTATE", USING, | { } 46 | "SENS", SENS, | { } 47 | "STEP", STEP, | { } 48 | "WITH", WITH, | { } 49 | "FROM", FROM, | { } 50 | "FORALL", FORALL1, | { } 51 | "TO", TO, | { } 52 | "BY", BY, | { } 53 | "if", IF, | { } 54 | "else", ELSE, | { } 55 | "while", WHILE, | { } 56 | "START", START1, | { } 57 | "DEFINE", DEFINE1, | { } 58 | 59 | "KINETIC", KINETIC, | { } 60 | "CONSERVE", CONSERVE, | { } 61 | "PLOT", PLOT, | { } 62 | "VS", VS, | { } 63 | "LAG", LAG, | { } 64 | "RESET", RESET, | { } 65 | "MATCH", MATCH, | { } 66 | "MODEL_LEVEL", MODEL_LEVEL, /* inserted by merge */ | { } 67 | "SWEEP", SWEEP, | { } 68 | "FIRST", FIRST, | { } 69 | "LAST", LAST, | { } 70 | "COMPARTMENT", COMPARTMENT, | { } 71 | "LONGITUDINAL_DIFFUSION", LONGDIFUS, | { } 72 | "PUTQ", PUTQ, | { } 73 | "GETQ", GETQ, | { } 74 | "IFERROR", IFERROR, | { } 75 | "SOLVEFOR", SOLVEFOR, | { } 76 | "UNITS", UNITS, | { } 77 | "UNITSON", UNITSON, | { } 78 | "UNITSOFF", UNITSOFF, | { } 79 | "TABLE", TABLE, | { } 80 | "DEPEND", DEPEND, | { } 81 | "NEURON", NEURON, | { } 82 | "SUFFIX", SUFFIX, | { } 83 | "POINT_PROCESS", SUFFIX, | { } 84 | "ARTIFICIAL_CELL", SUFFIX, | { } 85 | "NONSPECIFIC_CURRENT", NONSPECIFIC, | { } 86 | "ELECTRODE_CURRENT", ELECTRODE_CURRENT, | { } 87 | "SECTION", SECTION, | { } 88 | "RANGE", RANGE, | { } 89 | "USEION", USEION, | { } 90 | "READ", READ, | { } 91 | "WRITE", WRITE, | { } 92 | "VALENCE", VALENCE, | { } 93 | "CHARGE", VALENCE, | { } 94 | "GLOBAL", GLOBAL, | { } 95 | "POINTER", POINTER, | { } 96 | "BBCOREPOINTER", BBCOREPOINTER, | { } 97 | "EXTERNAL", EXTERNAL, | { } 98 | "INCLUDE", INCLUDE1, | { } 99 | "CONSTRUCTOR", CONSTRUCTOR, | { } 100 | "DESTRUCTOR", DESTRUCTOR, | { } 101 | "NET_RECEIVE", NETRECEIVE, | { } 102 | "BEFORE", BEFORE, /* before NEURON sets up cy' = f(y,t) */ | { } 103 | "AFTER", AFTER, /* after NEURON solves cy' = f(y, t) */ | { } 104 | "WATCH", WATCH, | { } 105 | "FOR_NETCONS", FOR_NETCONS, | { } 106 | "THREADSAFE", THREADSAFE, | { } 107 | "PROTECT", PROTECT, | { } 108 | "MUTEXLOCK", NRNMUTEXLOCK, | { } 109 | "MUTEXUNLOCK", NRNMUTEXUNLOCK, | { } 110 | "REPRESENTS", REPRESENTS, | { } 111 | 0, 0 | { 112 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nmodl/init.c:122:29: warning: missing braces around initializer [-Wmissing-braces] 122 | } special[] = { | ^ 123 | ";", SEMI, &semi, | { } 124 | "{", BEGINBLK, &beginblk, | { } 125 | "}", ENDBLK, &endblk, | { } 126 | 0, 0, 0 | { 127 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nmodl/init.c:133:29: warning: missing braces around initializer [-Wmissing-braces] 133 | } methods[] = { | ^ 134 | "adams", DERF | KINF, 0, | { } 135 | "runge", DERF | KINF, 0, | { } 136 | "euler", DERF | KINF, 0, | { } 137 | "adeuler", DERF | KINF, 1, | { } 138 | "heun", DERF | KINF, 0, | { } 139 | "adrunge", DERF | KINF, 1, | { } 140 | "gear", DERF | KINF, 1, | { } 141 | "newton", NLINF, 0, | { } 142 | "simplex", NLINF, 0, | { } 143 | "simeq", LINF, 0, | { } 144 | "seidel", LINF, 0, | { } 145 | "_advance", KINF, 0, | { } 146 | "sparse", KINF, 0, | { } 147 | "derivimplicit", DERF, 0, /* name hard wired in deriv.c */ | { } 148 | "cnexp", DERF, 0, /* see solve.c */ | { } 149 | "clsoda", DERF | KINF, 1, /* Tolerance built in to | { } 150 | scopgear.c */ 151 | "after_cvode", 0, 0, | { } 152 | "cvode_t", 0, 0, | { } 153 | "cvode_t_v", 0, 0, | { } 154 | 0, 0, 0 | { 155 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/deriv.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/deriv.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/deriv.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/deriv.c: In function 'massagederiv': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/deriv.c:432:33: warning: unused variable 'solve_seen' [-Wunused-variable] 432 | int count = 0, deriv_implicit, solve_seen; | ^~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/kinunit.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/kinunit.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/kinunit.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/list.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/list.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/list.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/io.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/io.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/io.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/nrnunit.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/nrnunit.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/nrnunit.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/model.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/model.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.c: In function 'openfiles': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.c:145:22: warning: '%s' directive writing up to 8191 bytes into a region of size 8187 [-Wformat-overflow=] 145 | sprintf(modprefix, "%s", argv[1]); | ^~~~ In file included from /usr/include/stdio.h:866, from /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.h:3, from /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.c:27: /usr/include/bits/stdio2.h:38:10: note: '__sprintf_chk' output between 1 and 8192 bytes into a destination of size 8187 38 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 6%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/passn.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/passn.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/passn.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/list.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/list.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/list.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 6%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/symbol.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/symbol.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c:4: /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c: In function 'lookup': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c:27:23: warning: array subscript has type 'char' [-Wchar-subscripts] 27 | ITERATE(sp, symlist[s[0]]) { | ~^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.h:25:38: note: in definition of macro 'ITERATE' 25 | #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next) | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c:27:23: warning: array subscript has type 'char' [-Wchar-subscripts] 27 | ITERATE(sp, symlist[s[0]]) { | ~^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/model.h:25:58: note: in definition of macro 'ITERATE' 25 | #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next) | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c: In function 'install': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/symbol.c:69:17: warning: array subscript has type 'char' [-Wchar-subscripts] 69 | sl = symlist[s[0]]; | ~^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 5%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/kinetic.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/kinetic.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c: In function 'flux': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:251:8: warning: unused variable 'isfunc' [-Wunused-variable] 251 | int isfunc; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c: In function 'kinetic_implicit': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:706:23: warning: unused variable 'sparsedec' [-Wunused-variable] 706 | int i, nstate, flag, sparsedec, firsttrans, firsttrans1; | ^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c: In function 'massageconserve': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:1024:8: warning: variable 'qv' set but not used [-Wunused-but-set-variable] 1024 | Item* qv; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c: In function 'kinlist': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:1160:8: warning: variable 'qv' set but not used [-Wunused-but-set-variable] 1160 | Item* qv; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c: In function 'single_channel': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:1590:6: warning: variable 'nstate' set but not used [-Wunused-but-set-variable] 1590 | int nstate, i; | ^~~~~~ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:1415:14: warning: 'astmt_last' defined but not used [-Wunused-variable] 1415 | static Item* astmt_last; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:120:12: warning: 'sparsedeclared' defined but not used [-Wunused-function] 120 | static int sparsedeclared(i) int i; { | ^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/kinetic.c:110:14: warning: 'instance_loop' defined but not used [-Wunused-function] 110 | static char* instance_loop() { | ^~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 7%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/modl.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/modl.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/modl.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/modl.c:77:13: warning: 'pgm_name' defined but not used [-Wunused-variable] 77 | static char pgm_name[] = "nmodl"; | ^~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 7%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/units1.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/units1.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units1.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 7%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/version.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/version.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/version.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 6%] Building C object src/nrniv/CMakeFiles/modlunit.dir/__/modlunit/units.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DNRNUNIT=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/modlunit.dir/__/modlunit/units.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:76:1: warning: missing braces around initializer [-Wmissing-braces] 76 | { | ^ 77 | 1e-18, "atto", | { } 78 | 1e-15, "femto", | { } 79 | 1e-12, "pico", | { } 80 | 1e-9, "nano", | { } 81 | 1e-6, "micro", | { } 82 | 1e-3, "milli", | { } 83 | 1e-2, "centi", | { } 84 | 1e-1, "deci", | { } 85 | 1e1, "deka", | { } 86 | 1e2, "hecta", | { } 87 | 1e2, "hecto", | { } 88 | 1e3, "kilo", | { } 89 | 1e6, "mega", | { } 90 | 1e6, "meg", | { } 91 | 1e9, "giga", | { } 92 | 1e12, "tera", | { } 93 | 0.0, 0 | { 94 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c: In function 'pu': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:660:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 660 | if(u > 1) | ^~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:662:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 662 | return(2); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c: In function 'unit_stk_clean': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:487:19: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 487 | usp = unit_stack - 1; | ~~~~~~~~~~~^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c: In function 'punit': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:185:27: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 185 | for (i=usp; i!=unit_stack-1; --i) { | ~~~~~~~~~~^~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c: In function 'unit_init': /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:487:19: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 487 | usp = unit_stack - 1; | ~~~~~~~~~~~^~~ /builddir/build/BUILD/nrn-7.8.1/src/modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 3%] Generating graphicsPrimitives.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && /usr/bin/cython -2 graphicsPrimitives.pyx -o /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/graphicsPrimitives.cpp cd /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d && bash /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/cy_cpp_filt.sh /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/graphicsPrimitives.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' + file=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/graphicsPrimitives.cpp + mingw= + test x = x1 make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 8%] Built target rxd_cython_generated make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 7%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/noccout.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/noccout.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/noccout.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/depend make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/depend.internal". Scanning dependencies of target rx3dextensions_0 make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3dextensions_0.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d && bash /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/runpy.sh /usr/bin/python3.9 runpy /usr/bin/python3.9 running build_ext make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' + echo runpy /usr/bin/python3.9 + pyexe=/usr/bin/python3.9 + mingw= + shift + test x = x1 + /usr/bin/python3.9 setup.py build_ext --build-lib=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/lib/python make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 8%] Built target rx3dextensions_0 make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 8%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/parsact.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/parsact.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/depend /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c: In function 'vectorize_scan_for_func': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c:403:6: warning: unused variable 'b' [-Wunused-variable] 403 | int b; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c:402:12: warning: unused variable 'qq' [-Wunused-variable] 402 | Item* q, *qq; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c: In function 'defarg': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c:425:18: warning: unused variable 'q3' [-Wunused-variable] 425 | Item *q3, *q; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c: In function 'hocfunchack': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/parsact.c:959:8: warning: unused variable 'q' [-Wunused-variable] 959 | Item *q; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/depend.internal". Scanning dependencies of target rx3d make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/build.make share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 8%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/netrec_discon.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/netrec_discon.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/netrec_discon.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/netrec_discon.c: In function 'general_discon_adjust': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/netrec_discon.c:158:7: warning: unused variable 'i' [-Wunused-variable] 158 | int i; | ^ make[2]: Nothing to be done for 'share/lib/python/neuron/rxd/geometry3d/CMakeFiles/rx3d.dir/build'. make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Built target rx3d make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/partial.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/partial.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/partial.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/sens.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/sens.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/sens.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 7%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/nocpout.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/nocpout.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'parout': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:224:9: warning: unused variable 'j' [-Wunused-variable] 224 | int i, j, ioncount, pointercount, gind, emit_check_table_thread; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'decode_limits': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:1377:9: warning: unused variable 'd1' [-Wunused-variable] 1377 | double d1; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'decode_tolerance': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:1404:9: warning: unused variable 'd1' [-Wunused-variable] 1404 | double d1; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'cvode_rw_cur': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:2537:10: warning: variable 'sion' set but not used [-Wunused-but-set-variable] 2537 | Symbol* sion; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'net_receive': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:2566:9: warning: unused variable 'b' [-Wunused-variable] 2566 | int i, b; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c: In function 'conductance_hint': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:2744:8: warning: unused variable 'q' [-Wunused-variable] 2744 | Item* q; | ^ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:180:12: warning: 'cvode_index' defined but not used [-Wunused-variable] 180 | static int cvode_index; | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/nocpout.c:177:12: warning: 'cond_index' defined but not used [-Wunused-variable] 177 | static int cond_index; | ^~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/simultan.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/simultan.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/simultan.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/solve.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/solve.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/solve.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nmodl/solve.c: In function 'whileloop': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/solve.c:393:8: warning: variable 'cp' set but not used [-Wunused-but-set-variable] 393 | char *cp=0; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/version.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/version.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/version.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 9%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/symbol.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/symbol.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c:3: /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c: In function 'lookup': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c:25:23: warning: array subscript has type 'char' [-Wchar-subscripts] 25 | ITERATE(sp, symlist[s[0]]) { | ~^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/modl.h:110:38: note: in definition of macro 'ITERATE' 110 | #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next) | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c:25:23: warning: array subscript has type 'char' [-Wchar-subscripts] 25 | ITERATE(sp, symlist[s[0]]) { | ~^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/modl.h:110:58: note: in definition of macro 'ITERATE' 110 | #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next) | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c: In function 'install': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/symbol.c:65:17: warning: array subscript has type 'char' [-Wchar-subscripts] 65 | sl = symlist[s[0]]; | ~^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Building C object src/nrniv/CMakeFiles/nocmodl.dir/__/nmodl/units.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -DCVODE=1 -DNMODL=1 -DNOCMODL=1 -DVECTORIZE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -o CMakeFiles/nocmodl.dir/__/nmodl/units.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nmodl/units.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nmodl/units.c:6: /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:76:1: warning: missing braces around initializer [-Wmissing-braces] 76 | { | ^ 77 | 1e-18, "atto", | { } 78 | 1e-15, "femto", | { } 79 | 1e-12, "pico", | { } 80 | 1e-9, "nano", | { } 81 | 1e-6, "micro", | { } 82 | 1e-3, "milli", | { } 83 | 1e-2, "centi", | { } 84 | 1e-1, "deci", | { } 85 | 1e1, "deka", | { } 86 | 1e2, "hecta", | { } 87 | 1e2, "hecto", | { } 88 | 1e3, "kilo", | { } 89 | 1e6, "mega", | { } 90 | 1e6, "meg", | { } 91 | 1e9, "giga", | { } 92 | 1e12, "tera", | { } 93 | 0.0, 0 | { 94 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c: In function 'pu': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:660:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 660 | if(u > 1) | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:662:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 662 | return(2); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c: In function 'unit_stk_clean': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:487:19: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 487 | usp = unit_stack - 1; | ~~~~~~~~~~~^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c: In function 'punit': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:185:27: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 185 | for (i=usp; i!=unit_stack-1; --i) { | ~~~~~~~~~~^~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c: In function 'unit_init': /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:487:19: warning: array subscript -1 is outside array bounds of 'struct unit[20]' [-Warray-bounds] 487 | usp = unit_stack - 1; | ~~~~~~~~~~~^~~ /builddir/build/BUILD/nrn-7.8.1/src/nmodl/../modlunit/units.c:121:20: note: while referencing 'unit_stack' 121 | static struct unit unit_stack[UNIT_STK_SIZE], *usp; | ^~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 8%] Linking C executable ../../bin/modlunit cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E cmake_link_script CMakeFiles/modlunit.dir/link.txt --verbose=1 /usr/bin/gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -rdynamic CMakeFiles/modlunit.dir/__/modlunit/parse1.c.o CMakeFiles/modlunit.dir/__/modlunit/lex.c.o CMakeFiles/modlunit.dir/__/modlunit/consist.c.o CMakeFiles/modlunit.dir/__/modlunit/declare.c.o CMakeFiles/modlunit.dir/__/modlunit/init.c.o CMakeFiles/modlunit.dir/__/modlunit/io.c.o CMakeFiles/modlunit.dir/__/modlunit/kinunit.c.o CMakeFiles/modlunit.dir/__/modlunit/list.c.o CMakeFiles/modlunit.dir/__/modlunit/model.c.o CMakeFiles/modlunit.dir/__/modlunit/nrnunit.c.o CMakeFiles/modlunit.dir/__/modlunit/passn.c.o CMakeFiles/modlunit.dir/__/modlunit/symbol.c.o CMakeFiles/modlunit.dir/__/modlunit/units.c.o CMakeFiles/modlunit.dir/__/modlunit/units1.c.o CMakeFiles/modlunit.dir/__/modlunit/version.c.o -o ../../bin/modlunit make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Built target modlunit make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Linking C executable ../../bin/nocmodl cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E cmake_link_script CMakeFiles/nocmodl.dir/link.txt --verbose=1 /usr/bin/gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -rdynamic CMakeFiles/nocmodl.dir/__/nmodl/parse1.c.o CMakeFiles/nocmodl.dir/__/nmodl/diffeq.c.o CMakeFiles/nocmodl.dir/__/nmodl/lex.c.o CMakeFiles/nocmodl.dir/__/nmodl/consist.c.o CMakeFiles/nocmodl.dir/__/nmodl/deriv.c.o CMakeFiles/nocmodl.dir/__/nmodl/discrete.c.o CMakeFiles/nocmodl.dir/__/nmodl/init.c.o CMakeFiles/nocmodl.dir/__/nmodl/io.c.o CMakeFiles/nocmodl.dir/__/nmodl/kinetic.c.o CMakeFiles/nocmodl.dir/__/nmodl/list.c.o CMakeFiles/nocmodl.dir/__/nmodl/modl.c.o CMakeFiles/nocmodl.dir/__/nmodl/nocpout.c.o CMakeFiles/nocmodl.dir/__/nmodl/noccout.c.o CMakeFiles/nocmodl.dir/__/nmodl/parsact.c.o CMakeFiles/nocmodl.dir/__/nmodl/netrec_discon.c.o CMakeFiles/nocmodl.dir/__/nmodl/partial.c.o CMakeFiles/nocmodl.dir/__/nmodl/sens.c.o CMakeFiles/nocmodl.dir/__/nmodl/simultan.c.o CMakeFiles/nocmodl.dir/__/nmodl/solve.c.o CMakeFiles/nocmodl.dir/__/nmodl/symbol.c.o CMakeFiles/nocmodl.dir/__/nmodl/units.c.o CMakeFiles/nocmodl.dir/__/nmodl/version.c.o -o ../../bin/nocmodl make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[1]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Built target nocmodl make[1]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f src/nrniv/CMakeFiles/nrniv_lib.dir/build.make src/nrniv/CMakeFiles/nrniv_lib.dir/depend make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Generating ../../../src/nrnoc/svclmp.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/svclmp.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Generating ../../../src/nrnoc/apcount.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/apcount.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 11%] Generating ../../../src/nrnoc/intfire2.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 11%] Generating ../../../src/nrnoc/feature.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire2.c Thread Safe Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/feature.c Notice: VERBATIM blocks are not thread safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] Generating ../nrnoc/hocusr.h cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -E -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/neuron.h > neuron.tmp1 cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed /^#/d neuron.tmp1 > neuron.tmp2 cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/python3.9 /builddir/build/BUILD/nrn-7.8.1/src/oc/mk_hocusr_h.py < neuron.tmp2 > temp2hoc cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed s/\"nrnhoc_topology\"/\"topology\"/ temp2hoc > /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 11%] Generating ../../../src/nrnoc/oclmp.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/oclmp.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 11%] Generating ../../../src/nrnoc/ppmark.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ppmark.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/syn.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/syn.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/exp2syn.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/exp2syn.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/hh.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hh.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/intfire4.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire4.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/passive.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 12%] Generating ../../../src/nrnoc/vclmp.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/vclmp.c Notice: VERBATIM blocks are not thread safe Notice: LINEAR is not thread safe. make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 13%] Generating ../../../src/nrnoc/stim.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/stim.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 10%] [BISON][ocparser] Building parser with bison 3.6.4 cd /builddir/build/BUILD/nrn-7.8.1/src/nrniv && /usr/bin/bison --defines=/builddir/build/BUILD/nrn-7.8.1/src/oc/parse.h -o /builddir/build/BUILD/nrn-7.8.1/src/oc/parse.c /builddir/build/BUILD/nrn-7.8.1/src/oc/parse.y make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/oc/parse.y: warning: 98 shift/reduce conflicts [-Wconflicts-sr] make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 13%] Generating ../../../src/nrnoc/expsyn.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/expsyn.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 13%] Generating ../../../src/nrnoc/intfire1.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.mod cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/intfire1.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 13%] Generating ../../../src/nrnoc/netstim.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.mod Notice: ARTIFICIAL_CELL is a synonym for POINT_PROCESS which hints that it only affects and is affected by discrete events. As such it is not located in a section and is not associated with an integrator cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/netstim.c Thread Safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 14%] Generating ../../../src/nrnoc/pattern.c cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/cmake -E env MODLUNIT=/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/share/nrn/lib/nrnunits.lib /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/bin/nocmodl /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.mod Notice: ARTIFICIAL_CELL is a synonym for POINT_PROCESS which hints that it only affects and is affected by discrete events. As such it is not located in a section and is not associated with an integrator cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && sed 's/_reg()/_reg_()/' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.c > /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.c.tmp cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && mv /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.c.tmp /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' Translating /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.mod into /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/pattern.c Notice: Use of POINTER is not thread safe. Notice: VERBATIM blocks are not thread safe make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /builddir/build/BUILD/nrn-7.8.1 /builddir/build/BUILD/nrn-7.8.1/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nrniv_lib.dir/DependInfo.cmake --color= Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nrniv_lib.dir/DependInfo.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nrniv_lib.dir/depend.internal". Dependee "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv/CMakeFiles/nrniv_lib.dir/depend.internal". Scanning dependencies of target nrniv_lib make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /usr/bin/make -f src/nrniv/CMakeFiles/nrniv_lib.dir/build.make src/nrniv/CMakeFiles/nrniv_lib.dir/build make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 14%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/bndedval.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/bndedval.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/bndedval.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 15%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/cbwidget.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/cbwidget.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/cbwidget.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 14%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/apwindow.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/apwindow.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/apwindow.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 14%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/axis.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/axis.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/axis.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 15%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/epsprint.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/epsprint.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/epsprint.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 15%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/fourier.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/fourier.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:38: /builddir/build/BUILD/nrn-7.8.1/src/ivoc/nrngsl_real_radix2.c: In function 'int nrngsl_fft_real_radix2_transform(double*, size_t, size_t)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/nrngsl_real_radix2.c:91:7: warning: variable 'status' set but not used [-Wunused-but-set-variable] 91 | int status; | ^~~~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:39: /builddir/build/BUILD/nrn-7.8.1/src/ivoc/nrngsl_hc_radix2.c: In function 'int nrngsl_fft_halfcomplex_radix2_transform(double*, size_t, size_t)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/nrngsl_hc_radix2.c:63:7: warning: variable 'status' set but not used [-Wunused-but-set-variable] 63 | int status; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp: In function 'void nrn_convlv(double*, long unsigned int, double*, long unsigned int, int, double*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:98:14: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'int' [-Wsign-compare] 98 | for (i=1; i < n2; ++i) { | ~~^~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:86:14: warning: unused variable 'x_' [-Wunused-variable] 86 | double scl, x_; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp: In function 'void nrn_spctrm(double*, double*, int, int)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:149:13: warning: variable 'ainv' set but not used [-Wunused-but-set-variable] 149 | double a, ainv, wfac, x_; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/fourier.cpp:149:25: warning: unused variable 'x_' [-Wunused-variable] 149 | double a, ainv, wfac, x_; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 15%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/gifimage.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/gifimage.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp: In function 'int LoadGIF(const char*, PICINFO*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp:288:8: warning: variable 'ch' set but not used [-Wunused-but-set-variable] 288 | int ch, j, sbsize, cmtlen; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp:156:22: warning: unused variable 'ch1' [-Wunused-variable] 156 | register byte ch, ch1, *origptr; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp: In function 'int readImage(PICINFO*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp:490:34: warning: unused variable 'picptr' [-Wunused-variable] 490 | register byte ch, ch1, *ptr1, *picptr; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp:96:5: warning: 'BytesPerScanline' defined but not used [-Wunused-variable] 96 | BytesPerScanline, /* bytes per scanline in output raster */ | ^~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp: In function 'gif_image(char const*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/gifimage.cpp:43:9: warning: 'image' may be used uninitialized in this function [-Wmaybe-uninitialized] 43 | return image; | ^~~~~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 15%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/checkpnt.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/checkpnt.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/checkpnt.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 16%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/graphvec.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/graphvec.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graphvec.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 16%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/grglyph.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/grglyph.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/grglyph.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 16%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/grmanip.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/grmanip.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/grmanip.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/grmanip.cpp: In member function 'virtual void HocMark::pick(ivCanvas*, const ivAllocation&, int, ivHit&)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/grmanip.cpp:147:9: warning: unused variable 'x' [-Wunused-variable] 147 | Coord x = h.left(), y = h.bottom(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/grmanip.cpp:147:23: warning: unused variable 'y' [-Wunused-variable] 147 | Coord x = h.left(), y = h.bottom(); | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 17%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/hocmark.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/hocmark.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/hocmark.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 17%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/htlist.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/htlist.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/htlist.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 17%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ivocmain.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ivocmain.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp: In function 'bool nrn_optarg_on(const char*, int*, const char**)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp:337:8: warning: unused variable 'a' [-Wunused-variable] 337 | char* a; | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp:332:13: warning: 'bool nrn_optarg_on(const char*, int*, char**)' declared 'static' but never defined [-Wunused-function] 332 | static bool nrn_optarg_on(const char* opt, int* argc, char** argv); | ^~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp:333:14: warning: 'char* nrn_optarg(const char*, int*, char**)' declared 'static' but never defined [-Wunused-function] 333 | static char* nrn_optarg(const char* opt, int* argc, char** argv); | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocmain.cpp:334:12: warning: 'int nrn_optargint(const char*, int*, char**, int)' declared 'static' but never defined [-Wunused-function] 334 | static int nrn_optargint(const char* opt, int* argc, char** argv, int dflt); | ^~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 17%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/idraw.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/idraw.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/idraw.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 17%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ivoc.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ivoc.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivoc.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 16%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/graph.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/graph.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp: In function 'double ivoc_view_size(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp:433:6: warning: unused variable 'i' [-Wunused-variable] 433 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp: In member function 'void Graph::ascii_save(std::ostream&) const': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp:1692:9: warning: unused variable 'j' [-Wunused-variable] 1692 | int j, jcnt; | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp: In member function 'virtual void Graph::wholeplot(ivCoord&, ivCoord&, ivCoord&, ivCoord&) const': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp:1812:13: warning: unused variable 'gl' [-Wunused-variable] 1812 | GraphLine* gl; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp: In member function 'void Graph::cross_action(char, GPolyLine*, int)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp:2064:8: warning: unused variable 'buf' [-Wunused-variable] 2064 | char buf[256]; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp: In member function 'virtual void LineExtension::request(ivRequisition&) const': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/graph.cpp:3392:14: warning: unused variable 'eps' [-Wunused-variable] 3392 | const float eps = 1e-4; | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 18%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ivocrand.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ivocrand.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocrand.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocrand.cpp:32: /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h: In constructor 'RandomInteger::RandomInteger(long int, long int, RNG*)': /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:54:8: warning: 'RandomInteger::pHigh' will be initialized after [-Wreorder] 54 | long pHigh; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:52:8: warning: 'RNG* RandomInteger::pGenerator' [-Wreorder] 52 | RNG *pGenerator; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:93:8: warning: when initialized here [-Wreorder] 93 | inline RandomInteger::RandomInteger(long low, long high, RNG *gen) | ^~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h: In constructor 'RandomInteger::RandomInteger(long int, RNG*)': /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:54:8: warning: 'RandomInteger::pHigh' will be initialized after [-Wreorder] 54 | long pHigh; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:52:8: warning: 'RNG* RandomInteger::pGenerator' [-Wreorder] 52 | RNG *pGenerator; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:99:8: warning: when initialized here [-Wreorder] 99 | inline RandomInteger::RandomInteger(long high, RNG *gen) | ^~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h: In constructor 'RandomInteger::RandomInteger(RNG*)': /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:54:8: warning: 'RandomInteger::pHigh' will be initialized after [-Wreorder] 54 | long pHigh; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:52:8: warning: 'RNG* RandomInteger::pGenerator' [-Wreorder] 52 | RNG *pGenerator; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/gnu/RndInt.h:106:8: warning: when initialized here [-Wreorder] 106 | inline RandomInteger::RandomInteger(RNG *gen) | ^~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 18%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/mlinedit.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/mlinedit.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mlinedit.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mlinedit.cpp: In function 'void* cons(Object*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mlinedit.cpp:139:1: warning: control reaches end of non-void function [-Wreturn-type] 139 | } | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 18%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/matrix.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/matrix.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/matrix.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/matrix.cpp: In function 'void steer_x(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/matrix.cpp:731:10: warning: unused variable 's' [-Wunused-variable] 731 | Symbol* s = hoc_spop(); | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 18%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/mymath.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/mymath.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mymath.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mymath.cpp: In function 'int nrn_feround(int)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/mymath.cpp:37:6: warning: unused variable 'm' [-Wunused-variable] 37 | int m; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 19%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/objcmd.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/objcmd.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/objcmd.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 19%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/oc2iv.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/oc2iv.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/oc2iv.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 19%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocbrowsr.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocbrowsr.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocbrowsr.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 19%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocbox.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocbox.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocbox.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocbox.cpp: In member function 'virtual void OcBox::box_append(OcGlyph*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocbox.cpp:577:13: warning: unused variable 'wk' [-Wunused-variable] 577 | WidgetKit& wk = *WidgetKit::instance(); | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 19%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocdeck.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocdeck.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocdeck.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocdeck.cpp: In member function 'virtual void OcDeck::box_append(OcGlyph*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocdeck.cpp:293:13: warning: unused variable 'wk' [-Wunused-variable] 293 | WidgetKit& wk = *WidgetKit::instance(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocdeck.cpp:294:13: warning: unused variable 'lk' [-Wunused-variable] 294 | LayoutKit& lk = *LayoutKit::instance(); | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 18%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ivocvect.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ivocvect.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'double v_fread(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:445:12: note: in expansion of macro 'FRead' 445 | FRead(xs,sizeof(short),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:454:12: note: in expansion of macro 'FRead' 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:460:12: note: in expansion of macro 'FRead' 460 | FRead(xf,sizeof(float),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:472:12: note: in expansion of macro 'FRead' 472 | FRead(xi,sizeof(unsigned short),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:483:12: note: in expansion of macro 'FRead' 483 | FRead(xc,sizeof(char),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:418:8: warning: unused variable 's' [-Wunused-variable] 418 | void* s = (void*)(vp->vec()); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'double v_vwrite(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:66:69: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 66 | #define FWrite(arg1,arg2,arg3,arg4) if (fwrite(arg1,arg2,arg3,arg4) != arg3){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:532:5: note: in expansion of macro 'FWrite' 532 | FWrite(xi,sizeof(int),n,fp); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:66:69: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 66 | #define FWrite(arg1,arg2,arg3,arg4) if (fwrite(arg1,arg2,arg3,arg4) != arg3){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:541:5: note: in expansion of macro 'FWrite' 541 | FWrite(x,sizeof(double),n,fp); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:66:69: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 66 | #define FWrite(arg1,arg2,arg3,arg4) if (fwrite(arg1,arg2,arg3,arg4) != arg3){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:551:5: note: in expansion of macro 'FWrite' 551 | FWrite(xf,sizeof(float),n,fp); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:66:69: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 66 | #define FWrite(arg1,arg2,arg3,arg4) if (fwrite(arg1,arg2,arg3,arg4) != arg3){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:577:5: note: in expansion of macro 'FWrite' 577 | FWrite(x,sizeof(unsigned short),n,fp); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:66:69: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 66 | #define FWrite(arg1,arg2,arg3,arg4) if (fwrite(arg1,arg2,arg3,arg4) != arg3){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:602:5: note: in expansion of macro 'FWrite' 602 | FWrite(x,sizeof(char),n,fp); | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'double v_vread(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | free(xc); | ~~~~~~~~~ 604 | break; | ~~~~~~ 605 | } | ~ 606 | | 607 | } | ~ 608 | return 1; | ~~~~~~~~~ 609 | } | ~ 610 | | 611 | | 612 | static double v_vread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 614 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | | 616 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | BYTEHEADER | ~~~~~~~~~~ 620 | | 621 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 622 | if (!fp) { | ~~~~~~~~~~ 623 | return 0.; | ~~~~~~~~~~ 624 | } | ~ 625 | | 626 | BinaryMode(f) | ~~~~~~~~~~~~~ 627 | int n; | ~~~~~~ 628 | FRead(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 629 | | 630 | int type = 0; | ~~~~~~~~~~~~~ 631 | FRead(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 | | 633 | // since the type ranges from 1 to 5 (very important that it not be 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 634 | // we can check the type and decide if it needs to be byteswapped | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | if (type < 1 || type > 5) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | BYTESWAP_FLAG = 1; | ~~~~~~~~~~~~~~~~~~ 637 | }else{ | ~~~~~~ 638 | BYTESWAP_FLAG = 0; | ~~~~~~~~~~~~~~~~~~ 639 | } | ~ 640 | | 641 | BYTESWAP(n,int) | ~~~~~~~~~~~~~~~ 642 | BYTESWAP(type,int) | ~~~~~~~~~~~~~~~~~~ 643 | if (type < 1 || type > 5) { return 0.;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | if (vp->capacity() != n) vp->resize(n); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | | 646 | // read as appropriate type and convert to doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | | 648 | int i; | ~~~~~~ 649 | double sf = 1.; | ~~~~~~~~~~~~~~~ 650 | double min = 0.; | ~~~~~~~~~~~~~~~~ 651 | double add; | ~~~~~~~~~~~ 652 | | 653 | switch (type) { | ~~~~~~~~~~~~~~~ 654 | | 655 | case 5: // ints; no conversion | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | { | ~ 657 | int *xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | FRead(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:658:12: note: in expansion of macro 'FRead' 658 | FRead(xi,sizeof(int),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | free(xc); | ~~~~~~~~~ 604 | break; | ~~~~~~ 605 | } | ~ 606 | | 607 | } | ~ 608 | return 1; | ~~~~~~~~~ 609 | } | ~ 610 | | 611 | | 612 | static double v_vread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 614 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | | 616 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | BYTEHEADER | ~~~~~~~~~~ 620 | | 621 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 622 | if (!fp) { | ~~~~~~~~~~ 623 | return 0.; | ~~~~~~~~~~ 624 | } | ~ 625 | | 626 | BinaryMode(f) | ~~~~~~~~~~~~~ 627 | int n; | ~~~~~~ 628 | FRead(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 629 | | 630 | int type = 0; | ~~~~~~~~~~~~~ 631 | FRead(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 | | 633 | // since the type ranges from 1 to 5 (very important that it not be 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 634 | // we can check the type and decide if it needs to be byteswapped | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | if (type < 1 || type > 5) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | BYTESWAP_FLAG = 1; | ~~~~~~~~~~~~~~~~~~ 637 | }else{ | ~~~~~~ 638 | BYTESWAP_FLAG = 0; | ~~~~~~~~~~~~~~~~~~ 639 | } | ~ 640 | | 641 | BYTESWAP(n,int) | ~~~~~~~~~~~~~~~ 642 | BYTESWAP(type,int) | ~~~~~~~~~~~~~~~~~~ 643 | if (type < 1 || type > 5) { return 0.;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | if (vp->capacity() != n) vp->resize(n); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | | 646 | // read as appropriate type and convert to doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | | 648 | int i; | ~~~~~~ 649 | double sf = 1.; | ~~~~~~~~~~~~~~~ 650 | double min = 0.; | ~~~~~~~~~~~~~~~~ 651 | double add; | ~~~~~~~~~~~ 652 | | 653 | switch (type) { | ~~~~~~~~~~~~~~~ 654 | | 655 | case 5: // ints; no conversion | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | { | ~ 657 | int *xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | FRead(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | } | ~ 663 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 664 | break; | ~~~~~~ 665 | } | ~ 666 | | 667 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 668 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:668:12: note: in expansion of macro 'FRead' 668 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 83 | for (_II__=0;_II__elem(i),double) } | ^~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:67:67: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 67 | #define FRead(arg1,arg2,arg3,arg4) if (fread(arg1,arg2,arg3,arg4) != arg3) {} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ 68 | #endif | ~~~~~~ 69 | | 70 | static double dmaxint_; | ~~~~~~~~~~~~~~~~~~~~~~~ 71 | | 72 | // Definitions allow machine independent write and read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | // note that must include BYTEHEADER at head of routine | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | // The policy is that each machine vwrite binary information in | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 | // without swapping, ie. native endian. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 | // On reading, the type is checked to decide whether | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77 | // byteswapping should be performed | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 78 | | 79 | #define BYTEHEADER int _II__; char *_IN__; char _OUT__[16]; int BYTESWAP_FLAG=0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 80 | #define BYTESWAP(_X__,_TYPE__) \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 | if (BYTESWAP_FLAG == 1) { \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 82 | _IN__ = (char *) &(_X__); \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | free(xc); | ~~~~~~~~~ 604 | break; | ~~~~~~ 605 | } | ~ 606 | | 607 | } | ~ 608 | return 1; | ~~~~~~~~~ 609 | } | ~ 610 | | 611 | | 612 | static double v_vread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 614 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | | 616 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | BYTEHEADER | ~~~~~~~~~~ 620 | | 621 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 622 | if (!fp) { | ~~~~~~~~~~ 623 | return 0.; | ~~~~~~~~~~ 624 | } | ~ 625 | | 626 | BinaryMode(f) | ~~~~~~~~~~~~~ 627 | int n; | ~~~~~~ 628 | FRead(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 629 | | 630 | int type = 0; | ~~~~~~~~~~~~~ 631 | FRead(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 | | 633 | // since the type ranges from 1 to 5 (very important that it not be 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 634 | // we can check the type and decide if it needs to be byteswapped | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | if (type < 1 || type > 5) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | BYTESWAP_FLAG = 1; | ~~~~~~~~~~~~~~~~~~ 637 | }else{ | ~~~~~~ 638 | BYTESWAP_FLAG = 0; | ~~~~~~~~~~~~~~~~~~ 639 | } | ~ 640 | | 641 | BYTESWAP(n,int) | ~~~~~~~~~~~~~~~ 642 | BYTESWAP(type,int) | ~~~~~~~~~~~~~~~~~~ 643 | if (type < 1 || type > 5) { return 0.;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | if (vp->capacity() != n) vp->resize(n); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | | 646 | // read as appropriate type and convert to doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | | 648 | int i; | ~~~~~~ 649 | double sf = 1.; | ~~~~~~~~~~~~~~~ 650 | double min = 0.; | ~~~~~~~~~~~~~~~~ 651 | double add; | ~~~~~~~~~~~ 652 | | 653 | switch (type) { | ~~~~~~~~~~~~~~~ 654 | | 655 | case 5: // ints; no conversion | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | { | ~ 657 | int *xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | FRead(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | } | ~ 663 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 664 | break; | ~~~~~~ 665 | } | ~ 666 | | 667 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 668 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (BYTESWAP_FLAG == 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | for (i=0;ielem(i),double) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 671 | } | ~ 672 | break; | ~~~~~~ 673 | | 674 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | { | ~ 676 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:677:12: note: in expansion of macro 'FRead' 677 | FRead(xf,sizeof(float),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | free(xc); | ~~~~~~~~~ 604 | break; | ~~~~~~ 605 | } | ~ 606 | | 607 | } | ~ 608 | return 1; | ~~~~~~~~~ 609 | } | ~ 610 | | 611 | | 612 | static double v_vread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 614 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | | 616 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | BYTEHEADER | ~~~~~~~~~~ 620 | | 621 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 622 | if (!fp) { | ~~~~~~~~~~ 623 | return 0.; | ~~~~~~~~~~ 624 | } | ~ 625 | | 626 | BinaryMode(f) | ~~~~~~~~~~~~~ 627 | int n; | ~~~~~~ 628 | FRead(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 629 | | 630 | int type = 0; | ~~~~~~~~~~~~~ 631 | FRead(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 | | 633 | // since the type ranges from 1 to 5 (very important that it not be 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 634 | // we can check the type and decide if it needs to be byteswapped | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | if (type < 1 || type > 5) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | BYTESWAP_FLAG = 1; | ~~~~~~~~~~~~~~~~~~ 637 | }else{ | ~~~~~~ 638 | BYTESWAP_FLAG = 0; | ~~~~~~~~~~~~~~~~~~ 639 | } | ~ 640 | | 641 | BYTESWAP(n,int) | ~~~~~~~~~~~~~~~ 642 | BYTESWAP(type,int) | ~~~~~~~~~~~~~~~~~~ 643 | if (type < 1 || type > 5) { return 0.;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | if (vp->capacity() != n) vp->resize(n); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | | 646 | // read as appropriate type and convert to doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | | 648 | int i; | ~~~~~~ 649 | double sf = 1.; | ~~~~~~~~~~~~~~~ 650 | double min = 0.; | ~~~~~~~~~~~~~~~~ 651 | double add; | ~~~~~~~~~~~ 652 | | 653 | switch (type) { | ~~~~~~~~~~~~~~~ 654 | | 655 | case 5: // ints; no conversion | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | { | ~ 657 | int *xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | FRead(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | } | ~ 663 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 664 | break; | ~~~~~~ 665 | } | ~ 666 | | 667 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 668 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (BYTESWAP_FLAG == 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | for (i=0;ielem(i),double) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 671 | } | ~ 672 | break; | ~~~~~~ 673 | | 674 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | { | ~ 676 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | } | ~ 682 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 683 | break; | ~~~~~~ 684 | } | ~ 685 | | 686 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | { // convert back to double | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 688 | FRead(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 689 | FRead(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | BYTESWAP(sf,double) | ~~~~~~~~~~~~~~~~~~~ 691 | BYTESWAP(min,double) | ~~~~~~~~~~~~~~~~~~~~ 692 | | 693 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:694:12: note: in expansion of macro 'FRead' 694 | FRead(xi,sizeof(unsigned short),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:83:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 83 | for (_II__=0;_II__ | ~~~~~~~~~~~~~~~~~~~~~ 92 | | 93 | // definition of random numer generator | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | #include "random1.h" | ~~~~~~~~~~~~~~~~~~~~ 95 | #include | ~~~~~~~~~~~~~~~~~~~~ 96 | | 97 | // definition of comparison functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 98 | #include | ~~~~~~~~~~~~~~~~~~~ 99 | | 100 | #if HAVE_IV | ~~~~~~~~~~~ 101 | #include "utility.h" | ~~~~~~~~~~~~~~~~~~~~ 102 | #endif | ~~~~~~ 103 | #include "oc2iv.h" | ~~~~~~~~~~~~~~~~~~ 104 | #include "parse.h" | ~~~~~~~~~~~~~~~~~~ 105 | #include "ocfile.h" | ~~~~~~~~~~~~~~~~~~~ 106 | | 107 | extern "C" { | ~~~~~~~~~~~~ 108 | extern Object* hoc_thisobject; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | extern Symlist* hoc_top_level_symlist; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | extern void nrn_exit(int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | IvocVect* (*nrnpy_vec_from_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | Object** (*nrnpy_vec_to_python_p_)(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | Object** (*nrnpy_vec_as_numpy_helper_)(int, double*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 114 | }; | ~~ 115 | | 116 | | 117 | int cmpfcn(double a, double b) { return ((a) <= (b))? (((a) == (b))? 0 : -1) : 1; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | | 120 | // math functions with error checking defined in oc/SRC/math.c | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 121 | extern "C" { | ~~~~~~~~~~~~ 122 | extern double hoc_Log(double x), hoc_Log10(double x), hoc_Exp(double x), hoc_Sqrt(double x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 123 | extern double hoc_scan(FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 124 | } | ~ 125 | | 126 | static int narg() { | ~~~~~~~~~~~~~~~~~~~ 127 | int i=0; | ~~~~~~~~ 128 | while (ifarg(i++)); | ~~~~~~~~~~~~~~~~~~~ 129 | return i-2; | ~~~~~~~~~~~ 130 | } | ~ 131 | | 132 | #define MAX_FIT_PARAMS 20 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | | 134 | #define TWO_BYTE_HIGH 65535. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 135 | #define ONE_BYTE_HIGH 255. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | #define ONE_BYTE_HALF 128. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | | 138 | #define EPSILON 1e-9 | ~~~~~~~~~~~~~~~~~~~~ 139 | | 140 | extern "C" { | ~~~~~~~~~~~~ 141 | extern void notify_freed_val_array(double*, size_t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 | extern void install_vector_method(const char* name, Pfrd_vp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 143 | extern int vector_instance_px(void*, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 144 | extern int vector_arg_px(int, double**); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | extern int nrn_mlh_gsort (double* vec, int *base_ptr, int total_elems, doubleComparator cmp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | }; | ~~ 147 | | 148 | extern "C" int hoc_return_type_code; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 | | 150 | IvocVect::IvocVect(Object* o) : ParentVect(){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | IvocVect::IvocVect(int l, Object* o) : ParentVect(l){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 | IvocVect::IvocVect(int l, double fill_value, Object* o) : ParentVect(l, fill_value){obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | IvocVect::IvocVect(IvocVect& v, Object* o) : ParentVect(v) {obj_ = o; label_ = NULL; MUTCONSTRUCT(0)} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 154 | | 155 | IvocVect::~IvocVect(){ | ~~~~~~~~~~~~~~~~~~~~~~ 156 | MUTDESTRUCT | ~~~~~~~~~~~ 157 | if (label_) { | ~~~~~~~~~~~~~ 158 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 159 | } | ~ 160 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 161 | } | ~ 162 | | 163 | void IvocVect::label(const char* label) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 164 | if (label_) { | ~~~~~~~~~~~~~ 165 | delete [] label_; | ~~~~~~~~~~~~~~~~~ 166 | label_ = NULL; | ~~~~~~~~~~~~~~ 167 | } | ~ 168 | if (label) { | ~~~~~~~~~~~~ 169 | label_ = new char[strlen(label) + 1]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | strcpy(label_, label); | ~~~~~~~~~~~~~~~~~~~~~~ 171 | } | ~ 172 | } | ~ 173 | | 174 | static const char* nullstr = ""; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | | 176 | static const char** v_label(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 177 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 178 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 179 | x->label(gargstr(1)); | ~~~~~~~~~~~~~~~~~~~~~ 180 | } | ~ 181 | if (x->label_) { | ~~~~~~~~~~~~~~~~ 182 | return (const char**)&x->label_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 183 | } | ~ 184 | return &nullstr; | ~~~~~~~~~~~~~~~~ 185 | } | ~ 186 | | 187 | static void same_err(const char* s, Vect* x, Vect* y) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | if (x == y) { | ~~~~~~~~~~~~~ 189 | hoc_execerror(s, " argument needs to be copied first"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | } | ~ 191 | } | ~ 192 | | 193 | /* the Vect->at(start, end) function was used in about a dozen places | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for the purpose of dealing with a subrange of elements. However that | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | function clones the subrange and returns a new Vect. This caused a | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | memory leak and was needlessly inefficient for those functions. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | To fix both problems for these specific functions | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | we use a special vector which does not have | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 199 | it's own space but merely a pointer and capacity to the right space of | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 200 | the original vector. The usage is restricted to only once at a time, i.e. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | can't use two subvecs at once and never do anything which affects the | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 202 | memory space. | ~~~~~~~~~~~~~ 203 | */ | ~~ 204 | | 205 | static IvocVect* subvec_; // allocated when registered. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 206 | IvocVect* IvocVect::subvec(int start, int end) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | subvec_->len = end - start + 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 208 | subvec_->s = s + start; | ~~~~~~~~~~~~~~~~~~~~~~~ 209 | return subvec_; | ~~~~~~~~~~~~~~~ 210 | } | ~ 211 | | 212 | void IvocVect::resize(int newlen) { // all that for this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | long oldcap = capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 214 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 215 | notify_freed_val_array(vec(), capacity()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | } | ~ 217 | ParentVect::resize(newlen); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | for (;oldcap < newlen; ++oldcap) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 219 | elem(oldcap) = 0.; | ~~~~~~~~~~~~~~~~~~ 220 | } | ~ 221 | } | ~ 222 | | 223 | void IvocVect::resize_chunk(int newlen, int extra) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | if (newlen > space) { | ~~~~~~~~~~~~~~~~~~~~~ 225 | long x = newlen + extra; | ~~~~~~~~~~~~~~~~~~~~~~~~ 226 | if (extra == 0) { | ~~~~~~~~~~~~~~~~~ 227 | x = ListImpl_best_new_count(newlen, sizeof(double)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 228 | } | ~ 229 | // printf("resize_chunk %d\n", x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | resize(x); | ~~~~~~~~~~ 231 | } | ~ 232 | resize(newlen); | ~~~~~~~~~~~~~~~ 233 | } | ~ 234 | | 235 | #if HAVE_IV | ~~~~~~~~~~~ 236 | /*static*/ class GraphMarkItem : public GraphItem { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | public: | ~~~~~~~ 238 | GraphMarkItem(Glyph* g) : GraphItem(g){} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | virtual ~GraphMarkItem(){}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | virtual void erase(Scene* s, GlyphIndex i, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (type & GraphItem::ERASE_LINE) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 242 | s->remove(i); | ~~~~~~~~~~~~~ 243 | } | ~ 244 | } | ~ 245 | }; | ~~ 246 | #endif | ~~~~~~ 247 | | 248 | static void* v_cons(Object* o) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | double fill_value = 0.; | ~~~~~~~~~~~~~~~~~~~~~~~ 250 | int n = 0; | ~~~~~~~~~~ 251 | Vect* vec; | ~~~~~~~~~~ 252 | if (ifarg(1)) { | ~~~~~~~~~~~~~~~ 253 | if (hoc_is_double_arg(1)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | n = int(chkarg(1,0,1e10)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 255 | if (ifarg(2)) fill_value = *getarg(2); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 256 | vec = new Vect(n,fill_value, o); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 257 | }else{ | ~~~~~~ 258 | if (!nrnpy_vec_from_python_p_) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 259 | hoc_execerror("Python not available", 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 260 | } | ~ 261 | vec = (*nrnpy_vec_from_python_p_)(new Vect(0, 0, o)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | } | ~ 263 | }else{ | ~~~~~~ 264 | vec = new Vect(0, 0, o); | ~~~~~~~~~~~~~~~~~~~~~~~~ 265 | } | ~ 266 | return vec; | ~~~~~~~~~~~ 267 | } | ~ 268 | | 269 | | 270 | static void v_destruct(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 271 | delete (Vect*)v; | ~~~~~~~~~~~~~~~~ 272 | } | ~ 273 | | 274 | static Symbol* svec_; | ~~~~~~~~~~~~~~~~~~~~~ 275 | | 276 | // extern "C" vector functions used by ocmatrix.dll | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 | // can also be used in mod files | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 278 | Vect* vector_new(int n, Object* o){return new Vect(n, o);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | Vect* vector_new0(){return new Vect();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | Vect* vector_new1(int n){return new Vect(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 281 | Vect* vector_new2(Vect* v){return new Vect(*v);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | void vector_delete(Vect* v){delete v;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 283 | int vector_buffer_size(Vect* v){return v->buffer_size();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 284 | int vector_capacity(Vect* v){return v->capacity();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 285 | void vector_resize(Vect* v, int n){v->resize(n);} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | Object** vector_temp_objvar(Vect* v){return v->temp_objvar();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | double* vector_vec(Vect* v){return v->vec();} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 288 | Object** vector_pobj(Vect* v){return &v->obj_;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 289 | char* vector_get_label(Vect* v) { return v->label_; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 290 | void vector_set_label(Vect* v, char* s) { v->label(s); } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 291 | void vector_append(Vect* v, double x){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | long n = v->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 293 | v->resize_chunk(n+1); | ~~~~~~~~~~~~~~~~~~~~~ 294 | v->elem(n) = x; | ~~~~~~~~~~~~~~~ 295 | } | ~ 296 | | 297 | #ifdef WIN32 | ~~~~~~~~~~~~ 298 | #if !defined(USEMATRIX) || USEMATRIX == 0 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 299 | #include "../windll/dll.h" | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | extern "C" {extern char* neuron_home;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | | 302 | void load_ocmatrix() { | ~~~~~~~~~~~~~~~~~~~~~~ 303 | struct DLL* dll = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~ 304 | char buf[256]; | ~~~~~~~~~~~~~~ 305 | sprintf(buf, "%s\\lib\\ocmatrix.dll", neuron_home); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | dll = dll_load(buf); | ~~~~~~~~~~~~~~~~~~~~ 307 | if (dll) { | ~~~~~~~~~~ 308 | Pfri mreg = (Pfri)dll_lookup(dll, "_Matrix_reg"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 309 | if (mreg) { | ~~~~~~~~~~~ 310 | (*mreg)(); | ~~~~~~~~~~ 311 | } | ~ 312 | }else{ | ~~~~~~ 313 | printf("No Matrix class.\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 314 | } | ~ 315 | } | ~ 316 | #endif | ~~~~~~ 317 | #endif | ~~~~~~ 318 | | 319 | Object** IvocVect::temp_objvar() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 320 | IvocVect* v = (IvocVect*)this; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 321 | Object** po; | ~~~~~~~~~~~~ 322 | if (v->obj_) { | ~~~~~~~~~~~~~~ 323 | po = hoc_temp_objptr(v->obj_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 324 | }else{ | ~~~~~~ 325 | po = hoc_temp_objvar(svec_, (void*)v); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 326 | obj_ = *po; | ~~~~~~~~~~~ 327 | } | ~ 328 | return po; | ~~~~~~~~~~ 329 | } | ~ 330 | | 331 | extern "C" { // bug in cray compiler requires this | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 332 | void install_vector_method(const char* name, double (*f)(void*)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 333 | Symbol* s_meth; | ~~~~~~~~~~~~~~~ 334 | if (hoc_table_lookup(name, svec_->u.ctemplate->symtable)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | hoc_execerror(name, " already a method in the Vector class"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | s_meth = hoc_install(name, FUNCTION, 0.0, &svec_->u.ctemplate->symtable); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 338 | s_meth->u.u_proc->defn.pfd = (Pfrd)f; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 339 | #define PUBLIC_TYPE 1 | ~~~~~~~~~~~~~~~~~~~~~ 340 | s_meth->cpublic = PUBLIC_TYPE; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | } | ~ 342 | } | ~ 343 | | 344 | int vector_instance_px(void* v, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 | Vect* x = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~ 346 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 347 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 348 | } | ~ 349 | | 350 | Vect* vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 351 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 352 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 353 | check_obj_type(ob, "Vector"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | } | ~ 355 | return (Vect*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 356 | } | ~ 357 | | 358 | int is_vector_arg(int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 359 | Object* ob = *hoc_objgetarg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 | if (!ob || ob->ctemplate != svec_->u.ctemplate) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | return 0; | ~~~~~~~~~ 362 | } | ~ 363 | return 1; | ~~~~~~~~~ 364 | } | ~ 365 | | 366 | int vector_arg_px(int i, double** px) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | Vect* x = vector_arg(i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 368 | *px = x->vec(); | ~~~~~~~~~~~~~~~ 369 | return x->capacity(); | ~~~~~~~~~~~~~~~~~~~~~ 370 | } | ~ 371 | | 372 | extern void nrn_vecsim_add(void*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 373 | extern void nrn_vecsim_remove(void*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | | 375 | static int possible_destvec(int arg, Vect*& dest) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | if (ifarg(arg) && hoc_is_object_arg(arg)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 377 | dest = vector_arg(arg); | ~~~~~~~~~~~~~~~~~~~~~~~ 378 | return arg+1; | ~~~~~~~~~~~~~ 379 | }else{ | ~~~~~~ 380 | dest = new Vect(); | ~~~~~~~~~~~~~~~~~~ 381 | return arg; | ~~~~~~~~~~~ 382 | } | ~ 383 | } | ~ 384 | | 385 | static double v_play_remove(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 386 | nrn_vecsim_remove(v); | ~~~~~~~~~~~~~~~~~~~~~ 387 | return 1.; | ~~~~~~~~~~ 388 | } | ~ 389 | | 390 | static double v_fwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 392 | void* s; | ~~~~~~~~ 393 | int x_max = vp->capacity()-1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | int start = 0; | ~~~~~~~~~~~~~~ 395 | int end = x_max; | ~~~~~~~~~~~~~~~~ 396 | hoc_return_type_code = 1; // integer | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 397 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 398 | start = int(chkarg(2,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 399 | end = int(chkarg(3,0,x_max)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 400 | } | ~ 401 | s = (void*)(&vp->elem(start)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | const char* x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 403 | | 404 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 406 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 408 | if (!fp) { | ~~~~~~~~~~ 409 | return 0.; | ~~~~~~~~~~ 410 | } | ~ 411 | int n = end-start+1; | ~~~~~~~~~~~~~~~~~~~~ 412 | BinaryMode(f); | ~~~~~~~~~~~~~~ 413 | return (double)fwrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | } | ~ 415 | | 416 | static double v_fread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 418 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 419 | | 420 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 421 | | 422 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 423 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | | 425 | if (ifarg(2)) vp->resize(int(chkarg(2,0,1e10))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 426 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 427 | | 428 | int type = 4; | ~~~~~~~~~~~~~ 429 | if (ifarg(3)) { | ~~~~~~~~~~~~~~~ 430 | type = int(chkarg(3,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | } | ~ 432 | | 433 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 434 | if (!fp) { | ~~~~~~~~~~ 435 | return 0.; | ~~~~~~~~~~ 436 | } | ~ 437 | | 438 | int i; | ~~~~~~ 439 | BinaryMode(f) | ~~~~~~~~~~~~~ 440 | if (n > 0) switch (type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | | 442 | case 5: // short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 443 | { | ~ 444 | short *xs = (short *)malloc(n * (unsigned)sizeof(short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | FRead(xs,sizeof(short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 446 | for (i=0;ielem(i) = double(xs[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 448 | } | ~ 449 | free((char *)xs); | ~~~~~~~~~~~~~~~~~ 450 | break; | ~~~~~~ 451 | } | ~ 452 | | 453 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 454 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 | break; | ~~~~~~ 456 | | 457 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 458 | { | ~ 459 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 460 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 461 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 463 | } | ~ 464 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 465 | break; | ~~~~~~ 466 | } | ~ 467 | | 468 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 469 | { | ~ 470 | | 471 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 472 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | } | ~ 476 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 477 | break; | ~~~~~~ 478 | } | ~ 479 | | 480 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 481 | { | ~ 482 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (i=0;ielem(i) = double(xc[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | } | ~ 487 | free(xc); | ~~~~~~~~~ 488 | break; | ~~~~~~ 489 | } | ~ 490 | } | ~ 491 | return 1; | ~~~~~~~~~ 492 | } | ~ 493 | | 494 | static double v_vwrite(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 496 | | 497 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 499 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 | | 501 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 502 | if (!fp) { | ~~~~~~~~~~ 503 | return 0.; | ~~~~~~~~~~ 504 | } | ~ 505 | | 506 | BinaryMode(f) | ~~~~~~~~~~~~~ 507 | // first, write the size of the vector | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 508 | int n = vp->capacity(); | ~~~~~~~~~~~~~~~~~~~~~~~ 509 | FWrite(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 510 | | 511 | // next, write the type of elements | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 512 | int type = 4; | ~~~~~~~~~~~~~ 513 | if (ifarg(2)) { | ~~~~~~~~~~~~~~~ 514 | type = int(chkarg(2,1,5)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 515 | } | ~ 516 | FWrite(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 517 | | 518 | // convert the data if necessary | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 519 | int i; | ~~~~~~ 520 | void *s; | ~~~~~~~~ 521 | const char* x; | ~~~~~~~~~~~~~~ 522 | | 523 | double min,r,sf,sub,intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | switch (type) { | ~~~~~~~~~~~~~~~ 525 | | 526 | case 5: // integers as ints (no scaling) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 527 | { | ~ 528 | int* xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 529 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 531 | } | ~ 532 | FWrite(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 534 | break; | ~~~~~~ 535 | } | ~ 536 | | 537 | case 4: // doubles (no conversion unless BYTESWAP used and needed) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 538 | { | ~ 539 | s = (void*)(&(vp->elem(0))); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 541 | FWrite(x,sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 542 | break; | ~~~~~~ 543 | } | ~ 544 | | 545 | case 3: // float (simple automatic type conversion) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | { | ~ 547 | float* xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 548 | for (i=0;ielem(i)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 550 | } | ~ 551 | FWrite(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 552 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 553 | break; | ~~~~~~ 554 | } | ~ 555 | | 556 | | 557 | case 2: // short ints (scale to 16 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | { | ~ 559 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 560 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 561 | if (r > 0) { | ~~~~~~~~~~~~ 562 | sf = TWO_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 563 | } else { | ~~~~~~~~ 564 | sf = 1.; | ~~~~~~~~ 565 | } | ~ 566 | unsigned short* xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | for (i=0;ielem(i)-min)*sf; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 569 | xi[i] = (unsigned short)intermed; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 570 | } | ~ 571 | s = (void*)xi; | ~~~~~~~~~~~~~~ 572 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 573 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 574 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 575 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 576 | // store the actual data | ~~~~~~~~~~~~~~~~~~~~~~~~ 577 | FWrite(x,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 578 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 579 | break; | ~~~~~~ 580 | } | ~ 581 | | 582 | case 1: // char (scale to 8 bits with compression) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | { | ~ 584 | sub = ONE_BYTE_HALF; | ~~~~~~~~~~~~~~~~~~~~ 585 | min = vp->min(); | ~~~~~~~~~~~~~~~~ 586 | r = vp->max()- min; | ~~~~~~~~~~~~~~~~~~~ 587 | if (r > 0) { | ~~~~~~~~~~~~ 588 | sf = ONE_BYTE_HIGH/r; | ~~~~~~~~~~~~~~~~~~~~~ 589 | } else { | ~~~~~~~~ 590 | sf = 1.; | ~~~~~~~~ 591 | } | ~ 592 | | 593 | char* xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 594 | for (i=0;ielem(i)-min)*sf)-sub); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | } | ~ 597 | s = (void*)xc; | ~~~~~~~~~~~~~~ 598 | x = (const char*)s; | ~~~~~~~~~~~~~~~~~~~ 599 | // store the info needed to reconvert | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | FWrite(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 601 | FWrite(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | FWrite(x,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 603 | free(xc); | ~~~~~~~~~ 604 | break; | ~~~~~~ 605 | } | ~ 606 | | 607 | } | ~ 608 | return 1; | ~~~~~~~~~ 609 | } | ~ 610 | | 611 | | 612 | static double v_vread(void* v) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | Vect* vp = (Vect*)v; | ~~~~~~~~~~~~~~~~~~~~ 614 | void* s = (void*)(vp->vec()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 615 | | 616 | Object* ob = *hoc_objgetarg(1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 617 | check_obj_type(ob, "File"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | OcFile* f = (OcFile*)(ob->u.this_pointer); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 619 | BYTEHEADER | ~~~~~~~~~~ 620 | | 621 | FILE* fp = f->file(); | ~~~~~~~~~~~~~~~~~~~~~ 622 | if (!fp) { | ~~~~~~~~~~ 623 | return 0.; | ~~~~~~~~~~ 624 | } | ~ 625 | | 626 | BinaryMode(f) | ~~~~~~~~~~~~~ 627 | int n; | ~~~~~~ 628 | FRead(&n,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 629 | | 630 | int type = 0; | ~~~~~~~~~~~~~ 631 | FRead(&type,sizeof(int),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 632 | | 633 | // since the type ranges from 1 to 5 (very important that it not be 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 634 | // we can check the type and decide if it needs to be byteswapped | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | if (type < 1 || type > 5) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | BYTESWAP_FLAG = 1; | ~~~~~~~~~~~~~~~~~~ 637 | }else{ | ~~~~~~ 638 | BYTESWAP_FLAG = 0; | ~~~~~~~~~~~~~~~~~~ 639 | } | ~ 640 | | 641 | BYTESWAP(n,int) | ~~~~~~~~~~~~~~~ 642 | BYTESWAP(type,int) | ~~~~~~~~~~~~~~~~~~ 643 | if (type < 1 || type > 5) { return 0.;} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | if (vp->capacity() != n) vp->resize(n); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | | 646 | // read as appropriate type and convert to doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 | | 648 | int i; | ~~~~~~ 649 | double sf = 1.; | ~~~~~~~~~~~~~~~ 650 | double min = 0.; | ~~~~~~~~~~~~~~~~ 651 | double add; | ~~~~~~~~~~~ 652 | | 653 | switch (type) { | ~~~~~~~~~~~~~~~ 654 | | 655 | case 5: // ints; no conversion | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | { | ~ 657 | int *xi = (int *)malloc(n * sizeof(int)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 658 | FRead(xi,sizeof(int),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | for (i=0;ielem(i) = double(xi[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 662 | } | ~ 663 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 664 | break; | ~~~~~~ 665 | } | ~ 666 | | 667 | case 4: // doubles | ~~~~~~~~~~~~~~~~~~~~~~~~~ 668 | FRead(&(vp->elem(0)),sizeof(double),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (BYTESWAP_FLAG == 1) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | for (i=0;ielem(i),double) } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 671 | } | ~ 672 | break; | ~~~~~~ 673 | | 674 | case 3: // floats | ~~~~~~~~~~~~~~~~~~~~~~~~~ 675 | { | ~ 676 | float *xf = (float *)malloc(n * (unsigned)sizeof(float)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | FRead(xf,sizeof(float),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | for (i=0;ielem(i) = double(xf[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 681 | } | ~ 682 | free((char *)xf); | ~~~~~~~~~~~~~~~~~ 683 | break; | ~~~~~~ 684 | } | ~ 685 | | 686 | case 2: // unsigned short ints | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 687 | { // convert back to double | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 688 | FRead(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 689 | FRead(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | BYTESWAP(sf,double) | ~~~~~~~~~~~~~~~~~~~ 691 | BYTESWAP(min,double) | ~~~~~~~~~~~~~~~~~~~~ 692 | | 693 | unsigned short *xi = (unsigned short *)malloc(n * (unsigned)sizeof(unsigned short)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | FRead(xi,sizeof(unsigned short),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (i=0;ielem(i) = double(xi[i]/sf +min); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 698 | } | ~ 699 | free((char *)xi); | ~~~~~~~~~~~~~~~~~ 700 | break; | ~~~~~~ 701 | } | ~ 702 | | 703 | case 1: // char | ~~~~~~~~~~~~~~~~~~~~~~~ 704 | { // convert back to double | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 | FRead(&sf,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 706 | FRead(&min,sizeof(double),1,fp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 707 | BYTESWAP(sf,double) | ~~~~~~~~~~~~~~~~~~~ 708 | BYTESWAP(min,double) | ~~~~~~~~~~~~~~~~~~~~ 709 | char *xc = (char *)malloc(n * (unsigned)sizeof(char)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 710 | FRead(xc,sizeof(char),n,fp); | ~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:710:12: note: in expansion of macro 'FRead' 710 | FRead(xc,sizeof(char),n,fp); | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:614:8: warning: unused variable 's' [-Wunused-variable] 614 | void* s = (void*)(vp->vec()); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'Object** v_hist(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:1127:9: warning: unused variable 'high' [-Wunused-variable] 1127 | double high = start+step*size; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'double v_indwhere(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:1755:16: warning: unused variable 'm' [-Wunused-variable] 1755 | int i, iarg, m=0; | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp: In function 'call_simplex(double*, int, IvocVect*, IvocVect*, char*, int)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ivocvect.cpp:2694:17: warning: 'retval' may be used uninitialized in this function [-Wmaybe-uninitialized] 2694 | return (retval); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocfile.cpp: In function 'bool makePath(const string&)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocfile.cpp:586:21: warning: comparison of integer expressions of different signedness: 'int' and 'const size_type' {aka 'const long unsigned int'} [-Wsign-compare] 586 | if (pos == std::string::npos) | ~~~~^~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ochelp.cpp:84:13: warning: 'void readmore()' defined but not used [-Wunused-function] 84 | static void readmore() { | ^~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ochelp.cpp:40:24: warning: 'filequeue' defined but not used [-Wunused-variable] 40 | static CopyStringList* filequeue; | ^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ochelp.cpp:16:14: warning: 'help_pipe' defined but not used [-Wunused-variable] 16 | static FILE* help_pipe; | ^~~~~~~~~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 20%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocfile.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocfile.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocfile.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 20%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ochelp.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ochelp.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ochelp.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 20%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/oclist.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/oclist.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/oclist.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 20%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocnoiv1.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocnoiv1.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocnoiv1.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 21%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocobserv.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocobserv.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocobserv.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 21%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocpicker.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocpicker.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocpicker.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 21%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocpointer.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocpointer.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocpointer.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 20%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocmatrix.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocmatrix.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocmatrix.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocmatrix.cpp: In member function 'virtual void OcFullMatrix::solv(IvocVect*, IvocVect*, bool)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocmatrix.cpp:290:36: warning: comparison of integer expressions of different signedness: 'u_int' {aka 'unsigned int'} and 'int' [-Wsign-compare] 290 | }else if (use_lu && lu_factor_->m == nrow()) { | ~~~~~~~~~~~~~~^~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 21%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/ocptrvector.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/ocptrvector.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/ocptrvector.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 21%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/octimer.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/octimer.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/octimer.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 22%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/rect.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/rect.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/rect.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 22%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/rubband.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/rubband.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/rubband.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 23%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/strfun.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/strfun.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/strfun.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/strfun.cpp: In function 'Object** l_alias_list(void*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/strfun.cpp:169:8: warning: unused variable 'buf' [-Wunused-variable] 169 | char buf[256]; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/strfun.cpp:167:6: warning: unused variable 'id' [-Wunused-variable] 167 | int id = (*po)->index; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 22%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/scene.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/scene.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scene.cpp /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scene.cpp: In member function 'virtual void Scene::save_class(std::ostream&, const char*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scene.cpp:870:7: warning: unused variable 'count' [-Wunused-variable] 870 | long count = views_->count(); | ^~~~~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 23%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/scenepic.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/scenepic.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp: In member function 'virtual void SpecView::execute()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp:691:7: warning: unused variable 'bx' [-Wunused-variable] 691 | bool bx = var_pair_chooser("X size", x1, x2, v->canvas()->window()); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp:692:7: warning: unused variable 'by' [-Wunused-variable] 692 | bool by = var_pair_chooser("Y size", y1, y2, v->canvas()->window()); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp: In member function 'void OcViewGlyph::viewmenu(ivGlyph*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/scenepic.cpp:761:14: warning: unused variable 'wk' [-Wunused-variable] 761 | WidgetKit& wk = *WidgetKit::instance(); | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 22%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/pwman.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/pwman.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp: In constructor 'PrintableWindowManager::PrintableWindowManager()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1206:15: warning: variable 'wp1' set but not used [-Wunused-but-set-variable] 1206 | Coord wp1; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1246:31: warning: unused variable 'mother' [-Wunused-variable] 1246 | Menu* mbar, *mprint, *mses, *mother; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp: In member function 'void PrintableWindowManager::reconfigured(PrintableWindow*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1642:8: warning: unused variable 'r' [-Wunused-variable] 1642 | Coord r = l + w->width_pw(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1644:8: warning: unused variable 't' [-Wunused-variable] 1644 | Coord t = b + w->height_pw(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp: In member function 'void PrintableWindowManager::reconfigured(JavaWindow*)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1672:8: warning: unused variable 'r' [-Wunused-variable] 1672 | Coord r = l + w->w(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:1674:8: warning: unused variable 't' [-Wunused-variable] 1674 | Coord t = b + w->h(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp: In member function 'void PWMImpl::common_print(ivPrinter*, bool, bool)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:2017:9: warning: unused variable 'sfac' [-Wunused-variable] 2017 | float sfac; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp: In member function 'PWMImpl::save_list(int, ScreenItem**, std::basic_ostream >&)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/pwman.cpp:3228:15: warning: 'ocg' may be used uninitialized in this function [-Wmaybe-uninitialized] 3228 | ocg->save(o); | ~~~~~~~~~^~~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 23%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/symchoos.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/symchoos.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/symchoos.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/symchoos.cpp: In member function 'virtual void SymChooser::reread()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/symchoos.cpp:265:21: warning: unused variable 'fc' [-Wunused-variable] 265 | SymChooserImpl& fc = *impl_; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/symchoos.cpp: In member function 'void SymChooserImpl::accept_browser_index(int)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/symchoos.cpp:627:13: warning: unused variable 'sym' [-Wunused-variable] 627 | Symbol* sym = dir->symbol(i); | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 23%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/utility.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/utility.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/utility.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/utility.cpp: In function 'bool str_chooser(const char*, char*, ivWindow*, ivCoord, ivCoord)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/utility.cpp:191:13: warning: unused variable 'l' [-Wunused-variable] 191 | LayoutKit& l = *LayoutKit::instance(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/utility.cpp: In static member function 'static bool Graph::label_chooser(const char*, char*, GLabel*, ivCoord, ivCoord)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/utility.cpp:350:13: warning: unused variable 'l' [-Wunused-variable] 350 | LayoutKit& l = *LayoutKit::instance(); | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 24%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/xdep.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/xdep.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xdep.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 24%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/field.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/field.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/field.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 24%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/xyview.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/xyview.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp: In member function 'virtual void XYView::transform(ivTransformer&, const ivAllocation&, const ivAllocation&) const': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp:478:19: warning: unused variable 'nx' [-Wunused-variable] 478 | const Allotment& nx = n.x_allotment(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp:479:19: warning: unused variable 'ny' [-Wunused-variable] 479 | const Allotment& ny = n.y_allotment(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp:480:10: warning: unused variable 'v' [-Wunused-variable] 480 | XYView* v = (XYView*)this; | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp: In member function 'virtual void View::transform(ivTransformer&, const ivAllocation&, const ivAllocation&) const': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xyview.cpp:554:8: warning: unused variable 'sy' [-Wunused-variable] 554 | float sy = ay.span()/XYView::height(); | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 25%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbsdirect.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbsdirect.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsdirect.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 24%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbs.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbs.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbs.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbs.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp: In member function 'virtual void BBSImpl::execute(int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp:290:9: warning: unused variable 's' [-Wunused-variable] 290 | char* s; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp:292:7: warning: unused variable 'i' [-Wunused-variable] 292 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp: In member function 'virtual bool BBSImpl::working(int&, double&, int&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp:390:8: warning: unused variable 'wid' [-Wunused-variable] 390 | int wid = upkint(); | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp:404:7: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized] 404 | printf("working n_=%d: after %d try elapsed %g sec got result for %d id=%d x=%g\n", | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | n_, cnt, time()-t, working_id_, id, x); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp: In member function 'BBS::take(char const*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbs.cpp:476:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized] 476 | printf("end take |%s| elapsed %g from %g\n", key, time()-t, t); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 25%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbslocal.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbslocal.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbslocal.cpp In file included from /builddir/build/BUILD/nrn-7.8.1/src/oc/hocdec.h:13, from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/oc2iv.h:7, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbslocal.cpp:4, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbslocal.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbslocal.cpp: In member function 'virtual char* BBSLocal::upkpickle(size_t*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbslocal.cpp:89:12: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 89 | assert(*n == len); | ~~~^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/hocassrt.h:19:28: note: in definition of macro 'assert' 19 | # define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 25%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbslsrv2.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbslsrv2.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbslsrv2.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 25%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbsrcli.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbsrcli.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsrcli.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 23%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/__/ivoc/xmenu.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DUSEBBS=1 -DUSEGNU=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/__/ivoc/xmenu.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: In function 'void set_format()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:1835:15: warning: unused variable 'len' [-Wunused-variable] 1835 | static Coord len; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: In member function 'virtual void HocEditorForItem::val_inc(const ivEvent&)': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:2213:8: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare] 2213 | if (i == strlen(buf)) { | ~~^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: In constructor 'StepperMenu::StepperMenu()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:2394:13: warning: unused variable 'k' [-Wunused-variable] 2394 | WidgetKit& k = *WidgetKit::instance(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: In member function 'void HocStateButton::button_action()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:2855:19: warning: unused variable 't' [-Wunused-variable] 2855 | TelltaleState* t = b_->state(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:2861:19: warning: unused variable 't' [-Wunused-variable] 2861 | TelltaleState* t = b_->state(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: In member function 'void HocStateMenuItem::button_action()': /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:3006:19: warning: unused variable 't' [-Wunused-variable] 3006 | TelltaleState* t = b_->state(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:3012:19: warning: unused variable 't' [-Wunused-variable] 3012 | TelltaleState* t = b_->state(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:1835:15: warning: 'len' defined but not used [-Wunused-variable] 1835 | static Coord len; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/ivoc/xmenu.cpp:887:13: warning: 'void saveMenuFile()' defined but not used [-Wunused-function] 887 | static void saveMenuFile() { | ^~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 26%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/bgpmeminfo.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/bgpmeminfo.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bgpmeminfo.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 26%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbssrv.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbssrv.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbssrv.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 25%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbslsrv.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbslsrv.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbslsrv.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbslsrv.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbslsrv.cpp: In member function 'void BBSLocalServer::post(const char*, MessageValue*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/bbslsrv.cpp:320:24: warning: variable 'm' set but not used [-Wunused-but-set-variable] 320 | MessageList::iterator m = messages_->insert( | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 26%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/classreg.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/classreg.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/classreg.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 26%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/cachevec.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/cachevec.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cachevec.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 27%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/cvodestb.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/cvodestb.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cvodestb.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cvodestb.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodestb.cpp: In function 'void deliver_net_events(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodestb.cpp:43:6: warning: unused variable 'i' [-Wunused-variable] 43 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodestb.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodestb.cpp:38:13: warning: 'void check_thresh(NrnThread*)' declared 'static' but never defined [-Wunused-function] 38 | static void check_thresh(NrnThread*); | ^~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 27%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/cvtrset.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/cvtrset.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cvtrset.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 26%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/cvodeobj.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/cvodeobj.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cvodeobj.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cvodeobj.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In function 'double use_mxb(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:345:12: warning: unused variable 'd' [-Wunused-variable] 345 | NetCvode* d = (NetCvode*)v; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In function 'double cache_efficient(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:358:12: warning: unused variable 'd' [-Wunused-variable] 358 | NetCvode* d = (NetCvode*)v; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In member function 'void Cvode::activate_maxstate(bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:921:7: warning: unused variable 'i' [-Wunused-variable] 921 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In member function 'int Cvode::cvode_init(double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1055:6: warning: unused variable 'iter' [-Wunused-variable] 1055 | int iter; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In member function 'int Cvode::daspk_advance_tn()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1334:6: warning: unused variable 'flag' [-Wunused-variable] 1334 | int flag, err; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1335:9: warning: unused variable 'tin' [-Wunused-variable] 1335 | double tin; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In function 'void* msolve_thread_part2(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1473:6: warning: unused variable 'i' [-Wunused-variable] 1473 | int i = nt->id; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In function 'void* f_thread_ms_part2(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1569:6: warning: unused variable 'i' [-Wunused-variable] 1569 | int i = nt->id; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: In function 'void* f_thread_ms_part3(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:1575:6: warning: unused variable 'i' [-Wunused-variable] 1575 | int i = nt->id; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/cvodeobj.cpp:689:14: warning: 'void* msetup_thread(NrnThread*)' declared 'static' but never defined [-Wunused-function] 689 | static void* msetup_thread(NrnThread*); | ^~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 28%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/finithnd.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/finithnd.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/finithnd.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 27%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/datapath.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/datapath.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/datapath.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/datapath.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp: In member function 'PathValue* HocDataPathImpl::found_v(void*, const char*, Symbol*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp:265:6: warning: unused variable 'len' [-Wunused-variable] 265 | int len = 0; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp: In member function 'void HocDataPathImpl::search_vectors()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp:424:9: warning: unused variable 'cnt' [-Wunused-variable] 424 | int i, cnt; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp: In member function 'void HocDataPathImpl::search(Node*, double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp:483:6: warning: unused variable 'i' [-Wunused-variable] 483 | int i, cnt; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/datapath.cpp:483:9: warning: unused variable 'cnt' [-Wunused-variable] 483 | int i, cnt; | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 27%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/cxprop.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/cxprop.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp: In function 'void read_temp1()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp:86:6: warning: unused variable 'nscan' [-Wunused-variable] 86 | int nscan, maxtype, imech, nmech, type, sz1, sz2, ntget, ith, nth, i, j, cnt, seq; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp: In function 'void nrn_cache_prop_realloc()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp:606:7: warning: unused variable 'j' [-Wunused-variable] 606 | int j, cnt = ml->nodecount; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/cxprop.cpp:585:13: warning: unused variable 'type' [-Wunused-variable] 585 | int i, it, type; | ^~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 28%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/geometry3d.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/geometry3d.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/geometry3d.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/geometry3d.cpp: In constructor 'geometry3d_Cylinder::geometry3d_Cylinder(double, double, double, double, double, double, double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/geometry3d.cpp:441:52: warning: 'geometry3d_Cylinder::cz' will be initialized after [-Wreorder] 441 | double r, rr, axisx, axisy, axisz, cx, cy, cz, h; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/geometry3d.cpp:441:19: warning: 'double geometry3d_Cylinder::rr' [-Wreorder] 441 | double r, rr, axisx, axisy, axisz, cx, cy, cz, h; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/geometry3d.cpp:444:1: warning: when initialized here [-Wreorder] 444 | geometry3d_Cylinder::geometry3d_Cylinder(double x0, double y0, double z0, | ^~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 24%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/bbsavestate.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/bbsavestate.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'double save_test_bin(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:629:15: warning: unused variable 'ss' [-Wunused-variable] 629 | BBSaveState* ss = (BBSaveState*)v; | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/oc/hocdec.h:14, from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/oc2iv.h:7, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnoc2iv.h:5, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:174: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'double restore_test_bin(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:899:54: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 899 | nrn_assert(fread(buf, sizeof(char), global_size, f) == global_size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:920:46: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 920 | nrn_assert(fread(buf, sizeof(char), sz, f) == sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'void tqcallback(const TQItem*, int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1142:12: warning: unused variable 'dl' [-Wunused-variable] 1142 | DEList *dl=0, *dl1=0; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1172:28: warning: unused variable 'tt' [-Wunused-variable] 1172 | int srcid, i; double ts, tt; PreSyn* ps; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In member function 'void BBSaveState::del_pp2de()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1360:10: warning: unused variable 'dl' [-Wunused-variable] 1360 | DEList* dl, *dl1; | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:178: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In member function 'int BBSaveState::counts(int**, int**)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1460:51: warning: unused variable 'base' [-Wunused-variable] 1460 | NrnHashIterateKeyValue(Int2Int, base2spgid, int, base, int, spgid) { | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnhash.h:89:8: note: in definition of macro 'NrnHashIterateKeyValue' 89 | Key key = (*p__).first; \ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1460:62: warning: unused variable 'spgid' [-Wunused-variable] 1460 | NrnHashIterateKeyValue(Int2Int, base2spgid, int, base, int, spgid) { | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnhash.h:90:10: note: in definition of macro 'NrnHashIterateKeyValue' 90 | Value value = (*p__).second; \ | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In member function 'void BBSaveState::mech(Prop*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1796:11: warning: unused variable 'd' [-Wunused-variable] 1796 | double d = hoc_xpop(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1798:11: warning: unused variable 'd' [-Wunused-variable] 1798 | double d = nrn_call_mech_func(ssi[p->type].callback, narg, p, p->type); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1810:12: warning: unused variable 'd' [-Wunused-variable] 1810 | double d = hoc_xpop(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1812:12: warning: unused variable 'd' [-Wunused-variable] 1812 | double d = nrn_call_mech_func(ssi[p->type].callback, narg, p, p->type); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1818:12: warning: unused variable 'd' [-Wunused-variable] 1818 | double d = hoc_xpop(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1820:12: warning: unused variable 'd' [-Wunused-variable] 1820 | double d = nrn_call_mech_func(ssi[p->type].callback, narg, p, p->type); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In member function 'void BBSaveState::netrecv_pp(Point_process*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1835:6: warning: unused variable 'type' [-Wunused-variable] 1835 | int type = pp->prop->type; | ^~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:178: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'void scatteritems()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2036:54: warning: unused variable 'gid' [-Wunused-variable] 2036 | NrnHashIterateKeyValue(Int2DblList, src2send, int, gid, DblList*, dl) { | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnhash.h:89:8: note: in definition of macro 'NrnHashIterateKeyValue' 89 | Key key = (*p__).first; \ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2070:53: warning: unused variable 'gid' [-Wunused-variable] 2070 | NrnHashIterateKeyValue(Int2DblList, src2send, int, gid, DblList*, dl) { | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnhash.h:89:8: note: in definition of macro 'NrnHashIterateKeyValue' 89 | Key key = (*p__).first; \ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2015:9: warning: unused variable 'gid' [-Wunused-variable] 2015 | int i, gid, host; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2016:11: warning: unused variable 'dl' [-Wunused-variable] 2016 | DblList* dl; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'void construct_presyn_queue()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2194:13: warning: unused variable 't2' [-Wunused-variable] 2194 | double t2 = dl->item(j); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2161:6: warning: unused variable 'gid' [-Wunused-variable] 2161 | int gid, tscnt, i; double ts, tt; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2161:28: warning: unused variable 'ts' [-Wunused-variable] 2161 | int gid, tscnt, i; double ts, tt; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2161:32: warning: unused variable 'tt' [-Wunused-variable] 2161 | int gid, tscnt, i; double ts, tt; | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:178: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: In function 'void bbss_queuecheck()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:2464:63: warning: unused variable 'gid' [-Wunused-variable] 2464 | NrnHashIterateKeyValue(Int2DblList, queuecheck_gid2unc, int, gid, DblList*, dl) { | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnhash.h:89:8: note: in definition of macro 'NrnHashIterateKeyValue' 89 | Key key = (*p__).first; \ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:1946:13: warning: 'void all2allv_helper(int*, int*, int*, int*)' defined but not used [-Wunused-function] 1946 | static void all2allv_helper(int* scnt, int* sdispl, int* rcnt, int* rdispl) { | ^~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:276:13: warning: 'use_gidcompress_' defined but not used [-Wunused-variable] 276 | static bool use_gidcompress_; | ^~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:275:13: warning: 'use_spikecompress_' defined but not used [-Wunused-variable] 275 | static bool use_spikecompress_; | ^~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:243:12: warning: 'int nrnmpi_int_allmax(int)' defined but not used [-Wunused-function] 243 | static int nrnmpi_int_allmax(int x) { return x; } | ^~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/bbsavestate.cpp:238:13: warning: 'void nrnmpi_dbl_alltoallv(double*, int*, int*, double*, int*, int*)' defined but not used [-Wunused-function] 238 | static void nrnmpi_dbl_alltoallv(double* s, int* scnt, int* sdispl, double* r, int* rcnt, int* rdispl) { | ^~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 28%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/hocmech.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/hocmech.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/hocmech.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/hocmech.cpp: In function 'void make_pointprocess()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/hocmech.cpp:311:14: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 311 | for (i=0; i < s2->s_varn; ++i) { | ~~^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/hocmech.cpp:252:7: warning: unused variable 'buf' [-Wunused-variable] 252 | char buf[256]; | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 28%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/impedanc.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/impedanc.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/impedanc.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 28%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/glinerec.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/glinerec.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/glinerec.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/glinerec.cpp: In member function 'void GraphVector::record_install()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/glinerec.cpp:165:18: warning: unused variable 'gvr' [-Wunused-variable] 165 | GVectorRecord* gvr = new GVectorRecord(this); | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 29%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/kssingle.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/kssingle.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kssingle.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kssingle.cpp: In member function 'void KSSingle::state(Node*, double*, Datum*, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kssingle.cpp:246:6: warning: unused variable 'i' [-Wunused-variable] 246 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kssingle.cpp: In member function 'void KSSingle::cv_update(Node*, double*, Datum*, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kssingle.cpp:262:6: warning: unused variable 'i' [-Wunused-variable] 262 | int i; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 29%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/linmod.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/linmod.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/linmod.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 29%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/linmod1.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/linmod1.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/linmod1.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 29%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/matrixmap.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/matrixmap.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:2: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h: In constructor 'MatrixMap::MatrixMap(OcMatrix&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h:63:11: warning: 'MatrixMap::ptree_' will be initialized after [-Wreorder] 63 | double** ptree_; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h:62:11: warning: 'double** MatrixMap::pm_' [-Wreorder] 62 | double** pm_; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:10:1: warning: when initialized here [-Wreorder] 10 | MatrixMap::MatrixMap(Matrix& mat) | ^~~~~~~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:2: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h: In constructor 'MatrixMap::MatrixMap(OcMatrix*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h:63:11: warning: 'MatrixMap::ptree_' will be initialized after [-Wreorder] 63 | double** ptree_; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.h:62:11: warning: 'double** MatrixMap::pm_' [-Wreorder] 62 | double** pm_; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:14:1: warning: when initialized here [-Wreorder] 14 | MatrixMap::MatrixMap(Matrix* mat) | ^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp: In member function 'void MatrixMap::alloc(int, int, Node**, int*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector::size_type' {aka 'long unsigned int'} [-Wsign-compare] 50 | for (int k = 0; k < nonzero_i.size(); k++) { | ~~^~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:41:6: warning: unused variable 'nrow' [-Wunused-variable] 41 | int nrow = m_.nrow(); | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/matrixmap.cpp:42:6: warning: unused variable 'ncol' [-Wunused-variable] 42 | int ncol = m_.ncol(); | ^~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 30%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/ndatclas.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/ndatclas.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ndatclas.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ndatclas.cpp: In member function 'bool NrnProperty::more_var()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ndatclas.cpp:138:22: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 138 | if (npi_->iterator_ >= npi_->sym_->s_varn) { | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 30%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/netpar.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/netpar.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In member function 'virtual void NetParEvent::deliver(double, NetCvode*, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:251:6: warning: unused variable 'seq' [-Wunused-variable] 251 | int seq; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In function 'void nrn_cleanup_presyn(PreSyn*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:964:10: warning: unused variable 'pss' [-Wunused-variable] 964 | PreSyn* pss; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In function 'void nrnmpi_gid_clear(int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:980:10: warning: unused variable 'ps' [-Wunused-variable] 980 | PreSyn* ps, *psi; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In function 'void nrn_gidout_iter(PFIO)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:1508:10: warning: unused variable 'ps' [-Wunused-variable] 1508 | PreSyn* ps; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In function 'size_t nrncore_netpar_bytes()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:1529:11: warning: unused variable 'ps' [-Wunused-variable] 1529 | PreSyn* ps; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: In function 'void nrncore_netpar_cellgroups_helper(nrncore_CellGroup*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:1580:11: warning: unused variable 'ps' [-Wunused-variable] 1580 | PreSyn* ps; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:39:15: warning: 'dt1_' defined but not used [-Wunused-variable] 39 | static double dt1_; // 1/dt | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:38:15: warning: 't_exchange_' defined but not used [-Wunused-variable] 38 | static double t_exchange_; | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netpar.cpp:32:12: warning: 'n_bgp_interval' defined but not used [-Wunused-variable] 32 | static int n_bgp_interval; | ^~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 29%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/kschan.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/kschan.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In function 'double ks_vres(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:292:10: warning: unused variable 'ks' [-Wunused-variable] 292 | KSChan* ks = (KSChan*)v; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In function 'double ks_rseed(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:301:10: warning: unused variable 'ks' [-Wunused-variable] 301 | KSChan* ks = (KSChan*)v; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In function 'double ks_pr(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:653:10: warning: unused variable 's' [-Wunused-variable] 653 | Symbol* s; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:655:9: warning: unused variable 'j' [-Wunused-variable] 655 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In constructor 'KSChan::KSChan(Object*, bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:874:6: warning: unused variable 'i' [-Wunused-variable] 874 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::setname(const char*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:990:32: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 990 | if (!is_point()) for (i=0; i < rlsym_->s_varn; ++i) { | ~~^~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::setion(const char*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:1202:19: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 1202 | for (i=2+io; i < rlsym_->s_varn; ++i) { | ~~^~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:1240:21: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 1240 | for (i=1 + io; i < rlsym_->s_varn; ++i) { | ~~^~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::free1()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:1270:22: warning: deleting object of polymorphic class type 'KSIv' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] 1270 | if (iv_relation_) { delete iv_relation_; iv_relation_ = NULL; } | ^~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::setcond()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:1289:22: warning: deleting object of polymorphic class type 'KSIv' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor] 1289 | if (iv_relation_) { delete iv_relation_; } | ^~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::settype(KSTransition*, int, const char*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:1443:7: warning: variable 'move' set but not used [-Wunused-but-set-variable] 1443 | bool move = true; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::ion_consist()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:2249:11: warning: unused variable 'sec' [-Wunused-variable] 2249 | Section* sec; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::state_consist(int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:2308:11: warning: unused variable 'sec' [-Wunused-variable] 2308 | Section* sec; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'virtual void KSChan::cv_sc_update(int, Node**, double**, Datum**, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:2910:9: warning: unused variable 'j' [-Wunused-variable] 2910 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:2911:10: warning: unused variable 's' [-Wunused-variable] 2911 | double* s; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp: In member function 'void KSChan::usetable(bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:3043:6: warning: unused variable 'i' [-Wunused-variable] 3043 | int i; | ^ In file included from /usr/include/string.h:519, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:2: In function 'strncpy', inlined from 'kst_ligand(void*)' at /builddir/build/BUILD/nrn-7.8.1/src/nrniv/kschan.cpp:633:10: /usr/include/bits/string_fortified.h:91:34: warning: 'strncpy' specified bound 20 equals destination size [-Wstringop-truncation] 91 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 30%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nonlinz.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nonlinz.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp: In constructor 'NonLinImpRep::NonLinImpRep()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:206:9: warning: unused variable 'j' [-Wunused-variable] 206 | int i, j, ieq, cnt; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:206:12: warning: unused variable 'ieq' [-Wunused-variable] 206 | int i, j, ieq, cnt; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp: In member function 'void NonLinImpRep::dsds()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:520:50: warning: unused variable 'nd' [-Wunused-variable] 520 | for (in = 0; in < ml->nodecount; ++in) { Node* nd = ml->nodelist[in]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp: In member function 'void NonLinImpRep::ode(int, Memb_list*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:557:6: warning: unused variable 'i' [-Wunused-variable] 557 | int i, nc; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:557:9: warning: variable 'nc' set but not used [-Wunused-but-set-variable] 557 | int i, nc; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp: In member function 'NonLinImpRep::gapsolve()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:619:20: warning: 'jb' may be used uninitialized in this function [-Wmaybe-uninitialized] 619 | cmplx_spSolve(m_, rb-1, rx1-1, jb-1, jx1-1); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:619:20: warning: 'rb' may be used uninitialized in this function [-Wmaybe-uninitialized] /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:619:20: warning: 'jx1' may be used uninitialized in this function [-Wmaybe-uninitialized] /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:619:20: warning: 'rx1' may be used uninitialized in this function [-Wmaybe-uninitialized] /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:591:16: warning: 'jx' may be used uninitialized in this function [-Wmaybe-uninitialized] 591 | double *rx, *jx, *rx1, *jx1, *rb, *jb; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nonlinz.cpp:591:11: warning: 'rx' may be used uninitialized in this function [-Wmaybe-uninitialized] 591 | double *rx, *jx, *rx1, *jx1, *rb, *jb; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 30%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/multisplit.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/multisplit.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::multisplit_clear()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:523:15: warning: unused variable 'ms' [-Wunused-variable] 523 | MultiSplit* ms; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::prstruct()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:1773:9: warning: unused variable 'nd' [-Wunused-variable] 1773 | Node* nd = ms->nd[0]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::multisplit_nocap_v_part3(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:1956:9: warning: unused variable 'j' [-Wunused-variable] 1956 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::matrix_exchange()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2020:9: warning: unused variable 'wt' [-Wunused-variable] 2020 | double wt = nrnmpi_wtime(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::matrix_exchange_nocap()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2227:9: warning: unused variable 'wt' [-Wunused-variable] 2227 | double wt = nrnmpi_wtime(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In destructor 'virtual ReducedTree::~ReducedTree()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2454:6: warning: unused variable 'i' [-Wunused-variable] 2454 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitThread::bksub_backbone(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2819:12: warning: unused variable 'ip' [-Wunused-variable] 2819 | int i, j, ip, ip1, ip2; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2819:16: warning: unused variable 'ip1' [-Wunused-variable] 2819 | int i, j, ip, ip1, ip2; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:2819:21: warning: unused variable 'ip2' [-Wunused-variable] 2819 | int i, j, ip, ip1, ip2; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::pmat(bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:3291:12: warning: unused variable 'ip' [-Wunused-variable] 3291 | int it, i, ip, is; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'void MultiSplitControl::pmatf(bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:3321:12: warning: unused variable 'ip' [-Wunused-variable] 3321 | int it, i, ip, is; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:43:15: warning: 'nrnmpi_splitcell_wait_' defined but not used [-Wunused-variable] 43 | static double nrnmpi_splitcell_wait_; | ^~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp: In member function 'MultiSplitControl::multisplit(Section*, double, int, int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/multisplit.cpp:411:17: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized] 411 | hoc_execerror(s, secname(root->sec)); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 31%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrndae.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrndae.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.cpp:3: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.h: In constructor 'NrnDAE::NrnDAE(OcMatrix*, IvocVect*, IvocVect*, int, Node**, IvocVect*, void (*)(void*), void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.h:186:7: warning: 'NrnDAE::yptmp_' will be initialized after [-Wreorder] 186 | Vect yptmp_; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.h:183:7: warning: 'IvocVect NrnDAE::cyp_' [-Wreorder] 183 | Vect cyp_; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.cpp:137:1: warning: when initialized here [-Wreorder] 137 | NrnDAE::NrnDAE(Matrix* cmat, Vect* const yvec, Vect* const y0, int nnode, | ^~~~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.cpp:3: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.h:183:7: warning: 'NrnDAE::cyp_' will be initialized after [-Wreorder] 183 | Vect cyp_; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.h:139:12: warning: 'void (* NrnDAE::f_init_)(void*)' [-Wreorder] 139 | void (*f_init_)(void* data); | ^~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndae.cpp:137:1: warning: when initialized here [-Wreorder] 137 | NrnDAE::NrnDAE(Matrix* cmat, Vect* const yvec, Vect* const y0, int nnode, | ^~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 31%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrndaspk.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrndaspk.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndaspk.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrndaspk.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/nrndaspk.cpp: In member function 'int Daspk::init()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/nrndaspk.cpp:233:6: warning: unused variable 'i' [-Wunused-variable] 233 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/nrndaspk.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/nrndaspk.cpp:64:12: warning: 'int msolve(IDAMem, N_Vector, N_Vector, N_Vector, N_Vector)' declared 'static' but never defined [-Wunused-function] 64 | static int msolve(IDAMem mem, N_Vector b, N_Vector ycur, N_Vector ypcur, | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/nrndaspk.cpp:216:15: warning: 'double check(double, Daspk*)' defined but not used [-Wunused-function] 216 | static double check(double t, Daspk* ida) { | ^~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 31%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrnpy.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DNRNCMAKE -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -DUSE_LIBNRNPYTHON_MAJORMINOR=0 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrnpy.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnpy.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 32%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrnrtime.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrnrtime.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnrtime.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 31%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrnmenu.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrnmenu.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp: In function 'void mech_menu(Prop*, double, int, const char*, MechSelector*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp:291:15: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 291 | for (j=0; j < sym->s_varn; j++ ) { | ~~^~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp: In function 'void point_menu(Object*, int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp:459:40: warning: array subscript has type 'char' [-Wchar-subscripts] 459 | psym = pointsym[pnt_map[pp->prop->type]]; | ~~~~~~~~~~~~~~~~~~~~~~^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp:476:15: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 476 | for (k=0; k < psym->s_varn; k++ ) { | ~~^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnmenu.cpp:488:16: warning: unused variable 'a' [-Wunused-variable] 488 | Arrayinfo* a = vsym->arayinfo; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 31%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrnbbcore_write.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrnbbcore_write.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:111: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnsection_mapping.h: In member function 'CellMapping* NrnMappingInfo::get_cell_mapping(int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnsection_mapping.h:119:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector::size_type' {aka 'long unsigned int'} [-Wsign-compare] 119 | for(int i = 0; i < mapping.size(); i++) { | ~~^~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'size_t part1()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:275:22: warning: unused variable 'tml' [-Wunused-variable] 275 | NrnThreadMembList* tml; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'void datumtransform(nrncore_CellGroup*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:730:16: warning: unused variable 'nt' [-Wunused-variable] 730 | NrnThread& nt = nrn_threads[ith]; | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptbinq.h:14, from /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/tqueue.h:58, from /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/netcvode.h:7, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:109: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'void write_contiguous_art_data(double**, int, int, FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1081:14: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 1081 | assert(n == szitem); | ~~^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'int nrnthread_dat2_2(int, int*&, double*&, double*&, double*&, double*&, double*&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1257:7: warning: unused variable 'n' [-Wunused-variable] 1257 | int n = nt.end; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'int nrnthread_dat2_3(int, int, int*&, double*&, int*&, int*&, double*&, double*&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1359:14: warning: unused variable 'nt' [-Wunused-variable] 1359 | NrnThread& nt = nrn_threads[tid]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'int nrnthread_dat2_corepointer(int, int&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1397:14: warning: unused variable 'nt' [-Wunused-variable] 1397 | NrnThread& nt = nrn_threads[tid]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'void write_nrnthread_task(const char*, nrncore_CellGroup*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1696:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector::size_type' {aka 'long unsigned int'} [-Wsign-compare] 1696 | for (int i = 0; i < iRecvVec.size(); ++i) | ~~^~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'int* datum2int(int, Memb_list*, NrnThread&, nrncore_CellGroup&, nrncore_DatumIndices&, int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1712:12: warning: unused variable 'd' [-Wunused-variable] 1712 | Datum* d = ml->pdata[i]; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: In function 'void* get_coreneuron_handle()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1952:8: warning: ignoring return value of 'char* getcwd(char*, size_t)' declared with attribute 'warn_unused_result' [-Wunused-result] 1952 | getcwd(pwd, FILENAME_MAX); | ~~~~~~^~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnbbcore_write.cpp:1075:13: warning: 'void write_contiguous_art_data(double**, int, int, FILE*)' defined but not used [-Wunused-function] 1075 | static void write_contiguous_art_data(double** data, int nitem, int szitem, FILE* f) { | ^~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 32%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/nvector_nrnserial_ld.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/nvector_nrnserial_ld.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnserial_ld.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnserial_ld.c: In function 'N_VNew_NrnSerialLD': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnserial_ld.c:160:21: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized] 160 | NV_DATA_S_LD(v) = data; /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnserial_ld.c: In function 'N_VClone_NrnSerialLD': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnserial_ld.c:364:21: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized] 364 | NV_DATA_S_LD(v) = data; make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 32%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/nvector_nrnthread.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/nvector_nrnthread.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c: In function 'N_VNew_NrnThread': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c:175:30: warning: unused variable 'content' [-Wunused-variable] 175 | N_VectorContent_NrnThread* content; | ^~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c: In function 'N_VWL2Norm_NrnThread': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c:701:12: warning: variable 'N' set but not used [-Wunused-but-set-variable] 701 | long int N; | ^ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c:781:14: warning: 'vminquotient' defined but not used [-Wunused-function] 781 | static void* vminquotient(NrnThread* nt) { | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread.c:366:13: warning: 'pr' defined but not used [-Wunused-function] 366 | static void pr(N_Vector x) { N_VPrint_NrnThread(x); } | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 32%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/nrnste.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/nrnste.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnste.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 32%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/nvector_nrnthread_ld.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/nvector_nrnthread_ld.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c: In function 'N_VNew_NrnThreadLD': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c:175:32: warning: unused variable 'content' [-Wunused-variable] 175 | N_VectorContent_NrnThreadLD* content; | ^~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c: In function 'N_VWL2Norm_NrnThreadLD': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c:700:12: warning: variable 'N' set but not used [-Wunused-but-set-variable] 700 | long int N; | ^ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c:780:14: warning: 'vminquotient' defined but not used [-Wunused-function] 780 | static void* vminquotient(NrnThread* nt) { | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nvector_nrnthread_ld.c:365:13: warning: 'pr' defined but not used [-Wunused-function] 365 | static void pr(N_Vector x) { N_VPrint_NrnThreadLD(x); } | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 30%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/netcvode.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/netcvode.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netcvode.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netcvode.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In static member function 'static DiscreteEvent* PlayRecordEvent::savestate_read(FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:341:17: warning: unused variable 'de' [-Wunused-variable] 341 | DiscreteEvent* de = nil; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::del_cv_memb_list(Cvode*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:1438:6: warning: unused variable 'i' [-Wunused-variable] 1438 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::distribute_dinfo(int*, int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:1500:6: warning: unused variable 'i' [-Wunused-variable] 1500 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'bool NetCvode::init_global()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:1800:22: warning: unused variable 'z' [-Wunused-variable] 1800 | CvodeThreadData& z = cv.ctd_[0]; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::init_events()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:2802:9: warning: unused variable 'fifodelay' [-Wunused-variable] 2802 | double fifodelay; | ^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In static member function 'static DiscreteEvent* SelfEvent::savestate_read(FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:3267:38: warning: unused variable 'iml' [-Wunused-variable] 3267 | int ppindex, ncindex, moff, pptype, iml; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:3269:10: warning: unused variable 'obj' [-Wunused-variable] 3269 | Object* obj; | ^~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netcvode.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'int NetCvode::pgvts_event(double&)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:3578:6: warning: unused variable 'rank' [-Wunused-variable] 3578 | int rank, op, err, init; | ^~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/netcvode.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::re_init(double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:3913:12: warning: unused variable 'k' [-Wunused-variable] 3913 | int i, j, k, l; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:3913:15: warning: unused variable 'l' [-Wunused-variable] 3913 | int i, j, k, l; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'NetCon* NetCvode::install_deliver(double*, Section*, Object*, Object*, double, double, double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:4485:6: warning: unused variable 'i' [-Wunused-variable] 4485 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'virtual void WatchCondition::pgvts_deliver(double, NetCvode*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:5400:13: warning: unused variable 'nt' [-Wunused-variable] 5400 | NrnThread* nt; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'virtual void STECondition::pgvts_deliver(double, NetCvode*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:5417:13: warning: unused variable 'nt' [-Wunused-variable] 5417 | NrnThread* nt; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In function 'void nrnthread_trajectory_values(int, int, void**, double)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:5736:9: warning: unused variable 'i_trajec' [-Wunused-variable] 5736 | int i_trajec = 0; | ^~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::deliver_net_events(NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:5831:13: warning: unused variable 'tt' [-Wunused-variable] 5831 | double tm, tt, tsav; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::vec_remove()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6198:12: warning: unused variable 'iv' [-Wunused-variable] 6198 | IvocVect* iv = vector_arg(1); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::playrec_setup()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6207:10: warning: unused variable 'px' [-Wunused-variable] 6207 | double* px; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'double NetCvode::state_magnitudes()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6378:11: warning: unused variable 'ms' [-Wunused-variable] 6378 | double* ms; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6346:6: warning: unused variable 'i' [-Wunused-variable] 6346 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'void NetCvode::maxstate_analyse()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6441:16: warning: unused variable 'n' [-Wunused-variable] 6441 | int i, it, j, n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'NetCvode::error_weights()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:4236:21: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized] 4236 | gcv_->states(vp + j); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'NetCvode::acor()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:4265:21: warning: 'j' may be used uninitialized in this function [-Wmaybe-uninitialized] 4265 | gcv_->states(vp + j); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp: In member function 'NetCvode::maxstate_analyse()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/netcvode.cpp:6460:22: warning: 'msi' may be used uninitialized in this function [-Wmaybe-uninitialized] 6460 | maxstate_analyze_1(it, *gcv_, msi, gcv_->ctd_[it]); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 33%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/ocjump.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/ocjump.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ocjump.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 33%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/ocbbs.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/ocbbs.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ocbbs.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ocbbs.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp: In function 'double multisplit(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp:616:6: warning: unused variable 'reducedtree_host' [-Wunused-variable] 616 | int reducedtree_host = 0; | ^~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp: In function 'double broadcast(void*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp:850:6: warning: unused variable 'srcid' [-Wunused-variable] 850 | int srcid = int(chkarg(2, 0, nrnmpi_numprocs - 1)); | ^~~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ocbbs.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp: In member function 'virtual void BBSImpl::return_args(int)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp:1304:6: warning: variable 'i' set but not used [-Wunused-but-set-variable] 1304 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp:1308:6: warning: unused variable 'wid' [-Wunused-variable] 1308 | int wid = upkint(); | ^~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/ocbbs.cpp:1297, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ocbbs.cpp:1: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp: In member function 'BBSImpl::subworld_worker_execute()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:19:6: warning: 'info[0]' is used uninitialized in this function [-Wuninitialized] 19 | int id = info[0]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:24:6: warning: 'info[1]' is used uninitialized in this function [-Wuninitialized] 24 | int style = info[1]; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:28:22: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized] 28 | char *s = new char[size]; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:46:16: warning: 'npickle' may be used uninitialized in this function [-Wmaybe-uninitialized] 46 | s = new char[npickle]; | ^~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:64:24: warning: 'argtypes' may be used uninitialized in this function [-Wmaybe-uninitialized] 64 | for (j = argtypes; (i = j%5) != 0; j /= 5) { | ~~~^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:52:20: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized] 52 | s = new char(size); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:70:13: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized] 70 | hoc_pushx(x); | ~~~~~~~~~^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:74:28: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized] 74 | sarg[ns] = new char(size); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:81:26: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized] 81 | Vect* vec = new Vect(n); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../parallel/subworld.cpp:88:17: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized] 88 | s = new char[n]; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 33%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/occvode.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/occvode.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/occvode.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/occvode.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp: In member function 'void Cvode::new_no_cap_memb(CvodeThreadData&, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp:277:13: warning: unused variable 'ml' [-Wunused-variable] 277 | Memb_list* ml; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp: In member function 'void Cvode::fun_thread_ms_part1(double, double*, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp:715:19: warning: unused variable 'z' [-Wunused-variable] 715 | CvodeThreadData& z = ctd_[nt->id]; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp: In member function 'void Cvode::before_after(BAMechList*, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp:764:9: warning: unused variable 'j' [-Wunused-variable] 764 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp: In member function 'void Cvode::acor(double*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp:989:13: warning: unused variable 'nt' [-Wunused-variable] 989 | NrnThread* nt; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp: In member function 'Cvode::new_no_cap_memb(CvodeThreadData&, NrnThread*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/occvode.cpp:298:14: warning: 'ncm' may be used uninitialized in this function [-Wmaybe-uninitialized] 298 | ncm->next = new CvMembList(); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 34%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/ppshape.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/ppshape.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/ppshape.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 34%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/prcellstate.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/prcellstate.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/prcellstate.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/prcellstate.cpp: In function 'void pr_memb(int, Memb_list*, int*, NrnThread&, FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/prcellstate.cpp:30:7: warning: unused variable 'psize' [-Wunused-variable] 30 | int psize = nrn_prop_dparam_size_[type]; | ^~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 34%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/pysecname2sec.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/pysecname2sec.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/pysecname2sec.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 34%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/rotate3d.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/rotate3d.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/rotate3d.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 33%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/partrans.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/partrans.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp: In function 'void nrn_partrans_update_ptrs()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:373:9: warning: variable 'n' set but not used [-Wunused-but-set-variable] 373 | int i, n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp: In function 'void nrnmpi_setup_transfer()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:701:6: warning: unused variable 'nhost' [-Wunused-variable] 701 | int nhost = nrnmpi_numprocs; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:329:13: warning: 'void check_pointers()' defined but not used [-Wunused-function] 329 | static void check_pointers() { | ^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:204:44: warning: 'outsrcdspl_' defined but not used [-Wunused-variable] 204 | static int outsrc_buf_size_, *outsrccnt_, *outsrcdspl_; | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:204:31: warning: 'outsrccnt_' defined but not used [-Wunused-variable] 204 | static int outsrc_buf_size_, *outsrccnt_, *outsrcdspl_; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:203:42: warning: 'insrcdspl_' defined but not used [-Wunused-variable] 203 | static int insrc_buf_size_, *insrccnt_, *insrcdspl_; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:203:30: warning: 'insrccnt_' defined but not used [-Wunused-variable] 203 | static int insrc_buf_size_, *insrccnt_, *insrcdspl_; | ^~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/partrans.cpp:203:12: warning: 'insrc_buf_size_' defined but not used [-Wunused-variable] 203 | static int insrc_buf_size_, *insrccnt_, *insrcdspl_; | ^~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 34%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/savstate.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/savstate.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp In file included from /builddir/build/BUILD/nrn-7.8.1/src/oc/hocdec.h:14, from /builddir/build/BUILD/nrn-7.8.1/src/ivoc/oc2iv.h:7, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnoc2iv.h:5, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:6: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp: In member function 'virtual void SaveState::read(OcFile*, bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:735:5: note: in expansion of macro 'ASSERTfread' 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:739:5: note: in expansion of macro 'ASSERTfread' 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:747:5: note: in expansion of macro 'ASSERTfread' 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:751:5: note: in expansion of macro 'ASSERTfread' 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:767:3: note: in expansion of macro 'ASSERTfread' 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp: In member function 'virtual void SaveState::write(OcFile*, bool)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:800:5: note: in expansion of macro 'ASSERTfwrite' 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:803:5: note: in expansion of macro 'ASSERTfwrite' 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:810:5: note: in expansion of macro 'ASSERTfwrite' 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:813:5: note: in expansion of macro 'ASSERTfwrite' 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:821:3: note: in expansion of macro 'ASSERTfwrite' 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp: In member function 'void SaveState::readnet(FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:939:4: note: in expansion of macro 'ASSERTfread' 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 940 | } | ~ 941 | } | ~ 942 | // PreSyn's | ~~~~~~~~~~~ 943 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 944 | sscanf(buf, "%d\n", &npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | if (npss_ != 0) { | ~~~~~~~~~~~~~~~~~ 946 | pss_ = new PreSynState[npss_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:947:3: note: in expansion of macro 'ASSERTfread' 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:33:56: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 33 | #define ASSERTfread(a,b,c,d) nrn_assert(fread(a,b,c,d) == c) | ~~~~~~~~~~~~~~~^~~~~ 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 940 | } | ~ 941 | } | ~ 942 | // PreSyn's | ~~~~~~~~~~~ 943 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 944 | sscanf(buf, "%d\n", &npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | if (npss_ != 0) { | ~~~~~~~~~~~~~~~~~ 946 | pss_ = new PreSynState[npss_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 948 | PreSyn* ps; | ~~~~~~~~~~~ 949 | i = 0; | ~~~~~~ 950 | hoc_Item* q; | ~~~~~~~~~~~~ 951 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 952 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 953 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 954 | ++i; | ~~~~ 955 | } | ~ 956 | assert(npss_ == i); | ~~~~~~~~~~~~~~~~~~~ 957 | } | ~ 958 | | 959 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 960 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 961 | tqs_->nstate = n; | ~~~~~~~~~~~~~~~~~ 962 | if (n) { | ~~~~~~~~ 963 | tqs_->items = new DiscreteEvent*[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 964 | tqs_->tdeliver = new double[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 965 | ASSERTfread((char*)tqs_->tdeliver, sizeof(double), n, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:965:3: note: in expansion of macro 'ASSERTfread' 965 | ASSERTfread((char*)tqs_->tdeliver, sizeof(double), n, f); | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp: In member function 'void SaveState::writenet(FILE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 940 | } | ~ 941 | } | ~ 942 | // PreSyn's | ~~~~~~~~~~~ 943 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 944 | sscanf(buf, "%d\n", &npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | if (npss_ != 0) { | ~~~~~~~~~~~~~~~~~ 946 | pss_ = new PreSynState[npss_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 948 | PreSyn* ps; | ~~~~~~~~~~~ 949 | i = 0; | ~~~~~~ 950 | hoc_Item* q; | ~~~~~~~~~~~~ 951 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 952 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 953 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 954 | ++i; | ~~~~ 955 | } | ~ 956 | assert(npss_ == i); | ~~~~~~~~~~~~~~~~~~~ 957 | } | ~ 958 | | 959 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 960 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 961 | tqs_->nstate = n; | ~~~~~~~~~~~~~~~~~ 962 | if (n) { | ~~~~~~~~ 963 | tqs_->items = new DiscreteEvent*[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 964 | tqs_->tdeliver = new double[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 965 | ASSERTfread((char*)tqs_->tdeliver, sizeof(double), n, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 966 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 967 | DiscreteEvent* de = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 968 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 969 | sscanf(buf, "%d\n", &type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 970 | switch(type) { | ~~~~~~~~~~~~~~ 971 | case DiscreteEventType: | ~~~~~~~~~~~~~~~~~~~~~~~ 972 | de = DiscreteEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 973 | break; | ~~~~~~ 974 | case TstopEventType: | ~~~~~~~~~~~~~~~~~~~~ 975 | de = TstopEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 976 | break; | ~~~~~~ 977 | case NetConType: | ~~~~~~~~~~~~~~~~ 978 | de = NetCon::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 979 | break; | ~~~~~~ 980 | case SelfEventType: | ~~~~~~~~~~~~~~~~~~~ 981 | de = SelfEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 982 | break; | ~~~~~~ 983 | case PreSynType: | ~~~~~~~~~~~~~~~~ 984 | de = PreSyn::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 985 | break; | ~~~~~~ 986 | case HocEventType: | ~~~~~~~~~~~~~~~~~~ 987 | de = HocEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 988 | break; | ~~~~~~ 989 | case PlayRecordEventType: | ~~~~~~~~~~~~~~~~~~~~~~~~~ 990 | de = PlayRecordEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 991 | break; | ~~~~~~ 992 | case NetParEventType: | ~~~~~~~~~~~~~~~~~~~~~ 993 | de = NetParEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 994 | break; | ~~~~~~ 995 | default: | ~~~~~~~~ 996 | hoc_execerror("SaveState::readnet", "Unimplemented DiscreteEvent type"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 997 | break; | ~~~~~~ 998 | } | ~ 999 | tqs_->items[i] = de; | ~~~~~~~~~~~~~~~~~~~~ 1000 | } | ~ 1001 | } | ~ 1002 | } | ~ 1003 | | 1004 | void SaveState::writenet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1005 | fprintf(f, "%d\n", nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1006 | int i, n; | ~~~~~~~~~ 1007 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1008 | fprintf(f, "%d %d\n", ncs_[i].object_index, ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1009 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 1010 | ASSERTfwrite((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:1010:4: note: in expansion of macro 'ASSERTfwrite' 1010 | ASSERTfwrite((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 940 | } | ~ 941 | } | ~ 942 | // PreSyn's | ~~~~~~~~~~~ 943 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 944 | sscanf(buf, "%d\n", &npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | if (npss_ != 0) { | ~~~~~~~~~~~~~~~~~ 946 | pss_ = new PreSynState[npss_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 948 | PreSyn* ps; | ~~~~~~~~~~~ 949 | i = 0; | ~~~~~~ 950 | hoc_Item* q; | ~~~~~~~~~~~~ 951 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 952 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 953 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 954 | ++i; | ~~~~ 955 | } | ~ 956 | assert(npss_ == i); | ~~~~~~~~~~~~~~~~~~~ 957 | } | ~ 958 | | 959 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 960 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 961 | tqs_->nstate = n; | ~~~~~~~~~~~~~~~~~ 962 | if (n) { | ~~~~~~~~ 963 | tqs_->items = new DiscreteEvent*[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 964 | tqs_->tdeliver = new double[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 965 | ASSERTfread((char*)tqs_->tdeliver, sizeof(double), n, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 966 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 967 | DiscreteEvent* de = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 968 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 969 | sscanf(buf, "%d\n", &type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 970 | switch(type) { | ~~~~~~~~~~~~~~ 971 | case DiscreteEventType: | ~~~~~~~~~~~~~~~~~~~~~~~ 972 | de = DiscreteEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 973 | break; | ~~~~~~ 974 | case TstopEventType: | ~~~~~~~~~~~~~~~~~~~~ 975 | de = TstopEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 976 | break; | ~~~~~~ 977 | case NetConType: | ~~~~~~~~~~~~~~~~ 978 | de = NetCon::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 979 | break; | ~~~~~~ 980 | case SelfEventType: | ~~~~~~~~~~~~~~~~~~~ 981 | de = SelfEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 982 | break; | ~~~~~~ 983 | case PreSynType: | ~~~~~~~~~~~~~~~~ 984 | de = PreSyn::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 985 | break; | ~~~~~~ 986 | case HocEventType: | ~~~~~~~~~~~~~~~~~~ 987 | de = HocEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 988 | break; | ~~~~~~ 989 | case PlayRecordEventType: | ~~~~~~~~~~~~~~~~~~~~~~~~~ 990 | de = PlayRecordEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 991 | break; | ~~~~~~ 992 | case NetParEventType: | ~~~~~~~~~~~~~~~~~~~~~ 993 | de = NetParEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 994 | break; | ~~~~~~ 995 | default: | ~~~~~~~~ 996 | hoc_execerror("SaveState::readnet", "Unimplemented DiscreteEvent type"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 997 | break; | ~~~~~~ 998 | } | ~ 999 | tqs_->items[i] = de; | ~~~~~~~~~~~~~~~~~~~~ 1000 | } | ~ 1001 | } | ~ 1002 | } | ~ 1003 | | 1004 | void SaveState::writenet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1005 | fprintf(f, "%d\n", nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1006 | int i, n; | ~~~~~~~~~ 1007 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1008 | fprintf(f, "%d %d\n", ncs_[i].object_index, ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1009 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 1010 | ASSERTfwrite((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1011 | } | ~ 1012 | } | ~ 1013 | fprintf(f, "%d\n", npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1014 | if (npss_) { | ~~~~~~~~~~~~ 1015 | ASSERTfwrite((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:1015:3: note: in expansion of macro 'ASSERTfwrite' 1015 | ASSERTfwrite((char*)pss_, sizeof(PreSynState), npss_, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:34:58: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare] 34 | #define ASSERTfwrite(a,b,c,d) nrn_assert(fwrite(a,b,c,d) == c) | ~~~~~~~~~~~~~~~~^~~~~ 35 | | 36 | class SaveState : public Resource { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 37 | public: | ~~~~~~~ 38 | SaveState(); | ~~~~~~~~~~~~ 39 | ~SaveState(); | ~~~~~~~~~~~~~ 40 | virtual void save(); | ~~~~~~~~~~~~~~~~~~~~ 41 | virtual void restore(int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 42 | virtual void read(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 43 | virtual void write(OcFile*, bool close); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 44 | struct NodeState { | ~~~~~~~~~~~~~~~~~~ 45 | double v; | ~~~~~~~~~ 46 | int nmemb; | ~~~~~~~~~~ 47 | int* type; | ~~~~~~~~~~ 48 | int nstate; | ~~~~~~~~~~~ 49 | double* state; | ~~~~~~~~~~~~~~ 50 | }; | ~~ 51 | struct SecState { | ~~~~~~~~~~~~~~~~~ 52 | Section* sec; | ~~~~~~~~~~~~~ 53 | int nnode; | ~~~~~~~~~~ 54 | struct NodeState* ns; | ~~~~~~~~~~~~~~~~~~~~~ 55 | struct NodeState* root; // non-zero for rootnode | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 56 | }; | ~~ 57 | struct StateStructInfo { | ~~~~~~~~~~~~~~~~~~~~~~~~ 58 | int offset; | ~~~~~~~~~~~ 59 | int size; | ~~~~~~~~~ 60 | }; | ~~ 61 | struct ACellState { | ~~~~~~~~~~~~~~~~~~~ 62 | int type; | ~~~~~~~~~ 63 | int ncell; | ~~~~~~~~~~ 64 | double* state; | ~~~~~~~~~~~~~~ 65 | }; | ~~ 66 | struct NetConState { | ~~~~~~~~~~~~~~~~~~~~ 67 | int object_index; // for checking | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | int nstate; | ~~~~~~~~~~~ 69 | double* state; | ~~~~~~~~~~~~~~ 70 | }; | ~~ 71 | struct PreSynState { | ~~~~~~~~~~~~~~~~~~~~ 72 | bool flag; // is it firing? | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | double valthresh, valold, told; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 74 | | 75 | }; | ~~ 76 | struct TQState { | ~~~~~~~~~~~~~~~~ 77 | int nstate; | ~~~~~~~~~~~ 78 | double* tdeliver; | ~~~~~~~~~~~~~~~~~ 79 | DiscreteEvent** items; | ~~~~~~~~~~~~~~~~~~~~~~ 80 | }; | ~~ 81 | private: | ~~~~~~~~ 82 | bool check(bool warn); | ~~~~~~~~~~~~~~~~~~~~~~ 83 | void alloc(); | ~~~~~~~~~~~~~ 84 | void ssfree(); | ~~~~~~~~~~~~~~ 85 | void ssi_def(); | ~~~~~~~~~~~~~~~ 86 | private: | ~~~~~~~~ 87 | void fread_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void fwrite_NodeState(NodeState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 | void fread_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 90 | void fwrite_SecState(SecState*, int, FILE*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 91 | private: | ~~~~~~~~ 92 | double t_; | ~~~~~~~~~~ 93 | int nroot_; | ~~~~~~~~~~~ 94 | int nsec_; | ~~~~~~~~~~ 95 | SecState* ss_; | ~~~~~~~~~~~~~~ 96 | int nacell_; // number of types | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 97 | ACellState* acell_; | ~~~~~~~~~~~~~~~~~~~ 98 | int nncs_; | ~~~~~~~~~~ 99 | NetConState* ncs_; | ~~~~~~~~~~~~~~~~~~ 100 | int npss_; | ~~~~~~~~~~ 101 | PreSynState* pss_; | ~~~~~~~~~~~~~~~~~~ 102 | TQState* tqs_; | ~~~~~~~~~~~~~~ 103 | int tqcnt_; // volatile for index of forall_callback | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 104 | int nprs_; | ~~~~~~~~~~ 105 | PlayRecordSave** prs_; | ~~~~~~~~~~~~~~~~~~~~~~ 106 | static StateStructInfo* ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 | static cTemplate* nct; | ~~~~~~~~~~~~~~~~~~~~~~ 108 | private: | ~~~~~~~~ 109 | void savenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void restorenode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 | bool checknode(NodeState&, Node*, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 | void allocnode(NodeState&, Node*); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 113 | | 114 | void saveacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | void restoreacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | bool checkacell(ACellState&, int type, bool); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void allocacell(ACellState&, int type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | | 119 | void savenet(); | ~~~~~~~~~~~~~~~ 120 | void restorenet(); | ~~~~~~~~~~~~~~~~~~ 121 | void readnet(FILE*); | ~~~~~~~~~~~~~~~~~~~~ 122 | void writenet(FILE*); | ~~~~~~~~~~~~~~~~~~~~~ 123 | bool checknet(bool); | ~~~~~~~~~~~~~~~~~~~~ 124 | void allocnet(); | ~~~~~~~~~~~~~~~~ 125 | void free_tq(); | ~~~~~~~~~~~~~~~ 126 | void alloc_tq(); | ~~~~~~~~~~~~~~~~ 127 | public: | ~~~~~~~ 128 | void tqcount(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 129 | void tqsave(const TQItem*, int); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | }; | ~~ 131 | | 132 | static SaveState* this_savestate; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 133 | static int callback_mode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 134 | | 135 | void tqcallback(const TQItem* tq, int i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | if (callback_mode == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 137 | this_savestate->tqcount(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 138 | }else{ | ~~~~~~ 139 | this_savestate->tqsave(tq, i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 | } | ~ 141 | } | ~ 142 | | 143 | #if __sgi && 0 | ~~~~~~~~~~~~~~ 144 | // fixed in version 5 of os | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 | StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | #else | ~~~~~ 147 | SaveState::StateStructInfo* SaveState::ssi; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 148 | #endif | ~~~~~~ 149 | cTemplate* SaveState::nct; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 | | 151 | SaveState::SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 152 | int i, j; | ~~~~~~~~~ 153 | ssi_def(); | ~~~~~~~~~~ 154 | nroot_ = 0; | ~~~~~~~~~~~ 155 | ss_ = NULL; | ~~~~~~~~~~~ 156 | nsec_ = 0; | ~~~~~~~~~~ 157 | nncs_ = 0; | ~~~~~~~~~~ 158 | ncs_ = NULL; | ~~~~~~~~~~~~ 159 | npss_ = 0; | ~~~~~~~~~~ 160 | pss_ = NULL; | ~~~~~~~~~~~~ 161 | tqs_ = new TQState(); | ~~~~~~~~~~~~~~~~~~~~~ 162 | tqs_->nstate = 0; | ~~~~~~~~~~~~~~~~~ 163 | nprs_ = 0; | ~~~~~~~~~~ 164 | prs_ = NULL; | ~~~~~~~~~~~~ 165 | nacell_ = 0; | ~~~~~~~~~~~~ 166 | for (i=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 167 | ++nacell_; | ~~~~~~~~~~ 168 | } | ~ 169 | acell_ = new ACellState[nacell_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 170 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 171 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 172 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 173 | } | ~ 174 | for (i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 175 | acell_[j].type = i; | ~~~~~~~~~~~~~~~~~~~ 176 | ++j; | ~~~~ 177 | } | ~ 178 | } | ~ 179 | | 180 | SaveState::~SaveState() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 181 | ssfree(); | ~~~~~~~~~ 182 | delete tqs_; | ~~~~~~~~~~~~ 183 | delete [] acell_; | ~~~~~~~~~~~~~~~~~ 184 | } | ~ 185 | | 186 | void SaveState::fread_NodeState(NodeState* ns, int cnt, FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 188 | ASSERTfread(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 189 | ASSERTfread(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 190 | ASSERTfread(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 | } | ~ 192 | } | ~ 193 | void SaveState::fwrite_NodeState(NodeState* ns, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 194 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 195 | ASSERTfwrite(&ns[i].v, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 196 | ASSERTfwrite(&ns[i].nmemb, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 | ASSERTfwrite(&ns[i].nstate, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 198 | } | ~ 199 | } | ~ 200 | void SaveState::fread_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 201 | int b; | ~~~~~~ 202 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 203 | ASSERTfread(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 204 | ASSERTfread(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 205 | if (b) { | ~~~~~~~~ 206 | ss[i].root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 207 | }else{ | ~~~~~~ 208 | ss[i].root = 0; | ~~~~~~~~~~~~~~~ 209 | } | ~ 210 | } | ~ 211 | } | ~ 212 | void SaveState::fwrite_SecState(SecState* ss, int cnt, FILE* f){ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 213 | int b; | ~~~~~~ 214 | for (int i=0; i < cnt; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 215 | ASSERTfwrite(&ss[i].nnode, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 216 | b = ss[i].root ? 1 : 0; | ~~~~~~~~~~~~~~~~~~~~~~~ 217 | ASSERTfwrite(&b, sizeof(int), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 218 | } | ~ 219 | } | ~ 220 | | 221 | void SaveState::ssi_def() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 222 | if (nct) { return; } | ~~~~~~~~~~~~~~~~~~~~ 223 | Symbol* s = hoc_lookup("NetCon"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 224 | nct = s->u.ctemplate; | ~~~~~~~~~~~~~~~~~~~~~ 225 | ssi = new StateStructInfo[n_memb_func]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 226 | for (int im=0; im < n_memb_func; ++im) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 227 | ssi[im].offset = -1; | ~~~~~~~~~~~~~~~~~~~~ 228 | ssi[im].size = 0; | ~~~~~~~~~~~~~~~~~ 229 | if (!memb_func[im].sym) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 230 | continue; | ~~~~~~~~~ 231 | } | ~ 232 | NrnProperty* np = new NrnProperty(memb_func[im].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 233 | // generally we only save STATE variables. However for | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 234 | // models containing a NET_RECEIVE block, we also need to | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 235 | // save everything except the parameters | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 236 | // because they often contain | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 237 | // logic and analytic state values. Unfortunately, it is often | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 238 | // the case that the ASSIGNED variables are not declared as | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 239 | // RANGE variables so to avoid missing state, save the whole | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 240 | // param array including PARAMETERs. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 241 | if (pnt_receive[im]) { | ~~~~~~~~~~~~~~~~~~~~~~~ 242 | ssi[im].offset = 0; | ~~~~~~~~~~~~~~~~~~~ 243 | ssi[im].size = np->prop()->param_size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 244 | }else{ | ~~~~~~ 245 | int type = STATE; | ~~~~~~~~~~~~~~~~~ 246 | for (Symbol* sym = np->first_var(); np->more_var(); sym = np->next_var()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 247 | if (np->var_type(sym) == type | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 248 | || np->var_type(sym) == STATE | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 249 | || sym->subtype == _AMBIGUOUS) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | if (ssi[im].offset < 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 251 | ssi[im].offset = np->prop_index(sym); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 252 | } | ~ 253 | ssi[im].size += hoc_total_array_data(sym, 0); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 | } | ~ 255 | } | ~ 256 | } | ~ 257 | delete np; | ~~~~~~~~~~ 258 | } | ~ 259 | } | ~ 260 | | 261 | bool SaveState::check(bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 262 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 263 | int isec; | ~~~~~~~~~ 264 | if (nsec_ != section_count) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 265 | if (warn) { | ~~~~~~~~~~~ 266 | fprintf(stderr, "SaveState warning: %d sections exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 267 | section_count, nsec_); | ~~~~~~~~~~~~~~~~~~~~~~ 268 | } | ~ 269 | return false; | ~~~~~~~~~~~~~ 270 | } | ~ 271 | if (nroot_ != nrn_global_ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | if (warn) { | ~~~~~~~~~~~ 273 | fprintf(stderr, "SaveState warning: %d cells exist but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 274 | nrn_global_ncell, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 275 | } | ~ 276 | return false; | ~~~~~~~~~~~~~ 277 | } | ~ 278 | if (nsec_ && ss_[0].sec == NULL) { // got the data from a read | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 279 | isec = 0; ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 | ss_[isec].sec = sec; | ~~~~~~~~~~~~~~~~~~~~ 281 | section_ref(ss_[isec].sec); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 282 | ++isec; | ~~~~~~~ 283 | } | ~ 284 | } | ~ 285 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 286 | if (!checkacell(acell_[j], i, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 287 | return false; | ~~~~~~~~~~~~~ 288 | } | ~ 289 | ++j; | ~~~~ 290 | } | ~ 291 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 292 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 293 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 294 | if (!sec->prop || sec->nnode != ss.nnode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 295 | if (warn) { | ~~~~~~~~~~~ 296 | if (!sec->prop) { | ~~~~~~~~~~~~~~~~~ 297 | fprintf(stderr, "SaveState warning: saved section no longer exists\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 298 | }else{ | ~~~~~~ 299 | fprintf(stderr, "SaveState warning: %s has %d nodes but saved %d\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 300 | secname(sec), sec->nnode, ss.nnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 301 | } | ~ 302 | } | ~ 303 | return false; | ~~~~~~~~~~~~~ 304 | } | ~ 305 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 306 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 307 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 308 | int i=0; | ~~~~~~~~ 309 | Prop* p; | ~~~~~~~~ 310 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 311 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 312 | continue; | ~~~~~~~~~ 313 | } | ~ 314 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 315 | if (warn) { | ~~~~~~~~~~~ 316 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 317 | fewer mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 318 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 319 | } | ~ 320 | return false; | ~~~~~~~~~~~~~ 321 | } | ~ 322 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 | if (warn) { | ~~~~~~~~~~~ 324 | fprintf(stderr, "SaveState warning: mechanisms out of order at node %d of %s\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 325 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 326 | inode, secname(sec), memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 327 | } | ~ 328 | return false; | ~~~~~~~~~~~~~ 329 | } | ~ 330 | ++i; | ~~~~ 331 | } | ~ 332 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 333 | if (warn) { | ~~~~~~~~~~~ 334 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at node %d of %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 335 | inode, secname(sec)); | ~~~~~~~~~~~~~~~~~~~~~ 336 | } | ~ 337 | return false; | ~~~~~~~~~~~~~ 338 | } | ~ 339 | } | ~ 340 | if (!sec->parentsec || ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 | if (sec->parentsec || !ss.root) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 342 | if (warn) { | ~~~~~~~~~~~ 343 | fprintf(stderr, "SaveState warning: Saved section and %s are not both root sections.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | secname(sec)); | ~~~~~~~~~~~~~~ 345 | } | ~ 346 | } | ~ 347 | if (!checknode(*ss.root, sec->parentnode, warn)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 348 | return false; | ~~~~~~~~~~~~~ 349 | } | ~ 350 | } | ~ 351 | | 352 | } | ~ 353 | if (!checknet(warn)) { return false; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 354 | return true; | ~~~~~~~~~~~~ 355 | } | ~ 356 | | 357 | bool SaveState::checknode(NodeState& ns, Node* nd, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 358 | int i=0; | ~~~~~~~~ 359 | Prop* p; | ~~~~~~~~ 360 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 361 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 362 | continue; | ~~~~~~~~~ 363 | } | ~ 364 | if (i >= ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 365 | if (warn) { | ~~~~~~~~~~~ 366 | fprintf(stderr,"SaveState warning: \ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 367 | fewer mechanisms saved than exist at a root node\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 368 | } | ~ 369 | return false; | ~~~~~~~~~~~~~ 370 | } | ~ 371 | if (p->type != ns.type[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 372 | if (warn) { | ~~~~~~~~~~~ 373 | fprintf(stderr, "SaveState warning: mechanisms out of order at a rootnode\n\ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 374 | saved %s but need %s\n", | ~~~~~~~~~~~~~~~~~~~~~~~~ 375 | memb_func[i].sym->name, memb_func[p->type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 376 | } | ~ 377 | return false; | ~~~~~~~~~~~~~ 378 | } | ~ 379 | ++i; | ~~~~ 380 | } | ~ 381 | if (i != ns.nmemb) { | ~~~~~~~~~~~~~~~~~~~~ 382 | if (warn) { | ~~~~~~~~~~~ 383 | fprintf(stderr, "SaveState warning: more mechanisms saved than exist at a rootnode\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 384 | } | ~ 385 | return false; | ~~~~~~~~~~~~~ 386 | } | ~ 387 | return true; | ~~~~~~~~~~~~ 388 | } | ~ 389 | | 390 | bool SaveState::checkacell(ACellState& ac, int type, bool warn) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 391 | if (memb_list[type].nodecount != ac.ncell) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 392 | if (warn) { | ~~~~~~~~~~~ 393 | fprintf(stderr, "SaveState warning: different number of %s saved than exist.\n", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 394 | memb_func[type].sym->name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 395 | } | ~ 396 | return false; | ~~~~~~~~~~~~~ 397 | } | ~ 398 | return true; | ~~~~~~~~~~~~ 399 | } | ~ 400 | | 401 | void SaveState::alloc() { | ~~~~~~~~~~~~~~~~~~~~~~~~~ 402 | ssfree(); | ~~~~~~~~~ 403 | int inode, isec; | ~~~~~~~~~~~~~~~~ 404 | hoc_Item* qsec; | ~~~~~~~~~~~~~~~ 405 | nsec_ = section_count; | ~~~~~~~~~~~~~~~~~~~~~~ 406 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 407 | nroot_ = 0; | ~~~~~~~~~~~ 408 | isec = 0; | ~~~~~~~~~ 409 | ForAllSections(sec) | ~~~~~~~~~~~~~~~~~~~ 410 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 411 | ss.sec = sec; | ~~~~~~~~~~~~~ 412 | section_ref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~ 413 | ss.nnode = ss.sec->nnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 414 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 415 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 416 | Node* nd = ss.sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 417 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 418 | allocnode(ns, nd); | ~~~~~~~~~~~~~~~~~~ 419 | } | ~ 420 | if (!sec->parentsec) { | ~~~~~~~~~~~~~~~~~~~~~~ 421 | assert(sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~ 422 | ss.root = new NodeState; | ~~~~~~~~~~~~~~~~~~~~~~~~ 423 | allocnode(*ss.root, sec->parentnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 424 | ++nroot_; | ~~~~~~~~~ 425 | }else{ | ~~~~~~ 426 | ss.root = 0; | ~~~~~~~~~~~~ 427 | } | ~ 428 | ++isec; | ~~~~~~~ 429 | } | ~ 430 | assert(isec == section_count); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 431 | assert(nroot_ == nrn_global_ncell); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 432 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 433 | allocacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 434 | ++j; | ~~~~ 435 | } | ~ 436 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 437 | nprs_ = prl->count(); | ~~~~~~~~~~~~~~~~~~~~~ 438 | if (nprs_) { | ~~~~~~~~~~~~ 439 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 440 | } | ~ 441 | allocnet(); | ~~~~~~~~~~~ 442 | } | ~ 443 | | 444 | void SaveState::allocnode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 445 | ns.nmemb = 0; | ~~~~~~~~~~~~~ 446 | ns.type = NULL; | ~~~~~~~~~~~~~~~ 447 | ns.state = NULL; | ~~~~~~~~~~~~~~~~ 448 | ns.nstate = 0; | ~~~~~~~~~~~~~~ 449 | Prop* p; | ~~~~~~~~ 450 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 451 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 452 | continue; | ~~~~~~~~~ 453 | } | ~ 454 | ++ns.nmemb; | ~~~~~~~~~~~ 455 | ns.nstate += ssi[p->type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 456 | } | ~ 457 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 458 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 459 | } | ~ 460 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 461 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 462 | } | ~ 463 | int i = 0; | ~~~~~~~~~~ 464 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 465 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 466 | continue; | ~~~~~~~~~ 467 | } | ~ 468 | ns.type[i] = p->type; | ~~~~~~~~~~~~~~~~~~~~~ 469 | ++i; | ~~~~ 470 | } | ~ 471 | } | ~ 472 | | 473 | void SaveState::allocacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 474 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 475 | ac.type = type; | ~~~~~~~~~~~~~~~ 476 | ac.ncell = ml.nodecount; | ~~~~~~~~~~~~~~~~~~~~~~~~ 477 | ac.state = new double[ac.ncell * ssi[type].size]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 478 | } | ~ 479 | | 480 | void SaveState::ssfree() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 481 | int i, isec, inode; | ~~~~~~~~~~~~~~~~~~~ 482 | for (isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 483 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 484 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 485 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 486 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 487 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 488 | } | ~ 489 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 490 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 491 | } | ~ 492 | } | ~ 493 | if (ss.root) { | ~~~~~~~~~~~~~~ 494 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 495 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 496 | delete [] ns.type; | ~~~~~~~~~~~~~~~~~~ 497 | } | ~ 498 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 499 | delete [] ns.state; | ~~~~~~~~~~~~~~~~~~~ 500 | } | ~ 501 | delete ss.root; | ~~~~~~~~~~~~~~~ 502 | } | ~ 503 | if (ss.nnode) { | ~~~~~~~~~~~~~~~ 504 | delete [] ss.ns; | ~~~~~~~~~~~~~~~~ 505 | } | ~ 506 | if (ss.sec) { // got info from an fread but never checked it | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 | section_unref(ss.sec); | ~~~~~~~~~~~~~~~~~~~~~~ 508 | } | ~ 509 | } | ~ 510 | if (nsec_) { | ~~~~~~~~~~~~ 511 | delete [] ss_; | ~~~~~~~~~~~~~~ 512 | } | ~ 513 | nsec_ = 0; | ~~~~~~~~~~ 514 | ss_ = NULL; | ~~~~~~~~~~~ 515 | for (i=0; i < nacell_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 516 | if (acell_[i].ncell) { | ~~~~~~~~~~~~~~~~~~~~~~ 517 | delete [] acell_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 518 | acell_[i].state = 0; | ~~~~~~~~~~~~~~~~~~~~ 519 | acell_[i].ncell = 0; | ~~~~~~~~~~~~~~~~~~~~ 520 | } | ~ 521 | } // note we do not destroy the acell_. | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 522 | if (nncs_) { | ~~~~~~~~~~~~ 523 | for (i = 0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 524 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 525 | delete [] ncs_[i].state; | ~~~~~~~~~~~~~~~~~~~~~~~~ 526 | } | ~ 527 | } | ~ 528 | delete [] ncs_; | ~~~~~~~~~~~~~~~ 529 | } | ~ 530 | nncs_ = 0; | ~~~~~~~~~~ 531 | ncs_ = NULL; | ~~~~~~~~~~~~ 532 | if (npss_) { | ~~~~~~~~~~~~ 533 | delete [] pss_; | ~~~~~~~~~~~~~~~ 534 | } | ~ 535 | npss_ = 0; | ~~~~~~~~~~ 536 | pss_ = NULL; | ~~~~~~~~~~~~ 537 | free_tq(); | ~~~~~~~~~~ 538 | if (nprs_) { | ~~~~~~~~~~~~ 539 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 540 | delete prs_[i]; | ~~~~~~~~~~~~~~~ 541 | } | ~ 542 | delete [] prs_; | ~~~~~~~~~~~~~~~ 543 | } | ~ 544 | nprs_ = 0; | ~~~~~~~~~~ 545 | } | ~ 546 | | 547 | void SaveState::save() { | ~~~~~~~~~~~~~~~~~~~~~~~~ 548 | NrnThread* nt; | ~~~~~~~~~~~~~~ 549 | if (!check(false)) { | ~~~~~~~~~~~~~~~~~~~~ 550 | alloc(); | ~~~~~~~~ 551 | } | ~ 552 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 553 | assert(t == nt->_t); | ~~~~~~~~~~~~~~~~~~~~ 554 | } | ~ 555 | t_ = t; | ~~~~~~~ 556 | int inode; | ~~~~~~~~~~ 557 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 558 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 559 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 560 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 561 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 562 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 563 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 564 | } | ~ 565 | if (ss.root) { | ~~~~~~~~~~~~~~ 566 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 567 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 568 | savenode(ns, nd); | ~~~~~~~~~~~~~~~~~ 569 | } | ~ 570 | } | ~ 571 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 572 | saveacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~ 573 | ++j; | ~~~~ 574 | } | ~ 575 | if (nprs_) { | ~~~~~~~~~~~~ 576 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 577 | int i; | ~~~~~~ 578 | assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 579 | for (i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 580 | prs_[i] = prl->item(i)->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 581 | } | ~ 582 | } | ~ 583 | savenet(); | ~~~~~~~~~~ 584 | } | ~ 585 | | 586 | void SaveState::savenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 587 | ns.v = NODEV(nd); | ~~~~~~~~~~~~~~~~~ 588 | int istate = 0; | ~~~~~~~~~~~~~~~ 589 | Prop* p; | ~~~~~~~~ 590 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 591 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 592 | continue; | ~~~~~~~~~ 593 | } | ~ 594 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 595 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 596 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 597 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 598 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 599 | ns.state[istate++] = nd->extnode->v[i]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 600 | } | ~ 601 | }else | ~~~~~ 602 | #endif | ~~~~~~ 603 | { | ~ 604 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 605 | ns.state[istate++] = p->param[ip]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 606 | } | ~ 607 | } | ~ 608 | } | ~ 609 | } | ~ 610 | | 611 | void SaveState::saveacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 612 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 613 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 614 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 615 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 616 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 617 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 618 | (*p++) = d[j]; | ~~~~~~~~~~~~~~ 619 | } | ~ 620 | } | ~ 621 | } | ~ 622 | | 623 | void SaveState::restore(int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 624 | NrnThread* nt; | ~~~~~~~~~~~~~~ 625 | if (!check(true)) { | ~~~~~~~~~~~~~~~~~~~ 626 | hoc_execerror("SaveState:", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 627 | "Stored state inconsistent with current neuron structure"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 628 | } | ~ 629 | t = t_; | ~~~~~~~ 630 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 631 | nt->_t = t_; | ~~~~~~~~~~~~ 632 | } | ~ 633 | int inode; | ~~~~~~~~~~ 634 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | Section* sec = ss.sec; | ~~~~~~~~~~~~~~~~~~~~~~ 637 | for (inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 638 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 639 | Node* nd = sec->pnode[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 641 | } | ~ 642 | if (ss.root) { | ~~~~~~~~~~~~~~ 643 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 644 | Node* nd = sec->parentnode; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 645 | restorenode(ns, nd); | ~~~~~~~~~~~~~~~~~~~~ 646 | } | ~ 647 | } | ~ 648 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 649 | restoreacell(acell_[j], i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 650 | ++j; | ~~~~ 651 | } | ~ 652 | if (type == 1) { return; } | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 653 | PlayRecList* prl = net_cvode_instance_prl(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 654 | // during a local step the PlayRecList is augmented with GLineRecord | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 655 | // assert(nprs_ == prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 656 | assert(nprs_ <= prl->count()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 657 | int i; | ~~~~~~ 658 | for (i = 0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 659 | prs_[i]->savestate_restore(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 660 | } | ~ 661 | restorenet(); | ~~~~~~~~~~~~~ 662 | } | ~ 663 | | 664 | void SaveState::restorenode(NodeState& ns, Node* nd) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 665 | NODEV(nd) = ns.v;; | ~~~~~~~~~~~~~~~~~~ 666 | int istate = 0; | ~~~~~~~~~~~~~~~ 667 | Prop* p; | ~~~~~~~~ 668 | for (p = nd->prop; p; p = p->next) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 669 | if (ssi[p->type].size == 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 670 | continue; | ~~~~~~~~~ 671 | } | ~ 672 | int type = p->type; | ~~~~~~~~~~~~~~~~~~~ 673 | int max = ssi[type].offset + ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 674 | #if EXTRACELLULAR | ~~~~~~~~~~~~~~~~~ 675 | if (type == EXTRACELL) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 676 | for (int i=0; i < nlayer; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 677 | nd->extnode->v[i] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 678 | } | ~ 679 | }else | ~~~~~ 680 | #endif | ~~~~~~ 681 | { | ~ 682 | for (int ip=ssi[type].offset; ip < max; ++ip) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 683 | p->param[ip] = ns.state[istate++]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 684 | } | ~ 685 | } | ~ 686 | } | ~ 687 | } | ~ 688 | | 689 | void SaveState::restoreacell(ACellState& ac, int type) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 690 | Memb_list& ml = memb_list[type]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 691 | int sz = ssi[type].size; | ~~~~~~~~~~~~~~~~~~~~~~~~ 692 | double* p = ac.state; | ~~~~~~~~~~~~~~~~~~~~~ 693 | for (int i = 0; i < ml.nodecount; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 694 | double* d = ml.data[i]; | ~~~~~~~~~~~~~~~~~~~~~~~ 695 | for (int j=0; j < sz; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 696 | d[j] = (*p++); | ~~~~~~~~~~~~~~ 697 | } | ~ 698 | } | ~ 699 | } | ~ 700 | | 701 | void SaveState::read(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 702 | if (!ocf->open(ocf->get_name(), "r")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 703 | hoc_execerror("Couldn't open file for reading:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 704 | } | ~ 705 | nrn_shape_update(); | ~~~~~~~~~~~~~~~~~~~ 706 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 707 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 708 | ssfree(); | ~~~~~~~~~ 709 | char buf[200]; | ~~~~~~~~~~~~~~ 710 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 711 | if (strcmp(buf, "SaveState binary file version 6.0\n") != 0) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 712 | ocf->close(); | ~~~~~~~~~~~~~ 713 | hoc_execerror("Bad SaveState binary file", " Not version 6.0"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 714 | } | ~ 715 | ASSERTfread((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 716 | // fscanf(f, "%d %d\n", &nsec_, &nrootnode_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 717 | // on some os's fscanf leaves file pointer at wrong place for next fread | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 718 | // can check it with ftell(f) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 720 | sscanf(buf, "%d %d\n", &nsec_, &nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 721 | // to enable comparison of SaveState files, we avoid | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 722 | // putting pointers in the files and instead explicitly read/write | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 723 | // structure elements. | ~~~~~~~~~~~~~~~~~~~~~~ 724 | ss_ = new SecState[nsec_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 725 | fread_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 726 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 727 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 728 | ss.sec = NULL; | ~~~~~~~~~~~~~~ 729 | ss.ns = new NodeState[ss.nnode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 730 | fread_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 731 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 732 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 733 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 734 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 735 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 736 | } | ~ 737 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 738 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 739 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 740 | } | ~ 741 | } | ~ 742 | if (ss.root) { | ~~~~~~~~~~~~~~ 743 | fread_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 744 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 745 | if (ns.nmemb) { | ~~~~~~~~~~~~~~~ 746 | ns.type = new int[ns.nmemb]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | ASSERTfread((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 748 | } | ~ 749 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 750 | ns.state = new double[ns.nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 751 | ASSERTfread((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 752 | } | ~ 753 | } | ~ 754 | } | ~ 755 | int n = 0; | ~~~~~~~~~~ 756 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 757 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 758 | assert(n == nacell_); | ~~~~~~~~~~~~~~~~~~~~~ 759 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 760 | int nt = 0, nc = 0, ns = 0; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 761 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 762 | nrn_assert(sscanf(buf, "%d %d %d\n", &nt, &nc, &ns) == 3); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 763 | assert(nt == i && nc == memb_list[i].nodecount); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 764 | assert(ns == nc * ssi[i].size); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 765 | acell_[j].ncell = nc; | ~~~~~~~~~~~~~~~~~~~~~ 766 | acell_[j].state = new double[ns]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 767 | ASSERTfread((char*)acell_[j].state, sizeof(double), ns, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 768 | ++j; | ~~~~ 769 | } | ~ 770 | ASSERTfgets(buf, 20, f); | ~~~~~~~~~~~~~~~~~~~~~~~~ 771 | sscanf(buf, "%d\n", &nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 772 | if (nprs_) { | ~~~~~~~~~~~~ 773 | prs_ = new PlayRecordSave*[nprs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 774 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 775 | prs_[i] = PlayRecord::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 776 | } | ~ 777 | } | ~ 778 | readnet(f); | ~~~~~~~~~~~ 779 | if (close) { | ~~~~~~~~~~~~ 780 | ocf->close(); | ~~~~~~~~~~~~~ 781 | } | ~ 782 | } | ~ 783 | | 784 | void SaveState::write(OcFile* ocf, bool close) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 785 | if (!ocf->open(ocf->get_name(), "w")) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 786 | hoc_execerror("Couldn't open file for writing:", ocf->get_name()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 787 | } | ~ 788 | BinaryMode(ocf) | ~~~~~~~~~~~~~~~ 789 | FILE* f = ocf->file(); | ~~~~~~~~~~~~~~~~~~~~~~ 790 | fprintf(f, "SaveState binary file version 6.0\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 791 | ASSERTfwrite((char*)&t_, sizeof(double), 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 792 | fprintf(f, "%d %d\n", nsec_, nroot_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 793 | fwrite_SecState(ss_, nsec_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 794 | for (int isec=0; isec < nsec_; ++isec) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 795 | SecState& ss = ss_[isec]; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 796 | fwrite_NodeState(ss.ns, ss.nnode, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 797 | for (int inode = 0; inode < ss.nnode; ++inode) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 798 | NodeState& ns = ss.ns[inode]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 799 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 800 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 801 | } | ~ 802 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 803 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 804 | } | ~ 805 | } | ~ 806 | if (ss.root) { | ~~~~~~~~~~~~~~ 807 | fwrite_NodeState(ss.root, 1, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 808 | NodeState& ns = *ss.root; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 809 | if (ns.nmemb){ | ~~~~~~~~~~~~~~ 810 | ASSERTfwrite((char*)ns.type, sizeof(int), ns.nmemb, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 811 | } | ~ 812 | if (ns.nstate) { | ~~~~~~~~~~~~~~~~ 813 | ASSERTfwrite((char*)ns.state, sizeof(double), ns.nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 814 | } | ~ 815 | } | ~ 816 | } | ~ 817 | fprintf(f, "%d\n", nacell_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 818 | for (int i=0, j=0; i < n_memb_func; ++i) if (nrn_is_artificial_[i]) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 819 | int sz = acell_[j].ncell * ssi[i].size; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 820 | fprintf(f, "%d %d %d\n", acell_[j].type, acell_[j].ncell, sz); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 821 | ASSERTfwrite((char*)acell_[j].state, sizeof(double), sz, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 822 | ++j; | ~~~~ 823 | } | ~ 824 | fprintf(f, "%d\n", nprs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 825 | for (int i=0; i < nprs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 826 | fprintf(f, "%d %d\n", prs_[i]->pr_->type(), i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 827 | prs_[i]->savestate_write(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 | } | ~ 829 | writenet(f); | ~~~~~~~~~~~~ 830 | if (close) { | ~~~~~~~~~~~~ 831 | ocf->close(); | ~~~~~~~~~~~~~ 832 | } | ~ 833 | } | ~ 834 | | 835 | void SaveState::savenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 | int i, j, n; | ~~~~~~~~~~~~ 837 | double* w; | ~~~~~~~~~~ 838 | hoc_Item* q; | ~~~~~~~~~~~~ 839 | Object* ob; | ~~~~~~~~~~~ 840 | NetCon* d; | ~~~~~~~~~~ 841 | PreSyn* ps; | ~~~~~~~~~~~ 842 | i = 0; | ~~~~~~ 843 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 844 | ob = OBJ(q); | ~~~~~~~~~~~~ 845 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 846 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 847 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 848 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 849 | w[j] = d->weight_[j]; | ~~~~~~~~~~~~~~~~~~~~~ 850 | } | ~ 851 | ++i; | ~~~~ 852 | } | ~ 853 | i = 0; | ~~~~~~ 854 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 855 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 856 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 857 | pss_[i].flag = ps->flag_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 858 | pss_[i].valthresh = ps->valthresh_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 859 | pss_[i].valold = ps->valold_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 860 | pss_[i].told = ps->told_; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 861 | ++i; | ~~~~ 862 | } | ~ 863 | alloc_tq(); | ~~~~~~~~~~~ 864 | tqcnt_ = 0; | ~~~~~~~~~~~ 865 | NrnThread* nt; | ~~~~~~~~~~~~~~ 866 | FOR_THREADS(nt) { | ~~~~~~~~~~~~~~~~~ 867 | TQueue* tq = net_cvode_instance_event_queue(nt); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 868 | this_savestate = this; callback_mode = 1; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 869 | tq->forall_callback(tqcallback); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 870 | } | ~ 871 | } | ~ 872 | | 873 | void SaveState::tqcount(const TQItem*, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 874 | ++tqcnt_; | ~~~~~~~~~ 875 | } | ~ 876 | | 877 | void SaveState::tqsave(const TQItem* q, int) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 878 | DiscreteEvent* de = (DiscreteEvent*)q->data_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 879 | tqs_->tdeliver[tqcnt_] = q->t_; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 880 | tqs_->items[tqcnt_] = de->savestate_save(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 881 | ++tqcnt_; | ~~~~~~~~~ 882 | } | ~ 883 | | 884 | void SaveState::restorenet() { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 885 | int i, j, n; | ~~~~~~~~~~~~ 886 | double* w; | ~~~~~~~~~~ 887 | hoc_Item* q; | ~~~~~~~~~~~~ 888 | Object* ob; | ~~~~~~~~~~~ 889 | NetCon* d; | ~~~~~~~~~~ 890 | PreSyn* ps; | ~~~~~~~~~~~ 891 | // NetCon's | ~~~~~~~~~~~ 892 | i = 0; | ~~~~~~ 893 | ITERATE(q, nct->olist) { | ~~~~~~~~~~~~~~~~~~~~~~~~ 894 | ob = OBJ(q); | ~~~~~~~~~~~~ 895 | d = (NetCon*)ob->u.this_pointer; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 896 | n = ncs_[i].nstate; | ~~~~~~~~~~~~~~~~~~~ 897 | w = ncs_[i].state; | ~~~~~~~~~~~~~~~~~~ 898 | for (j=0; j < n; ++j) { | ~~~~~~~~~~~~~~~~~~~~~~~ 899 | d->weight_[j] = w[j]; | ~~~~~~~~~~~~~~~~~~~~~ 900 | } | ~ 901 | ++i; | ~~~~ 902 | } | ~ 903 | // PreSyn's | ~~~~~~~~~~~ 904 | i = 0; | ~~~~~~ 905 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 906 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 907 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 908 | ps->flag_ = pss_[i].flag; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 909 | ps->valthresh_ = pss_[i].valthresh; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 910 | ps->valold_ = pss_[i].valold; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 911 | ps->told_ = pss_[i].told; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 912 | ++i; | ~~~~ 913 | } | ~ 914 | | 915 | // event queue | ~~~~~~~~~~~~~~ 916 | // clear it | ~~~~~~~~~~~ 917 | clear_event_queue(); | ~~~~~~~~~~~~~~~~~~~~ 918 | // restore it | ~~~~~~~~~~~~~ 919 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 920 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 921 | tqs_->items[i]->savestate_restore(tqs_->tdeliver[i], net_cvode_instance); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 922 | } | ~ 923 | } | ~ 924 | | 925 | void SaveState::readnet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 926 | free_tq(); | ~~~~~~~~~~ 927 | char buf[200]; | ~~~~~~~~~~~~~~ 928 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 929 | sscanf(buf, "%d\n", &nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 930 | if (nncs_ != 0) { | ~~~~~~~~~~~~~~~~~ 931 | ncs_ = new NetConState[nncs_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 932 | } | ~ 933 | int i, n, type; | ~~~~~~~~~~~~~~~ 934 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 935 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 936 | sscanf(buf, "%d %d\n", &ncs_[i].object_index, &ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 937 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 938 | ncs_[i].state = new double[ncs_[i].nstate]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | ASSERTfread((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 940 | } | ~ 941 | } | ~ 942 | // PreSyn's | ~~~~~~~~~~~ 943 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 944 | sscanf(buf, "%d\n", &npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 945 | if (npss_ != 0) { | ~~~~~~~~~~~~~~~~~ 946 | pss_ = new PreSynState[npss_]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 947 | ASSERTfread((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 948 | PreSyn* ps; | ~~~~~~~~~~~ 949 | i = 0; | ~~~~~~ 950 | hoc_Item* q; | ~~~~~~~~~~~~ 951 | if (net_cvode_instance_psl()) ITERATE(q, net_cvode_instance_psl()) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 952 | ps = (PreSyn*)VOIDITM(q); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 953 | ps->hi_index_ = i; | ~~~~~~~~~~~~~~~~~~ 954 | ++i; | ~~~~ 955 | } | ~ 956 | assert(npss_ == i); | ~~~~~~~~~~~~~~~~~~~ 957 | } | ~ 958 | | 959 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 960 | sscanf(buf, "%d\n", &n); | ~~~~~~~~~~~~~~~~~~~~~~~~ 961 | tqs_->nstate = n; | ~~~~~~~~~~~~~~~~~ 962 | if (n) { | ~~~~~~~~ 963 | tqs_->items = new DiscreteEvent*[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 964 | tqs_->tdeliver = new double[n]; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 965 | ASSERTfread((char*)tqs_->tdeliver, sizeof(double), n, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 966 | for (i=0; i < n; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~ 967 | DiscreteEvent* de = NULL; | ~~~~~~~~~~~~~~~~~~~~~~~~~ 968 | ASSERTfgets(buf, 200, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~ 969 | sscanf(buf, "%d\n", &type); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 970 | switch(type) { | ~~~~~~~~~~~~~~ 971 | case DiscreteEventType: | ~~~~~~~~~~~~~~~~~~~~~~~ 972 | de = DiscreteEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 973 | break; | ~~~~~~ 974 | case TstopEventType: | ~~~~~~~~~~~~~~~~~~~~ 975 | de = TstopEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 976 | break; | ~~~~~~ 977 | case NetConType: | ~~~~~~~~~~~~~~~~ 978 | de = NetCon::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 979 | break; | ~~~~~~ 980 | case SelfEventType: | ~~~~~~~~~~~~~~~~~~~ 981 | de = SelfEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 982 | break; | ~~~~~~ 983 | case PreSynType: | ~~~~~~~~~~~~~~~~ 984 | de = PreSyn::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 985 | break; | ~~~~~~ 986 | case HocEventType: | ~~~~~~~~~~~~~~~~~~ 987 | de = HocEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 988 | break; | ~~~~~~ 989 | case PlayRecordEventType: | ~~~~~~~~~~~~~~~~~~~~~~~~~ 990 | de = PlayRecordEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 991 | break; | ~~~~~~ 992 | case NetParEventType: | ~~~~~~~~~~~~~~~~~~~~~ 993 | de = NetParEvent::savestate_read(f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 994 | break; | ~~~~~~ 995 | default: | ~~~~~~~~ 996 | hoc_execerror("SaveState::readnet", "Unimplemented DiscreteEvent type"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 997 | break; | ~~~~~~ 998 | } | ~ 999 | tqs_->items[i] = de; | ~~~~~~~~~~~~~~~~~~~~ 1000 | } | ~ 1001 | } | ~ 1002 | } | ~ 1003 | | 1004 | void SaveState::writenet(FILE* f) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1005 | fprintf(f, "%d\n", nncs_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1006 | int i, n; | ~~~~~~~~~ 1007 | for (i=0; i < nncs_; ++i) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1008 | fprintf(f, "%d %d\n", ncs_[i].object_index, ncs_[i].nstate); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1009 | if (ncs_[i].nstate) { | ~~~~~~~~~~~~~~~~~~~~~ 1010 | ASSERTfwrite((char*)ncs_[i].state, sizeof(double), ncs_[i].nstate, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1011 | } | ~ 1012 | } | ~ 1013 | fprintf(f, "%d\n", npss_); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1014 | if (npss_) { | ~~~~~~~~~~~~ 1015 | ASSERTfwrite((char*)pss_, sizeof(PreSynState), npss_, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1016 | } | ~ 1017 | n = tqs_->nstate; | ~~~~~~~~~~~~~~~~~ 1018 | fprintf(f, "%d\n", n); | ~~~~~~~~~~~~~~~~~~~~~~ 1019 | if (n) { | ~~~~~~~~ 1020 | ASSERTfwrite((char*)tqs_->tdeliver, sizeof(double), n, f); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnassrt.h:23:33: note: in definition of macro 'nrn_assert' 23 | # define nrn_assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:1020:3: note: in expansion of macro 'ASSERTfwrite' 1020 | ASSERTfwrite((char*)tqs_->tdeliver, sizeof(double), n, f); | ^~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp: In member function 'void SaveState::allocnet()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/savstate.cpp:1079:9: warning: unused variable 'n' [-Wunused-variable] 1079 | int i, n; | ^ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/nrnoc2iv.h:8, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:18: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp: In constructor 'OcSectionBrowser::OcSectionBrowser(Object*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:131:18: warning: unused variable 'sec' [-Wunused-variable] 131 | ForAllSections(sec) //{ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/section.h:314:41: note: in definition of macro 'ForAllSections' 314 | ITERATE(qsec, section_list) { Section* sec = hocSEC(qsec); | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp: In constructor 'SectionBrowserImpl::SectionBrowserImpl()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:365:17: warning: unused variable 'sec' [-Wunused-variable] 365 | ForAllSections(sec) //{ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/section.h:314:41: note: in definition of macro 'ForAllSections' 314 | ITERATE(qsec, section_list) { Section* sec = hocSEC(qsec); | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp: In constructor 'SectionBrowser::SectionBrowser()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:392:13: warning: unused variable 'lk' [-Wunused-variable] 392 | LayoutKit& lk = *LayoutKit::instance(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:393:13: warning: unused variable 'wk' [-Wunused-variable] 393 | WidgetKit& wk = *WidgetKit::instance(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp: In static member function 'static void SectionBrowser::make_section_browser()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:440:13: warning: unused variable 'wk' [-Wunused-variable] 440 | WidgetKit& wk = *WidgetKit::instance(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp: In static member function 'static void PointProcessBrowser::make_point_process_browser(OcList*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp:500:13: warning: unused variable 'wk' [-Wunused-variable] 500 | WidgetKit& wk = *WidgetKit::instance(); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void OcShape::select_section(Section*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:743:11: warning: unused variable 's' [-Wunused-variable] 743 | Section* s; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:744:15: warning: unused variable 'c' [-Wunused-variable] 744 | const Color* c; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeScene::observe(SectionList*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:832:16: warning: unused variable 'cnt' [-Wunused-variable] 832 | GlyphIndex i, cnt; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeScene::transform3d(Rubberband*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1000:8: warning: unused variable 'x' [-Wunused-variable] 1000 | Coord x, y; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1000:11: warning: unused variable 'y' [-Wunused-variable] 1000 | Coord x, y; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeScene::wholeplot(ivCoord&, ivCoord&, ivCoord&, ivCoord&) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1025:10: warning: unused variable 'j' [-Wunused-variable] 1025 | long i, j, n = sg_->count(); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In destructor 'virtual ShapeSection::~ShapeSection()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1294:6: warning: unused variable 'n' [-Wunused-variable] 1294 | int n = sec_->npt3d -1; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeSection::set_range_variable(Symbol*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1514:7: warning: variable 'any' set but not used [-Wunused-but-set-variable] 1514 | bool any = false; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeSection::draw(ivCanvas*, const ivAllocation&) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1554:8: warning: unused variable 'e' [-Wunused-variable] 1554 | float e = 1e-2; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'virtual void ShapeSection::fast_draw(ivCanvas*, ivCoord, ivCoord, bool) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1612:9: warning: variable 'a3dold' set but not used [-Wunused-but-set-variable] 1612 | double a3dold; // the arc length at i3d-1 | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'void ShapeSection::fastidious_draw(ivCanvas*, const ivColor*, int, float, float) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1698:8: warning: unused variable 'len' [-Wunused-variable] 1698 | float len, f1, f2, d, x1, x2, y1, y2, a, aa; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'ShapeSection::fast_draw(ivCanvas*, float, float, bool) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:1631:26: warning: 'cv' may be used uninitialized in this function [-Wmaybe-uninitialized] 1631 | color = cv->get_color(*pvar_[iseg]); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp: In member function 'ShapeSection::arc_position(float, float) const': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp:2003:25: warning: 'ic' may be used uninitialized in this function [-Wmaybe-uninitialized] 2003 | len = MyMath::norm2(x_[ic] - x_[ic+1], y_[ic] - y_[ic+1]); | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shapeplt.cpp: In member function 'ivGlyph* ColorValue::make_glyph()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shapeplt.cpp:1108:13: warning: unused variable 'wk' [-Wunused-variable] 1108 | WidgetKit& wk = *WidgetKit::instance(); | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/oc/hocdec.h:13, from /builddir/build/BUILD/nrn-7.8.1/src/oc/classreg.h:5, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shapeplt.cpp:2: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shapeplt.cpp: In member function 'Hinton::request(ivRequisition&) const': /builddir/build/BUILD/nrn-7.8.1/src/oc/hocassrt.h:19:22: warning: 'nonnull' argument 'this' compared to NULL [-Wnonnull-compare] 19 | # define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__,__LINE__);hoc_execerror(#ex, (char *)0);}} | ^~ make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 35%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/secbrows.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/secbrows.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/secbrows.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 35%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/shape.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/shape.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shape.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 35%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/shapeplt.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/shapeplt.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/shapeplt.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 36%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/splitcell.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/splitcell.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/splitcell.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 35%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/singlech.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/singlech.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/singlech.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 36%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/symdir.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/symdir.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/symdir.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/symdir.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/symdir.cpp: In constructor 'SymDirectory::SymDirectory(Object*)': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/symdir.cpp:172:6: warning: unused variable 'suffix' [-Wunused-variable] 172 | int suffix = '.'; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/symdir.cpp: In member function 'void SymDirectoryImpl::load_section()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../ivoc/symdir.cpp:549:6: warning: unused variable 'n' [-Wunused-variable] 549 | int n = sec->nnode; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 35%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/spaceplt.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/spaceplt.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/spaceplt.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrniv/spaceplt.cpp: In member function 'RangeVarPlot::fill_pointers()': /builddir/build/BUILD/nrn-7.8.1/src/nrniv/spaceplt.cpp:531:24: warning: 'sym' may be used uninitialized in this function [-Wmaybe-uninitialized] 531 | does_exist = nrn_exists(sym, node_exact(sec, hoc_ac_)); | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 37%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/capac.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/capac.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/capac.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 37%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/clamp.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/clamp.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/clamp.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/clamp.c: In function 'activclamp_lhs': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/clamp.c:180:9: warning: unused variable 'v' [-Wunused-variable] 180 | double v; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 36%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/tqueue.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/tqueue.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/tqueue.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptbinq.cpp:391, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/tqueue.cpp:133, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/tqueue.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptree.c: In function 'TQItem* sptq_spenq(TQItem*, SPTREE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptree.c:104:18: warning: unused variable 'Sct' [-Wunused-variable] 104 | register int Sct; /* Strcmp value */ | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptree.c: In function 'TQItem* sptq_spenqprior(TQItem*, SPTREE*)': /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptree.c:329:18: warning: unused variable 'Sct' [-Wunused-variable] 329 | register int Sct; /* Strcmp value */ | ^~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/../nrncvode/tqueue.cpp:133, from /builddir/build/BUILD/nrn-7.8.1/src/nrniv/tqueue.cpp:5: /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptbinq.cpp: At global scope: /builddir/build/BUILD/nrn-7.8.1/src/nrncvode/sptbinq.cpp:56:13: warning: 'void chk(TQItem*, int)' defined but not used [-Wunused-function] 56 | static void chk(TQItem* b, int level) { | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 36%] Building CXX object src/nrniv/CMakeFiles/nrniv_lib.dir/vrecord.cpp.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/g++ -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -DOOP=1 -DUSEBBS=1 -DUSECVODE=1 -DUSEMATRIX=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -std=c++98 -o CMakeFiles/nrniv_lib.dir/vrecord.cpp.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrniv/vrecord.cpp make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 36%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/cabcode.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/cabcode.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c: In function 'nrn_rootnode_alloc': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c:1654:11: warning: unused variable 'nde' [-Wunused-variable] 1654 | Extnode* nde; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c: In function 'ismembrane': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c:2254:8: warning: unused variable 'p' [-Wunused-variable] 2254 | Prop *p; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c: In function 'section_exists': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabcode.c:2466:14: warning: unused variable 'cp' [-Wunused-variable] 2466 | char *str, *cp, buf[100]; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 37%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/eion.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/eion.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c:25:28: warning: missing braces around initializer [-Wmissing-braces] 25 | static DoubScal scdoub[] = { /* just a template*/ | ^ 26 | "ci0_na_ion", 0, | { } 27 | "co0_na_ion", 0, | { } 28 | 0, 0 | { 29 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c: In function 'ion_cur': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c:521:9: warning: unused variable 'vnode' [-Wunused-variable] 521 | Node** vnode = ml->nodelist; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c: In function 'ion_init': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c:543:9: warning: unused variable 'vnode' [-Wunused-variable] 543 | Node** vnode = ml->nodelist; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c: In function 'second_order_cur': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/eion.c:605:6: warning: unused variable 'j' [-Wunused-variable] 605 | int j, i, i2; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 37%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/extcelln.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/extcelln.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:26:33: warning: missing braces around initializer [-Wmissing-braces] 26 | static HocParmLimits limits[] = { | ^ 27 | "xraxial", 1e-9, 1e15, | { { }} 28 | "xg", 0., 1e15, | { { }} 29 | "xc", 0., 1e15, | { { }} 30 | 0,0.,0. | { { 31 | }; | }} /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:33:31: warning: missing braces around initializer [-Wmissing-braces] 33 | static HocParmUnits units[] = { | ^ 34 | "xraxial", "MOhm/cm", | { } 35 | "xg", "S/cm2", | { } 36 | "xc", "uF/cm2", | { } 37 | "e_extracellular", "mV", | { } 38 | "vext", "mV", | { } 39 | "i_membrane", "mA/cm2", | { } 40 | 0,0 | { 41 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c: In function 'nrn_update_2d': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:94:9: warning: variable 'cfac' set but not used [-Wunused-but-set-variable] 94 | double cfac; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:90:13: warning: unused variable 'secondorder' [-Wunused-variable] 90 | extern int secondorder; | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c: In function 'extcell_node_create': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:197:6: warning: unused variable 'i' [-Wunused-variable] 197 | int i, j; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c: In function 'extcell_2d_alloc': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:240:8: warning: unused variable 'p' [-Wunused-variable] 240 | Prop* p; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:239:11: warning: unused variable 'nde' [-Wunused-variable] 239 | Extnode *nde; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:238:8: warning: unused variable 'nd' [-Wunused-variable] 238 | Node *nd; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/extcelln.c:237:9: warning: unused variable 'j' [-Wunused-variable] 237 | int i, j; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 38%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/fstim.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/fstim.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fstim.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 38%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/hocprax.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/hocprax.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocprax.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocprax.c: In function 'fit_praxis': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocprax.c:101:25: warning: variable 'nvarsav' set but not used [-Wunused-but-set-variable] 101 | long int printmodesav, nvarsav; | ^~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocprax.c: In function 'efun': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocprax.c:279:6: warning: unused variable 'i' [-Wunused-variable] 279 | int i; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 38%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/hocusr.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/hocusr.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocusr.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hocusr.c:9, from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hocusr.c:6: /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:32:30: warning: missing braces around initializer [-Wmissing-braces] 32 | static VoidFunc function[] = { | ^ 33 | 34 | "node_data", node_data, | { } 35 | "disconnect", disconnect, | { } 36 | "batch_run", batch_run, | { } 37 | "batch_save", batch_save, | { } 38 | "pt3dclear", pt3dclear, | { } 39 | "pt3dadd", pt3dadd, | { } 40 | "n3d", n3d, | { } 41 | "x3d", x3d, | { } 42 | "y3d", y3d, | { } 43 | "z3d", z3d, | { } 44 | "arc3d", arc3d, | { } 45 | "diam3d", diam3d, | { } 46 | "pt3dinsert", pt3dinsert, | { } 47 | "pt3dremove", pt3dremove, | { } 48 | "pt3dchange", pt3dchange, | { } 49 | "define_shape", define_shape, | { } 50 | "pt3dconst", pt3dconst, | { } 51 | "pt3dstyle", pt3dstyle, | { } 52 | "spine3d", spine3d, | { } 53 | "setSpineArea", setSpineArea, | { } 54 | "getSpineArea", getSpineArea, | { } 55 | "area", area, | { } 56 | "ri", ri, | { } 57 | "initnrn", initnrn, | { } 58 | "topology", nrnhoc_topology, | { } 59 | "fadvance", fadvance, | { } 60 | "distance", distance, | { } 61 | "finitialize", finitialize, | { } 62 | "fstim", fstim, | { } 63 | "fstimi", fstimi, | { } 64 | "ion_style", ion_style, | { } 65 | "ion_register", ion_register, | { } 66 | "ion_charge", ion_charge, | { } 67 | "nernst", nernst, | { } 68 | "ghk", ghk, | { } 69 | "section_owner", section_owner, | { } 70 | "make_mechanism", make_mechanism, | { } 71 | "make_pointprocess", make_pointprocess, | { } 72 | "nrnpython", nrnpython, | { } 73 | "fsyn", fsyn, | { } 74 | "fsyng", fsyng, | { } 75 | "fsyni", fsyni, | { } 76 | "fclamp", fclamp, | { } 77 | "fclampi", fclampi, | { } 78 | "fclampv", fclampv, | { } 79 | "prstim", prstim, | { } 80 | "fcurrent", fcurrent, | { } 81 | "fmatrix", fmatrix, | { } 82 | "frecord_init", frecord_init, | { } 83 | "issection", issection, | { } 84 | "ismembrane", ismembrane, | { } 85 | "sectionname", sectionname, | { } 86 | "psection", psection, | { } 87 | "pop_section", pop_section, | { } 88 | "push_section", push_section, | { } 89 | "section_exists", section_exists, | { } 90 | "delete_section", delete_section, | { } 91 | "fit_praxis", fit_praxis, | { } 92 | "attr_praxis", attr_praxis, | { } 93 | "pval_praxis", pval_praxis, | { } 94 | "stop_praxis", stop_praxis, | { } 95 | "keep_nseg_parm", keep_nseg_parm, | { } 96 | "nrnallsectionmenu", nrnallsectionmenu, | { } 97 | "nrnallpointmenu", nrnallpointmenu, | { } 98 | "nrnsecmenu", nrnsecmenu, | { } 99 | "nrnglobalmechmenu", nrnglobalmechmenu, | { } 100 | "nrnmechmenu", nrnmechmenu, | { } 101 | "nrnpointmenu", nrnpointmenu, | { } 102 | "this_section", this_section, | { } 103 | "this_node", this_node, | { } 104 | "parent_section", parent_section, | { } 105 | "parent_node", parent_node, | { } 106 | "parent_connection", parent_connection, | { } 107 | "section_orientation", section_orientation, | { } 108 | 0, 0 | { 109 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:114:13: warning: missing braces around initializer [-Wmissing-braces] 114 | } scint[] = { | ^ 115 | 116 | "secondorder", &secondorder, | { } 117 | "diam_changed", &diam_changed, | { } 118 | "nrn_shape_changed_", &nrn_shape_changed_, | { } 119 | "nrn_netrec_state_adjust", &nrn_netrec_state_adjust, | { } 120 | "nrn_sparse_partrans", &nrn_sparse_partrans, | { } 121 | "stoprun", &stoprun, | { } 122 | 0, 0 | { 123 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:129:12: warning: missing braces around initializer [-Wmissing-braces] 129 | } vint[] = { | ^ 130 | 131 | 0,0 | { 132 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:137:15: warning: missing braces around initializer [-Wmissing-braces] 137 | } scfloat[] = { | ^ 138 | 139 | 0, 0 | { 140 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:146:14: warning: missing braces around initializer [-Wmissing-braces] 146 | } vfloat[] = { | ^ 147 | 148 | 0,0,0 | { 149 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:152:21: warning: missing braces around initializer [-Wmissing-braces] 152 | DoubScal scdoub[] = { | ^ 153 | 154 | "clamp_resist", &clamp_resist, | { } 155 | "celsius", &celsius, | { } 156 | 0,0 | { 157 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:160:19: warning: missing braces around initializer [-Wmissing-braces] 160 | DoubVec vdoub[] = { | ^ 161 | 162 | 0, 0, 0 | { 163 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:170:14: warning: missing braces around initializer [-Wmissing-braces] 170 | } ardoub[] = { | ^ 171 | 172 | 0, 0, 0, 0 | { 173 | }; | } /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc/hocusr.h:181:15: warning: missing braces around initializer [-Wmissing-braces] 181 | } thredim[] = { | ^ 182 | 183 | 0, 0, 0, 0, 0 | { 184 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 38%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/fadvance.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/fadvance.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c: In function 'nrn_daspk_init_step': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c:284:6: warning: unused variable 'i' [-Wunused-variable] 284 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c: In function 'nrn_fixed_step': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c:301:6: warning: unused variable 'i' [-Wunused-variable] 301 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c: In function 'fcurrent': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c:607:6: warning: unused variable 'i' [-Wunused-variable] 607 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c: In function 'nrn_ba': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c:1015:7: warning: unused variable 'type' [-Wunused-variable] 1015 | int type = tbl->bam->type; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c: In function 'nrn_finitialize': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/fadvance.c:783:2: warning: '_nt' is used uninitialized in this function [-Wuninitialized] 783 | nrn_random_play(_nt); | ^~~~~~~~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 39%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/hoc_init.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/hoc_init.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hoc_init.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hoc_init.c:6: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:34:16: warning: missing braces around initializer [-Wmissing-braces] 34 | } keywords[] = { | ^ 35 | "proc", parsePROC, | { } 36 | "func", FUNC, | { } 37 | "obfunc", HOCOBJFUNC, | { } 38 | "return", RETURN, | { } 39 | "break", BREAK, | { } 40 | "continue", CONTINUE, | { } 41 | "stop", STOPSTMT, | { } 42 | "if", IF, | { } 43 | "else", ELSE, | { } 44 | "while", WHILE, | { } 45 | "for", FOR, | { } 46 | "print", PRINT, | { } 47 | "delete", parseDELETE, | { } 48 | "read", READ, | { } 49 | "debug", DEBUG, | { } 50 | "double", parseDOUBLE, | { } 51 | "em", EDIT, | { } 52 | "depvar", DEPENDENT, | { } 53 | "eqn", EQUATION, | { } 54 | "local", LOCAL, | { } 55 | "localobj", LOCALOBJ, | { } 56 | "strdef", STRDEF, | { } 57 | "parallel", PARALLEL, | { } 58 | "help", HELP, | { } 59 | "iterator", ITERKEYWORD, | { } 60 | "iterator_statement", ITERSTMT, | { } 61 | #if CABLE 62 | "create", SECTIONKEYWORD, | { } 63 | "connect", CONNECTKEYWORD, | { } 64 | "setpointer", SETPOINTERKEYWORD, | { } 65 | "access", ACCESSKEYWORD, | { } 66 | "insert", INSERTKEYWORD, | { } 67 | "uninsert", UNINSERTKEYWORD, | { } 68 | "forall", FORALL, | { } 69 | "ifsec", IFSEC, | { } 70 | "forsec", FORSEC, | { } ...... 73 | "begintemplate", BEGINTEMPLATE, | { } 74 | "endtemplate", ENDTEMPLATE, | { } 75 | "objectvar", OBJVARDECL, | { } 76 | "objref", OBJVARDECL, | { } 77 | "public", PUBLICDECL, | { } 78 | "external", EXTERNALDECL, | { } 79 | "new", NEW, | { } 80 | #endif 81 | 0, 0 | { 82 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:86:14: warning: missing braces around initializer [-Wmissing-braces] 86 | } consts[] = { | ^ 87 | "PI", 3.14159265358979323846, | { } 88 | "E", 2.71828182845904523536, | { } 89 | "GAMMA",0.57721566490153286060, /* Euler */ | { } 90 | "DEG", 57.29577951308232087680, /* deg/radian */ | { } 91 | "PHI", 1.61803398874989484820, /* golden ratio */ | { } 92 | #if defined(LegacyFR) && LegacyFR == 1 93 | "FARADAY", 96485.309, /*coulombs/mole*/ | { } 94 | "R", 8.31441, /*molar gas constant, joules/mole/deg-K*/ | { } ...... 101 | 0, 0 | { 102 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:107:16: warning: missing braces around initializer [-Wmissing-braces] 107 | } builtins[] = { | ^ 108 | "sin", sin, | { } 109 | "cos", cos, | { } 110 | "atan", atan, | { } 111 | "tanh", tanh, | { } 112 | "log", Log, /* checks argument */ | { } 113 | "log10",Log10, /* checks argument */ | { } 114 | "exp", hoc1_Exp, /* checks argument */ | { } 115 | "sqrt", Sqrt, /* checks argument */ | { } 116 | "int", integer, | { } ...... 122 | "abs", fabs, | { } 123 | "erf", erf, | { } 124 | "erfc", erfc, | { } 125 | #endif 126 | 0, 0 | { 127 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:131:17: warning: missing braces around initializer [-Wmissing-braces] 131 | } fun_bltin[] = { | ^ 132 | "atan2", hoc_atan2, | { } 133 | "system", hoc_System, | { } 134 | "prmat", hoc_Prmat, | { } 135 | "solve", hoc_solve, | { } 136 | "eqinit", hoc_eqinit, | { } 137 | "plt", hoc_Plt, | { } 138 | "axis", hoc_axis, | { } 139 | "plot", hoc_Plot, | { } 140 | "plotx", hoc_plotx, | { } 141 | "ploty", hoc_ploty, | { } 142 | "regraph", hoc_regraph, | { } 143 | "symbols", hoc_symbols, | { } 144 | "printf", hoc_PRintf, | { } 145 | "xred", hoc_Xred, | { } 146 | "sred", hoc_Sred, | { } 147 | "ropen", hoc_ropen, | { } 148 | "wopen", hoc_wopen, | { } 149 | "xopen", hoc_xopen, | { } 150 | "hoc_stdout", hoc_stdout, | { } 151 | "chdir", hoc_Chdir, | { } 152 | "fprint", hoc_Fprint, | { } 153 | "fscan", hoc_Fscan, | { } 154 | "sscanf", hoc_sscanf, | { } 155 | "sprint", hoc_Sprint, | { } 156 | "graph", hoc_Graph, | { } 157 | "graphmode", hoc_Graphmode, | { } 158 | "fmenu", hoc_fmenu, | { } 159 | "lw", hoc_Lw, | { } 160 | "getstr", hoc_Getstr, | { } 161 | "strcmp", hoc_Strcmp, | { } 162 | "setcolor", hoc_Setcolor, | { } 163 | "startsw", hoc_startsw, | { } 164 | "stopsw", hoc_stopsw, | { } 165 | "object_id", hoc_object_id, | { } 166 | "allobjectvars", hoc_allobjectvars, | { } 167 | "allobjects", hoc_allobjects, | { } 168 | "xpanel", hoc_xpanel, | { } 169 | "xbutton", hoc_xbutton, | { } 170 | "xcheckbox", hoc_xcheckbox, | { } 171 | "xstatebutton", hoc_xstatebutton, | { } 172 | "xlabel", hoc_xlabel, | { } 173 | "xmenu", hoc_xmenu, | { } 174 | "xvalue", hoc_xvalue, | { } 175 | "xpvalue", hoc_xpvalue, | { } 176 | "xradiobutton", hoc_xradiobutton, | { } 177 | "xfixedvalue", hoc_xfixedvalue, | { } 178 | "xvarlabel", hoc_xvarlabel, | { } 179 | "xslider", hoc_xslider, | { } 180 | "boolean_dialog", hoc_boolean_dialog, | { } 181 | "continue_dialog", hoc_continue_dialog, | { } 182 | "string_dialog", hoc_string_dialog, | { } 183 | "doEvents", hoc_single_event_run, | { } 184 | "doNotify", hoc_notify_iv, | { } 185 | "nrniv_bind_thread", nrniv_bind_thread, | { } 186 | "ivoc_style", ivoc_style, | { } 187 | "numarg", hoc_Numarg, | { } 188 | "argtype", hoc_Argtype, | { } 189 | "hoc_pointer_", hoc_pointer, /* for internal use */ | { } 190 | "nrn_mallinfo", hoc_mallinfo, | { } 191 | "execute", hoc_exec_cmd, | { } 192 | "execute1", hoc_execute1, | { } 193 | "load_proc", hoc_load_proc, | { } 194 | "load_func", hoc_load_func, | { } 195 | "load_template", hoc_load_template, | { } 196 | "load_file", hoc_load_file, | { } 197 | "load_java", hoc_load_java, | { } 198 | "unix_mac_pc", hoc_unix_mac_pc, | { } 199 | "show_winio", hoc_show_winio, | { } 200 | "nrn_load_dll", hoc_nrn_load_dll, | { } 201 | "machine_name", hoc_machine_name, | { } 202 | "saveaudit", hoc_Saveaudit, | { } 203 | "retrieveaudit", hoc_Retrieveaudit, | { } 204 | "coredump_on_error", hoc_coredump_on_error, | { } 205 | "checkpoint", hoc_checkpoint, | { } 206 | "quit", hoc_quit, | { } 207 | "object_push", hoc_object_push, | { } 208 | "object_pop", hoc_object_pop, | { } 209 | "pwman_place", hoc_pwman_place, | { } 210 | "save_session", hoc_save_session, | { } 211 | "print_session", hoc_print_session, | { } 212 | "show_errmess_always", hoc_show_errmess_always, | { } 213 | "execerror", hoc_Execerror, | { } 214 | "variable_domain", hoc_Symbol_limits, | { } 215 | "name_declared", hoc_name_declared, | { } 216 | "use_mcell_ran4", hoc_usemcran4, | { } 217 | "mcell_ran4", hoc_mcran4, | { } 218 | "mcell_ran4_init", hoc_mcran4init, | { } 219 | "nrn_feenableexcept", nrn_feenableexcept, | { } 220 | "nrnmpi_init", hoc_nrnmpi_init, | { } ...... 232 | 0, 0 | { 233 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:238:20: warning: missing braces around initializer [-Wmissing-braces] 238 | } strfun_bltin[] = { | ^ 239 | "secname", hoc_secname, | { } 240 | "units", hoc_Symbol_units, | { } 241 | "neuronhome", hoc_neuronhome, | { } 242 | "getcwd", hoc_getcwd, | { } 243 | "nrnversion", hoc_nrnversion, | { } 244 | 0, 0 | { 245 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:250:20: warning: missing braces around initializer [-Wmissing-braces] 250 | } objfun_bltin[] = { | ^ 251 | "object_pushed", hoc_object_pushed, | { } 252 | 0, 0 | { 253 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c: In function 'hoc_show_winio': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_init.c:355:9: warning: variable 'b' set but not used [-Wunused-but-set-variable] 355 | int b; | ^ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 37%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/code.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/code.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/code.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/code.c:6: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c: In function 'hoc_pop_defer': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:237:10: warning: unused variable 'obj' [-Wunused-variable] 237 | Object* obj; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c: In function 'frameobj_clean': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:273:9: warning: unused variable 'narg' [-Wunused-variable] 273 | int i, narg; | ^~~~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/code.c:6: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c: In function 'hoc_Argtype': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:1509:6: warning: unused variable 'narg' [-Wunused-variable] 1509 | int narg, iarg, type, itype=0; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c: In function 'hoc_autoobject': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:1760:11: warning: unused variable 'obp' [-Wunused-variable] 1760 | Object **obp; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:1758:6: warning: unused variable 'i' [-Wunused-variable] 1758 | int i; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c: In function 'hoc_delete_symbol': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/code.c:2507:14: warning: unused variable 'sp' [-Wunused-variable] 2507 | * sp; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 39%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/ldifus.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/ldifus.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c: In function 'longdifus_diamchange': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:147:39: warning: variable 'vnodecount' set but not used [-Wunused-but-set-variable] 147 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:147:24: warning: unused variable 'index' [-Wunused-variable] 147 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:147:21: warning: unused variable 'j' [-Wunused-variable] 147 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c: In function 'longdifusalloc': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:192:12: warning: unused variable 'qsec' [-Wunused-variable] 192 | hoc_Item* qsec; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:191:8: warning: unused variable 'nd' [-Wunused-variable] 191 | Node* nd, *pnd; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:189:24: warning: unused variable 'index' [-Wunused-variable] 189 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:189:16: warning: unused variable 'mpi' [-Wunused-variable] 189 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:189:12: warning: unused variable 'mi' [-Wunused-variable] 189 | int i, n, mi, mpi, j, index, pindex, vnodecount; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c: In function 'stagger': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:369:7: warning: unused variable 'mi' [-Wunused-variable] 369 | int mi = pld->mindex[i]; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:329:24: warning: unused variable 'dx' [-Wunused-variable] 329 | double dc, vol, dfdi, dx; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:329:13: warning: unused variable 'vol' [-Wunused-variable] 329 | double dc, vol, dfdi, dx; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:328:12: warning: variable 'di' set but not used [-Wunused-but-set-variable] 328 | int i, n, di; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c: In function 'ode': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:401:13: warning: unused variable 'vol' [-Wunused-variable] 401 | double dc, vol, dfdi; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c: In function 'matsol': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/ldifus.c:459:13: warning: unused variable 'vol' [-Wunused-variable] 459 | double dc, vol, dfdi; | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 39%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/method3.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/method3.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/method3.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 40%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/nrntimeout.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/nrntimeout.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrntimeout.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 40%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/nrnnemo.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/nrnnemo.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnnemo.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 39%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/init.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/init.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/init.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/init.c:22: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/cabvars.h:8:15: warning: missing braces around initializer [-Wmissing-braces] 8 | } usrprop[] = { | ^ 9 | "nseg", 0, 0, | { } 10 | "L", 1, 2, | { } 11 | "rallbranch", 1, 4, | { } 12 | "Ra", 1, 7, | { } 13 | 0, 0, 0 | { 14 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/init.c:109:43: warning: missing braces around initializer [-Wmissing-braces] 109 | static HocParmLimits _hoc_parm_limits[] = { | ^ 110 | "Ra", 1e-6, 1e9, | { { }} 111 | "L", 1e-4, 1e20, | { { }} 112 | "diam", 1e-9, 1e9, | { { }} 113 | "cm", 0., 1e9, | { { }} 114 | "rallbranch", 1., 1e9, | { { }} 115 | "nseg", 1., 1e9, | { { }} 116 | "celsius", -273., 1e6, | { { }} 117 | "dt", 1e-9, 1e15, | { { }} 118 | 0, 0., 0. | { { 119 | }; | }} /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/init.c:121:41: warning: missing braces around initializer [-Wmissing-braces] 121 | static HocParmUnits _hoc_parm_units[] = { | ^ 122 | "Ra", "ohm-cm", | { } 123 | "L", "um", | { } 124 | "diam", "um", | { } 125 | "cm", "uF/cm2", | { } 126 | "celsius", "degC", | { } 127 | "dt", "ms", | { } 128 | "t", "ms", | { } 129 | "v", "mV", | { } 130 | "i_cap", "mA/cm2", | { } 131 | 0, 0 | { 132 | }; | } /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/init.c:287:28: warning: missing braces around initializer [-Wmissing-braces] 287 | static DoubScal scdoub[] = { | ^ 288 | "t", &t, | { } 289 | "dt", &dt, | { } 290 | 0,0 | { 291 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 40%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/nrnversion.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/nrnversion.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnversion.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnversion.c: In function 'nrn_version': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnversion.c:54:12: warning: unused variable 'size' [-Wunused-variable] 54 | int j, size; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnversion.c:29:7: warning: unused variable 'b' [-Wunused-variable] 29 | int b; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/nrnversion.c:28:9: warning: unused variable 'cp' [-Wunused-variable] 28 | char *cp; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 40%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/passive0.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/passive0.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive0.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive0.c: In function 'pas_cur': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive0.c:31:10: warning: unused variable 'vpdata' [-Wunused-variable] 31 | Datum **vpdata = ml->pdata; | ^~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive0.c: In function 'pas_jacob': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/passive0.c:45:10: warning: unused variable 'vpdata' [-Wunused-variable] 45 | Datum **vpdata = ml->pdata; | ^~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 41%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/psection.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/psection.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/psection.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 40%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/point.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/point.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/point.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 41%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/seclist.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/seclist.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c: In function 'wholetree': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:124:24: warning: unused variable 'last' [-Wunused-variable] 124 | Item* i, *j, *first, *last; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:124:16: warning: unused variable 'first' [-Wunused-variable] 124 | Item* i, *j, *first, *last; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:124:12: warning: unused variable 'j' [-Wunused-variable] 124 | Item* i, *j, *first, *last; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:124:8: warning: unused variable 'i' [-Wunused-variable] 124 | Item* i, *j, *first, *last; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:123:21: warning: unused variable 'ch' [-Wunused-variable] 123 | Section* s, *sec, *ch; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c: At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/seclist.c:254:32: warning: missing braces around initializer [-Wmissing-braces] 254 | static Member_func members[] = { | ^ 255 | "append", append, | { } 256 | "remove", seclist_remove, | { } 257 | "wholetree", wholetree, | { } 258 | "subtree", subtree, | { } 259 | "children", children, | { } 260 | "unique", unique, | { } 261 | "printnames", printnames, | { } 262 | "contains", contains, | { } 263 | "allroots", allroots, | { } 264 | 0,0 | { 265 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 39%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/hoc_oop.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DCABLE=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/hoc_oop.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hoc_oop.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/hoc_oop.c:6: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'hoc_newobj': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:612:11: warning: unused variable 'o' [-Wunused-variable] 612 | Object* o = hoc_obj_look_inside_stack(narg); | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:594:9: warning: unused variable 'total' [-Wunused-variable] 594 | int i, total; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:594:6: warning: unused variable 'i' [-Wunused-variable] 594 | int i, total; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:593:16: warning: unused variable 's' [-Wunused-variable] 593 | Symbol *sym, *s; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:592:14: warning: unused variable 'obd' [-Wunused-variable] 592 | Objectdata *obd; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'hoc_cmp_otype': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:804:6: warning: variable 'type' set but not used [-Wunused-but-set-variable] 804 | int type; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'hoc_known_type': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:809:6: warning: variable 'type' set but not used [-Wunused-but-set-variable] 809 | int type; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'hoc_name2obj': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:881:7: warning: unused variable 'buf' [-Wunused-variable] 881 | char buf[200]; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'hoc_ob_pointer': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:1275:10: warning: unused variable 'sym' [-Wunused-variable] 1275 | Symbol* sym; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c: In function 'java2nrn_class': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/../oc/hoc_oop.c:1563:41: warning: unused variable 'buf' [-Wunused-variable] 1563 | char mname[256], signature[256], *cn, *buf; | ^~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 41%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/secref.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/secref.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: In function 's_rename': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:81:17: warning: unused variable 'hoc_thisobject' [-Wunused-variable] 81 | extern Object* hoc_thisobject, **hoc_objgetarg(); | ^~~~~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: In function 's_nchild': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:230:6: warning: unused variable 'n' [-Wunused-variable] 230 | int n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: In function 's_has_parent': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:236:6: warning: unused variable 'n' [-Wunused-variable] 236 | int n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: In function 's_has_trueparent': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:246:6: warning: unused variable 'n' [-Wunused-variable] 246 | int n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: In function 's_exists': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:256:6: warning: unused variable 'n' [-Wunused-variable] 256 | int n; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c: At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/secref.c:275:32: warning: missing braces around initializer [-Wmissing-braces] 275 | static Member_func members[] = { | ^ 276 | "sec", s_rename, /* will actually become a SECTIONREF below */ | { } 277 | "parent", s_rename, | { } 278 | "trueparent", s_rename, | { } 279 | "root", s_rename, | { } 280 | "child", s_rename, | { } 281 | "nchild", s_nchild, | { } 282 | "has_parent", s_has_parent, | { } 283 | "has_trueparent", s_has_trueparent, | { } 284 | "exists", s_exists, | { } 285 | "rename", s_rename, | { } 286 | "unname", s_unname, | { } 287 | "is_cas", s_cas, | { } 288 | 0, 0 | { 289 | }; | } make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 41%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/synapse.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/synapse.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/synapse.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 42%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/isaac64.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/isaac64.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/isaac64.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 41%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/solve.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/solve.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c: In function 'node_destruct': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c:648:8: warning: unused variable 'nd' [-Wunused-variable] 648 | Node* nd; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c: In function 'node_realloc': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c:724:22: warning: unused variable 'i' [-Wunused-variable] 724 | int n1, n2, i1, i2, i; | ^ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c:710:14: warning: 'node_interp' defined but not used [-Wunused-function] 710 | static Node* node_interp(Node* nd1, Node* nd2, double frac) | ^~~~~~~~~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c: In function 'distance': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/solve.c:271:7: warning: 'my_origin_node' may be used uninitialized in this function [-Wmaybe-uninitialized] 271 | d = topol_distance(my_origin_sec, my_origin_node, sec, node, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 272 | &sec, &node ); | ~~~~~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 42%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/nrnisaac.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/nrnisaac.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnisaac.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 42%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/mcran4.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/mcran4.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/mcran4.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/oc/mcran4.c: In function 'nrnRan4dbl': /builddir/build/BUILD/nrn-7.8.1/src/oc/mcran4.c:163:23: warning: unused variable 'extra' [-Wunused-variable] 163 | uint32_t hi, lo, extra; | ^~~~~ /builddir/build/BUILD/nrn-7.8.1/src/oc/mcran4.c:163:19: warning: unused variable 'lo' [-Wunused-variable] 163 | uint32_t hi, lo, extra; | ^~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 42%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnran123.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /usr/include/Random123/features/compilerfeatures.h:211, from /usr/include/Random123/philox.h:37, from /builddir/build/BUILD/nrn-7.8.1/src/oc/nrnran123.c:7: /usr/include/Random123/features/gccfeatures.h:38:4: error: #error "This code has only been tested on x86 and powerpc platforms." 38 | # error "This code has only been tested on x86 and powerpc platforms." | ^~~~~ /usr/include/Random123/features/gccfeatures.h:39:10: fatal error: including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task: No such file or directory 39 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [src/nrniv/CMakeFiles/nrniv_lib.dir/build.make:2002: src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/nrnran123.c.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 43%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/audit.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/audit.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/audit.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' In file included from /usr/include/stdio.h:866, from /builddir/build/BUILD/nrn-7.8.1/src/oc/audit.c:2: In function 'fgets', inlined from 'xopen_audit' at /builddir/build/BUILD/nrn-7.8.1/src/oc/audit.c:243:2: /usr/include/bits/stdio2.h:270:10: warning: '*fgets' writing 200 bytes into a region of size 197 overflows the destination [-Wstringop-overflow=] 270 | return __fgets_alias (__s, __n, __stream); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/features.h:465, from /usr/include/bits/libc-header-start.h:33, from /usr/include/stdio.h:27, from /builddir/build/BUILD/nrn-7.8.1/src/oc/audit.c:2: /usr/include/bits/stdio2.h: In function 'xopen_audit': /usr/include/bits/stdio2.h:249:14: note: in a call to function '*fgets' declared with attribute 'write_only (1, 2)' 249 | extern char *__REDIRECT (__fgets_alias, | ^~~~~~~~~~ make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 43%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/oc/axis.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -DHOC=1 -DINTERVIEWS=1 -DOOP=1 -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/oc/axis.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/oc/axis.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' make[2]: Entering directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' [ 42%] Building C object src/nrniv/CMakeFiles/nrniv_lib.dir/__/nrnoc/treeset.c.o cd /builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrniv && /usr/bin/gcc -DHAVE_CONFIG_H -Dnrniv_lib_EXPORTS -I/builddir/build/BUILD/nrn-7.8.1/src/ivoc -I/builddir/build/BUILD/nrn-7.8.1/src/nrniv -I/builddir/build/BUILD/nrn-7.8.1/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnjava -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnoc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/oc -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu/src/sundials/shared -I/builddir/build/BUILD/nrn-7.8.1/src -I/builddir/build/BUILD/nrn-7.8.1/src/gnu -I/builddir/build/BUILD/nrn-7.8.1/src/memacs -I/builddir/build/BUILD/nrn-7.8.1/src/mesch -I/builddir/build/BUILD/nrn-7.8.1/src/nrncvode -I/builddir/build/BUILD/nrn-7.8.1/src/nrnmpi -I/builddir/build/BUILD/nrn-7.8.1/src/nrnpython -I/builddir/build/BUILD/nrn-7.8.1/src/parallel -I/builddir/build/BUILD/nrn-7.8.1/src/sparse -I/builddir/build/BUILD/nrn-7.8.1/src/sparse13 -I/builddir/build/BUILD/nrn-7.8.1/src/sundials -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/cvodes -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/ida -I/builddir/build/BUILD/nrn-7.8.1/src/sundials/shared -I/usr/include/python3.9 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection -fPIC -o CMakeFiles/nrniv_lib.dir/__/nrnoc/treeset.c.o -c /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c make[2]: Leaving directory '/builddir/build/BUILD/nrn-7.8.1/riscv64-redhat-linux-gnu' /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'nrn_lhs': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:481:10: warning: variable 'neqn' set but not used [-Wunused-but-set-variable] 481 | int i, neqn; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:481:7: warning: unused variable 'i' [-Wunused-variable] 481 | int i, neqn; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'connection_coef': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:816:8: warning: unused variable 'p' [-Wunused-variable] 816 | Prop *p; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:813:25: warning: unused variable 'ra' [-Wunused-variable] 813 | double dx, diam, area, ra; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:813:13: warning: unused variable 'diam' [-Wunused-variable] 813 | double dx, diam, area, ra; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:813:9: warning: unused variable 'dx' [-Wunused-variable] 813 | double dx, diam, area, ra; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'pt3dinsert': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1118:6: warning: unused variable 'i' [-Wunused-variable] 1118 | int i, n, i0; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'pt3dremove': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1169:6: warning: unused variable 'i' [-Wunused-variable] 1169 | int i, i0, n; | ^ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1598: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c: In function 'setaffinity': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c:288:6: warning: unused variable 'mask' [-Wunused-variable] 288 | int mask; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c: In function 'reorder_secorder': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c:879:19: warning: unused variable 'i' [-Wunused-variable] 879 | int order, isec, i, j, inode; | ^ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1598: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c: In function 'nrn_how_many_processors': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c:1288:6: warning: unused variable 'i' [-Wunused-variable] 1288 | int i, ip; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'v_setup_vectors': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1605:8: warning: unused variable 'nd' [-Wunused-variable] 1605 | Node* nd; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1604:11: warning: unused variable 'sec' [-Wunused-variable] 1604 | Section* sec; | ^~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1603:6: warning: unused variable 'isec' [-Wunused-variable] 1603 | int isec; | ^~~~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'nrn_modeltype': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1914:19: warning: unused variable 'lm' [-Wunused-variable] 1914 | static Template* lm = (Template*)0; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'nrn_matrix_node_alloc': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1979:8: warning: unused variable 'nd' [-Wunused-variable] 1979 | Node* nd; | ^~ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1978:9: warning: unused variable 'b' [-Wunused-variable] 1978 | int i, b; | ^ /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c: In function 'nrn_recalc_node_ptrs': /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:2204:10: warning: unused variable 'd' [-Wunused-variable] 2204 | Datum* d; | ^ At top level: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1914:19: warning: 'lm' defined but not used [-Wunused-variable] 1914 | static Template* lm = (Template*)0; | ^~ In file included from /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/treeset.c:1598: /builddir/build/BUILD/nrn-7.8.1/src/nrnoc/multicore.c:268:13: warning: 'wait_for_workers_timeit' defined but not used [-Wunused-function] 268 | static void wait_for_workers_timeit() { | ^~~~~~~~~~~~~~~~~~~~~~~ RPM build errors: make[1]: *** [CMakeFiles/Makefile2:1080: src/nrniv/CMakeFiles/nrniv_lib.dir/all] Error 2 make: *** [Makefile:163: all] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.uw0ol8 (%build) Bad exit status from /var/tmp/rpm-tmp.uw0ol8 (%build) Child return code was: 1 EXCEPTION: [Error()] Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mockbuild/trace_decorator.py", line 95, in trace result = func(*args, **kw) File "/usr/lib/python3.8/site-packages/mockbuild/util.py", line 746, in do_with_status raise exception.Error("Command failed: \n # %s\n%s" % (command, output), child.returncode) mockbuild.exception.Error: Command failed: # bash --login -c /usr/bin/rpmbuild -bb --target riscv64 --nodeps /builddir/build/SPECS/neuron.spec